Debugger - add breakpoint dialog - pop up in a reasonable place, and limit address size based on the core's bus size

This commit is contained in:
adelikat 2014-12-13 16:59:01 +00:00
parent 925d6f5a50
commit 18e112536a
3 changed files with 22 additions and 1 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);