diff --git a/UI/Debugger/Breakpoints/BreakpointManager.cs b/UI/Debugger/Breakpoints/BreakpointManager.cs index d796e56..62c7998 100644 --- a/UI/Debugger/Breakpoints/BreakpointManager.cs +++ b/UI/Debugger/Breakpoints/BreakpointManager.cs @@ -11,12 +11,23 @@ namespace Mesen.GUI.Debugger public static event EventHandler BreakpointsChanged; private static List _breakpoints = new List(); + private static bool _breakpointsEnabled = false; public static ReadOnlyCollection Breakpoints { get { return _breakpoints.ToList().AsReadOnly(); } } + public static bool BreakpointsEnabled + { + get { return _breakpointsEnabled; } + set + { + _breakpointsEnabled = value; + SetBreakpoints(); + } + } + public static void RefreshBreakpoints(Breakpoint bp = null) { if(BreakpointsChanged != null) { @@ -105,8 +116,10 @@ namespace Mesen.GUI.Debugger public static void SetBreakpoints() { List breakpoints = new List(); - for(int i = 0; i < Breakpoints.Count; i++) { - breakpoints.Add(Breakpoints[i].ToInteropBreakpoint(i)); + if(BreakpointsEnabled) { + for(int i = 0; i < Breakpoints.Count; i++) { + breakpoints.Add(Breakpoints[i].ToInteropBreakpoint(i)); + } } DebugApi.SetBreakpoints(breakpoints.ToArray(), (UInt32)breakpoints.Count); } diff --git a/UI/Debugger/Breakpoints/ctrlBreakpoints.cs b/UI/Debugger/Breakpoints/ctrlBreakpoints.cs index 08fa17d..3fab916 100644 --- a/UI/Debugger/Breakpoints/ctrlBreakpoints.cs +++ b/UI/Debugger/Breakpoints/ctrlBreakpoints.cs @@ -40,6 +40,8 @@ namespace Mesen.GUI.Debugger.Controls mnuGoToLocation.Enabled = false; InitShortcuts(); + + RefreshList(); } } diff --git a/UI/Debugger/Controls/ctrlDisassemblyView.cs b/UI/Debugger/Controls/ctrlDisassemblyView.cs index fa7dbd9..485c31a 100644 --- a/UI/Debugger/Controls/ctrlDisassemblyView.cs +++ b/UI/Debugger/Controls/ctrlDisassemblyView.cs @@ -57,12 +57,16 @@ namespace Mesen.GUI.Debugger.Controls public void SetActiveAddress(int? address) { - UpdateCode(); + if(_styleProvider.ActiveAddress == address) { + return; + } _styleProvider.ActiveAddress = address; if(address.HasValue && address.Value >= 0) { ctrlCode.ScrollToAddress(address.Value); } + + ctrlCode.Invalidate(); } public void ScrollToAddress(uint address) @@ -70,7 +74,7 @@ namespace Mesen.GUI.Debugger.Controls ctrlCode.ScrollToAddress((int)address); } - private void UpdateCode() + public void UpdateCode() { int centerLineIndex = ctrlCode.GetLineIndexAtPosition(0) + ctrlCode.GetNumberVisibleLines() / 2; int centerLineAddress; diff --git a/UI/Debugger/EventViewer/ctrlEventViewerPpuView.designer.cs b/UI/Debugger/EventViewer/ctrlEventViewerPpuView.designer.cs index 0fa3287..497b0e3 100644 --- a/UI/Debugger/EventViewer/ctrlEventViewerPpuView.designer.cs +++ b/UI/Debugger/EventViewer/ctrlEventViewerPpuView.designer.cs @@ -35,6 +35,7 @@ namespace Mesen.GUI.Debugger this.pnlPicture = new System.Windows.Forms.Panel(); this.grpOptions = new System.Windows.Forms.GroupBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.chkShowPreviousFrameEvents = new System.Windows.Forms.CheckBox(); this.picNmi = new Mesen.GUI.Debugger.ctrlColorPicker(); this.chkShowNmi = new System.Windows.Forms.CheckBox(); this.picIrq = new Mesen.GUI.Debugger.ctrlColorPicker(); @@ -62,7 +63,6 @@ namespace Mesen.GUI.Debugger this.picPpuReads = new Mesen.GUI.Debugger.ctrlColorPicker(); this.chkShowMarkedBreakpoints = new System.Windows.Forms.CheckBox(); this.picMarkedBreakpoints = new Mesen.GUI.Debugger.ctrlColorPicker(); - this.chkShowPreviousFrameEvents = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.picViewer)).BeginInit(); this.pnlPicture.SuspendLayout(); this.grpOptions.SuspendLayout(); @@ -173,6 +173,19 @@ namespace Mesen.GUI.Debugger this.tableLayoutPanel1.Size = new System.Drawing.Size(255, 510); this.tableLayoutPanel1.TabIndex = 0; // + // chkShowPreviousFrameEvents + // + this.chkShowPreviousFrameEvents.AutoSize = true; + this.tableLayoutPanel1.SetColumnSpan(this.chkShowPreviousFrameEvents, 6); + this.chkShowPreviousFrameEvents.Location = new System.Drawing.Point(3, 148); + this.chkShowPreviousFrameEvents.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3); + this.chkShowPreviousFrameEvents.Name = "chkShowPreviousFrameEvents"; + this.chkShowPreviousFrameEvents.Size = new System.Drawing.Size(167, 17); + this.chkShowPreviousFrameEvents.TabIndex = 28; + this.chkShowPreviousFrameEvents.Text = "Show previous frame\'s events"; + this.chkShowPreviousFrameEvents.UseVisualStyleBackColor = true; + this.chkShowPreviousFrameEvents.Click += new System.EventHandler(this.chkOption_Click); + // // picNmi // this.picNmi.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -427,6 +440,7 @@ namespace Mesen.GUI.Debugger // this.chkShowMarkedBreakpoints.AutoSize = true; this.tableLayoutPanel1.SetColumnSpan(this.chkShowMarkedBreakpoints, 2); + this.chkShowMarkedBreakpoints.Enabled = false; this.chkShowMarkedBreakpoints.Location = new System.Drawing.Point(3, 118); this.chkShowMarkedBreakpoints.Name = "chkShowMarkedBreakpoints"; this.chkShowMarkedBreakpoints.Size = new System.Drawing.Size(121, 17); @@ -444,19 +458,6 @@ namespace Mesen.GUI.Debugger this.picMarkedBreakpoints.TabIndex = 27; this.picMarkedBreakpoints.TabStop = false; // - // chkShowPreviousFrameEvents - // - this.chkShowPreviousFrameEvents.AutoSize = true; - this.tableLayoutPanel1.SetColumnSpan(this.chkShowPreviousFrameEvents, 6); - this.chkShowPreviousFrameEvents.Location = new System.Drawing.Point(3, 148); - this.chkShowPreviousFrameEvents.Margin = new System.Windows.Forms.Padding(3, 10, 3, 3); - this.chkShowPreviousFrameEvents.Name = "chkShowPreviousFrameEvents"; - this.chkShowPreviousFrameEvents.Size = new System.Drawing.Size(167, 17); - this.chkShowPreviousFrameEvents.TabIndex = 28; - this.chkShowPreviousFrameEvents.Text = "Show previous frame\'s events"; - this.chkShowPreviousFrameEvents.UseVisualStyleBackColor = true; - this.chkShowPreviousFrameEvents.Click += new System.EventHandler(this.chkOption_Click); - // // ctrlEventViewerPpuView // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/UI/Debugger/frmDebugger.cs b/UI/Debugger/frmDebugger.cs index c5119c6..f953fe5 100644 --- a/UI/Debugger/frmDebugger.cs +++ b/UI/Debugger/frmDebugger.cs @@ -34,6 +34,7 @@ namespace Mesen.GUI.Debugger InitShortcuts(); InitToolbar(); + BreakpointManager.BreakpointsEnabled = true; DebugApi.Step(10000); } @@ -41,6 +42,7 @@ namespace Mesen.GUI.Debugger { base.OnClosing(e); + BreakpointManager.BreakpointsEnabled = false; if(this._notifListener != null) { this._notifListener.Dispose(); this._notifListener = null; @@ -184,6 +186,7 @@ namespace Mesen.GUI.Debugger UpdateContinueAction(); ctrlStatus.UpdateStatus(state); + ctrlDisassemblyView.UpdateCode(); ctrlDisassemblyView.SetActiveAddress(activeAddress); ctrlWatch.UpdateWatch(true); ctrlCallstack.UpdateCallstack();