Sync controls when loading a config file, fixes #1965

This commit is contained in:
adelikat 2020-05-01 15:02:37 -05:00
parent e1f6c7afb1
commit 2254098b9c
2 changed files with 11 additions and 8 deletions

View File

@ -1376,10 +1376,7 @@ namespace BizHawk.Client.EmuHawk
private void LoadConfigMenuItem_Click(object sender, EventArgs e)
{
Config = ConfigService.Load<Config>(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<Config>(ofd.FileName);
Config.ResolveDefaults();
InitControls(); // rebind hotkeys
AddOnScreenMessage($"Config file loaded: {ofd.FileName}");
LoadConfigFile(ofd.FileName);
}
}

View File

@ -2798,6 +2798,15 @@ namespace BizHawk.Client.EmuHawk
}
}
private void LoadConfigFile(string iniPath)
{
Config = ConfigService.Load<Config>(iniPath);
Config.ResolveDefaults();
InitControls(); // rebind hotkeys
InputManager.SyncControls(Emulator, Config);
AddOnScreenMessage($"Config file loaded: {iniPath}");
}
#endregion
#region Frame Loop