예제 #1
0
        static void DisassembleRom(RomVersion ver, string path)
        {
            Rom rom;

            Console.Write("Initializing task list:  ");
            if (ver.Game == Game.OcarinaOfTime)
            {
                rom = new ORom(path, ver);
            }
            else
            {
                rom = new MRom(path, ver);
            }

            List <DisassemblyTask> taskList = DisassemblyTask.CreateTaskList(rom);

            taskList = taskList.Where(x => x.VRom.End > 0).ToList();
            Console.WriteLine("DONE!");
            Console.Write($"Building symbol table: ");
            Stream getFile(FileAddress x) => rom.Files.GetFile(x);

            LoadFunctionDatabase(ver);
            GetSymbols(taskList, rom.Version, getFile);

            Console.WriteLine("DONE!");
            Console.WriteLine("Disassembling files: ");

            DisassembleTasks(rom.Version, taskList, getFile);
            DumpFoundFunctions(rom.Version, Disassemble.GetFunctions());
        }
예제 #2
0
        private void DumpActorTable()
        {
            List <RomVersion> versions = new List <RomVersion>();

            versions.AddRange(ORom.GetSupportedBuilds());
            versions.AddRange(MRom.GetSupportedBuilds());

            StringBuilder sb = new StringBuilder();

            foreach (var version in versions)
            {
                string outFile = $"actor_dlf_{version.ShortUniqueKey}.txt";
                if (PathUtil.TryGetRomLocation(version, out string file))
                {
                    var txt = Get.ActorTable(Rom.New(file, version));
                    System.IO.File.WriteAllText(outFile, txt);
                    sb.AppendLine($"Created {outFile}");
                }
                else
                {
                    sb.AppendLine($"{outFile} failed; no rom found");
                }
            }
            outRichTextBox.Text = sb.ToString();
        }
예제 #3
0
        private static void DisplayHelp()
        {
            Console.WriteLine("compress   'inputRom' 'outputRom' 'GameId' 'Version'");
            Console.WriteLine("decompress 'inputRom' 'outputRom' 'GameId' 'Version'");
            Console.WriteLine("swap       'inputRom' 'outputRom' 'SwapType'");
            Console.WriteLine();

            Console.Write("Press Enter to Continue...");
            Console.ReadLine();
            Console.Clear();

            ORom.ConsolePrintSupportedVersions();
            Console.WriteLine();

            MRom.ConsolePrintSupportedVersions();
            Console.WriteLine();

            Console.Write("Press Enter to Continue...");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("Swap Types:");
            //                                    00 01 02 03
            Console.WriteLine("little16: converts 01 00 03 02 -> 00 01 02 03");
            Console.WriteLine("little32: converts 03 02 01 00 -> 00 01 02 03");
            //                                    02 03 00 01


            Console.WriteLine();
            Console.WriteLine("Press Enter to Quit");
            Console.ReadLine();
        }
예제 #4
0
        public static void DmaMap(IExperimentFace face, List <string> filePath)
        {
            Rom sourceRom = new MRom(filePath[0], MRom.Build.J0);
            Rom targetRom = new MRom(filePath[1], MRom.Build.U0);

            VFileTable source;                                                             //rom containing the complete file list
            VFileTable target;                                                             //rom we're using to link to file names
            Dictionary <long, FileRecord> unmatched = new Dictionary <long, FileRecord>(); //address pool
            Dictionary <long, FOut>       fOut      = new Dictionary <long, FOut>();

            source = sourceRom.Files;
            target = targetRom.Files;

            //Load file table data
            foreach (FileRecord t in target)
            {
                if (t.VRom.End != 0)
                {
                    fOut.Add(t.VRom.Start, new FOut(t));
                }
            }
            foreach (FileRecord s in source)
            {
                if (s.VRom.End != 0)
                {
                    unmatched.Add(s.VRom.Start, s);
                }
            }

            //match scene files
            MatchGeneric(TableInfo.Type.Scenes, source, target, fOut, unmatched);

            //match room files
            MatchRooms(source, target, fOut, unmatched);

            MatchGeneric(TableInfo.Type.GameOvls, source, target, fOut, unmatched);
            MatchGeneric(TableInfo.Type.TitleCards, source, target, fOut, unmatched);
            MatchGeneric(TableInfo.Type.Actors, source, target, fOut, unmatched);
            MatchGeneric(TableInfo.Type.Objects, source, target, fOut, unmatched);
            MatchGeneric(TableInfo.Type.HyruleSkybox, source, target, fOut, unmatched);
            MatchGeneric(TableInfo.Type.Particles, source, target, fOut, unmatched);
            MatchGeneric(TableInfo.Type.Transitions, source, target, fOut, unmatched);


            StringBuilder sw = new StringBuilder();

            {
                foreach (FOut item in fOut.Values)
                {
                    FileAddress vS = item.Source;
                    FileAddress vT = item.Target;
                    sw.AppendLine($"{item.SourceIndex}\t{vS.Start}\t{vS.End}\t{item.TargetIndex}\t{vT.Start}\t{vT.End}");
                }
            }
            face.OutputText(sw.ToString());
        }
예제 #5
0
 private void VersionSelector_Load(object sender, EventArgs e)
 {
     if (Game == Game.OcarinaOfTime)
     {
         versionComboBox.DataSource = ORom.GetSupportedBuilds().ToList();
     }
     else if (Game == Game.MajorasMask)
     {
         versionComboBox.DataSource = MRom.GetSupportedBuilds().ToList();
     }
 }
예제 #6
0
        static void MMDebugTest()
        {
            RomVersion ver = MRom.Build.DBG;

            PathUtil.TryGetRomLocation(ver, out string path);
            Rom             rom  = new MRom(path, ver);
            DisassemblyTask task = null;

            Disassemble.PrintRelocations = true;

            using StreamWriter sw = File.CreateText("__code.txt");
            using BinaryReader br = new BinaryReader(rom.Files.GetFile(task.VRom));
            Disassemble.FirstParse(br, task);
            Disassemble.Task(sw, br, task);
        }
예제 #7
0
        private static void DisplayHelp()
        {
            Console.WriteLine("compress   \"inputRom\" \"outputRom\" \"GameId\" \"Version\"");
            Console.WriteLine("decompress \"inputRom\" \"outputRom\" \"GameId\" \"Version\"");
            Console.WriteLine("swap       \"inputRom\" \"outputRom\" \"SwapType\"");
            Console.WriteLine();

            Console.Write("Press Enter to Continue...");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("Ocarina of Time: use GameId \"oot\"");
            Console.WriteLine("Version:");
            foreach (var item in ORom.GetSupportedBuilds())
            {
                var info = ORom.BuildInformation.Get(item);
                Console.WriteLine(" {0,-5} {1}", info.Version + ":", info.Name);
            }
            Console.WriteLine();

            Console.WriteLine("Majora's Mask: use GameId \"mm\"");
            Console.WriteLine("Version:");
            foreach (var item in MRom.GetSupportedBuilds())
            {
                var info = MRom.BuildInformation.Get(item);
                Console.WriteLine(" {0,-5} {1}", info.Version + ":", info.Name);
            }
            Console.WriteLine();

            Console.Write("Press Enter to Continue...");
            Console.ReadLine();
            Console.Clear();

            Console.WriteLine("Swap Types:");
            //                                    00 01 02 03
            Console.WriteLine("little16: converts 01 00 03 02 -> 00 01 02 03");
            Console.WriteLine("little32: converts 03 02 01 00 -> 00 01 02 03");
            //                                    02 03 00 01


            Console.WriteLine();
            Console.WriteLine("Press Enter to Quit");
            Console.ReadLine();
        }
예제 #8
0
        private void GetMMSceneData()
        {
            List <string> file;

            if (!int.TryParse(inputTextBox.Text, out int sceneIndex))
            {
                return;
            }

            file = SingleDialog();
            if (file == null)
            {
                return;
            }

            Rom r = new MRom(file[0], MRom.Build.U0);

            mzxrules.OcaLib.SceneRoom.Scene scene = SceneRoomReader.InitializeScene(r.Files.GetSceneFile(sceneIndex), sceneIndex);
            outRichTextBox.Text = SceneRoomReader.ReadScene(scene);
        }
예제 #9
0
        private void GetInternalSceneMap()
        {
            List <string> file;
            MRom          rom;
            StringBuilder sb = new StringBuilder();

            file = SingleDialog();
            if (file == null)
            {
                return;
            }

            rom = new MRom(file[0], MRom.Build.U0);

            for (int i = 0; i < 0x6E; i++)
            {
                sb.AppendLine(string.Format("{0},{1}", i,
                                            rom.Files.GetInternalSceneIndex(i)));
            }
            outRichTextBox.Text = sb.ToString();
        }
예제 #10
0
 private static void ListSupportedVersions()
 {
     ORom.ConsolePrintSupportedVersions();
     MRom.ConsolePrintSupportedVersions();
 }