Merge pull request #10253 from Filoppi/fix_input_config_loading

Fix InputConfig::LoadConfig() not always replacing emu controllers values
This commit is contained in:
JosJuice 2021-12-09 22:21:02 +01:00 committed by GitHub
commit 2f4ecde5cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 10 deletions

View File

@ -150,22 +150,18 @@ bool InputConfig::LoadConfig(InputClass type)
} }
else else
{ {
// Only load the default profile for the first controller, // Only load the default profile for the first controller and clear the others,
// otherwise they would all share the same mappings and default device // otherwise they would all share the same mappings on the same (default) device
if (m_controllers.size() > 0) if (m_controllers.size() > 0)
{ {
m_controllers[0]->LoadDefaults(g_controller_interface); m_controllers[0]->LoadDefaults(g_controller_interface);
m_controllers[0]->UpdateReferences(g_controller_interface); m_controllers[0]->UpdateReferences(g_controller_interface);
} }
// Set the "default" default device for all other controllers, or they would end up for (size_t i = 1; i < m_controllers.size(); ++i)
// having no default device (which is fine, but might be confusing for some users)
const std::string& default_device_string = g_controller_interface.GetDefaultDeviceString();
if (!default_device_string.empty())
{ {
for (size_t i = 1; i < m_controllers.size(); ++i) // Calling the base version just clears all settings without overwriting them with a default
{ m_controllers[i]->EmulatedController::LoadDefaults(g_controller_interface);
m_controllers[i]->SetDefaultDevice(default_device_string); m_controllers[i]->UpdateReferences(g_controller_interface);
}
} }
return false; return false;
} }