Debugger - fix how IMemoryCallbackSystem is used, breakpoint control no longer permanently disabled even when it is implemented in a core

This commit is contained in:
adelikat 2014-12-23 18:24:01 +00:00
parent 816a6e53df
commit f79d8332a6
2 changed files with 35 additions and 7 deletions

View File

@ -15,8 +15,8 @@ namespace BizHawk.Client.EmuHawk
private IDisassemblable Disassembler { get; set; }
[OptionalService]
private IMemoryDomains MemoryDomainSource { get; set; }
[OptionalService]
private IMemoryCallbackSystem MCS { get; set; }
private IMemoryCallbackSystem MemoryCallbacks { get { return Debuggable.MemoryCallbacks; } }
private MemoryDomainList MemoryDomains { get { return MemoryDomainSource.MemoryDomains; } }
@ -28,6 +28,27 @@ namespace BizHawk.Client.EmuHawk
#region Implementation checking
private bool CanUseMemoryCallbacks
{
get
{
if (Debuggable != null)
{
try
{
var result = Debuggable.MemoryCallbacks.HasReads;
return true;
}
catch (NotImplementedException)
{
return false;
}
}
return false;
}
}
private bool CanDisassemble
{
get

View File

@ -91,11 +91,18 @@ namespace BizHawk.Client.EmuHawk
RegisterPanel.ParentDebugger = this;
RegisterPanel.GenerateUI();
BreakPointControl1.Core = Debuggable;
BreakPointControl1.MCS = MCS;
BreakPointControl1.ParentDebugger = this;
BreakPointControl1.MemoryDomains = MemoryDomains;
BreakPointControl1.GenerateUI();
if (CanUseMemoryCallbacks)
{
BreakPointControl1.Core = Debuggable;
BreakPointControl1.MCS = MemoryCallbacks;
BreakPointControl1.ParentDebugger = this;
BreakPointControl1.MemoryDomains = MemoryDomains;
BreakPointControl1.GenerateUI();
}
else
{
DisableBreakpointBox();
}
StepIntoMenuItem.Enabled = StepIntoBtn.Enabled = CanStepInto;
StepOutMenuItem.Enabled = StepOutBtn.Enabled = CanStepOut;