diff --git a/src/hactoolnet/CliParser.cs b/src/hactoolnet/CliParser.cs index ab6872bb..1c19ac0b 100644 --- a/src/hactoolnet/CliParser.cs +++ b/src/hactoolnet/CliParser.cs @@ -15,6 +15,7 @@ internal static class CliParser new CliOption("verify", 'y', 0, (o, _) => o.Validate = true), new CliOption("dev", 'd', 0, (o, _) => o.UseDevKeys = true), new CliOption("enablehash", 'h', 0, (o, _) => o.EnableHash = true), + new CliOption("disablekeywarns", 0, (o, _) => o.DisableKeyWarns = true), new CliOption("keyset", 'k', 1, (o, a) => o.Keyfile = a[0]), new CliOption("titlekeys", 1, (o, a) => o.TitleKeyFile = a[0]), new CliOption("consolekeys", 1, (o, a) => o.ConsoleKeyFile = a[0]), @@ -208,6 +209,7 @@ internal static class CliParser sb.AppendLine(" -t, --intype=type Specify input file type [nca, xci, romfs, pfs0, pk11, pk21, ini1, kip1, switchfs, save, ndv0, keygen, romfsbuild, pfsbuild]"); sb.AppendLine(" --titlekeys Load title keys from an external file."); sb.AppendLine(" --accesslog Specify the access log file path."); + sb.AppendLine(" --disablekeywarns Disables warning output when loading external keys."); sb.AppendLine("NCA options:"); sb.AppendLine(" --plaintext Specify file path for saving a decrypted copy of the NCA."); sb.AppendLine(" --ciphertext Specify file path for saving an encrypted copy of the NCA."); diff --git a/src/hactoolnet/Options.cs b/src/hactoolnet/Options.cs index 9f0f3fdd..9754a4db 100644 --- a/src/hactoolnet/Options.cs +++ b/src/hactoolnet/Options.cs @@ -13,6 +13,7 @@ internal class Options public bool Validate; public bool UseDevKeys; public bool EnableHash; + public bool DisableKeyWarns; public string Keyfile; public string TitleKeyFile; public string ConsoleKeyFile; diff --git a/src/hactoolnet/Program.cs b/src/hactoolnet/Program.cs index 4c9f9797..a7eb00d0 100644 --- a/src/hactoolnet/Program.cs +++ b/src/hactoolnet/Program.cs @@ -221,6 +221,8 @@ public static class Program var keySet = KeySet.CreateDefaultKeySet(); + var logger = ctx.Options.DisableKeyWarns ? null : ctx.Logger; + // If the user specifies a key file then only load that file into the mode they specified, // otherwise load both prod.keys and dev.keys. // Todo: Should we add a way that both dev-only key files and mixed prod/dev key files @@ -228,11 +230,11 @@ public static class Program if (ctx.Options.Keyfile != null && File.Exists(ctx.Options.Keyfile)) { keySet.SetMode(ctx.Options.KeyMode); - ExternalKeyReader.ReadKeyFile(keySet, ctx.Options.Keyfile, titleKeyFile, consoleKeyFile, ctx.Logger); + ExternalKeyReader.ReadKeyFile(keySet, ctx.Options.Keyfile, titleKeyFile, consoleKeyFile, logger); } else { - ExternalKeyReader.ReadKeyFile(keySet, prodKeyFile, devKeyFile, titleKeyFile, consoleKeyFile, ctx.Logger); + ExternalKeyReader.ReadKeyFile(keySet, prodKeyFile, devKeyFile, titleKeyFile, consoleKeyFile, logger); } keySet.SetMode(ctx.Options.KeyMode);