Add key file exporting to hactoolnet

This commit is contained in:
Alex Barney 2018-10-02 22:00:57 -05:00
parent e740d13bbe
commit e798a8dd45
2 changed files with 13 additions and 1 deletions

View file

@ -202,6 +202,8 @@ namespace hactoolnet
sb.AppendLine(" --outdir <dir> Specify directory path to save contents to."); sb.AppendLine(" --outdir <dir> Specify directory path to save contents to.");
sb.AppendLine(" --debugoutdir <dir> Specify directory path to save intermediate data to for debugging."); sb.AppendLine(" --debugoutdir <dir> 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(" --sign Sign the save file. (Requires device_key in key file)");
sb.AppendLine("Keygen options:");
sb.AppendLine(" --outdir <dir> Specify directory path to save key files to.");
return sb.ToString(); return sb.ToString();
} }

View file

@ -97,6 +97,16 @@ namespace hactoolnet
{ {
ctx.Keyset.SetSdSeed(ctx.Options.SdSeed.ToBytes()); 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) private static void ProcessKeygen(Context ctx)