mirror of
https://github.com/libretro/Mesen.git
synced 2024-12-14 21:08:44 +00:00
Debugger: Added goto init/load handler buttons for NSF files
This commit is contained in:
parent
4c25a2b9f1
commit
119ccd5881
@ -112,6 +112,8 @@
|
||||
this.mnuGoToIrqHandler = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuGoToNmiHandler = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuGoToResetHandler = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuGoToInitHandler = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.mnuGoToPlayHandler = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tableLayoutPanel2.SuspendLayout();
|
||||
this.grpPPUStatus.SuspendLayout();
|
||||
this.tableLayoutPanel8.SuspendLayout();
|
||||
@ -1144,9 +1146,11 @@
|
||||
this.contextGoTo.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.mnuGoToIrqHandler,
|
||||
this.mnuGoToNmiHandler,
|
||||
this.mnuGoToResetHandler});
|
||||
this.mnuGoToResetHandler,
|
||||
this.mnuGoToInitHandler,
|
||||
this.mnuGoToPlayHandler});
|
||||
this.contextGoTo.Name = "contextGoTo";
|
||||
this.contextGoTo.Size = new System.Drawing.Size(148, 70);
|
||||
this.contextGoTo.Size = new System.Drawing.Size(153, 136);
|
||||
this.contextGoTo.Opening += new System.ComponentModel.CancelEventHandler(this.contextGoTo_Opening);
|
||||
//
|
||||
// mnuGoToIrqHandler
|
||||
@ -1170,6 +1174,20 @@
|
||||
this.mnuGoToResetHandler.Text = "Reset Handler";
|
||||
this.mnuGoToResetHandler.Click += new System.EventHandler(this.mnuGoToResetHandler_Click);
|
||||
//
|
||||
// mnuGoToInitHandler
|
||||
//
|
||||
this.mnuGoToInitHandler.Name = "mnuGoToInitHandler";
|
||||
this.mnuGoToInitHandler.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuGoToInitHandler.Text = "Init Handler";
|
||||
this.mnuGoToInitHandler.Click += new System.EventHandler(this.mnuGoToInitHandler_Click);
|
||||
//
|
||||
// mnuGoToPlayHandler
|
||||
//
|
||||
this.mnuGoToPlayHandler.Name = "mnuGoToPlayHandler";
|
||||
this.mnuGoToPlayHandler.Size = new System.Drawing.Size(152, 22);
|
||||
this.mnuGoToPlayHandler.Text = "Play Handler";
|
||||
this.mnuGoToPlayHandler.Click += new System.EventHandler(this.mnuGoToPlayHandler_Click);
|
||||
//
|
||||
// ctrlConsoleStatus
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -1300,5 +1318,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuGoToIrqHandler;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuGoToNmiHandler;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuGoToResetHandler;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuGoToInitHandler;
|
||||
private System.Windows.Forms.ToolStripMenuItem mnuGoToPlayHandler;
|
||||
}
|
||||
}
|
||||
|
@ -204,13 +204,26 @@ namespace Mesen.GUI.Debugger
|
||||
|
||||
private void UpdateVectorAddresses()
|
||||
{
|
||||
int nmiHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8);
|
||||
int resetHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFC) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFD) << 8);
|
||||
int irqHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8);
|
||||
bool isNsf = InteropEmu.GetRomInfo().Format == RomFormat.Nsf;
|
||||
if(isNsf) {
|
||||
NsfHeader header = InteropEmu.NsfGetHeader();
|
||||
mnuGoToInitHandler.Text = "Init Handler ($" + header.InitAddress.ToString("X4") + ")";
|
||||
mnuGoToPlayHandler.Text = "Play Handler ($" + header.PlayAddress.ToString("X4") + ")";
|
||||
} else {
|
||||
int nmiHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFA) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFB) << 8);
|
||||
int resetHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFC) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFD) << 8);
|
||||
int irqHandler = InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFE) | (InteropEmu.DebugGetMemoryValue(DebugMemoryType.CpuMemory, 0xFFFF) << 8);
|
||||
|
||||
mnuGoToNmiHandler.Text = "NMI Handler ($" + nmiHandler.ToString("X4") + ")";
|
||||
mnuGoToResetHandler.Text = "Reset Handler ($" + resetHandler.ToString("X4") + ")";
|
||||
mnuGoToIrqHandler.Text = "IRQ Handler ($" + irqHandler.ToString("X4") + ")";
|
||||
mnuGoToNmiHandler.Text = "NMI Handler ($" + nmiHandler.ToString("X4") + ")";
|
||||
mnuGoToResetHandler.Text = "Reset Handler ($" + resetHandler.ToString("X4") + ")";
|
||||
mnuGoToIrqHandler.Text = "IRQ Handler ($" + irqHandler.ToString("X4") + ")";
|
||||
}
|
||||
|
||||
mnuGoToInitHandler.Visible = isNsf;
|
||||
mnuGoToPlayHandler.Visible = isNsf;
|
||||
mnuGoToIrqHandler.Visible = !isNsf;
|
||||
mnuGoToNmiHandler.Visible = !isNsf;
|
||||
mnuGoToResetHandler.Visible = !isNsf;
|
||||
}
|
||||
|
||||
private void btnGoto_Click(object sender, EventArgs e)
|
||||
@ -236,6 +249,16 @@ namespace Mesen.GUI.Debugger
|
||||
this.OnGotoLocation?.Invoke(address, null);
|
||||
}
|
||||
|
||||
private void mnuGoToInitHandler_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.OnGotoLocation?.Invoke((int)InteropEmu.NsfGetHeader().InitAddress, null);
|
||||
}
|
||||
|
||||
private void mnuGoToPlayHandler_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.OnGotoLocation?.Invoke((int)InteropEmu.NsfGetHeader().PlayAddress, null);
|
||||
}
|
||||
|
||||
private void contextGoTo_Opening(object sender, CancelEventArgs e)
|
||||
{
|
||||
UpdateVectorAddresses();
|
||||
|
@ -1085,6 +1085,7 @@ namespace Mesen.GUI
|
||||
iNes = 1,
|
||||
Unif = 2,
|
||||
Fds = 3,
|
||||
Nsf = 4,
|
||||
}
|
||||
|
||||
public class RomInfo
|
||||
|
Loading…
Reference in New Issue
Block a user