2014-05-26 18:23:58 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
2014-12-07 18:53:56 +00:00
|
|
|
|
using BizHawk.Emulation.Common;
|
|
|
|
|
|
2014-05-26 18:23:58 +00:00
|
|
|
|
namespace BizHawk.Client.EmuHawk
|
|
|
|
|
{
|
|
|
|
|
public partial class AddBreakpointDialog : Form
|
|
|
|
|
{
|
2015-07-18 18:41:06 +00:00
|
|
|
|
public AddBreakpointDialog(BreakpointOperation op)
|
2014-05-26 18:23:58 +00:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2015-07-18 18:41:06 +00:00
|
|
|
|
Operation = op;
|
2016-08-08 11:37:39 +00:00
|
|
|
|
AddressMaskBox.SetHexProperties(0xFFFFFFFF);
|
|
|
|
|
AddressMask = 0xFFFFFFFF;
|
2015-07-18 18:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-08 11:37:39 +00:00
|
|
|
|
public AddBreakpointDialog(BreakpointOperation op, uint address, uint mask, MemoryCallbackType type):this(op)
|
2015-07-18 18:41:06 +00:00
|
|
|
|
{
|
2016-08-08 11:37:39 +00:00
|
|
|
|
AddressMaskBox.SetHexProperties(0xFFFFFFFF);
|
2015-07-18 18:41:06 +00:00
|
|
|
|
Address = address;
|
2016-08-08 11:37:39 +00:00
|
|
|
|
AddressMask = mask;
|
2015-07-18 18:41:06 +00:00
|
|
|
|
BreakType = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BreakpointOperation _operation;
|
|
|
|
|
|
|
|
|
|
private BreakpointOperation Operation
|
|
|
|
|
{
|
2016-08-08 11:37:39 +00:00
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _operation;
|
2015-07-18 18:41:06 +00:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
switch (value)
|
|
|
|
|
{
|
|
|
|
|
case BreakpointOperation.Add:
|
|
|
|
|
Text = "Add Breakpoint";
|
|
|
|
|
break;
|
|
|
|
|
case BreakpointOperation.Duplicate:
|
|
|
|
|
Text = "Duplicate Breakpoint";
|
|
|
|
|
break;
|
|
|
|
|
case BreakpointOperation.Edit:
|
|
|
|
|
Text = "Edit Breakpoint";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
_operation = value;
|
|
|
|
|
}
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-25 22:14:58 +00:00
|
|
|
|
public void DisableExecuteOption()
|
|
|
|
|
{
|
|
|
|
|
if (ExecuteRadio.Checked)
|
|
|
|
|
{
|
|
|
|
|
ReadRadio.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ExecuteRadio.Enabled = false;
|
2016-08-08 11:37:39 +00:00
|
|
|
|
|
2015-01-25 22:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-08 11:37:39 +00:00
|
|
|
|
public MemoryCallbackType BreakType
|
2014-05-26 18:23:58 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (ReadRadio.Checked)
|
|
|
|
|
{
|
2014-12-07 18:53:56 +00:00
|
|
|
|
return MemoryCallbackType.Read;
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (WriteRadio.Checked)
|
|
|
|
|
{
|
2014-12-07 18:53:56 +00:00
|
|
|
|
return MemoryCallbackType.Write;
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ExecuteRadio.Checked)
|
|
|
|
|
{
|
2014-12-07 18:53:56 +00:00
|
|
|
|
return MemoryCallbackType.Execute;
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-07 18:53:56 +00:00
|
|
|
|
return MemoryCallbackType.Read;
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
2015-07-18 18:41:06 +00:00
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ReadRadio.Checked = WriteRadio.Checked = ExecuteRadio.Checked = false;
|
|
|
|
|
switch (value)
|
|
|
|
|
{
|
|
|
|
|
case MemoryCallbackType.Read:
|
|
|
|
|
ReadRadio.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case MemoryCallbackType.Write:
|
|
|
|
|
WriteRadio.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
case MemoryCallbackType.Execute:
|
|
|
|
|
ExecuteRadio.Checked = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public uint Address
|
|
|
|
|
{
|
2016-08-08 11:37:39 +00:00
|
|
|
|
get { return (uint)AddressBox.ToRawInt().Value & AddressMask; }
|
|
|
|
|
set { AddressBox.SetFromLong(value & AddressMask); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public uint AddressMask
|
|
|
|
|
{
|
|
|
|
|
get { return (uint)AddressMaskBox.ToRawInt().Value; }
|
|
|
|
|
set { AddressMaskBox.SetFromLong(value); }
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-18 15:25:47 +00:00
|
|
|
|
public long MaxAddressSize
|
2014-12-13 16:59:01 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2015-01-18 19:08:25 +00:00
|
|
|
|
return AddressBox.GetMax();
|
2014-12-13 16:59:01 +00:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
2014-12-13 17:33:02 +00:00
|
|
|
|
AddressBox.SetHexProperties(value);
|
2016-08-08 11:37:39 +00:00
|
|
|
|
AddressMaskBox.SetHexProperties(value);
|
2014-12-13 16:59:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-26 18:23:58 +00:00
|
|
|
|
private void AddButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.OK;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 18:41:06 +00:00
|
|
|
|
private void CancelBtn_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DialogResult = DialogResult.Cancel;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-26 18:23:58 +00:00
|
|
|
|
private void AddBreakpointDialog_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2015-07-18 18:41:06 +00:00
|
|
|
|
|
|
|
|
|
public enum BreakpointOperation
|
|
|
|
|
{
|
|
|
|
|
Add, Edit, Duplicate
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-26 18:23:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|