private void ImportButton_Click(object sender, EventArgs e) { if (!File.Exists(SRCFilename.Text)) { SRCSelectButton_Click(sender, e); } string EAFilename = SRCFilename.Text; if (!File.Exists(SRCFilename.Text)) { return; } if (this.AutoReCompile.Checked) {//自動コンパイル string error = RunAutoReCompile(EAFilename); if (error != "") { R.ShowStopError(error); return; } } Undo.UndoData undodata = Program.Undo.NewUndoData(this); try { uint freearea = (uint)FREEAREA.Value; if (!this.FREEAREA_DEF.Checked) {//フリーエリアを利用しない. freearea = 0; } SymbolUtil.DebugSymbol storeSymbol = (SymbolUtil.DebugSymbol)(DebugSymbolComboBox.SelectedIndex); WriteEA(EAFilename, freearea, U.NOT_FOUND, undodata, storeSymbol); } catch (PatchForm.PatchException exception) { Program.Undo.Rollback(undodata); R.ShowStopError(exception.Message); return; } Program.Undo.Push(undodata); InputFormRef.ShowWriteNotifyAnimation(this, 0); UndoButton.Show(); // U.ForceUpdate(FREEAREA, InputFormRef.AllocBinaryData(1024 * 1024)); //とりあえず1MBの空きがあるところ. }
public static void ProcessSymbol(string basefilename, string symbol, SymbolUtil.DebugSymbol storeSymbol, uint baseaddr) { if (storeSymbol == SymbolUtil.DebugSymbol.None) {//シンボルを利用しない } else if (storeSymbol == SymbolUtil.DebugSymbol.SaveSymTxt) {//シンボルをファイルに保存 SymbolUtil.StoreSymbol(basefilename, symbol); } else if (storeSymbol == SymbolUtil.DebugSymbol.SaveComment) {//シンボルをコメントとして保存 SymbolUtil.RegistSymbol(basefilename, symbol, baseaddr); } else if (storeSymbol == SymbolUtil.DebugSymbol.SaveBoth) { //両方 SymbolUtil.StoreSymbol(basefilename, symbol); //まずは保存. SymbolUtil.RegistSymbol(basefilename, symbol, baseaddr); } }
public static void WriteEA(string EA, uint freearea, uint org_sp, Undo.UndoData undodata, SymbolUtil.DebugSymbol storeSymbol) { string output; string symbol; bool r; try { r = MainFormUtil.CompilerEventAssembler(EA, freearea, org_sp, out output, out symbol); } catch (Win32Exception e) { r = false; symbol = ""; output = R._("プロセスを実行できません。\r\nfilename:{0}\r\n{1}", EA, e.ToString()); } if (!r) { throw new PatchForm.PatchException(output); } r = Program.ROM.SwapNewROMData(File.ReadAllBytes(output) , "event_assembler", undodata); if (!r) { throw new PatchForm.PatchException(R.Notify("変更をユーザーが取り消しました")); } SymbolUtil.ProcessSymbolByComment(EA, symbol, storeSymbol, 0); //EAの結果作成したROMを消します. 残すとROMがPATCHディレクトリに残るのでいろいろよろしくない. File.Delete(output); }