From 29d685916703b465894f13efae30f691fc73c4a6 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 13 Dec 2014 23:57:23 +0000 Subject: [PATCH] Debugger - convert to using OptionalServices for the Disassembler --- .../tools/Debugger/GenericDebugger.IToolForm.cs | 4 +--- BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs | 5 ++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs index b92a37e8c7..af543fac39 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.IToolForm.cs @@ -11,7 +11,7 @@ namespace BizHawk.Client.EmuHawk { public IDictionary EmulatorServices { private get; set; } private IDebuggable Core { get { return (IDebuggable)EmulatorServices[typeof(IDebuggable)]; } } - private IDisassemblable Disassembler; + private IDisassemblable Disassembler { get { return (IDisassemblable)EmulatorServices[typeof(IDisassemblable)]; } } public void UpdateValues() { @@ -29,8 +29,6 @@ namespace BizHawk.Client.EmuHawk { return; } - - Disassembler = Global.Emulator.AsDissassembler(); } public bool AskSaveChanges() diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs index 5d403fe67c..fe355f1714 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/GenericDebugger.cs @@ -14,6 +14,7 @@ using BizHawk.Client.Common; namespace BizHawk.Client.EmuHawk { [RequiredServices(typeof(IDebuggable))] + [OptionalServices(typeof(IDisassemblable))] public partial class GenericDebugger : Form, IToolForm, IControlMainform { private int _defaultWidth; @@ -45,8 +46,6 @@ namespace BizHawk.Client.EmuHawk Size = Global.Config.GenericDebuggerSettings.WindowSize; } - Disassembler = Global.Emulator.AsDissassembler(); - EngageDebugger(); } @@ -72,7 +71,7 @@ namespace BizHawk.Client.EmuHawk private void EngageDebugger() { - if (Core.CanDisassemble()) + if (Disassembler != null) { try {