From 18e112536a4fac6f34a5c39b017168451f1267fc Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 13 Dec 2014 16:59:01 +0000 Subject: [PATCH] Debugger - add breakpoint dialog - pop up in a reasonable place, and limit address size based on the core's bus size --- .../tools/Debugger/AddBreakpointDialog.Designer.cs | 1 + .../tools/Debugger/AddBreakpointDialog.cs | 13 +++++++++++++ .../tools/Debugger/BreakpointControl.cs | 9 ++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs index eeb6125977..dae11ab55a 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.Designer.cs @@ -125,6 +125,7 @@ this.MinimizeBox = false; this.Name = "AddBreakpointDialog"; this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Add Breakpoint"; this.Load += new System.EventHandler(this.AddBreakpointDialog_Load); this.BreakpointTypeGroupbox.ResumeLayout(false); diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs index a148e4ddb6..d0fd5d71cb 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/AddBreakpointDialog.cs @@ -46,6 +46,19 @@ namespace BizHawk.Client.EmuHawk get { return (uint)AddressBox.ToRawInt().Value; } } + public int MaxAddressSize + { + get + { + return AddressBox.MaxLength; + } + + set + { + AddressBox.MaxLength = value; + } + } + private void AddButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs index f242a96f90..d96aa95e25 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/BreakpointControl.cs @@ -7,8 +7,10 @@ using System.Linq; using System.Text; using System.Windows.Forms; +using BizHawk.Common.NumberExtensions; using BizHawk.Emulation.Common; using BizHawk.Emulation.Common.IEmulatorExtensions; +using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk.tools.Debugger { @@ -96,7 +98,12 @@ namespace BizHawk.Client.EmuHawk.tools.Debugger private void AddBreakpointButton_Click(object sender, EventArgs e) { - var b = new AddBreakpointDialog(); + var b = new AddBreakpointDialog + { + // TODO: don't use Global.Emulator! Pass in an IMemoryDomains implementation from the parent tool + MaxAddressSize = (Global.Emulator.AsMemoryDomains().MemoryDomains.SystemBus.Size - 1).NumHexDigits() + }; + if (b.ShowDialog() == DialogResult.OK) { Breakpoints.Add(Core, b.Address, b.BreakType);