Debugger - convert to using OptionalServices for the Disassembler

This commit is contained in:
adelikat 2014-12-13 23:57:23 +00:00
parent 1cd49d5b54
commit 29d6859167
2 changed files with 3 additions and 6 deletions

View File

@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk
{ {
public IDictionary<Type, object> EmulatorServices { private get; set; } public IDictionary<Type, object> EmulatorServices { private get; set; }
private IDebuggable Core { get { return (IDebuggable)EmulatorServices[typeof(IDebuggable)]; } } private IDebuggable Core { get { return (IDebuggable)EmulatorServices[typeof(IDebuggable)]; } }
private IDisassemblable Disassembler; private IDisassemblable Disassembler { get { return (IDisassemblable)EmulatorServices[typeof(IDisassemblable)]; } }
public void UpdateValues() public void UpdateValues()
{ {
@ -29,8 +29,6 @@ namespace BizHawk.Client.EmuHawk
{ {
return; return;
} }
Disassembler = Global.Emulator.AsDissassembler();
} }
public bool AskSaveChanges() public bool AskSaveChanges()

View File

@ -14,6 +14,7 @@ using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
[RequiredServices(typeof(IDebuggable))] [RequiredServices(typeof(IDebuggable))]
[OptionalServices(typeof(IDisassemblable))]
public partial class GenericDebugger : Form, IToolForm, IControlMainform public partial class GenericDebugger : Form, IToolForm, IControlMainform
{ {
private int _defaultWidth; private int _defaultWidth;
@ -45,8 +46,6 @@ namespace BizHawk.Client.EmuHawk
Size = Global.Config.GenericDebuggerSettings.WindowSize; Size = Global.Config.GenericDebuggerSettings.WindowSize;
} }
Disassembler = Global.Emulator.AsDissassembler();
EngageDebugger(); EngageDebugger();
} }
@ -72,7 +71,7 @@ namespace BizHawk.Client.EmuHawk
private void EngageDebugger() private void EngageDebugger()
{ {
if (Core.CanDisassemble()) if (Disassembler != null)
{ {
try try
{ {