FullscreenUI: Fix saving of list options (e.g. controller settings)
This commit is contained in:
parent
0af2c01a18
commit
f99d5ff39d
|
@ -1939,7 +1939,8 @@ void FullscreenUI::DrawIntListSetting(SettingsInterface* bsi, const char* title,
|
||||||
(i == static_cast<size_t>(index)));
|
(i == static_cast<size_t>(index)));
|
||||||
}
|
}
|
||||||
OpenChoiceDialog(title, false, std::move(cd_options),
|
OpenChoiceDialog(title, false, std::move(cd_options),
|
||||||
[game_settings, section, key, option_offset](s32 index, const std::string& title, bool checked) {
|
[game_settings, section = TinyString(section), key = TinyString(key),
|
||||||
|
option_offset](s32 index, const std::string& title, bool checked) {
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
|
@ -2556,30 +2557,30 @@ void FullscreenUI::DrawEnumSetting(SettingsInterface* bsi, const char* title, co
|
||||||
for (u32 i = 0; i < static_cast<u32>(option_count); i++)
|
for (u32 i = 0; i < static_cast<u32>(option_count); i++)
|
||||||
cd_options.emplace_back(to_display_string_function(static_cast<DataType>(i)),
|
cd_options.emplace_back(to_display_string_function(static_cast<DataType>(i)),
|
||||||
(typed_value.has_value() && i == static_cast<u32>(typed_value.value())));
|
(typed_value.has_value() && i == static_cast<u32>(typed_value.value())));
|
||||||
OpenChoiceDialog(
|
OpenChoiceDialog(title, false, std::move(cd_options),
|
||||||
title, false, std::move(cd_options),
|
[section = TinyString(section), key = TinyString(key), to_string_function,
|
||||||
[section, key, to_string_function, game_settings](s32 index, const std::string& title, bool checked) {
|
game_settings](s32 index, const std::string& title, bool checked) {
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
SettingsInterface* bsi = GetEditingSettingsInterface(game_settings);
|
SettingsInterface* bsi = GetEditingSettingsInterface(game_settings);
|
||||||
if (game_settings)
|
if (game_settings)
|
||||||
{
|
{
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
bsi->DeleteValue(section, key);
|
bsi->DeleteValue(section, key);
|
||||||
else
|
else
|
||||||
bsi->SetStringValue(section, key, to_string_function(static_cast<DataType>(index - 1)));
|
bsi->SetStringValue(section, key, to_string_function(static_cast<DataType>(index - 1)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bsi->SetStringValue(section, key, to_string_function(static_cast<DataType>(index)));
|
bsi->SetStringValue(section, key, to_string_function(static_cast<DataType>(index)));
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSettingsChanged(bsi);
|
SetSettingsChanged(bsi);
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseChoiceDialog();
|
CloseChoiceDialog();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void FullscreenUI::DrawFloatListSetting(SettingsInterface* bsi, const char* title, const char* summary,
|
void FullscreenUI::DrawFloatListSetting(SettingsInterface* bsi, const char* title, const char* summary,
|
||||||
|
@ -2632,7 +2633,8 @@ void FullscreenUI::DrawFloatListSetting(SettingsInterface* bsi, const char* titl
|
||||||
(value.has_value() && i == static_cast<size_t>(index)));
|
(value.has_value() && i == static_cast<size_t>(index)));
|
||||||
}
|
}
|
||||||
OpenChoiceDialog(title, false, std::move(cd_options),
|
OpenChoiceDialog(title, false, std::move(cd_options),
|
||||||
[game_settings, section, key, option_values](s32 index, const std::string& title, bool checked) {
|
[game_settings, section = TinyString(section), key = TinyString(key),
|
||||||
|
option_values](s32 index, const std::string& title, bool checked) {
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
{
|
{
|
||||||
auto lock = Host::GetSettingsLock();
|
auto lock = Host::GetSettingsLock();
|
||||||
|
@ -2665,8 +2667,8 @@ void FullscreenUI::DrawFolderSetting(SettingsInterface* bsi, const char* title,
|
||||||
if (MenuButton(title, runtime_var.c_str()))
|
if (MenuButton(title, runtime_var.c_str()))
|
||||||
{
|
{
|
||||||
OpenFileSelector(title, true,
|
OpenFileSelector(title, true,
|
||||||
[game_settings = IsEditingGameSettings(bsi), section = std::string(section),
|
[game_settings = IsEditingGameSettings(bsi), section = TinyString(section),
|
||||||
key = std::string(key)](const std::string& dir) {
|
key = TinyString(key)](const std::string& dir) {
|
||||||
if (dir.empty())
|
if (dir.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue