diff --git a/hactoolnet/CliParser.cs b/hactoolnet/CliParser.cs index 0d3f3b07..476912f3 100644 --- a/hactoolnet/CliParser.cs +++ b/hactoolnet/CliParser.cs @@ -202,7 +202,9 @@ namespace hactoolnet sb.AppendLine(" --outdir Specify directory path to save contents to."); sb.AppendLine(" --debugoutdir Specify directory path to save intermediate data to for debugging."); sb.AppendLine(" --sign Sign the save file. (Requires device_key in key file)"); - + sb.AppendLine("Keygen options:"); + sb.AppendLine(" --outdir Specify directory path to save key files to."); + return sb.ToString(); } diff --git a/hactoolnet/Program.cs b/hactoolnet/Program.cs index 7b32c088..cfd2daa7 100644 --- a/hactoolnet/Program.cs +++ b/hactoolnet/Program.cs @@ -97,6 +97,16 @@ namespace hactoolnet { ctx.Keyset.SetSdSeed(ctx.Options.SdSeed.ToBytes()); } + + if (ctx.Options.OutDir != null) + { + string dir = ctx.Options.OutDir; + Directory.CreateDirectory(dir); + + File.WriteAllText(Path.Combine(dir, "prod.keys"), ExternalKeys.PrintCommonKeys(ctx.Keyset)); + File.WriteAllText(Path.Combine(dir, "console.keys"), ExternalKeys.PrintUniqueKeys(ctx.Keyset)); + File.WriteAllText(Path.Combine(dir, "title.keys"), ExternalKeys.PrintTitleKeys(ctx.Keyset)); + } } private static void ProcessKeygen(Context ctx)