frontend_common: config: Only write setting related to opened config file

If we tried to write a switchable setting to config that was not using global in the global config instance, we could write the per-game setting accidentally. This ensures that we always use the global setting for global config and the currently applied setting for custom config.
This commit is contained in:
t895 2024-01-03 22:16:54 -05:00
parent 1c278974a8
commit fa04dea7c4

View File

@ -894,9 +894,10 @@ void Config::WriteSettingGeneric(const Settings::BasicSetting* const setting) {
WriteBooleanSetting(std::string(key).append("\\use_global"), setting->UsingGlobal()); WriteBooleanSetting(std::string(key).append("\\use_global"), setting->UsingGlobal());
} }
if (global || !setting->UsingGlobal()) { if (global || !setting->UsingGlobal()) {
auto value = global ? setting->ToStringGlobal() : setting->ToString();
WriteBooleanSetting(std::string(key).append("\\default"), WriteBooleanSetting(std::string(key).append("\\default"),
setting->ToString() == setting->DefaultToString()); value == setting->DefaultToString());
WriteStringSetting(key, setting->ToString()); WriteStringSetting(key, value);
} }
} else if (global) { } else if (global) {
WriteBooleanSetting(std::string(key).append("\\default"), WriteBooleanSetting(std::string(key).append("\\default"),