From 2254098b9c0ee947b72148796e08c3467417008e Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 1 May 2020 15:02:37 -0500 Subject: [PATCH] Sync controls when loading a config file, fixes #1965 --- BizHawk.Client.EmuHawk/MainForm.Events.cs | 10 ++-------- BizHawk.Client.EmuHawk/MainForm.cs | 9 +++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/BizHawk.Client.EmuHawk/MainForm.Events.cs b/BizHawk.Client.EmuHawk/MainForm.Events.cs index e7bf6c6740..b558c4eb02 100644 --- a/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -1376,10 +1376,7 @@ namespace BizHawk.Client.EmuHawk private void LoadConfigMenuItem_Click(object sender, EventArgs e) { - Config = ConfigService.Load(Config.DefaultIniPath); - Config.ResolveDefaults(); - InitControls(); // rebind hotkeys - AddOnScreenMessage($"Config file loaded: {Config.DefaultIniPath}"); + LoadConfigFile(Config.DefaultIniPath); } private void LoadConfigFromMenuItem_Click(object sender, EventArgs e) @@ -1394,10 +1391,7 @@ namespace BizHawk.Client.EmuHawk if (ofd.ShowHawkDialog().IsOk()) { - Config = ConfigService.Load(ofd.FileName); - Config.ResolveDefaults(); - InitControls(); // rebind hotkeys - AddOnScreenMessage($"Config file loaded: {ofd.FileName}"); + LoadConfigFile(ofd.FileName); } } diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index 1dbf18fdfe..65be34780c 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -2798,6 +2798,15 @@ namespace BizHawk.Client.EmuHawk } } + private void LoadConfigFile(string iniPath) + { + Config = ConfigService.Load(iniPath); + Config.ResolveDefaults(); + InitControls(); // rebind hotkeys + InputManager.SyncControls(Emulator, Config); + AddOnScreenMessage($"Config file loaded: {iniPath}"); + } + #endregion #region Frame Loop