From 5617950f504af1b3790153b3af02698bd4fbe0b9 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 15 Mar 2020 17:13:56 -0500 Subject: [PATCH] InputManager - pass some dependencies into SyncControls --- BizHawk.Client.Common/inputAdapters/InputManager.cs | 8 ++++---- BizHawk.Client.EmuHawk/MainForm.Events.cs | 4 ++-- BizHawk.Client.EmuHawk/MainForm.cs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BizHawk.Client.Common/inputAdapters/InputManager.cs b/BizHawk.Client.Common/inputAdapters/InputManager.cs index a11cb88420..cf7a4aff20 100644 --- a/BizHawk.Client.Common/inputAdapters/InputManager.cs +++ b/BizHawk.Client.Common/inputAdapters/InputManager.cs @@ -35,12 +35,12 @@ namespace BizHawk.Client.Common } } - public static void SyncControls() + public static void SyncControls(IEmulator emulator, Config config) { - var def = Global.Emulator.ControllerDefinition; + var def = emulator.ControllerDefinition; - Global.ActiveController = BindToDefinition(def, Global.Config.AllTrollers, Global.Config.AllTrollersAnalog); - Global.AutoFireController = BindToDefinitionAF(def, Global.Emulator, Global.Config.AllTrollersAutoFire); + Global.ActiveController = BindToDefinition(def, config.AllTrollers, config.AllTrollersAnalog); + Global.AutoFireController = BindToDefinitionAF(def, emulator, config.AllTrollersAutoFire); // 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? diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index e19acc471f..2845aba85a 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -941,7 +941,7 @@ namespace BizHawk.Client.EmuHawk { AddOnScreenMessage("Controller settings saved"); InitControls(); - InputManager.SyncControls(); + InputManager.SyncControls(Emulator, Config); } else { @@ -956,7 +956,7 @@ namespace BizHawk.Client.EmuHawk { AddOnScreenMessage("Hotkey settings saved"); InitControls(); - InputManager.SyncControls(); + InputManager.SyncControls(Emulator, Config); } else { diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 47969c2ba9..8243e03341 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -3696,7 +3696,7 @@ namespace BizHawk.Client.EmuHawk string openAdvancedArgs = $"*{OpenAdvancedSerializer.Serialize(ioa)}"; Emulator = loader.LoadedEmulator; Global.Game = loader.Game; - InputManager.SyncControls(); + InputManager.SyncControls(Emulator, Config); if (oaOpenrom != null && Path.GetExtension(oaOpenrom.Path.Replace("|", "")).ToLowerInvariant() == ".xml" && !(Emulator is LibsnesCore)) {