private void InitializeRomSystem(string romPath) { // Read the ROM file. DataStream romStream = new DataStream(romPath, FileMode.Open, FileAccess.Read); rom = new GameFile("Game.nds", romStream); Format romFormat = new Rom(); romFormat.Initialize(rom); romFormat.Read(); }
private static void SearchGame(string romPath) { // Create file of the ROM DataStream romStream = new DataStream(romPath, FileMode.Open, FileAccess.Read); GameFile rom = new GameFile("Game.nds", romStream); Format romFormat = new Rom(); romFormat.Initialize(rom); // Read the ROM Console.WriteLine("Reading: {0}", romPath); rom.Format.Read(); // For each ARM and Overlay, search the string. foreach (GameFile systemFile in rom.Folders[1].GetFilesRecursive(false)) { SearchAndShow(systemFile); } }
private static void PatchGame(string romPath) { // Create file of the ROM DataStream romStream = new DataStream(romPath, FileMode.Open, FileAccess.Read); GameFile rom = new GameFile("Game.nds", romStream); Format romFormat = new Rom(); romFormat.Initialize(rom); // Read the ROM Console.WriteLine("Reading ROM: {0}", romPath); rom.Format.Read(); // For each ARM and Overlay, search the string and change it. bool found = false; foreach (GameFile systemFile in rom.Folders[1].GetFilesRecursive(false)) { if (SearchAndModify(systemFile)) { found = true; } } // If no match, close without writing new ROM if (!found) { Console.WriteLine("Not found"); } else { // Save the new ROM Console.WriteLine("Writing new ROM"); string outPath = Path.Combine(Path.GetDirectoryName(romPath), Path.GetFileNameWithoutExtension(romPath)); outPath += " [NOSSL].nds"; rom.Format.Write(outPath); // Close rom.Format.Dispose(); } }