Example #1
0
        private void UninstallButton_Click(object sender, EventArgs e)
        {
            string title  = R._("アンインストールするeventファイルを選択してください");
            string filter = R._("event file|*.event;*.txt|event|*.event|text|*.txt|All files|*");

            OpenFileDialog open = new OpenFileDialog();

            open.Title  = title;
            open.Filter = filter;
            Program.LastSelectedFilename.Load(this, "", open);
            DialogResult dr = open.ShowDialog();

            if (dr != DialogResult.OK)
            {
                return;
            }
            if (!U.CanReadFileRetry(open))
            {
                return;
            }
            Program.LastSelectedFilename.Save(this, "", open);
            string EAFilename = open.FileNames[0];

            PatchForm f = (PatchForm)InputFormRef.JumpFormLow <PatchForm>();

            f.Show();
            PatchForm.PatchSt patchSt = PatchForm.MakeInstantEAToPatch(EAFilename);
            f.UnInstallPatch(patchSt, true);
        }
        void Run()
        {
            string target_filename = this.TargetFilenameTextBox.Text;

            if (!File.Exists(target_filename))
            {
                R.ShowStopError("ターゲット({0})が見つかりませんでした。", target_filename);
                return;
            }
            string orignal = this.OrignalROMTextArea.Text;

            if (!File.Exists(orignal))
            {
                R.ShowStopError("無改造ROM({0})が見つかりませんでした", orignal);
                return;
            }

            string parentPatchFilename = Path.Combine(Program.BaseDirectory, "config", "patch2", "FE8U"
                                                      , "skill20220703", "PATCH_Skill20220703.txt");

            this.ParentPatch = PatchForm.LoadPatch(parentPatchFilename, isScanOnly: false);
            if (this.ParentPatch == null)
            {
                R.ShowStopError("ベースとなるシステム({0})が見つかりませんでした", parentPatchFilename);
                return;
            }

            bool r;

            if (U.GetFilenameExt(target_filename) == ".CMD")
            {
                r = BuildCMD();
            }
            else
            {
                r = BuildEA();
            }
            if (!r)
            {
                return;
            }

            //マージデータの作成を行う
            r = MargeAndUpdate();
            if (!r)
            {
                return;
            }

            R.ShowOK("完成");
        }
Example #3
0
        public void ApplyFilter(string search, bool isJP, ToolTipEx tooltip)
        {
            this.LastSearchWord = search;
            if (search == "" || this.PatchButton.Visible)
            {
                this.PatchLabelName.Hide();
                for (int i = 0; i < Buttons.Length; i++)
                {
                    this.Buttons[i].Hide();
                }
                return;
            }
            if (Patchs == null)
            {
                Patchs = PatchForm.ScanPatch();
            }

            int foundCount = 0;

            for (int i = 0; i < this.Patchs.Length; i++)
            {
                PatchForm.PatchSt patch = this.Patchs[i];
                if (!U.StrStrEx(patch.SearchData, search, isJP))
                {//フィルターで消す.
                    continue;
                }
                Button b = Buttons[foundCount];
                b.Text = patch.Name;
                string info = U.at(patch.Param, "INFO");
                tooltip.SetToolTipOverraide(b, U.nl2br(info));
                b.Show();

                foundCount++;
                if (foundCount == 1)
                {//ボタンがあるならラベルも出す.
                    this.PatchLabelName.Show();
                }

                if (foundCount >= Buttons.Length)
                {
                    return;
                }
            }

            for (int n = foundCount; n < Buttons.Length; n++)
            {
                Button b = Buttons[n];
                b.Hide();
            }
        }
        //マージデータの作成を行う
        bool MargeAndUpdate()
        {
            string orignal = this.OrignalROMTextArea.Text;

            if (!File.Exists(orignal))
            {
                return(false);
            }
            byte[] orignalBIN = File.ReadAllBytes(orignal);
            byte[] buildBIN   = File.ReadAllBytes(this.EABuildROM_Filename);

            string skill_CustomBuildDirectory = Path.Combine(Program.BaseDirectory, "config", "patch2", "FE8U"
                                                             , "skill_CustomBuild");

            U.mkdir(skill_CustomBuildDirectory);

            U.CopyDirectory(Path.GetDirectoryName(ParentPatch.PatchFileName), skill_CustomBuildDirectory);
            U.DeleteFile(skill_CustomBuildDirectory, "0*.bin");
            U.DeleteFile(skill_CustomBuildDirectory, "PATCH_*.txt");

            //シンボル情報のコピー
            CopySYM(skill_CustomBuildDirectory);
            //他のバイナリファイルのコピー
            CopySomeDumpFiles(skill_CustomBuildDirectory);

            //ビルドしたROMとバニラを比較して、差分を作る
            string custombuild = Path.Combine(skill_CustomBuildDirectory, "PATCH_SkillSystem_CustomBuild.txt");

            ToolDiffForm.MakeDiff(custombuild, orignalBIN, buildBIN, 10, true);

            //パッチテキストをマージする
            MargePatch(custombuild, ParentPatch.PatchFileName, U.atoh(TakeoverSkillAssignmentComboBox.Text));

            //作成したパッチを読込み
            PatchForm.PatchSt newPatchSt = PatchForm.LoadPatch(custombuild, isScanOnly: false);

            //パッチアップデート
            PatchForm patchF = (PatchForm)InputFormRef.JumpForm <PatchForm>();

            patchF.UpdatePatch(newPatchSt);

            return(true);
        }