From aaed8e67d5c543303c4af98f1e5110cda2895cf0 Mon Sep 17 00:00:00 2001 From: adelikat Date: Wed, 14 Dec 2016 09:16:54 -0600 Subject: [PATCH] NullController - remove a bunch of methods that were originally part of IController but no longer are, and clean up the code a bit --- .../Base Implementations/NullController.cs | 30 ++++++++++++------- .../Consoles/PC Engine/PCEngine.cs | 2 +- .../Consoles/Sega/SMS/SMS.cs | 4 ++- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/BizHawk.Emulation.Common/Base Implementations/NullController.cs b/BizHawk.Emulation.Common/Base Implementations/NullController.cs index ae3d4269bf..7491e14cd9 100644 --- a/BizHawk.Emulation.Common/Base Implementations/NullController.cs +++ b/BizHawk.Emulation.Common/Base Implementations/NullController.cs @@ -7,16 +7,26 @@ /// public class NullController : IController { - public ControllerDefinition Definition { get { return null; } } - public bool this[string button] { get { return false; } } - public bool IsPressed(string button) { return false; } - public float GetFloat(string name) { return 0f; } - public void UnpressButton(string button) { } - public void ForceButton(string button) { } + public ControllerDefinition Definition + { + get { return null; } + } - public void SetSticky(string button, bool sticky) { } - public bool IsSticky(string button) { return false; } - private static readonly NullController nullController = new NullController(); - public static NullController GetNullController() { return nullController; } + public bool this[string button] + { + get { return false; } + } + + public bool IsPressed(string button) + { + return false; + } + + public float GetFloat(string name) + { + return 0f; + } + + public static NullController Instance = new NullController(); } } \ No newline at end of file diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs index f8904c0d84..2d72cca66f 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/PCEngine.cs @@ -141,7 +141,7 @@ namespace BizHawk.Emulation.Cores.PCEngine private void Init(GameInfo game, byte[] rom) { - Controller = NullController.GetNullController(); + Controller = NullController.Instance; Cpu = new HuC6280(MemoryCallbacks); VCE = new VCE(); VDC1 = new VDC(this, Cpu, VCE); diff --git a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs index 75190da025..737ac343e5 100644 --- a/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs +++ b/BizHawk.Emulation.Cores/Consoles/Sega/SMS/SMS.cs @@ -102,7 +102,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem HasYM2413 = true; if (Controller == null) - Controller = NullController.GetNullController(); + { + Controller = NullController.Instance; + } Cpu = new Z80A(); Cpu.RegisterSP = 0xDFF0;