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" />
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();
}
}

View File

@ -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);

View File

@ -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;