NullController - remove a bunch of methods that were originally part of IController but no longer are, and clean up the code a bit

This commit is contained in:
adelikat 2016-12-14 09:16:54 -06:00
parent 40418ad25d
commit aaed8e67d5
3 changed files with 24 additions and 12 deletions

View File

@ -7,16 +7,26 @@
/// <seealso cref="IController" /> /// <seealso cref="IController" />
public class NullController : IController public class NullController : IController
{ {
public ControllerDefinition Definition { get { return null; } } public ControllerDefinition Definition
public bool this[string button] { get { return false; } } {
public bool IsPressed(string button) { return false; } get { return null; }
public float GetFloat(string name) { return 0f; } }
public void UnpressButton(string button) { }
public void ForceButton(string button) { }
public void SetSticky(string button, bool sticky) { } public bool this[string button]
public bool IsSticky(string button) { return false; } {
private static readonly NullController nullController = new NullController(); get { return false; }
public static NullController GetNullController() { return nullController; } }
public bool IsPressed(string button)
{
return false;
}
public float GetFloat(string name)
{
return 0f;
}
public static NullController Instance = new NullController();
} }
} }

View File

@ -141,7 +141,7 @@ namespace BizHawk.Emulation.Cores.PCEngine
private void Init(GameInfo game, byte[] rom) private void Init(GameInfo game, byte[] rom)
{ {
Controller = NullController.GetNullController(); Controller = NullController.Instance;
Cpu = new HuC6280(MemoryCallbacks); Cpu = new HuC6280(MemoryCallbacks);
VCE = new VCE(); VCE = new VCE();
VDC1 = new VDC(this, Cpu, VCE); VDC1 = new VDC(this, Cpu, VCE);

View File

@ -102,7 +102,9 @@ namespace BizHawk.Emulation.Cores.Sega.MasterSystem
HasYM2413 = true; HasYM2413 = true;
if (Controller == null) if (Controller == null)
Controller = NullController.GetNullController(); {
Controller = NullController.Instance;
}
Cpu = new Z80A(); Cpu = new Z80A();
Cpu.RegisterSP = 0xDFF0; Cpu.RegisterSP = 0xDFF0;