From 4a091b9e2508f365b564a71badbdc31482d8800e Mon Sep 17 00:00:00 2001 From: Souryo Date: Sun, 4 Dec 2016 09:53:25 -0500 Subject: [PATCH] Debugger: Added break on power/reset option --- GUI.NET/Config/DebugInfo.cs | 1 + GUI.NET/Debugger/frmDebugger.Designer.cs | 35 ++++++++++++++++-------- GUI.NET/Debugger/frmDebugger.cs | 17 ++++++++++-- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/GUI.NET/Config/DebugInfo.cs b/GUI.NET/Config/DebugInfo.cs index 637a6298..bdb36f15 100644 --- a/GUI.NET/Config/DebugInfo.cs +++ b/GUI.NET/Config/DebugInfo.cs @@ -108,6 +108,7 @@ namespace Mesen.GUI.Config public bool DisableDefaultLabels = false; public bool BreakOnOpen = true; + public bool BreakOnReset = true; public DebugInfo() { diff --git a/GUI.NET/Debugger/frmDebugger.Designer.cs b/GUI.NET/Debugger/frmDebugger.Designer.cs index da0fb2ff..da3d01f4 100644 --- a/GUI.NET/Debugger/frmDebugger.Designer.cs +++ b/GUI.NET/Debugger/frmDebugger.Designer.cs @@ -59,6 +59,7 @@ this.mnuResetWorkspace = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator(); this.mnuAutoLoadDbgFiles = new System.Windows.Forms.ToolStripMenuItem(); + this.mnuDisableDefaultLabels = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripSeparator(); this.mnuClose = new System.Windows.Forms.ToolStripMenuItem(); this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -94,6 +95,7 @@ this.mnuDecreaseFontSize = new System.Windows.Forms.ToolStripMenuItem(); this.mnuResetFontSize = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripSeparator(); + this.mnuBreakOnReset = new System.Windows.Forms.ToolStripMenuItem(); this.mnuBreakOnOpen = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripSeparator(); this.mnuShowCpuMemoryMapping = new System.Windows.Forms.ToolStripMenuItem(); @@ -125,7 +127,6 @@ this.lblChrAnalysisResult = new System.Windows.Forms.ToolStripStatusLabel(); this.ctrlPpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); this.ctrlCpuMemoryMapping = new Mesen.GUI.Debugger.Controls.ctrlMemoryMapping(); - this.mnuDisableDefaultLabels = new System.Windows.Forms.ToolStripMenuItem(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -403,7 +404,7 @@ this.mnuAutoLoadDbgFiles, this.mnuDisableDefaultLabels}); this.mnuWorkspace.Name = "mnuWorkspace"; - this.mnuWorkspace.Size = new System.Drawing.Size(152, 22); + this.mnuWorkspace.Size = new System.Drawing.Size(132, 22); this.mnuWorkspace.Text = "Workspace"; // // mnuImportLabels @@ -435,15 +436,23 @@ this.mnuAutoLoadDbgFiles.Text = "Auto-load DBG files"; this.mnuAutoLoadDbgFiles.Click += new System.EventHandler(this.mnuAutoLoadDbgFiles_Click); // + // mnuDisableDefaultLabels + // + this.mnuDisableDefaultLabels.CheckOnClick = true; + this.mnuDisableDefaultLabels.Name = "mnuDisableDefaultLabels"; + this.mnuDisableDefaultLabels.Size = new System.Drawing.Size(185, 22); + this.mnuDisableDefaultLabels.Text = "Disable default labels"; + this.mnuDisableDefaultLabels.Click += new System.EventHandler(this.mnuDisableDefaultLabels_Click); + // // toolStripMenuItem3 // this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(149, 6); + this.toolStripMenuItem3.Size = new System.Drawing.Size(129, 6); // // mnuClose // this.mnuClose.Name = "mnuClose"; - this.mnuClose.Size = new System.Drawing.Size(152, 22); + this.mnuClose.Size = new System.Drawing.Size(132, 22); this.mnuClose.Text = "Close"; this.mnuClose.Click += new System.EventHandler(this.mnuClose_Click); // @@ -672,6 +681,7 @@ this.mnuSplitView, this.fontSizeToolStripMenuItem, this.toolStripMenuItem5, + this.mnuBreakOnReset, this.mnuBreakOnOpen, this.toolStripMenuItem11, this.mnuShowCpuMemoryMapping, @@ -737,6 +747,14 @@ this.toolStripMenuItem5.Name = "toolStripMenuItem5"; this.toolStripMenuItem5.Size = new System.Drawing.Size(240, 6); // + // mnuBreakOnReset + // + this.mnuBreakOnReset.CheckOnClick = true; + this.mnuBreakOnReset.Name = "mnuBreakOnReset"; + this.mnuBreakOnReset.Size = new System.Drawing.Size(243, 22); + this.mnuBreakOnReset.Text = "Break on power/reset"; + this.mnuBreakOnReset.Click += new System.EventHandler(this.mnuBreakOnReset_Click); + // // mnuBreakOnOpen // this.mnuBreakOnOpen.CheckOnClick = true; @@ -978,14 +996,6 @@ this.ctrlCpuMemoryMapping.Text = "ctrlMemoryMapping1"; this.ctrlCpuMemoryMapping.Visible = false; // - // mnuDisableDefaultLabels - // - this.mnuDisableDefaultLabels.CheckOnClick = true; - this.mnuDisableDefaultLabels.Name = "mnuDisableDefaultLabels"; - this.mnuDisableDefaultLabels.Size = new System.Drawing.Size(185, 22); - this.mnuDisableDefaultLabels.Text = "Disable default labels"; - this.mnuDisableDefaultLabels.Click += new System.EventHandler(this.mnuDisableDefaultLabels_Click); - // // frmDebugger // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1119,5 +1129,6 @@ private System.Windows.Forms.ToolStripMenuItem mnuBreakOnOpen; private System.Windows.Forms.ToolStripSeparator toolStripMenuItem11; private System.Windows.Forms.ToolStripMenuItem mnuDisableDefaultLabels; + private System.Windows.Forms.ToolStripMenuItem mnuBreakOnReset; } } \ No newline at end of file diff --git a/GUI.NET/Debugger/frmDebugger.cs b/GUI.NET/Debugger/frmDebugger.cs index 2d18eb03..5f8bc133 100644 --- a/GUI.NET/Debugger/frmDebugger.cs +++ b/GUI.NET/Debugger/frmDebugger.cs @@ -190,8 +190,15 @@ namespace Mesen.GUI.Debugger this.AutoLoadDbgFile(true); UpdateDebugger(); BreakpointManager.SetBreakpoints(); - })); - InteropEmu.DebugStep(1); + + if(!ConfigManager.Config.DebugInfo.BreakOnReset) { + ClearActiveStatement(); + } + })); + + if(ConfigManager.Config.DebugInfo.BreakOnReset) { + InteropEmu.DebugStep(1); + } break; } } @@ -595,6 +602,12 @@ namespace Mesen.GUI.Debugger ctrlDebuggerCode.UpdateLineColors(); ctrlDebuggerCodeSplit.UpdateLineColors(); } + + private void mnuBreakOnReset_Click(object sender, EventArgs e) + { + ConfigManager.Config.DebugInfo.BreakOnReset = mnuBreakOnReset.Checked; + ConfigManager.ApplyChanges(); + } private void mnuBreakOnOpen_Click(object sender, EventArgs e) {