Refactor the way a Null ControllerDefinition is created
This commit is contained in:
parent
2b4267d2c9
commit
40be0dd0b3
|
@ -290,7 +290,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var comm = CreateCoreComm();
|
||||
CoreFileProvider.SyncCoreCommInputSignals(comm);
|
||||
Emulator = new NullEmulator(comm, Global.Config.GetCoreSettings<NullEmulator>());
|
||||
Global.ActiveController = new Controller(NullEmulator.NullController);
|
||||
Global.ActiveController = new Controller(NullController.Instance.Definition);
|
||||
Global.AutoFireController = Global.AutofireNullControls;
|
||||
Global.AutofireStickyXORAdapter.SetOnOffPatternFromConfig();
|
||||
try { GlobalWin.Sound = new Sound(Handle); }
|
||||
|
@ -1769,7 +1769,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
Global.ClientControls = controls;
|
||||
Global.AutofireNullControls = new AutofireController(NullEmulator.NullController, Emulator);
|
||||
Global.AutofireNullControls = new AutofireController(NullController.Instance.Definition, Emulator);
|
||||
|
||||
}
|
||||
|
||||
|
@ -3655,7 +3655,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var coreComm = CreateCoreComm();
|
||||
CoreFileProvider.SyncCoreCommInputSignals(coreComm);
|
||||
Emulator = new NullEmulator(coreComm, Global.Config.GetCoreSettings<NullEmulator>());
|
||||
Global.ActiveController = new Controller(NullEmulator.NullController);
|
||||
Global.ActiveController = new Controller(NullController.Instance.Definition);
|
||||
Global.AutoFireController = Global.AutofireNullControls;
|
||||
RewireSound();
|
||||
RebootStatusBarIcon.Visible = false;
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
// TODO
|
||||
//CoreFileProvider.SyncCoreCommInputSignals();
|
||||
|
||||
Global.ActiveController = new Controller(NullEmulator.NullController);
|
||||
Global.ActiveController = new Controller(NullController.Instance.Definition);
|
||||
Global.AutoFireController = Global.AutofireNullControls;
|
||||
Global.AutofireStickyXORAdapter.SetOnOffPatternFromConfig();
|
||||
|
||||
|
@ -199,7 +199,7 @@ namespace BizHawk.Client.MultiHawk
|
|||
}
|
||||
|
||||
Global.ClientControls = controls;
|
||||
Global.AutofireNullControls = new AutofireController(NullEmulator.NullController, Emulator);
|
||||
Global.AutofireNullControls = new AutofireController(NullController.Instance.Definition, Emulator);
|
||||
}
|
||||
|
||||
private void OpenRomMenuItem_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -7,9 +7,14 @@
|
|||
/// <seealso cref="IController" />
|
||||
public class NullController : IController
|
||||
{
|
||||
private static readonly ControllerDefinition _definition = new ControllerDefinition
|
||||
{
|
||||
Name = "Null Controller"
|
||||
};
|
||||
|
||||
public ControllerDefinition Definition
|
||||
{
|
||||
get { return null; }
|
||||
get { return _definition; }
|
||||
}
|
||||
|
||||
public bool this[string button]
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
{
|
||||
get { return NullController; }
|
||||
get { return NullController.Instance.Definition; }
|
||||
}
|
||||
|
||||
public IController Controller { get; set; }
|
||||
|
@ -205,8 +205,6 @@ namespace BizHawk.Emulation.Common
|
|||
|
||||
#endregion
|
||||
|
||||
public static readonly ControllerDefinition NullController = new ControllerDefinition { Name = "Null Controller" };
|
||||
|
||||
private readonly int[] FrameBuffer = new int[256 * 192];
|
||||
private readonly short[] SampleBuffer = new short[735 * 2];
|
||||
private readonly Random Rand = new Random();
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES9X
|
|||
|
||||
public ControllerDefinition ControllerDefinition
|
||||
{
|
||||
get { return NullEmulator.NullController; }
|
||||
get { return NullController.Instance.Definition; }
|
||||
}
|
||||
|
||||
public IController Controller { get; set; }
|
||||
|
|
Loading…
Reference in New Issue