public int CompileRom(string fileName, bool includeGfx) { Rom = new Rom(); if (!Rom.Load(fileName)) return -1; //if (!Rom.IsPatchedRom) //{ // ErrorMessage = "Rom has not been patched. Please patch with Reuben.ips"; // return false; //} //if (Rom.IsClean) //{ // Rom.Sign(ProjectController.ProjectManager.CurrentProject.Guid); //} //if (!VerifyRomGuid(ProjectController.ProjectManager.CurrentProject.Guid)) return false; Rom.ProtectionMode = RomWriteProtection.PaletteData; WritePalettes(ProjectController.PaletteManager.Palettes); Rom.ProtectionMode = RomWriteProtection.TSAData; SaveTSA(); byte levelIndex = 0; foreach (LevelInfo li in ProjectController.LevelManager.Levels) { levelIndexTable.Add(li.LevelGuid, levelIndex); levelTypeTable.Add(levelIndex++, li.LevelType); } levelDataPointer = 0x28010; CompileWorlds(); levelDataPointer = 0x40010; levelDataPointer = CompileLevels(); if (includeGfx) { Rom.ProtectionMode = RomWriteProtection.GraphicsData; SaveGraphics(); } Rom.Save(); return 0x7C00F - levelDataPointer; }