Debugger: Added NES header editor

This commit is contained in:
Souryo 2017-08-12 16:52:45 -04:00
parent 078535436e
commit 2ee5b59db4
15 changed files with 1392 additions and 42 deletions

View file

@ -509,6 +509,7 @@ void BaseMapper::Initialize(RomData &romData)
_prgSize = (uint32_t)romData.PrgRom.size();
_chrRomSize = (uint32_t)romData.ChrRom.size();
_originalPrgRom = romData.PrgRom;
_originalChrRom = romData.ChrRom;
_prgRom = new uint8_t[_prgSize];
_chrRom = new uint8_t[_chrRomSize];
@ -989,13 +990,26 @@ CartridgeState BaseMapper::GetState()
return state;
}
void BaseMapper::SaveRomToDisk(string filename)
NESHeader BaseMapper::GetNesHeader()
{
return _nesHeader;
}
void BaseMapper::SaveRomToDisk(string filename, uint8_t* header)
{
ofstream file(filename, ios::out | ios::binary);
if(file.good()) {
file.write((char*)&_nesHeader, sizeof(NESHeader));
file.write((char*)_prgRom, _prgSize);
file.write((char*)_chrRom, _onlyChrRam ? 0 : _chrRomSize);
if(header) {
//Save original rom with edited header
file.write((char*)header, sizeof(NESHeader));
file.write((char*)_originalPrgRom.data(), _originalPrgRom.size());
file.write((char*)_originalChrRom.data(), _originalChrRom.size());
} else {
//Save edited rom
file.write((char*)&_nesHeader, sizeof(NESHeader));
file.write((char*)_prgRom, _prgSize);
file.write((char*)_chrRom, _onlyChrRam ? 0 : _chrRomSize);
}
file.close();
}
}

View file

@ -48,6 +48,7 @@ private:
HashInfo _hashInfo;
vector<uint8_t> _originalPrgRom;
vector<uint8_t> _originalChrRom;
protected:
NESHeader _nesHeader;
@ -212,5 +213,6 @@ public:
int32_t ToAbsoluteChrAddress(uint16_t addr);
int32_t FromAbsoluteAddress(uint32_t addr, AddressType type = AddressType::PrgRom);
void SaveRomToDisk(string filename);
NESHeader GetNesHeader();
void SaveRomToDisk(string filename, uint8_t* header);
};

View file

@ -922,9 +922,15 @@ void Debugger::StopCodeRunner()
Debugger::Instance->Step(1);
}
void Debugger::SaveRomToDisk(string filename)
void Debugger::GetNesHeader(uint8_t* header)
{
_mapper->SaveRomToDisk(filename);
NESHeader nesHeader = _mapper->GetNesHeader();
memcpy(header, &nesHeader, sizeof(NESHeader));
}
void Debugger::SaveRomToDisk(string filename, uint8_t* header)
{
_mapper->SaveRomToDisk(filename, header);
}
int32_t Debugger::FindSubEntryPoint(uint16_t relativeAddress)

View file

@ -197,7 +197,8 @@ public:
void StartCodeRunner(uint8_t *byteCode, uint32_t codeLength);
void StopCodeRunner();
void SaveRomToDisk(string filename);
void GetNesHeader(uint8_t* header);
void SaveRomToDisk(string filename, uint8_t* header);
int32_t FindSubEntryPoint(uint16_t relativeAddress);

View file

@ -148,6 +148,7 @@ namespace Mesen.GUI.Debugger
this.lblCyclesElapsed = new System.Windows.Forms.ToolStripStatusLabel();
this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping();
this.mnuEditHeader = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
@ -192,7 +193,7 @@ namespace Mesen.GUI.Debugger
this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10);
this.splitContainer.Panel2MinSize = 100;
this.splitContainer.Size = new System.Drawing.Size(1172, 573);
this.splitContainer.SplitterDistance = 450;
this.splitContainer.SplitterDistance = 447;
this.splitContainer.SplitterWidth = 7;
this.splitContainer.TabIndex = 1;
this.splitContainer.TabStop = false;
@ -215,8 +216,8 @@ namespace Mesen.GUI.Debugger
//
this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists);
this.ctrlSplitContainerTop.Panel2MinSize = 150;
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 450);
this.ctrlSplitContainerTop.SplitterDistance = 929;
this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1172, 447);
this.ctrlSplitContainerTop.SplitterDistance = 926;
this.ctrlSplitContainerTop.SplitterWidth = 7;
this.ctrlSplitContainerTop.TabIndex = 3;
this.ctrlSplitContainerTop.PanelCollapsed += new System.EventHandler(this.ctrlSplitContainerTop_PanelCollapsed);
@ -237,7 +238,7 @@ namespace Mesen.GUI.Debugger
this.tlpTop.Name = "tlpTop";
this.tlpTop.RowCount = 1;
this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tlpTop.Size = new System.Drawing.Size(929, 450);
this.tlpTop.Size = new System.Drawing.Size(926, 447);
this.tlpTop.TabIndex = 2;
//
// ctrlDebuggerCode
@ -246,7 +247,7 @@ namespace Mesen.GUI.Debugger
this.ctrlDebuggerCode.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCode.Location = new System.Drawing.Point(3, 3);
this.ctrlDebuggerCode.Name = "ctrlDebuggerCode";
this.ctrlDebuggerCode.Size = new System.Drawing.Size(465, 444);
this.ctrlDebuggerCode.Size = new System.Drawing.Size(462, 441);
this.ctrlDebuggerCode.TabIndex = 2;
this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
this.ctrlDebuggerCode.OnSetNextStatement += new Mesen.GUI.Debugger.ctrlDebuggerCode.AddressEventHandler(this.ctrlDebuggerCode_OnSetNextStatement);
@ -255,10 +256,10 @@ namespace Mesen.GUI.Debugger
// ctrlConsoleStatus
//
this.ctrlConsoleStatus.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlConsoleStatus.Location = new System.Drawing.Point(471, 0);
this.ctrlConsoleStatus.Location = new System.Drawing.Point(468, 0);
this.ctrlConsoleStatus.Margin = new System.Windows.Forms.Padding(0);
this.ctrlConsoleStatus.Name = "ctrlConsoleStatus";
this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 450);
this.ctrlConsoleStatus.Size = new System.Drawing.Size(458, 447);
this.ctrlConsoleStatus.TabIndex = 3;
this.ctrlConsoleStatus.OnGotoLocation += new System.EventHandler(this.ctrlConsoleStatus_OnGotoLocation);
//
@ -266,9 +267,9 @@ namespace Mesen.GUI.Debugger
//
this.ctrlDebuggerCodeSplit.Code = null;
this.ctrlDebuggerCodeSplit.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(474, 3);
this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(471, 3);
this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit";
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 444);
this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 441);
this.ctrlDebuggerCodeSplit.TabIndex = 4;
this.ctrlDebuggerCodeSplit.Visible = false;
this.ctrlDebuggerCodeSplit.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode);
@ -288,16 +289,16 @@ namespace Mesen.GUI.Debugger
this.tlpFunctionLabelLists.RowCount = 2;
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(236, 450);
this.tlpFunctionLabelLists.Size = new System.Drawing.Size(239, 447);
this.tlpFunctionLabelLists.TabIndex = 5;
//
// grpLabels
//
this.grpLabels.Controls.Add(this.ctrlLabelList);
this.grpLabels.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpLabels.Location = new System.Drawing.Point(3, 228);
this.grpLabels.Location = new System.Drawing.Point(3, 226);
this.grpLabels.Name = "grpLabels";
this.grpLabels.Size = new System.Drawing.Size(230, 219);
this.grpLabels.Size = new System.Drawing.Size(233, 218);
this.grpLabels.TabIndex = 6;
this.grpLabels.TabStop = false;
this.grpLabels.Text = "Labels";
@ -307,7 +308,7 @@ namespace Mesen.GUI.Debugger
this.ctrlLabelList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlLabelList.Location = new System.Drawing.Point(3, 16);
this.ctrlLabelList.Name = "ctrlLabelList";
this.ctrlLabelList.Size = new System.Drawing.Size(224, 200);
this.ctrlLabelList.Size = new System.Drawing.Size(227, 199);
this.ctrlLabelList.TabIndex = 0;
this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence);
this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected);
@ -318,7 +319,7 @@ namespace Mesen.GUI.Debugger
this.grpFunctions.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpFunctions.Location = new System.Drawing.Point(3, 3);
this.grpFunctions.Name = "grpFunctions";
this.grpFunctions.Size = new System.Drawing.Size(230, 219);
this.grpFunctions.Size = new System.Drawing.Size(233, 217);
this.grpFunctions.TabIndex = 5;
this.grpFunctions.TabStop = false;
this.grpFunctions.Text = "Functions";
@ -328,7 +329,7 @@ namespace Mesen.GUI.Debugger
this.ctrlFunctionList.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlFunctionList.Location = new System.Drawing.Point(3, 16);
this.ctrlFunctionList.Name = "ctrlFunctionList";
this.ctrlFunctionList.Size = new System.Drawing.Size(224, 200);
this.ctrlFunctionList.Size = new System.Drawing.Size(227, 198);
this.ctrlFunctionList.TabIndex = 0;
this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence);
this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected);
@ -349,7 +350,7 @@ namespace Mesen.GUI.Debugger
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel10.Size = new System.Drawing.Size(1172, 116);
this.tableLayoutPanel10.Size = new System.Drawing.Size(1172, 119);
this.tableLayoutPanel10.TabIndex = 0;
//
// grpWatch
@ -359,7 +360,7 @@ namespace Mesen.GUI.Debugger
this.grpWatch.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpWatch.Location = new System.Drawing.Point(3, 3);
this.grpWatch.Name = "grpWatch";
this.grpWatch.Size = new System.Drawing.Size(384, 110);
this.grpWatch.Size = new System.Drawing.Size(384, 113);
this.grpWatch.TabIndex = 2;
this.grpWatch.TabStop = false;
this.grpWatch.Text = "Watch";
@ -379,7 +380,7 @@ namespace Mesen.GUI.Debugger
this.ctrlWatch.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlWatch.Location = new System.Drawing.Point(3, 16);
this.ctrlWatch.Name = "ctrlWatch";
this.ctrlWatch.Size = new System.Drawing.Size(378, 91);
this.ctrlWatch.Size = new System.Drawing.Size(378, 94);
this.ctrlWatch.TabIndex = 0;
//
// grpBreakpoints
@ -388,7 +389,7 @@ namespace Mesen.GUI.Debugger
this.grpBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpBreakpoints.Location = new System.Drawing.Point(393, 3);
this.grpBreakpoints.Name = "grpBreakpoints";
this.grpBreakpoints.Size = new System.Drawing.Size(384, 110);
this.grpBreakpoints.Size = new System.Drawing.Size(384, 113);
this.grpBreakpoints.TabIndex = 3;
this.grpBreakpoints.TabStop = false;
this.grpBreakpoints.Text = "Breakpoints";
@ -398,7 +399,7 @@ namespace Mesen.GUI.Debugger
this.ctrlBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlBreakpoints.Location = new System.Drawing.Point(3, 16);
this.ctrlBreakpoints.Name = "ctrlBreakpoints";
this.ctrlBreakpoints.Size = new System.Drawing.Size(378, 91);
this.ctrlBreakpoints.Size = new System.Drawing.Size(378, 94);
this.ctrlBreakpoints.TabIndex = 0;
this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation);
//
@ -408,7 +409,7 @@ namespace Mesen.GUI.Debugger
this.grpCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
this.grpCallstack.Location = new System.Drawing.Point(783, 3);
this.grpCallstack.Name = "grpCallstack";
this.grpCallstack.Size = new System.Drawing.Size(386, 110);
this.grpCallstack.Size = new System.Drawing.Size(386, 113);
this.grpCallstack.TabIndex = 4;
this.grpCallstack.TabStop = false;
this.grpCallstack.Text = "Call Stack";
@ -418,7 +419,7 @@ namespace Mesen.GUI.Debugger
this.ctrlCallstack.Dock = System.Windows.Forms.DockStyle.Fill;
this.ctrlCallstack.Location = new System.Drawing.Point(3, 16);
this.ctrlCallstack.Name = "ctrlCallstack";
this.ctrlCallstack.Size = new System.Drawing.Size(380, 91);
this.ctrlCallstack.Size = new System.Drawing.Size(380, 94);
this.ctrlCallstack.TabIndex = 0;
this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected);
//
@ -441,6 +442,7 @@ namespace Mesen.GUI.Debugger
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuSaveRom,
this.mnuEditHeader,
this.toolStripMenuItem14,
this.mnuWorkspace,
this.toolStripMenuItem3,
@ -453,14 +455,14 @@ namespace Mesen.GUI.Debugger
//
this.mnuSaveRom.Image = global::Mesen.GUI.Properties.Resources.Floppy;
this.mnuSaveRom.Name = "mnuSaveRom";
this.mnuSaveRom.Size = new System.Drawing.Size(151, 22);
this.mnuSaveRom.Size = new System.Drawing.Size(162, 22);
this.mnuSaveRom.Text = "Save ROM as...";
this.mnuSaveRom.Click += new System.EventHandler(this.mnuSaveRom_Click);
//
// toolStripMenuItem14
//
this.toolStripMenuItem14.Name = "toolStripMenuItem14";
this.toolStripMenuItem14.Size = new System.Drawing.Size(148, 6);
this.toolStripMenuItem14.Size = new System.Drawing.Size(159, 6);
//
// mnuWorkspace
//
@ -471,7 +473,7 @@ namespace Mesen.GUI.Debugger
this.mnuAutoLoadDbgFiles,
this.mnuDisableDefaultLabels});
this.mnuWorkspace.Name = "mnuWorkspace";
this.mnuWorkspace.Size = new System.Drawing.Size(151, 22);
this.mnuWorkspace.Size = new System.Drawing.Size(162, 22);
this.mnuWorkspace.Text = "Workspace";
//
// mnuImportLabels
@ -514,13 +516,13 @@ namespace Mesen.GUI.Debugger
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(148, 6);
this.toolStripMenuItem3.Size = new System.Drawing.Size(159, 6);
//
// mnuClose
//
this.mnuClose.Image = global::Mesen.GUI.Properties.Resources.Exit;
this.mnuClose.Name = "mnuClose";
this.mnuClose.Size = new System.Drawing.Size(151, 22);
this.mnuClose.Size = new System.Drawing.Size(162, 22);
this.mnuClose.Text = "Close";
this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click);
//
@ -1250,6 +1252,14 @@ namespace Mesen.GUI.Debugger
this.ctrlCpuMemoryMapping.Text = "ctrlMemoryMapping1";
this.ctrlCpuMemoryMapping.Visible = false;
//
// mnuEditHeader
//
this.mnuEditHeader.Image = global::Mesen.GUI.Properties.Resources.Edit;
this.mnuEditHeader.Name = "mnuEditHeader";
this.mnuEditHeader.Size = new System.Drawing.Size(162, 22);
this.mnuEditHeader.Text = "Edit iNES Header";
this.mnuEditHeader.Click += new System.EventHandler(this.mnuEditHeader_Click);
//
// frmDebugger
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1410,5 +1420,6 @@ namespace Mesen.GUI.Debugger
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolStripStatusLabel lblCyclesElapsedCount;
private System.Windows.Forms.ToolStripStatusLabel lblCyclesElapsed;
private System.Windows.Forms.ToolStripMenuItem mnuEditHeader;
}
}

View file

@ -121,7 +121,7 @@ namespace Mesen.GUI.Debugger
UpdateCdlRatios();
tmrCdlRatios.Start();
mnuSaveRom.Enabled = InteropEmu.GetRomInfo().Format == RomFormat.iNes;
mnuEditHeader.Enabled = mnuSaveRom.Enabled = InteropEmu.GetRomInfo().Format == RomFormat.iNes;
}
protected override void OnActivated(EventArgs e)
@ -246,7 +246,7 @@ namespace Mesen.GUI.Debugger
case InteropEmu.ConsoleNotificationType.GameReset:
case InteropEmu.ConsoleNotificationType.GameLoaded:
this.BeginInvoke((MethodInvoker)(() => {
mnuSaveRom.Enabled = InteropEmu.GetRomInfo().Format == RomFormat.iNes;
mnuEditHeader.Enabled = mnuSaveRom.Enabled = InteropEmu.GetRomInfo().Format == RomFormat.iNes;
this.UpdateWorkspace();
this.AutoLoadDbgFile(true);
@ -910,6 +910,13 @@ namespace Mesen.GUI.Debugger
}
}
private void mnuEditHeader_Click(object sender, EventArgs e)
{
using(frmEditHeader frm = new frmEditHeader()) {
frm.ShowDialog(sender, this);
}
}
private void OpenAssembler(string code, UInt16 startAddress, UInt16 blockLength = 0)
{
frmAssembler assembler = new frmAssembler(code, startAddress, blockLength);

554
GUI.NET/Debugger/frmEditHeader.Designer.cs generated Normal file
View file

@ -0,0 +1,554 @@
namespace Mesen.GUI.Debugger
{
partial class frmEditHeader
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if(disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.radNes2 = new System.Windows.Forms.RadioButton();
this.radiNes = new System.Windows.Forms.RadioButton();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.label6 = new System.Windows.Forms.Label();
this.txtChrRomSize = new System.Windows.Forms.TextBox();
this.lblPrgSize = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.cboWorkRam = new System.Windows.Forms.ComboBox();
this.cboSaveRam = new System.Windows.Forms.ComboBox();
this.cboChrRam = new System.Windows.Forms.ComboBox();
this.cboChrRamBattery = new System.Windows.Forms.ComboBox();
this.lblMirroringType = new System.Windows.Forms.Label();
this.cboMirroringType = new System.Windows.Forms.ComboBox();
this.lblSystem = new System.Windows.Forms.Label();
this.cboSystem = new System.Windows.Forms.ComboBox();
this.chkBattery = new System.Windows.Forms.CheckBox();
this.chkTrainer = new System.Windows.Forms.CheckBox();
this.lblVsPpuType = new System.Windows.Forms.Label();
this.cboVsPpuType = new System.Windows.Forms.ComboBox();
this.hexBox = new Be.Windows.Forms.HexBox();
this.lblHeader = new System.Windows.Forms.Label();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.lblPrgKb = new System.Windows.Forms.Label();
this.txtPrgRomSize = new System.Windows.Forms.TextBox();
this.lblSubmapperId = new System.Windows.Forms.Label();
this.lblMapperId = new System.Windows.Forms.Label();
this.txtSubmapperId = new System.Windows.Forms.TextBox();
this.txtMapperId = new System.Windows.Forms.TextBox();
this.lblHeaderType = new System.Windows.Forms.Label();
this.lblError = new System.Windows.Forms.Label();
this.baseConfigPanel.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// baseConfigPanel
//
this.baseConfigPanel.Controls.Add(this.lblError);
this.baseConfigPanel.Location = new System.Drawing.Point(0, 223);
this.baseConfigPanel.Size = new System.Drawing.Size(477, 29);
this.baseConfigPanel.Controls.SetChildIndex(this.lblError, 0);
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 4;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel4, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.lblPrgSize, 2, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.label3, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.label1, 2, 4);
this.tableLayoutPanel1.Controls.Add(this.label4, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.label5, 2, 5);
this.tableLayoutPanel1.Controls.Add(this.cboWorkRam, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.cboSaveRam, 3, 3);
this.tableLayoutPanel1.Controls.Add(this.cboChrRam, 3, 4);
this.tableLayoutPanel1.Controls.Add(this.cboChrRamBattery, 3, 5);
this.tableLayoutPanel1.Controls.Add(this.lblMirroringType, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.cboMirroringType, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.lblSystem, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.cboSystem, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.chkBattery, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.chkTrainer, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.lblVsPpuType, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.cboVsPpuType, 1, 5);
this.tableLayoutPanel1.Controls.Add(this.hexBox, 1, 8);
this.tableLayoutPanel1.Controls.Add(this.lblHeader, 0, 8);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 3, 0);
this.tableLayoutPanel1.Controls.Add(this.lblSubmapperId, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.lblMapperId, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.txtSubmapperId, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.txtMapperId, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.lblHeaderType, 0, 0);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 10;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 10F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(477, 223);
this.tableLayoutPanel1.TabIndex = 0;
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.ColumnCount = 2;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel4.Controls.Add(this.radNes2, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.radiNes, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel4.Location = new System.Drawing.Point(83, 0);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 1;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel4.Size = new System.Drawing.Size(150, 26);
this.tableLayoutPanel4.TabIndex = 31;
//
// radNes2
//
this.radNes2.AutoSize = true;
this.radNes2.Location = new System.Drawing.Point(58, 3);
this.radNes2.Name = "radNes2";
this.radNes2.Size = new System.Drawing.Size(65, 17);
this.radNes2.TabIndex = 1;
this.radNes2.TabStop = true;
this.radNes2.Text = "NES 2.0";
this.radNes2.UseVisualStyleBackColor = true;
this.radNes2.CheckedChanged += new System.EventHandler(this.radVersion_CheckedChanged);
//
// radiNes
//
this.radiNes.AutoSize = true;
this.radiNes.Location = new System.Drawing.Point(3, 3);
this.radiNes.Name = "radiNes";
this.radiNes.Size = new System.Drawing.Size(49, 17);
this.radiNes.TabIndex = 0;
this.radiNes.TabStop = true;
this.radiNes.Text = "iNES";
this.radiNes.UseVisualStyleBackColor = true;
this.radiNes.CheckedChanged += new System.EventHandler(this.radVersion_CheckedChanged);
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 2;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Controls.Add(this.label6, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.txtChrRomSize, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(327, 26);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.Size = new System.Drawing.Size(150, 26);
this.tableLayoutPanel3.TabIndex = 29;
//
// label6
//
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(66, 6);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(21, 13);
this.label6.TabIndex = 15;
this.label6.Text = "KB";
//
// txtChrRomSize
//
this.txtChrRomSize.Location = new System.Drawing.Point(3, 3);
this.txtChrRomSize.Name = "txtChrRomSize";
this.txtChrRomSize.Size = new System.Drawing.Size(57, 20);
this.txtChrRomSize.TabIndex = 15;
//
// lblPrgSize
//
this.lblPrgSize.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblPrgSize.AutoSize = true;
this.lblPrgSize.Location = new System.Drawing.Point(236, 6);
this.lblPrgSize.Name = "lblPrgSize";
this.lblPrgSize.Size = new System.Drawing.Size(61, 13);
this.lblPrgSize.TabIndex = 4;
this.lblPrgSize.Text = "PRG ROM:";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(236, 32);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.TabIndex = 5;
this.label2.Text = "CHR ROM:";
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(236, 59);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(63, 13);
this.label3.TabIndex = 7;
this.label3.Text = "Work RAM:";
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(236, 113);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
this.label1.TabIndex = 6;
this.label1.Text = "CHR RAM:";
//
// label4
//
this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(236, 86);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(62, 13);
this.label4.TabIndex = 8;
this.label4.Text = "Save RAM:";
//
// label5
//
this.label5.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(236, 140);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(88, 13);
this.label5.TabIndex = 9;
this.label5.Text = "CHR Save RAM:";
//
// cboWorkRam
//
this.cboWorkRam.FormattingEnabled = true;
this.cboWorkRam.Location = new System.Drawing.Point(330, 55);
this.cboWorkRam.Name = "cboWorkRam";
this.cboWorkRam.Size = new System.Drawing.Size(84, 21);
this.cboWorkRam.TabIndex = 10;
//
// cboSaveRam
//
this.cboSaveRam.FormattingEnabled = true;
this.cboSaveRam.Location = new System.Drawing.Point(330, 82);
this.cboSaveRam.Name = "cboSaveRam";
this.cboSaveRam.Size = new System.Drawing.Size(84, 21);
this.cboSaveRam.TabIndex = 12;
this.cboSaveRam.SelectedIndexChanged += new System.EventHandler(this.cboSaveRam_SelectedIndexChanged);
//
// cboChrRam
//
this.cboChrRam.FormattingEnabled = true;
this.cboChrRam.Location = new System.Drawing.Point(330, 109);
this.cboChrRam.Name = "cboChrRam";
this.cboChrRam.Size = new System.Drawing.Size(84, 21);
this.cboChrRam.TabIndex = 11;
//
// cboChrRamBattery
//
this.cboChrRamBattery.FormattingEnabled = true;
this.cboChrRamBattery.Location = new System.Drawing.Point(330, 136);
this.cboChrRamBattery.Name = "cboChrRamBattery";
this.cboChrRamBattery.Size = new System.Drawing.Size(84, 21);
this.cboChrRamBattery.TabIndex = 13;
this.cboChrRamBattery.SelectedIndexChanged += new System.EventHandler(this.cboSaveRam_SelectedIndexChanged);
//
// lblMirroringType
//
this.lblMirroringType.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblMirroringType.AutoSize = true;
this.lblMirroringType.Location = new System.Drawing.Point(3, 86);
this.lblMirroringType.Name = "lblMirroringType";
this.lblMirroringType.Size = new System.Drawing.Size(77, 13);
this.lblMirroringType.TabIndex = 16;
this.lblMirroringType.Text = "Mirroring Type:";
//
// cboMirroringType
//
this.cboMirroringType.FormattingEnabled = true;
this.cboMirroringType.Location = new System.Drawing.Point(86, 82);
this.cboMirroringType.Name = "cboMirroringType";
this.cboMirroringType.Size = new System.Drawing.Size(101, 21);
this.cboMirroringType.TabIndex = 17;
//
// lblSystem
//
this.lblSystem.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblSystem.AutoSize = true;
this.lblSystem.Location = new System.Drawing.Point(3, 113);
this.lblSystem.Name = "lblSystem";
this.lblSystem.Size = new System.Drawing.Size(41, 13);
this.lblSystem.TabIndex = 22;
this.lblSystem.Text = "System";
//
// cboSystem
//
this.cboSystem.FormattingEnabled = true;
this.cboSystem.Location = new System.Drawing.Point(86, 109);
this.cboSystem.Name = "cboSystem";
this.cboSystem.Size = new System.Drawing.Size(101, 21);
this.cboSystem.TabIndex = 23;
this.cboSystem.SelectedIndexChanged += new System.EventHandler(this.cboSystem_SelectedIndexChanged);
//
// chkBattery
//
this.chkBattery.AutoSize = true;
this.chkBattery.Location = new System.Drawing.Point(3, 163);
this.chkBattery.Name = "chkBattery";
this.chkBattery.Size = new System.Drawing.Size(59, 17);
this.chkBattery.TabIndex = 19;
this.chkBattery.Text = "Battery";
this.chkBattery.UseVisualStyleBackColor = true;
//
// chkTrainer
//
this.chkTrainer.AutoSize = true;
this.chkTrainer.Location = new System.Drawing.Point(86, 163);
this.chkTrainer.Name = "chkTrainer";
this.chkTrainer.Size = new System.Drawing.Size(59, 17);
this.chkTrainer.TabIndex = 21;
this.chkTrainer.Text = "Trainer";
this.chkTrainer.UseVisualStyleBackColor = true;
//
// lblVsPpuType
//
this.lblVsPpuType.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblVsPpuType.AutoSize = true;
this.lblVsPpuType.Location = new System.Drawing.Point(3, 140);
this.lblVsPpuType.Name = "lblVsPpuType";
this.lblVsPpuType.Size = new System.Drawing.Size(73, 13);
this.lblVsPpuType.TabIndex = 24;
this.lblVsPpuType.Text = "VS PPU Type";
//
// cboVsPpuType
//
this.cboVsPpuType.FormattingEnabled = true;
this.cboVsPpuType.Location = new System.Drawing.Point(86, 136);
this.cboVsPpuType.Name = "cboVsPpuType";
this.cboVsPpuType.Size = new System.Drawing.Size(101, 21);
this.cboVsPpuType.TabIndex = 25;
//
// hexBox
//
this.hexBox.ByteColorProvider = null;
this.tableLayoutPanel1.SetColumnSpan(this.hexBox, 3);
this.hexBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.hexBox.Font = new System.Drawing.Font("Segoe UI", 9F);
this.hexBox.InfoBackColor = System.Drawing.Color.DarkGray;
this.hexBox.Location = new System.Drawing.Point(86, 196);
this.hexBox.Name = "hexBox";
this.hexBox.ReadOnly = true;
this.hexBox.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
this.hexBox.Size = new System.Drawing.Size(388, 18);
this.hexBox.TabIndex = 26;
//
// lblHeader
//
this.lblHeader.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblHeader.AutoSize = true;
this.lblHeader.Location = new System.Drawing.Point(3, 198);
this.lblHeader.Name = "lblHeader";
this.lblHeader.Size = new System.Drawing.Size(77, 13);
this.lblHeader.TabIndex = 27;
this.lblHeader.Text = "Binary Header:";
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Controls.Add(this.lblPrgKb, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.txtPrgRomSize, 0, 0);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(327, 0);
this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel2.Size = new System.Drawing.Size(150, 26);
this.tableLayoutPanel2.TabIndex = 28;
//
// lblPrgKb
//
this.lblPrgKb.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblPrgKb.AutoSize = true;
this.lblPrgKb.Location = new System.Drawing.Point(66, 6);
this.lblPrgKb.Name = "lblPrgKb";
this.lblPrgKb.Size = new System.Drawing.Size(21, 13);
this.lblPrgKb.TabIndex = 15;
this.lblPrgKb.Text = "KB";
//
// txtPrgRomSize
//
this.txtPrgRomSize.Location = new System.Drawing.Point(3, 3);
this.txtPrgRomSize.Name = "txtPrgRomSize";
this.txtPrgRomSize.Size = new System.Drawing.Size(57, 20);
this.txtPrgRomSize.TabIndex = 14;
//
// lblSubmapperId
//
this.lblSubmapperId.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblSubmapperId.AutoSize = true;
this.lblSubmapperId.Location = new System.Drawing.Point(3, 59);
this.lblSubmapperId.Name = "lblSubmapperId";
this.lblSubmapperId.Size = new System.Drawing.Size(64, 13);
this.lblSubmapperId.TabIndex = 1;
this.lblSubmapperId.Text = "Submapper:";
//
// lblMapperId
//
this.lblMapperId.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblMapperId.AutoSize = true;
this.lblMapperId.Location = new System.Drawing.Point(3, 32);
this.lblMapperId.Name = "lblMapperId";
this.lblMapperId.Size = new System.Drawing.Size(46, 13);
this.lblMapperId.TabIndex = 0;
this.lblMapperId.Text = "Mapper:";
//
// txtSubmapperId
//
this.txtSubmapperId.Location = new System.Drawing.Point(86, 55);
this.txtSubmapperId.Name = "txtSubmapperId";
this.txtSubmapperId.Size = new System.Drawing.Size(55, 20);
this.txtSubmapperId.TabIndex = 3;
//
// txtMapperId
//
this.txtMapperId.Location = new System.Drawing.Point(86, 29);
this.txtMapperId.Name = "txtMapperId";
this.txtMapperId.Size = new System.Drawing.Size(55, 20);
this.txtMapperId.TabIndex = 2;
//
// lblHeaderType
//
this.lblHeaderType.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblHeaderType.AutoSize = true;
this.lblHeaderType.Location = new System.Drawing.Point(3, 6);
this.lblHeaderType.Name = "lblHeaderType";
this.lblHeaderType.Size = new System.Drawing.Size(53, 13);
this.lblHeaderType.TabIndex = 30;
this.lblHeaderType.Text = "File Type:";
//
// lblError
//
this.lblError.AutoSize = true;
this.lblError.ForeColor = System.Drawing.Color.Red;
this.lblError.Location = new System.Drawing.Point(4, 8);
this.lblError.Name = "lblError";
this.lblError.Size = new System.Drawing.Size(44, 13);
this.lblError.TabIndex = 3;
this.lblError.Text = "warning";
this.lblError.Visible = false;
//
// frmEditHeader
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(477, 252);
this.Controls.Add(this.tableLayoutPanel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(493, 290);
this.Name = "frmEditHeader";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "NES Header Editor";
this.Controls.SetChildIndex(this.baseConfigPanel, 0);
this.Controls.SetChildIndex(this.tableLayoutPanel1, 0);
this.baseConfigPanel.ResumeLayout(false);
this.baseConfigPanel.PerformLayout();
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblMapperId;
private System.Windows.Forms.Label lblSubmapperId;
private System.Windows.Forms.TextBox txtMapperId;
private System.Windows.Forms.TextBox txtSubmapperId;
private System.Windows.Forms.Label lblPrgSize;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.ComboBox cboWorkRam;
private System.Windows.Forms.ComboBox cboSaveRam;
private System.Windows.Forms.ComboBox cboChrRam;
private System.Windows.Forms.ComboBox cboChrRamBattery;
private System.Windows.Forms.TextBox txtChrRomSize;
private System.Windows.Forms.TextBox txtPrgRomSize;
private System.Windows.Forms.Label lblMirroringType;
private System.Windows.Forms.ComboBox cboMirroringType;
private System.Windows.Forms.CheckBox chkTrainer;
private System.Windows.Forms.CheckBox chkBattery;
private System.Windows.Forms.Label lblSystem;
private System.Windows.Forms.ComboBox cboSystem;
private System.Windows.Forms.Label lblVsPpuType;
private System.Windows.Forms.ComboBox cboVsPpuType;
private System.Windows.Forms.Label lblError;
private Be.Windows.Forms.HexBox hexBox;
private System.Windows.Forms.Label lblHeader;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.RadioButton radNes2;
private System.Windows.Forms.RadioButton radiNes;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Label lblPrgKb;
private System.Windows.Forms.Label lblHeaderType;
}
}

View file

@ -0,0 +1,543 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Be.Windows.Forms;
using Mesen.GUI.Forms;
namespace Mesen.GUI.Debugger
{
public partial class frmEditHeader : BaseConfigForm
{
public frmEditHeader()
{
InitializeComponent();
NesHeader header = NesHeader.FromBytes(InteropEmu.DebugGetNesHeader());
Entity = header;
AddBinding("MapperId", txtMapperId, eNumberFormat.Decimal);
AddBinding("SubmapperId", txtSubmapperId, eNumberFormat.Decimal);
AddBinding("Mirroring", cboMirroringType);
AddBinding("System", cboSystem);
AddBinding("VsPpu", cboVsPpuType);
AddBinding("HasBattery", chkBattery);
AddBinding("HasTrainer", chkTrainer);
AddBinding("PrgRom", txtPrgRomSize, eNumberFormat.Decimal);
AddBinding("ChrRom", txtChrRomSize, eNumberFormat.Decimal);
AddBinding("WorkRam", cboWorkRam);
AddBinding("SaveRam", cboSaveRam);
AddBinding("ChrRam", cboChrRam);
AddBinding("ChrRamBattery", cboChrRamBattery);
AddBinding("IsNes20", radNes2, radiNes);
UpdateUI();
UpdateVsDropdown();
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
if(this.DialogResult == DialogResult.OK) {
using(SaveFileDialog sfd = new SaveFileDialog()) {
sfd.Filter = "NES roms (*.nes)|*.nes";
sfd.FileName = InteropEmu.GetRomInfo().GetRomName() + ".nes";
if(sfd.ShowDialog() == DialogResult.OK) {
InteropEmu.DebugSaveRomToDisk(sfd.FileName, ((NesHeader)Entity).ToBytes());
} else {
e.Cancel = true;
}
}
}
base.OnFormClosing(e);
}
protected override void OnShown(EventArgs e)
{
base.OnShown(e);
btnOK.Text = "Save As";
btnOK.Image = Mesen.GUI.Properties.Resources.Floppy;
btnOK.TextImageRelation = TextImageRelation.ImageBeforeText;
btnOK.AutoSize = true;
}
protected override bool ValidateInput()
{
UpdateObject();
NesHeader header = Entity as NesHeader;
if((header.PrgRom % 16) != 0) {
lblError.Text = "Error: PRG ROM size must be a multiple of 16 KB";
lblError.Visible = true;
return false;
}
if((header.ChrRom % 8) != 0) {
lblError.Text = "Error: CHR ROM size must be a multiple of 8 KB";
lblError.Visible = true;
return false;
}
if(header.IsNes20) {
if(header.MapperId >= 4096) {
lblError.Text = "Error: Mapper ID must be lower than 4096";
lblError.Visible = true;
return false;
}
if(header.SubmapperId >= 16) {
lblError.Text = "Error: Submapper ID must be lower than 16";
lblError.Visible = true;
return false;
}
if(header.ChrRom >= 32768) {
lblError.Text = "Error: CHR ROM size must be lower than 32768 KB";
lblError.Visible = true;
return false;
}
if(header.PrgRom >= 65536) {
lblError.Text = "Error: PRG ROM size must be lower than 65536 KB";
lblError.Visible = true;
return false;
}
} else {
if(header.MapperId >= 256) {
lblError.Text = "Error: Mapper ID must be lower than 256 ";
lblError.Visible = true;
return false;
}
if(header.ChrRom >= 2048) {
lblError.Text = "Error: CHR ROM size must be lower than 2048 KB";
lblError.Visible = true;
return false;
}
if(header.PrgRom >= 4096) {
lblError.Text = "Error: PRG ROM size must be lower than 4096 KB";
lblError.Visible = true;
return false;
}
}
lblError.Visible = false;
hexBox.ByteProvider = new StaticByteProvider(header.ToBytes());
return base.ValidateInput();
}
private void cboSaveRam_SelectedIndexChanged(object sender, EventArgs e)
{
chkBattery.Enabled = cboSaveRam.SelectedIndex == 0 && cboChrRamBattery.SelectedIndex == 0;
if(!chkBattery.Enabled) {
chkBattery.Checked = true;
}
}
private void UpdateVsDropdown()
{
bool isVsSystem = cboSystem.GetEnumValue<TvSystem>() == TvSystem.VsSystem;
cboVsPpuType.Visible = isVsSystem;
lblVsPpuType.Visible = isVsSystem;
if(!isVsSystem) {
cboVsPpuType.SelectedIndex = 0;
}
}
private void cboSystem_SelectedIndexChanged(object sender, EventArgs e)
{
UpdateVsDropdown();
}
private void radVersion_CheckedChanged(object sender, EventArgs e)
{
cboChrRam.Enabled = radNes2.Checked;
cboChrRamBattery.Enabled = radNes2.Checked;
cboSaveRam.Enabled = radNes2.Checked;
cboWorkRam.Enabled = radNes2.Checked;
cboVsPpuType.Enabled = radNes2.Checked;
txtSubmapperId.Enabled = radNes2.Checked;
if(!cboChrRam.Enabled) {
cboChrRam.SelectedIndex = 0;
}
if(!cboChrRamBattery.Enabled) {
cboChrRamBattery.SelectedIndex = 0;
}
if(!cboSaveRam.Enabled) {
cboSaveRam.SelectedIndex = 0;
}
if(!cboWorkRam.Enabled) {
cboWorkRam.SelectedIndex = 0;
}
if(!cboVsPpuType.Enabled) {
cboVsPpuType.SelectedIndex = 0;
}
if(!txtSubmapperId.Enabled) {
txtSubmapperId.Text = "0";
}
}
private class NesHeader
{
public bool IsNes20;
public uint MapperId;
public uint SubmapperId;
public uint PrgRom;
public uint ChrRom;
public MirroringType Mirroring;
public TvSystem System;
public bool HasTrainer;
public bool HasBattery;
public VsPpuType VsPpu;
public MemorySizes WorkRam = MemorySizes.None;
public MemorySizes SaveRam = MemorySizes.None;
public MemorySizes ChrRam = MemorySizes.None;
public MemorySizes ChrRamBattery = MemorySizes.None;
public byte[] ToBytes()
{
byte[] header = new byte[16];
header[0] = 0x4E;
header[1] = 0x45;
header[2] = 0x53;
header[3] = 0x1A;
uint prgRomValue = PrgRom / 16;
uint chrRomValue = ChrRom / 8;
if(IsNes20) {
//NES 2.0
header[4] = (byte)(prgRomValue);
header[5] = (byte)(chrRomValue);
header[6] = (byte)(
((byte)(MapperId & 0x0F) << 4) |
(byte)Mirroring | (HasTrainer ? 0x04 : 0x00) | (HasBattery ? 0x02 : 0x00)
);
header[7] = (byte)(
((byte)MapperId & 0xF0) |
(byte)(System == TvSystem.VsSystem ? 0x01 : 0x00) | (System == TvSystem.Playchoice ? 0x02 : 0x00) |
0x08 //Enable NES 2.0 header
);
header[8] = (byte)(((SubmapperId & 0x0F) << 4) | ((MapperId & 0xF00) >> 8));
header[9] = (byte)(((prgRomValue & 0xF00) >> 8) | ((chrRomValue & 0xF00) >> 4));
header[10] = (byte)((byte)WorkRam | ((byte)SaveRam) << 4);
header[11] = (byte)((byte)ChrRam | ((byte)ChrRamBattery) << 4);
switch(System) {
default:
case TvSystem.Ntsc:
header[12] = 0;
break;
case TvSystem.Pal:
header[12] = 1;
break;
case TvSystem.NtscAndPal:
header[12] = 2;
break;
}
header[13] = (byte)VsPpu;
} else {
//iNES
if(prgRomValue == 0x100) {
header[4] = 0;
} else {
header[4] = (byte)(prgRomValue);
}
header[5] = (byte)(chrRomValue);
header[6] = (byte)(
((byte)(MapperId & 0x0F) << 4) |
(byte)Mirroring | (HasTrainer ? 0x04 : 0x00) | (HasBattery ? 0x02 : 0x00)
);
header[7] = (byte)(
((byte)MapperId & 0xF0) |
(byte)(System == TvSystem.VsSystem ? 0x01 : 0x00) | (System == TvSystem.Playchoice ? 0x02 : 0x00)
);
header[8] = 0;
header[9] = (byte)(System == TvSystem.Pal ? 0x01 : 0x00);
header[10] = 0;
header[11] = 0;
header[12] = 0;
header[13] = 0;
}
//Reserved bytes
header[14] = 0;
header[15] = 0;
return header;
}
public static NesHeader FromBytes(byte[] bytes)
{
BinaryHeader binHeader = new BinaryHeader(bytes);
NesHeader header = new NesHeader();
header.IsNes20 = binHeader.GetRomHeaderVersion() == RomHeaderVersion.Nes2_0;
header.PrgRom = (uint)(binHeader.GetPrgSize() * 16);
header.ChrRom = (uint)(binHeader.GetChrSize() * 8);
header.HasTrainer = binHeader.HasTrainer();
header.HasBattery = binHeader.HasBattery();
if(binHeader.IsVsSystem()) {
header.System = TvSystem.VsSystem;
} else if(binHeader.IsPlaychoice()) {
header.System = TvSystem.Playchoice;
} else if(binHeader.IsPalRom()) {
header.System = TvSystem.Pal;
} else {
header.System = TvSystem.Ntsc;
}
header.Mirroring = binHeader.GetMirroringType();
header.MapperId = (uint)binHeader.GetMapperID();
header.SubmapperId = (uint)binHeader.GetSubMapper();
header.WorkRam = (MemorySizes)binHeader.GetWorkRamSize();
header.SaveRam = (MemorySizes)binHeader.GetSaveRamSize();
header.ChrRam = (MemorySizes)binHeader.GetChrRamSize();
header.ChrRamBattery = (MemorySizes)binHeader.GetSaveChrRamSize();
header.VsPpu = (VsPpuType)bytes[13];
return header;
}
}
private class BinaryHeader
{
private byte[] _bytes;
private byte PrgCount;
private byte ChrCount;
public BinaryHeader(byte[] bytes)
{
_bytes = bytes;
PrgCount = bytes[4];
ChrCount = bytes[5];
}
public RomHeaderVersion GetRomHeaderVersion()
{
if((_bytes[7] & 0x0C) == 0x08) {
return RomHeaderVersion.Nes2_0;
} else if((_bytes[7] & 0x0C) == 0x00) {
return RomHeaderVersion.iNes;
} else {
return RomHeaderVersion.OldiNes;
}
}
public int GetMapperID()
{
switch(GetRomHeaderVersion()) {
case RomHeaderVersion.Nes2_0:
return ((_bytes[8] & 0x0F) << 4) | (_bytes[7] & 0xF0) | (_bytes[6] >> 4);
default:
case RomHeaderVersion.iNes:
return (_bytes[7] & 0xF0) | (_bytes[6] >> 4);
case RomHeaderVersion.OldiNes:
return (_bytes[6] >> 4);
}
}
public bool HasBattery()
{
return (_bytes[6] & 0x02) == 0x02;
}
public bool HasTrainer()
{
return (_bytes[6] & 0x04) == 0x04;
}
public bool IsPalRom()
{
switch(GetRomHeaderVersion()) {
case RomHeaderVersion.Nes2_0:
return (_bytes[12] & 0x01) == 0x01;
case RomHeaderVersion.iNes:
return (_bytes[9] & 0x01) == 0x01;
default:
return false;
}
}
public bool IsPlaychoice()
{
switch(GetRomHeaderVersion()) {
case RomHeaderVersion.Nes2_0:
case RomHeaderVersion.iNes:
return (_bytes[7] & 0x02) == 0x02;
default:
return false;
}
}
public bool IsVsSystem()
{
switch(GetRomHeaderVersion()) {
case RomHeaderVersion.Nes2_0:
case RomHeaderVersion.iNes:
return (_bytes[7] & 0x01) == 0x01;
default:
return false;
}
}
public int GetPrgSize()
{
if(GetRomHeaderVersion() == RomHeaderVersion.Nes2_0) {
return (((_bytes[9] & 0x0F) << 8) | PrgCount);
} else {
if(PrgCount == 0) {
return 256; //0 is a special value and means 256
} else {
return PrgCount;
}
}
}
public int GetChrSize()
{
if(GetRomHeaderVersion() == RomHeaderVersion.Nes2_0) {
return (((_bytes[9] & 0xF0) << 4) | ChrCount);
} else {
return ChrCount;
}
}
public int GetWorkRamSize()
{
if(GetRomHeaderVersion() == RomHeaderVersion.Nes2_0) {
return _bytes[10] & 0x0F;
} else {
return 0;
}
}
public int GetSaveRamSize()
{
if(GetRomHeaderVersion() == RomHeaderVersion.Nes2_0) {
return (_bytes[10] & 0xF0) >> 4;
} else {
return 0;
}
}
public int GetChrRamSize()
{
if(GetRomHeaderVersion() == RomHeaderVersion.Nes2_0) {
return _bytes[11] & 0x0F;
} else {
return 0;
}
}
public int GetSaveChrRamSize()
{
if(GetRomHeaderVersion() == RomHeaderVersion.Nes2_0) {
return (_bytes[11] & 0xF0) >> 4;
} else {
return 0;
}
}
public int GetSubMapper()
{
if(GetRomHeaderVersion() == RomHeaderVersion.Nes2_0) {
return (_bytes[8] & 0xF0) >> 4;
} else {
return 0;
}
}
public MirroringType GetMirroringType()
{
if((_bytes[6] & 0x08) != 0) {
return MirroringType.FourScreens;
} else {
return (_bytes[6] & 0x01) != 0 ? MirroringType.Vertical : MirroringType.Horizontal;
}
}
}
private enum RomHeaderVersion
{
iNes = 0,
Nes2_0 = 1,
OldiNes = 2
}
private enum MirroringType
{
Horizontal = 0,
Vertical = 1,
FourScreens = 8
}
private enum TvSystem
{
Ntsc = 0,
Pal = 1,
NtscAndPal = 2,
VsSystem = 3,
Playchoice = 4,
}
private enum MemorySizes
{
None = 0,
_128Bytes = 1,
_256Bytes = 2,
_512Bytes = 3,
_1KB = 4,
_2KB = 5,
_4KB = 6,
_8KB = 7,
_16KB = 8,
_32KB = 9,
_64KB = 10,
_128KB = 11,
_256KB = 12,
_512KB = 13,
_1024KB = 14,
Reserved = 15
}
private enum VsPpuType
{
RP2C03B = 0,
RP2C03G = 1,
RP2C040001 = 2,
RP2C040002 = 3,
RP2C040003 = 4,
RP2C040004 = 5,
RC2C03B = 6,
RC2C03C = 7,
RC2C0501 = 8,
RC2C0502 = 9,
RC2C0503 = 10,
RC2C0504 = 11,
RC2C0505 = 12,
Undefined = 13,
Undefined2 = 14,
Undefined3 = 15
}
}
}

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -198,10 +198,60 @@
<Value ID="ZMBV">Zip Motion Block Video (ZMBV)</Value>
<Value ID="CSCD">Camstudio (CSCD)</Value>
</Enum>
<!-- Resources below are used by the debugger only - no translation is needed -->
<Enum ID="StatusFlagFormat">
<Value ID="Hexadecimal">Hexadecimal</Value>
<Value ID="Text">Text</Value>
<Value ID="CompactText">Text (Active only)</Value>
</Enum>
<Enum ID="MemorySizes">
<Value ID="None">None</Value>
<Value ID="_128Bytes">128 bytes</Value>
<Value ID="_256Bytes">256 bytes</Value>
<Value ID="_512Bytes">512 bytes</Value>
<Value ID="_1KB">1 KB</Value>
<Value ID="_2KB">2 KB</Value>
<Value ID="_4KB">4 KB</Value>
<Value ID="_8KB">8 KB</Value>
<Value ID="_16KB">16 KB</Value>
<Value ID="_32KB">32 KB</Value>
<Value ID="_64KB">64 KB</Value>
<Value ID="_128KB">128 KB</Value>
<Value ID="_256KB">256 KB</Value>
<Value ID="_512KB">512 KB</Value>
<Value ID="_1024KB">1024 KB</Value>
<Value ID="Reserved">Reserved</Value>
</Enum>
<Enum ID="TvSystem">
<Value ID="Ntsc">NTSC</Value>
<Value ID="Pal">PAL</Value>
<Value ID="NtscAndPal">NTSC and PAL</Value>
<Value ID="VsSystem">VS System</Value>
<Value ID="Playchoice">Playchoice-10</Value>
</Enum>
<Enum ID="MirroringType">
<Value ID="Horizontal">Horizontal</Value>
<Value ID="Vertical">Vertical</Value>
<Value ID="FourScreens">Four Screens</Value>
</Enum>
<Enum ID="VsPpuType">
<Value ID="RP2C03B">RP2C03B</Value>
<Value ID="RP2C03G">RP2C03G</Value>
<Value ID="RP2C040001">RP2C04-0001</Value>
<Value ID="RP2C040002">RP2C04-0002</Value>
<Value ID="RP2C040003">RP2C04-0003</Value>
<Value ID="RP2C040004">RP2C04-0004</Value>
<Value ID="RC2C03B">RC2C03B</Value>
<Value ID="RC2C03C">RC2C03C</Value>
<Value ID="RC2C0501">RC2C05-01</Value>
<Value ID="RC2C0502">RC2C05-02</Value>
<Value ID="RC2C0503">RC2C05-03</Value>
<Value ID="RC2C0504">RC2C05-04</Value>
<Value ID="RC2C0505">RC2C05-05</Value>
<Value ID="Undefined">Undefined</Value>
<Value ID="Undefined2">Undefined (2)</Value>
<Value ID="Undefined3">Undefined (3)</Value>
</Enum>
</Enums>
</Resources>

View file

@ -121,9 +121,9 @@ namespace Mesen.GUI.Forms
_binder.AddBinding(fieldName, trueRadio);
}
protected void AddBinding(string fieldName, Control bindedField)
protected void AddBinding(string fieldName, Control bindedField, eNumberFormat format = eNumberFormat.Default)
{
_binder.AddBinding(fieldName, bindedField);
_binder.AddBinding(fieldName, bindedField, format);
}
public static void InitializeComboBox(ComboBox combo, Type enumType)

View file

@ -152,6 +152,9 @@ namespace Mesen.GUI.Forms
object value = kvp.Value.Text;
NumberStyles numberStyle = format == eNumberFormat.Decimal ? NumberStyles.Integer : NumberStyles.HexNumber;
value = ((string)value).Trim().Replace("$", "").Replace("0x", "");
if(string.IsNullOrWhiteSpace((string)value)) {
value = "0";
}
if(field.FieldType == typeof(UInt32)) {
value = (object)UInt32.Parse((string)value, numberStyle);
} else if(field.FieldType == typeof(Int32)) {

View file

@ -401,6 +401,12 @@
<Compile Include="Debugger\frmCodeTooltip.Designer.cs">
<DependentUpon>frmCodeTooltip.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmEditHeader.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Debugger\frmEditHeader.Designer.cs">
<DependentUpon>frmEditHeader.cs</DependentUpon>
</Compile>
<Compile Include="Debugger\frmEditLabel.cs">
<SubType>Form</SubType>
</Compile>
@ -815,6 +821,9 @@
<EmbeddedResource Include="Debugger\frmCodeTooltip.resx">
<DependentUpon>frmCodeTooltip.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmEditHeader.resx">
<DependentUpon>frmEditHeader.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Debugger\frmEditLabel.resx">
<DependentUpon>frmEditLabel.cs</DependentUpon>
</EmbeddedResource>

View file

@ -245,7 +245,33 @@ namespace Mesen.GUI
[DllImport(DLLPath)] public static extern void DebugResetMemoryAccessCounts();
[DllImport(DLLPath)] public static extern void DebugResetProfiler();
[DllImport(DLLPath)] public static extern void DebugSaveRomToDisk([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string filename);
[DllImport(DLLPath, EntryPoint = "DebugGetNesHeader")] public static extern void DebugGetNesHeaderWrapper(IntPtr headerBuffer);
public static byte[] DebugGetNesHeader()
{
byte[] header = new byte[16];
GCHandle handle = GCHandle.Alloc(header, GCHandleType.Pinned);
try {
InteropEmu.DebugGetNesHeaderWrapper(handle.AddrOfPinnedObject());
} finally {
handle.Free();
}
return header;
}
[DllImport(DLLPath, EntryPoint = "DebugSaveRomToDisk")] public static extern void DebugSaveRomToDiskWrapper([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UTF8Marshaler))]string filename, IntPtr headerBuffer);
public static void DebugSaveRomToDisk(string filename, byte[] header = null)
{
if(header != null) {
GCHandle handle = GCHandle.Alloc(header, GCHandleType.Pinned);
try {
InteropEmu.DebugSaveRomToDiskWrapper(filename, handle.AddrOfPinnedObject());
} finally {
handle.Free();
}
} else {
InteropEmu.DebugSaveRomToDiskWrapper(filename, IntPtr.Zero);
}
}
[DllImport(DLLPath, EntryPoint = "DebugGetCode")] private static extern IntPtr DebugGetCodeWrapper(out UInt32 length);
public static string DebugGetCode()

View file

@ -100,8 +100,9 @@ extern "C"
DllExport uint32_t __stdcall DebugAssembleCode(char* code, uint16_t startAddress, int16_t* assembledOutput) { return GetDebugger()->GetAssembler()->AssembleCode(code, startAddress, assembledOutput); }
DllExport void __stdcall DebugStartCodeRunner(uint8_t* byteCode, uint32_t codeLength) { return GetDebugger()->StartCodeRunner(byteCode, codeLength); }
DllExport void __stdcall DebugSaveRomToDisk(char* filename) { GetDebugger()->SaveRomToDisk(filename); }
DllExport void __stdcall DebugGetNesHeader(uint8_t* header) { GetDebugger()->GetNesHeader(header); }
DllExport void __stdcall DebugSaveRomToDisk(char* filename, uint8_t* header) { GetDebugger()->SaveRomToDisk(filename, header); }
DllExport int32_t __stdcall DebugFindSubEntryPoint(uint16_t relativeAddress) { return GetDebugger()->FindSubEntryPoint(relativeAddress); }