diff --git a/src/BizHawk.Client.Common/AutofireController.cs b/src/BizHawk.Client.Common/AutofireController.cs index c0aa363792..9ae6a09ec5 100644 --- a/src/BizHawk.Client.Common/AutofireController.cs +++ b/src/BizHawk.Client.Common/AutofireController.cs @@ -9,11 +9,10 @@ namespace BizHawk.Client.Common { public class AutofireController : IController { - public AutofireController(ControllerDefinition definition, IEmulator emulator, int on, int off) + public AutofireController(IEmulator emulator, int on, int off) { On = on < 1 ? 0 : on; Off = off < 1 ? 0 : off; - Definition = definition; _emulator = emulator; } @@ -28,7 +27,7 @@ namespace BizHawk.Client.Common public int On { get; set; } public int Off { get; set; } - public ControllerDefinition Definition { get; } + public ControllerDefinition Definition => _emulator.ControllerDefinition; public bool IsPressed(string button) { diff --git a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs index 2cee3d9a1d..f947d6bbc2 100644 --- a/src/BizHawk.Client.Common/inputAdapters/InputManager.cs +++ b/src/BizHawk.Client.Common/inputAdapters/InputManager.cs @@ -84,7 +84,7 @@ namespace BizHawk.Client.Common var def = emulator.ControllerDefinition; ActiveController = BindToDefinition(def, config.AllTrollers, config.AllTrollersAnalog); - AutoFireController = BindToDefinitionAF(def, emulator, config.AllTrollersAutoFire, config.AutofireOn, config.AutofireOff); + AutoFireController = BindToDefinitionAF(emulator, config.AllTrollersAutoFire, config.AutofireOn, config.AutofireOff); // allow propagating controls that are in the current controller definition but not in the prebaked one // these two lines shouldn't be required anymore under the new system? @@ -122,16 +122,15 @@ namespace BizHawk.Client.Common } private static AutofireController BindToDefinitionAF( - ControllerDefinition def, IEmulator emulator, IDictionary> allBinds, int on, int off) { - var ret = new AutofireController(def, emulator, on, off); - if (allBinds.TryGetValue(def.Name, out var binds)) + var ret = new AutofireController(emulator, on, off); + if (allBinds.TryGetValue(emulator.ControllerDefinition.Name, out var binds)) { - foreach (var btn in def.BoolButtons) + foreach (var btn in emulator.ControllerDefinition.BoolButtons) { if (binds.TryGetValue(btn, out var bind)) { diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index 106bd92715..eeca5d626e 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -1948,7 +1948,6 @@ namespace BizHawk.Client.EmuHawk Global.InputManager.ClientControls = controls; _autofireNullControls = new AutofireController( - NullController.Instance.Definition, Emulator, Config.AutofireOn, Config.AutofireOff);