Show Step buttons/menu items based on whether it is implemented in the current core

This commit is contained in:
adelikat 2014-12-20 13:36:22 +00:00
parent ffdeb618f7
commit af851b8ad6
2 changed files with 55 additions and 6 deletions

View File

@ -10,7 +10,7 @@ namespace BizHawk.Client.EmuHawk
public partial class GenericDebugger : IToolForm
{
[RequiredService]
private IDebuggable Core { get; set; }
private IDebuggable Debuggable { get; set; }
[OptionalService]
private IDisassemblable Disassembler { get; set; }
[OptionalService]
@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
private int PC
{
// TODO: is this okay for N64?
get { return (int)Core.GetCpuFlagsAndRegisters()[Disassembler.PCRegisterName].Value; }
get { return (int)Debuggable.GetCpuFlagsAndRegisters()[Disassembler.PCRegisterName].Value; }
}
#region Implementation checking
@ -66,6 +66,51 @@ namespace BizHawk.Client.EmuHawk
}
}
private bool CanStepInto
{
get
{
try
{
return Debuggable.CanStep(StepType.Into);
}
catch (NotImplementedException)
{
return false;
}
}
}
private bool CanStepOver
{
get
{
try
{
return Debuggable.CanStep(StepType.Over);
}
catch (NotImplementedException)
{
return false;
}
}
}
private bool CanStepOut
{
get
{
try
{
return Debuggable.CanStep(StepType.Out);
}
catch (NotImplementedException)
{
return false;
}
}
}
#endregion
public void UpdateValues()

View File

@ -132,22 +132,26 @@ namespace BizHawk.Client.EmuHawk
});
}
RegisterPanel.Core = Core;
RegisterPanel.Core = Debuggable;
RegisterPanel.ParentDebugger = this;
RegisterPanel.GenerateUI();
BreakPointControl1.Core = Core;
BreakPointControl1.Core = Debuggable;
BreakPointControl1.MCS = MCS;
BreakPointControl1.ParentDebugger = this;
BreakPointControl1.GenerateUI();
StepIntoMenuItem.Enabled = StepIntoBtn.Enabled = CanStepInto;
StepOutMenuItem.Enabled = StepOutBtn.Enabled = CanStepOut;
StepOverMenuItem.Enabled = StepOverBtn.Enabled = CanStepOver;
}
private void DisengageDebugger()
{
SaveConfigSettings();
if (Core.Tracer != null)
if (Debuggable.Tracer != null)
{
Core.Tracer.Enabled = false;
Debuggable.Tracer.Enabled = false;
}
BreakPointControl1.Shutdown();