pass mainform to BreakpointControl

This commit is contained in:
adelikat 2019-12-22 12:06:46 -06:00
parent ed45318a75
commit b9c0d11c16
3 changed files with 16 additions and 21 deletions

View File

@ -12,8 +12,9 @@ namespace BizHawk.Client.EmuHawk
{
public partial class BreakpointControl : UserControl
{
public MainForm MainForm { get; set; }
public IDebuggable Core { get; set; }
public IMemoryCallbackSystem MCS { get; set; }
public IMemoryCallbackSystem Mcs { get; set; }
public GenericDebugger ParentDebugger { get; set; }
public IMemoryDomains MemoryDomains { get; set; }
@ -47,9 +48,9 @@ namespace BizHawk.Client.EmuHawk
private void BreakpointCallback(uint addr, uint value, uint flags)
{
GlobalWin.MainForm.PauseEmulator();
MainForm.PauseEmulator();
UpdateValues();
GlobalWin.OSD.AddMessage("Breakpoint hit");
MainForm.AddOnScreenMessage("Breakpoint hit");
}
private void SeekCallback(uint addr, uint value, uint flags)
@ -67,8 +68,6 @@ namespace BizHawk.Client.EmuHawk
ParentDebugger.DisableCancelSeekBtn();
}
public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
{
if (Enabled)
@ -83,9 +82,9 @@ namespace BizHawk.Client.EmuHawk
// Did any breakpoints get added from other sources such as lua?
private void CheckForNewBreakpoints()
{
if (MCS != null)
if (Mcs != null)
{
foreach (var callback in MCS)
foreach (var callback in Mcs)
{
if (!_breakpoints.Any(b =>
b.Type == callback.Type &&
@ -102,9 +101,9 @@ namespace BizHawk.Client.EmuHawk
public void GenerateUI()
{
if (MCS != null)
if (Mcs != null)
{
foreach (var callback in MCS)
foreach (var callback in Mcs)
{
_breakpoints.Add(new Breakpoint(Core, callback));
}
@ -170,16 +169,10 @@ namespace BizHawk.Client.EmuHawk
}
private IEnumerable<int> SelectedIndices => BreakpointView.SelectedIndices.Cast<int>();
private IEnumerable<Breakpoint> SelectedItems => SelectedIndices.Select(index => _breakpoints[index]);
private IEnumerable<Breakpoint> SelectedItems
{
get { return SelectedIndices.Select(index => _breakpoints[index]); }
}
private IEnumerable<Breakpoint> EditableItems
{
get { return SelectedItems.Where(item => !item.ReadOnly); }
}
private IEnumerable<Breakpoint> EditableItems => SelectedItems.Where(item => !item.ReadOnly);
private void RemoveBreakpointButton_Click(object sender, EventArgs e)
{
@ -324,7 +317,7 @@ namespace BizHawk.Client.EmuHawk
b.AddressMask = (uint)mask;
}
if (!MCS.ExecuteCallbacksAvailable)
if (!Mcs.ExecuteCallbacksAvailable)
{
b.DisableExecuteOption();
}

View File

@ -187,9 +187,10 @@
this.BreakPointControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.BreakPointControl1.MainForm = null;
this.BreakPointControl1.Core = null;
this.BreakPointControl1.Location = new System.Drawing.Point(8, 19);
this.BreakPointControl1.MCS = null;
this.BreakPointControl1.Mcs = null;
this.BreakPointControl1.MemoryDomains = null;
this.BreakPointControl1.Name = "BreakPointControl1";
this.BreakPointControl1.ParentDebugger = null;

View File

@ -107,8 +107,9 @@ namespace BizHawk.Client.EmuHawk
if (CanUseMemoryCallbacks)
{
BreakPointControl1.MainForm = MainForm;
BreakPointControl1.Core = Debuggable;
BreakPointControl1.MCS = MemoryCallbacks;
BreakPointControl1.Mcs = MemoryCallbacks;
BreakPointControl1.ParentDebugger = this;
BreakPointControl1.MemoryDomains = MemoryDomains;
BreakPointControl1.GenerateUI();