Пример #1
0
        static string ReOpen(string romRebuildFilename, string orignalFilename, int useFreeArea, uint freeAreaMinimumSize, uint freeAreaStartAddress, string appendFreeAreaFilename, uint useShareSameData)
        {
            ROM    rom = new ROM();
            string version;
            bool   r = rom.Load(orignalFilename, out version);

            if (!r)
            {
                R.ShowStopError("未対応のROMです。\r\ngame version={0}", version);
                return("");
            }

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait())
            {
                r = ToolROMRebuildForm.ApplyROMRebuild(pleaseWait, rom, romRebuildFilename
                                                       , useFreeArea
                                                       , freeAreaMinimumSize
                                                       , freeAreaStartAddress
                                                       , appendFreeAreaFilename
                                                       , useShareSameData);
                if (!r)
                {
                    U.SelectFileByExplorer(ToolROMRebuildApply.GetLogFilename(romRebuildFilename));
                    return("");
                }
            }

            string newFilename = U.ChangeExtFilename(romRebuildFilename, ".gba");

            rom.Save(newFilename, false);

            return(newFilename);
        }
Пример #2
0
        static bool ProcCommandLine()
        {
            if (ArgsDic.ContainsKey("--lint"))
            {//コマンドラインLint
                Program.IsCommandLine = true;
                Environment.Exit(ToolFELintForm.CommandLineLint());
                return(true);
            }
            if (ArgsDic.ContainsKey("--rebuild"))
            {//コマンドラインrebuild
                Program.IsCommandLine = true;
                Environment.Exit(ToolROMRebuildForm.ComandLineRebuild());
                return(true);
            }
            if (ArgsDic.ContainsKey("--pointercalc"))
            {//ポインタ変換
                Program.IsCommandLine = true;
                Environment.Exit(PointerToolForm.ComandLineSearch());
                return(true);
            }
            if (ArgsDic.ContainsKey("--translate"))
            {//ROM翻訳の実行
                Program.IsCommandLine = true;
                Environment.Exit(ToolTranslateROMForm.CommandLineTranslate());
                return(true);
            }
            if (ArgsDic.ContainsKey("--makeups"))
            {//UPSの作成
                Program.IsCommandLine = true;
                Environment.Exit(ToolUPSPatchSimpleForm.CommandLineMakeUPS());
                return(true);
            }
            if (ArgsDic.ContainsKey("--songexchange"))
            {//曲交換
                Program.IsCommandLine = true;
                Environment.Exit(SongExchangeForm.CommandLineImport());
                return(true);
            }

#if DEBUG
            //デバッグの場合はテストを実行
            DebugTESTRunner();

            if (ArgsDic.ContainsKey("--translate_batch"))
            {//翻訳を自動実行
                DevTranslateForm.CommandLineTranslateOnly();
            }
            if (ArgsDic.ContainsKey("--testonly"))
            {
                //フルテストの場合、終了する.
                Environment.Exit(0);
                return(true);
            }
#endif
            return(false);
        }
        private void ApplyROMRebuildButton_Click(object sender, EventArgs e)
        {
            if (InputFormRef.IsPleaseWaitDialog(this))
            {//2重割り込み禁止
                return;
            }

            string errorMessage = MainFormUtil.CheckOrignalROM(OrignalFilename.Text);

            if (errorMessage != "")
            {
                R.ShowStopError("無改造ROMを指定してください。" + "\r\n" + errorMessage);
                OrignalFilename.ErrorMessage = R._("無改造ROMを指定してください。" + "\r\n" + errorMessage);
                return;
            }
            OrignalFilename.ErrorMessage = "";

            ROM    rom = new ROM();
            string version;
            bool   r = rom.Load(OrignalFilename.Text, out version);

            if (!r)
            {
                R.ShowStopError("未対応のROMです。\r\ngame version={0}", version);
                return;
            }

            using (InputFormRef.AutoPleaseWait pleaseWait = new InputFormRef.AutoPleaseWait(this))
            {
                r = ToolROMRebuildForm.ApplyROMRebuild(pleaseWait, rom, this.ROMRebuildFilename, UseFreeAreaComboBox.SelectedIndex);
                if (!r)
                {
                    U.SelectFileByExplorer(ToolROMRebuildApply.GetLogFilename(this.ROMRebuildFilename));
                    return;
                }
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();

            if (this.UseReOpen)
            {//メインフォームを開きなおさないといけない場合
                MainFormUtil.ReOpenMainForm();
            }

            if (this.IsSaveFileCheckBox.Checked)
            {
                string newFilename = U.ChangeExtFilename(this.ROMRebuildFilename, ".gba");
                rom.Save(newFilename, false);

                //エクスプローラで選択しよう
                U.SelectFileByExplorer(newFilename);

                //保存したROMを開く.
                Program.LoadROM(newFilename, this.ForceVersion);
            }
            else
            {
                //保存しない場合、メモリ上の存在になる.
                Program.LoadVirtualROM(rom, this.ROMRebuildFilename);
            }
        }