mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 06:25:37 +00:00
System: Preparations for per-game controller settings
This commit is contained in:
parent
54c2447ff3
commit
c3da236f92
|
@ -862,8 +862,13 @@ bool System::UpdateGameSettingsLayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string input_profile_name;
|
std::string input_profile_name;
|
||||||
|
bool use_game_settings_for_controller = false;
|
||||||
if (new_interface)
|
if (new_interface)
|
||||||
|
{
|
||||||
|
new_interface->GetBoolValue("ControllerPorts", "UseGameSettingsForController", &use_game_settings_for_controller);
|
||||||
|
if (!use_game_settings_for_controller)
|
||||||
new_interface->GetStringValue("ControllerPorts", "InputProfileName", &input_profile_name);
|
new_interface->GetStringValue("ControllerPorts", "InputProfileName", &input_profile_name);
|
||||||
|
}
|
||||||
|
|
||||||
if (!s_game_settings_interface && !new_interface && s_input_profile_name == input_profile_name)
|
if (!s_game_settings_interface && !new_interface && s_input_profile_name == input_profile_name)
|
||||||
return false;
|
return false;
|
||||||
|
@ -872,6 +877,8 @@ bool System::UpdateGameSettingsLayer()
|
||||||
s_game_settings_interface = std::move(new_interface);
|
s_game_settings_interface = std::move(new_interface);
|
||||||
|
|
||||||
std::unique_ptr<INISettingsInterface> input_interface;
|
std::unique_ptr<INISettingsInterface> input_interface;
|
||||||
|
if (!use_game_settings_for_controller)
|
||||||
|
{
|
||||||
if (!input_profile_name.empty())
|
if (!input_profile_name.empty())
|
||||||
{
|
{
|
||||||
const std::string filename(GetInputProfilePath(input_profile_name));
|
const std::string filename(GetInputProfilePath(input_profile_name));
|
||||||
|
@ -894,9 +901,15 @@ bool System::UpdateGameSettingsLayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
Host::Internal::SetInputSettingsLayer(input_interface.get());
|
Host::Internal::SetInputSettingsLayer(input_interface.get());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// using game settings for bindings too
|
||||||
|
Host::Internal::SetInputSettingsLayer(s_game_settings_interface.get());
|
||||||
|
}
|
||||||
|
|
||||||
s_input_settings_interface = std::move(input_interface);
|
s_input_settings_interface = std::move(input_interface);
|
||||||
s_input_profile_name = std::move(input_profile_name);
|
s_input_profile_name = std::move(input_profile_name);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue