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("完成"); }
//マージデータの作成を行う 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); }