diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 75b80b34a6..2f46a8dd51 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -290,7 +290,7 @@ namespace BizHawk.Client.EmuHawk var comm = CreateCoreComm(); CoreFileProvider.SyncCoreCommInputSignals(comm); Emulator = new NullEmulator(comm, Global.Config.GetCoreSettings()); - 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()); - Global.ActiveController = new Controller(NullEmulator.NullController); + Global.ActiveController = new Controller(NullController.Instance.Definition); Global.AutoFireController = Global.AutofireNullControls; RewireSound(); RebootStatusBarIcon.Visible = false; diff --git a/BizHawk.Client.MultiHawk/Mainform.cs b/BizHawk.Client.MultiHawk/Mainform.cs index ac66217f20..bbcacb5b29 100644 --- a/BizHawk.Client.MultiHawk/Mainform.cs +++ b/BizHawk.Client.MultiHawk/Mainform.cs @@ -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) diff --git a/BizHawk.Emulation.Common/Base Implementations/NullController.cs b/BizHawk.Emulation.Common/Base Implementations/NullController.cs index 7491e14cd9..8ea8738bc4 100644 --- a/BizHawk.Emulation.Common/Base Implementations/NullController.cs +++ b/BizHawk.Emulation.Common/Base Implementations/NullController.cs @@ -7,9 +7,14 @@ /// 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] diff --git a/BizHawk.Emulation.Common/Base Implementations/NullEmulator.cs b/BizHawk.Emulation.Common/Base Implementations/NullEmulator.cs index 36c2d3bc82..15b7257425 100644 --- a/BizHawk.Emulation.Common/Base Implementations/NullEmulator.cs +++ b/BizHawk.Emulation.Common/Base Implementations/NullEmulator.cs @@ -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(); diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs index 5b8dcaf782..15fbd3e03a 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/SNES9X/Snes9x.cs @@ -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; }