private static void DumpObjectTable(string toeePath, string gsiPath) { using var vfs = TroikaVfs.CreateFromInstallationDir(toeePath); Tig.FS = vfs; var sgi = SaveGameInfoReader.Read(gsiPath); Console.WriteLine($"Loading {sgi.Name}"); var tempDir = Path.GetTempFileName(); File.Delete(tempDir); Directory.CreateDirectory(tempDir); try { var tfaiFile = sgi.BasePath + ".tfai"; var tfafFile = sgi.BasePath + ".tfaf"; ExtractSaveArchive.Extract(tfaiFile, tfafFile, tempDir); DumpObjectTableForSaveDir(tempDir); } finally { Directory.Delete(tempDir, true); } }
public static void Main(string[] args) { // When a debugger is attached, immediately rethrow unobserved exceptions from asynchronous tasks if (Debugger.IsAttached) { TaskScheduler.UnobservedTaskException += (_, eventArgs) => { if (!eventArgs.Observed) { throw eventArgs.Exception; } }; } else { AppDomain.CurrentDomain.UnhandledException += HandleException; } if (JumpListHandler.Handle(args)) { return; } if (args.Length > 0 && args[0] == "--extract-save") { ExtractSaveArchive.Main(args.Skip(1).ToArray()); return; } if (args.Length == 2 && args[0] == "--mes-to-json") { var mesContent = MesFile.Read(args[1]); var newFile = Path.ChangeExtension(args[1], ".json"); var options = new JsonSerializerOptions(); options.WriteIndented = true; var jsonContent = JsonSerializer.Serialize(mesContent.ToDictionary( kvp => kvp.Key.ToString(), kvp => kvp.Value ), options); File.WriteAllText(newFile, jsonContent); return; } if (args.Length > 0 && args[0] == "--dump-addresses") { var dumper = new AddressDumper(); dumper.DumpAddresses(); return; } string dataDir = null; if (args.Length > 0 && args[0] == "--data-dir") { dataDir = args[1]; } using var startup = new GameStartup { DataFolder = dataDir }; if (startup.Startup()) { startup.EnterMainMenu(); Globals.GameLoop.Run(); } }