コード例 #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
        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);
            }
        }