diff options
| author | Filoppi <filippotarpini@hotmail.it> | 2021-11-30 00:33:11 +0200 |
|---|---|---|
| committer | Filoppi <filippotarpini@hotmail.it> | 2021-12-05 23:37:58 +0200 |
| commit | 689545a7959ce3e4cd1a6b45686e98cd9c027917 (patch) | |
| tree | b2c07c7c6c5adaef335c5c83f5032e903c5091e3 /Source/Core/InputCommon/InputConfig.cpp | |
| parent | 57d251c2f0d5b294ac25c0d0703ea193fc8830aa (diff) | |
InputCommon: fix InputConfig::LoadConfig() not always replacing emu controllers values
If InputConfig::LoadConfig() was called once with a non empty/customized config,
then called again after manually deleting the config (dolphin calls LoadConfig() every time it opens the mapping widget),
the second load would fail to clear the values on any non first EmulatedController and would instead keep the
previous config values despite it being deleted (while it would instead correctly default the first EmulatedController).
This is not a big bug though the code is better now.
Diffstat (limited to 'Source/Core/InputCommon/InputConfig.cpp')
| -rw-r--r-- | Source/Core/InputCommon/InputConfig.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index bace091ca5..ad044ea79e 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -150,22 +150,18 @@ bool InputConfig::LoadConfig(InputClass type) } else { - // Only load the default profile for the first controller, - // otherwise they would all share the same mappings and default device + // Only load the default profile for the first controller and clear the others, + // otherwise they would all share the same mappings on the same (default) device if (m_controllers.size() > 0) { m_controllers[0]->LoadDefaults(g_controller_interface); m_controllers[0]->UpdateReferences(g_controller_interface); } - // Set the "default" default device for all other controllers, or they would end up - // 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) { - for (size_t i = 1; i < m_controllers.size(); ++i) - { - m_controllers[i]->SetDefaultDevice(default_device_string); - } + // 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]->UpdateReferences(g_controller_interface); } return false; } |
