diff --git a/Core/DebuggerTypes.h b/Core/DebuggerTypes.h index dd388170..53aba7e7 100644 --- a/Core/DebuggerTypes.h +++ b/Core/DebuggerTypes.h @@ -34,6 +34,8 @@ enum class DebuggerFlags HidePauseIcon = 0x1000, BreakOnDecayedOamRead = 0x2000, + BreakOnInit = 0x4000, + BreakOnPlay = 0x8000, }; enum class BreakSource diff --git a/Core/NsfMapper.cpp b/Core/NsfMapper.cpp index 4a947b8f..49091ae8 100644 --- a/Core/NsfMapper.cpp +++ b/Core/NsfMapper.cpp @@ -169,6 +169,7 @@ void NsfMapper::TriggerIrq(NsfIrqType type) _trackEnded = false; } + _debugIrqStatus = type; _irqStatus = type; _console->GetCpu()->SetIrqSource(IRQSource::External); } @@ -230,6 +231,23 @@ void NsfMapper::SelectNextTrack() void NsfMapper::ProcessCpuClock() { + if(_console->IsDebuggerAttached()) { + shared_ptr debugger = _console->GetDebugger(false); + if(debugger) { + uint16_t programCounter = _console->GetCpu()->GetPC(); + if(_debugIrqStatus == NsfIrqType::Init && programCounter == _nsfHeader.InitAddress) { + _debugIrqStatus = NsfIrqType::None; + if(debugger->CheckFlag(DebuggerFlags::BreakOnInit)) { + debugger->Step(1); + } + } else if(_debugIrqStatus == NsfIrqType::Play && programCounter == _nsfHeader.PlayAddress) { + _debugIrqStatus = NsfIrqType::None; + if(debugger->CheckFlag(DebuggerFlags::BreakOnPlay)) { + debugger->Step(1); + } + } + } + } _console->GetCpu()->SetIrqMask(_console->GetSettings()->GetNsfDisableApuIrqs() ? (uint8_t)IRQSource::External : 0xFF); if(_needInit) { diff --git a/Core/NsfMapper.h b/Core/NsfMapper.h index e680c8c5..081b00c5 100644 --- a/Core/NsfMapper.h +++ b/Core/NsfMapper.h @@ -45,6 +45,7 @@ private: uint32_t _irqReloadValue = 0; uint32_t _irqCounter = 0; NsfIrqType _irqStatus = NsfIrqType::None; + NsfIrqType _debugIrqStatus = NsfIrqType::None; uint8_t _mmc5MultiplierValues[2]; int32_t _trackEndCounter; diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index 57ff2a6d..cdc3c953 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -293,6 +293,8 @@ namespace Mesen.GUI.Config public bool BreakOnCrash = false; public bool BreakOnDecayedOamRead = false; public bool BreakOnUninitMemoryRead = false; + public bool BreakOnInit = true; + public bool BreakOnPlay = false; public bool BringToFrontOnPause = false; public bool BringToFrontOnBreak = true; diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs index eb179798..eb7d9b6f 100644 --- a/GUI.NET/Debugger/frmDebugger.Designer.cs +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -205,6 +205,9 @@ namespace Mesen.GUI.Debugger this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.tsToolbar = new Mesen.GUI.Controls.ctrlMesenToolStrip(); + this.mnuBreakOnInit = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuBreakOnPlay = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem26 = new System.Windows.Forms.ToolStripSeparator(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -249,7 +252,7 @@ namespace Mesen.GUI.Debugger this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel10); this.splitContainer.Panel2MinSize = 100; this.splitContainer.Size = new System.Drawing.Size(1075, 570); - this.splitContainer.SplitterDistance = 420; + this.splitContainer.SplitterDistance = 417; this.splitContainer.SplitterWidth = 7; this.splitContainer.TabIndex = 1; this.splitContainer.TabStop = false; @@ -273,7 +276,7 @@ namespace Mesen.GUI.Debugger // this.ctrlSplitContainerTop.Panel2.Controls.Add(this.tlpFunctionLabelLists); this.ctrlSplitContainerTop.Panel2MinSize = 150; - this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 420); + this.ctrlSplitContainerTop.Size = new System.Drawing.Size(1075, 417); this.ctrlSplitContainerTop.SplitterDistance = 750; this.ctrlSplitContainerTop.SplitterWidth = 7; this.ctrlSplitContainerTop.TabIndex = 3; @@ -294,8 +297,8 @@ 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.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 420F)); - this.tlpTop.Size = new System.Drawing.Size(750, 420); + this.tlpTop.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 417F)); + this.tlpTop.Size = new System.Drawing.Size(750, 417); this.tlpTop.TabIndex = 2; // // panel1 @@ -306,7 +309,7 @@ namespace Mesen.GUI.Debugger this.panel1.Location = new System.Drawing.Point(3, 0); this.panel1.Margin = new System.Windows.Forms.Padding(3, 0, 3, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(286, 420); + this.panel1.Size = new System.Drawing.Size(286, 417); this.panel1.TabIndex = 5; // // ctrlSourceViewer @@ -315,7 +318,7 @@ namespace Mesen.GUI.Debugger this.ctrlSourceViewer.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlSourceViewer.Location = new System.Drawing.Point(0, 0); this.ctrlSourceViewer.Name = "ctrlSourceViewer"; - this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 420); + this.ctrlSourceViewer.Size = new System.Drawing.Size(286, 417); this.ctrlSourceViewer.SymbolProvider = null; this.ctrlSourceViewer.TabIndex = 7; this.ctrlSourceViewer.Visible = false; @@ -328,7 +331,7 @@ namespace Mesen.GUI.Debugger this.ctrlDebuggerCode.Location = new System.Drawing.Point(0, 0); this.ctrlDebuggerCode.Name = "ctrlDebuggerCode"; this.ctrlDebuggerCode.ShowMemoryValues = false; - this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 420); + this.ctrlDebuggerCode.Size = new System.Drawing.Size(286, 417); this.ctrlDebuggerCode.SymbolProvider = null; this.ctrlDebuggerCode.TabIndex = 2; this.ctrlDebuggerCode.OnEditCode += new Mesen.GUI.Debugger.ctrlDebuggerCode.AssemblerEventHandler(this.ctrlDebuggerCode_OnEditCode); @@ -342,7 +345,7 @@ namespace Mesen.GUI.Debugger this.panel2.Location = new System.Drawing.Point(292, 0); this.panel2.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(1, 420); + this.panel2.Size = new System.Drawing.Size(1, 417); this.panel2.TabIndex = 6; // // ctrlSourceViewerSplit @@ -351,7 +354,7 @@ namespace Mesen.GUI.Debugger this.ctrlSourceViewerSplit.Dock = System.Windows.Forms.DockStyle.Fill; this.ctrlSourceViewerSplit.Location = new System.Drawing.Point(0, 0); this.ctrlSourceViewerSplit.Name = "ctrlSourceViewerSplit"; - this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 420); + this.ctrlSourceViewerSplit.Size = new System.Drawing.Size(1, 417); this.ctrlSourceViewerSplit.SymbolProvider = null; this.ctrlSourceViewerSplit.TabIndex = 8; this.ctrlSourceViewerSplit.Visible = false; @@ -364,7 +367,7 @@ namespace Mesen.GUI.Debugger this.ctrlDebuggerCodeSplit.Location = new System.Drawing.Point(0, 0); this.ctrlDebuggerCodeSplit.Name = "ctrlDebuggerCodeSplit"; this.ctrlDebuggerCodeSplit.ShowMemoryValues = false; - this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 420); + this.ctrlDebuggerCodeSplit.Size = new System.Drawing.Size(1, 417); this.ctrlDebuggerCodeSplit.SymbolProvider = null; this.ctrlDebuggerCodeSplit.TabIndex = 4; this.ctrlDebuggerCodeSplit.Visible = false; @@ -384,7 +387,7 @@ namespace Mesen.GUI.Debugger this.tableLayoutPanel1.RowCount = 2; 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(458, 420); + this.tableLayoutPanel1.Size = new System.Drawing.Size(458, 417); this.tableLayoutPanel1.TabIndex = 7; // // ctrlConsoleStatus @@ -408,7 +411,7 @@ namespace Mesen.GUI.Debugger this.tlpVerticalLayout.Name = "tlpVerticalLayout"; this.tlpVerticalLayout.RowCount = 1; this.tlpVerticalLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 20); + this.tlpVerticalLayout.Size = new System.Drawing.Size(458, 17); this.tlpVerticalLayout.TabIndex = 4; // // tlpFunctionLabelLists @@ -424,16 +427,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(318, 420); + this.tlpFunctionLabelLists.Size = new System.Drawing.Size(318, 417); 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, 213); + this.grpLabels.Location = new System.Drawing.Point(3, 211); this.grpLabels.Name = "grpLabels"; - this.grpLabels.Size = new System.Drawing.Size(312, 204); + this.grpLabels.Size = new System.Drawing.Size(312, 203); this.grpLabels.TabIndex = 6; this.grpLabels.TabStop = false; this.grpLabels.Text = "Labels"; @@ -443,7 +446,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(306, 185); + this.ctrlLabelList.Size = new System.Drawing.Size(306, 184); this.ctrlLabelList.TabIndex = 0; this.ctrlLabelList.OnFindOccurrence += new System.EventHandler(this.ctrlLabelList_OnFindOccurrence); this.ctrlLabelList.OnLabelSelected += new System.EventHandler(this.ctrlLabelList_OnLabelSelected); @@ -454,7 +457,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(312, 204); + this.grpFunctions.Size = new System.Drawing.Size(312, 202); this.grpFunctions.TabIndex = 5; this.grpFunctions.TabStop = false; this.grpFunctions.Text = "Functions"; @@ -464,7 +467,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(306, 185); + this.ctrlFunctionList.Size = new System.Drawing.Size(306, 183); this.ctrlFunctionList.TabIndex = 0; this.ctrlFunctionList.OnFindOccurrence += new System.EventHandler(this.ctrlFunctionList_OnFindOccurrence); this.ctrlFunctionList.OnFunctionSelected += new System.EventHandler(this.ctrlFunctionList_OnFunctionSelected); @@ -495,7 +498,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(1075, 143); + this.tableLayoutPanel10.Size = new System.Drawing.Size(1075, 146); this.tableLayoutPanel10.TabIndex = 0; // // grpWatch @@ -504,7 +507,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(352, 137); + this.grpWatch.Size = new System.Drawing.Size(352, 140); this.grpWatch.TabIndex = 2; this.grpWatch.TabStop = false; this.grpWatch.Text = "Watch"; @@ -514,7 +517,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(346, 118); + this.ctrlWatch.Size = new System.Drawing.Size(346, 121); this.ctrlWatch.TabIndex = 0; // // grpBreakpoints @@ -523,7 +526,7 @@ namespace Mesen.GUI.Debugger this.grpBreakpoints.Dock = System.Windows.Forms.DockStyle.Fill; this.grpBreakpoints.Location = new System.Drawing.Point(361, 3); this.grpBreakpoints.Name = "grpBreakpoints"; - this.grpBreakpoints.Size = new System.Drawing.Size(352, 137); + this.grpBreakpoints.Size = new System.Drawing.Size(352, 140); this.grpBreakpoints.TabIndex = 3; this.grpBreakpoints.TabStop = false; this.grpBreakpoints.Text = "Breakpoints"; @@ -533,7 +536,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(346, 118); + this.ctrlBreakpoints.Size = new System.Drawing.Size(346, 121); this.ctrlBreakpoints.TabIndex = 0; this.ctrlBreakpoints.BreakpointNavigation += new System.EventHandler(this.ctrlBreakpoints_BreakpointNavigation); // @@ -543,7 +546,7 @@ namespace Mesen.GUI.Debugger this.grpCallstack.Dock = System.Windows.Forms.DockStyle.Fill; this.grpCallstack.Location = new System.Drawing.Point(719, 3); this.grpCallstack.Name = "grpCallstack"; - this.grpCallstack.Size = new System.Drawing.Size(353, 137); + this.grpCallstack.Size = new System.Drawing.Size(353, 140); this.grpCallstack.TabIndex = 4; this.grpCallstack.TabStop = false; this.grpCallstack.Text = "Call Stack"; @@ -553,7 +556,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(347, 118); + this.ctrlCallstack.Size = new System.Drawing.Size(347, 121); this.ctrlCallstack.TabIndex = 0; this.ctrlCallstack.FunctionSelected += new System.EventHandler(this.ctrlCallstack_FunctionSelected); // @@ -1159,6 +1162,9 @@ namespace Mesen.GUI.Debugger this.mnuBreakOnBrk, this.mnuBreakOnCrash, this.toolStripMenuItem25, + this.mnuBreakOnInit, + this.mnuBreakOnPlay, + this.toolStripMenuItem26, this.mnuBreakOnDecayedOamRead, this.mnuBreakOnUninitMemoryRead, this.toolStripMenuItem15, @@ -1817,6 +1823,27 @@ namespace Mesen.GUI.Debugger this.tsToolbar.Text = "toolStrip1"; this.tsToolbar.Visible = false; // + // mnuBreakOnInit + // + this.mnuBreakOnInit.CheckOnClick = true; + this.mnuBreakOnInit.Name = "mnuBreakOnInit"; + this.mnuBreakOnInit.Size = new System.Drawing.Size(261, 22); + this.mnuBreakOnInit.Text = "Break on Init (NSF)"; + this.mnuBreakOnInit.Click += new System.EventHandler(this.mnuBreakOnInit_Click); + // + // mnuBreakOnPlay + // + this.mnuBreakOnPlay.CheckOnClick = true; + this.mnuBreakOnPlay.Name = "mnuBreakOnPlay"; + this.mnuBreakOnPlay.Size = new System.Drawing.Size(261, 22); + this.mnuBreakOnPlay.Text = "Break on Play (NSF)"; + this.mnuBreakOnPlay.Click += new System.EventHandler(this.mnuBreakOnPlay_Click); + // + // toolStripMenuItem26 + // + this.toolStripMenuItem26.Name = "toolStripMenuItem26"; + this.toolStripMenuItem26.Size = new System.Drawing.Size(258, 6); + // // frmDebugger // this.AllowDrop = true; @@ -2042,5 +2069,8 @@ namespace Mesen.GUI.Debugger private System.Windows.Forms.ToolStripSeparator toolStripMenuItem25; private System.Windows.Forms.ToolStripMenuItem mnuBreakOnDecayedOamRead; private System.Windows.Forms.ToolStripMenuItem mnuAlwaysScrollToCenter; + private System.Windows.Forms.ToolStripMenuItem mnuBreakOnInit; + private System.Windows.Forms.ToolStripMenuItem mnuBreakOnPlay; + private System.Windows.Forms.ToolStripSeparator toolStripMenuItem26; } } \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index aad82a2d..57255e23 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -96,6 +96,8 @@ namespace Mesen.GUI.Debugger this.mnuAutoLoadDbgFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadDbgFiles; this.mnuAutoLoadCdlFiles.Checked = ConfigManager.Config.DebugInfo.AutoLoadCdlFiles; this.mnuBreakOnReset.Checked = ConfigManager.Config.DebugInfo.BreakOnReset; + this.mnuBreakOnInit.Checked = ConfigManager.Config.DebugInfo.BreakOnInit; + this.mnuBreakOnPlay.Checked = ConfigManager.Config.DebugInfo.BreakOnPlay; this.mnuBreakOnOpen.Checked = ConfigManager.Config.DebugInfo.BreakOnOpen; this.mnuBreakOnUnofficialOpcodes.Checked = ConfigManager.Config.DebugInfo.BreakOnUnofficialOpcodes; this.mnuBreakOnBrk.Checked = ConfigManager.Config.DebugInfo.BreakOnBrk; @@ -450,19 +452,22 @@ namespace Mesen.GUI.Debugger private void UpdateDebuggerFlags() { - SetFlag(DebuggerFlags.PpuPartialDraw, mnuPpuPartialDraw.Checked); - SetFlag(DebuggerFlags.PpuShowPreviousFrame, mnuPpuShowPreviousFrame.Checked); - SetFlag(DebuggerFlags.ShowEffectiveAddresses, mnuShowEffectiveAddresses.Checked); - SetFlag(DebuggerFlags.DisplayOpCodesInLowerCase, mnuDisplayOpCodesInLowerCase.Checked); - SetFlag(DebuggerFlags.DisassembleVerifiedData, mnuDisassembleVerifiedData.Checked); - SetFlag(DebuggerFlags.DisassembleUnidentifiedData, mnuDisassembleUnidentifiedData.Checked); - SetFlag(DebuggerFlags.ShowVerifiedData, mnuShowVerifiedData.Checked); - SetFlag(DebuggerFlags.ShowUnidentifiedData, mnuShowUnidentifiedData.Checked); - SetFlag(DebuggerFlags.BreakOnUnofficialOpCode, mnuBreakOnUnofficialOpcodes.Checked); - SetFlag(DebuggerFlags.BreakOnBrk, mnuBreakOnBrk.Checked); - SetFlag(DebuggerFlags.BreakOnUninitMemoryRead, mnuBreakOnUninitMemoryRead.Checked); - SetFlag(DebuggerFlags.BreakOnDecayedOamRead, mnuBreakOnDecayedOamRead.Checked); - SetFlag(DebuggerFlags.HidePauseIcon, mnuHidePauseIcon.Checked); + DebugInfo config = ConfigManager.Config.DebugInfo; + SetFlag(DebuggerFlags.PpuPartialDraw, config.PpuPartialDraw); + SetFlag(DebuggerFlags.PpuShowPreviousFrame, config.PpuShowPreviousFrame); + SetFlag(DebuggerFlags.ShowEffectiveAddresses, config.ShowEffectiveAddresses); + SetFlag(DebuggerFlags.DisplayOpCodesInLowerCase, config.DisplayOpCodesInLowerCase); + SetFlag(DebuggerFlags.DisassembleVerifiedData, config.DisassembleVerifiedData); + SetFlag(DebuggerFlags.DisassembleUnidentifiedData, config.DisassembleUnidentifiedData); + SetFlag(DebuggerFlags.ShowVerifiedData, config.ShowVerifiedData); + SetFlag(DebuggerFlags.ShowUnidentifiedData, config.ShowUnidentifiedData); + SetFlag(DebuggerFlags.BreakOnUnofficialOpCode, config.BreakOnUnofficialOpcodes); + SetFlag(DebuggerFlags.BreakOnBrk, config.BreakOnBrk); + SetFlag(DebuggerFlags.BreakOnUninitMemoryRead, config.BreakOnUninitMemoryRead); + SetFlag(DebuggerFlags.BreakOnDecayedOamRead, config.BreakOnDecayedOamRead); + SetFlag(DebuggerFlags.BreakOnInit, config.BreakOnInit); + SetFlag(DebuggerFlags.BreakOnPlay, config.BreakOnPlay); + SetFlag(DebuggerFlags.HidePauseIcon, config.HidePauseIcon); InteropEmu.SetFlag(EmulationFlags.DebuggerWindowEnabled, true); } @@ -503,6 +508,9 @@ namespace Mesen.GUI.Debugger case InteropEmu.ConsoleNotificationType.GameReset: case InteropEmu.ConsoleNotificationType.GameLoaded: + UpdateDebuggerFlags(); + + bool breakOnReset = ConfigManager.Config.DebugInfo.BreakOnReset && !InteropEmu.IsNsf(); this.BeginInvoke((MethodInvoker)(() => { this.UpdateWorkspace(); this.AutoLoadCdlFiles(); @@ -510,12 +518,12 @@ namespace Mesen.GUI.Debugger UpdateDebugger(true, false); BreakpointManager.SetBreakpoints(); - if(!ConfigManager.Config.DebugInfo.BreakOnReset) { + if(!breakOnReset) { ClearActiveStatement(); } })); - if(ConfigManager.Config.DebugInfo.BreakOnReset) { + if(breakOnReset) { InteropEmu.DebugStep(1); } break; @@ -1103,6 +1111,20 @@ namespace Mesen.GUI.Debugger ConfigManager.ApplyChanges(); } + private void mnuBreakOnInit_Click(object sender, EventArgs e) + { + ConfigManager.Config.DebugInfo.BreakOnInit = mnuBreakOnInit.Checked; + ConfigManager.ApplyChanges(); + UpdateDebuggerFlags(); + } + + private void mnuBreakOnPlay_Click(object sender, EventArgs e) + { + ConfigManager.Config.DebugInfo.BreakOnPlay = mnuBreakOnPlay.Checked; + ConfigManager.ApplyChanges(); + UpdateDebuggerFlags(); + } + private void mnuBreakOnOpen_Click(object sender, EventArgs e) { ConfigManager.Config.DebugInfo.BreakOnOpen = mnuBreakOnOpen.Checked; @@ -1592,6 +1614,12 @@ namespace Mesen.GUI.Debugger private void mnuBreakOptions_DropDownOpening(object sender, EventArgs e) { this.mnuBreakOnDecayedOamRead.Enabled = ConfigManager.Config.EmulationInfo.EnableOamDecay; + + bool isNsf = InteropEmu.IsNsf(); + mnuBreakOnInit.Visible = isNsf; + mnuBreakOnPlay.Visible = isNsf; + + mnuBreakOnReset.Enabled = !isNsf; } private void frmDebugger_DragDrop(object sender, DragEventArgs e) diff --git a/GUI.NET/InteropEmu.cs b/GUI.NET/InteropEmu.cs index 66f31ca6..2c332874 100644 --- a/GUI.NET/InteropEmu.cs +++ b/GUI.NET/InteropEmu.cs @@ -1657,6 +1657,8 @@ namespace Mesen.GUI HidePauseIcon = 0x1000, BreakOnDecayedOamRead = 0x2000, + BreakOnInit = 0x4000, + BreakOnPlay = 0x8000, } public struct InteropRomInfo