Merge pull request #12575 from t895/inconsistent-settings-application
frontend_common: config: Only write setting related to opened config file
This commit is contained in:
		@@ -167,13 +167,14 @@ class GamesViewModel : ViewModel() {
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    fun onCloseGameFoldersFragment() =
 | 
			
		||||
    fun onCloseGameFoldersFragment() {
 | 
			
		||||
        NativeConfig.saveGlobalConfig()
 | 
			
		||||
        viewModelScope.launch {
 | 
			
		||||
            withContext(Dispatchers.IO) {
 | 
			
		||||
                NativeConfig.saveGlobalConfig()
 | 
			
		||||
                getGameDirs(true)
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun getGameDirs(reloadList: Boolean = false) {
 | 
			
		||||
        val gameDirs = NativeConfig.getGameDirs()
 | 
			
		||||
 
 | 
			
		||||
@@ -14,12 +14,6 @@ AndroidConfig::AndroidConfig(const std::string& config_name, ConfigType config_t
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AndroidConfig::~AndroidConfig() {
 | 
			
		||||
    if (global) {
 | 
			
		||||
        AndroidConfig::SaveAllValues();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AndroidConfig::ReloadAllValues() {
 | 
			
		||||
    Reload();
 | 
			
		||||
    ReadAndroidValues();
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,6 @@ class AndroidConfig final : public Config {
 | 
			
		||||
public:
 | 
			
		||||
    explicit AndroidConfig(const std::string& config_name = "config",
 | 
			
		||||
                           ConfigType config_type = ConfigType::GlobalConfig);
 | 
			
		||||
    ~AndroidConfig() override;
 | 
			
		||||
 | 
			
		||||
    void ReloadAllValues() override;
 | 
			
		||||
    void SaveAllValues() override;
 | 
			
		||||
 
 | 
			
		||||
@@ -883,9 +883,10 @@ void Config::WriteSettingGeneric(const Settings::BasicSetting* const setting) {
 | 
			
		||||
            WriteBooleanSetting(std::string(key).append("\\use_global"), setting->UsingGlobal());
 | 
			
		||||
        }
 | 
			
		||||
        if (global || !setting->UsingGlobal()) {
 | 
			
		||||
            auto value = global ? setting->ToStringGlobal() : setting->ToString();
 | 
			
		||||
            WriteBooleanSetting(std::string(key).append("\\default"),
 | 
			
		||||
                                setting->ToString() == setting->DefaultToString());
 | 
			
		||||
            WriteStringSetting(key, setting->ToString());
 | 
			
		||||
                                value == setting->DefaultToString());
 | 
			
		||||
            WriteStringSetting(key, value);
 | 
			
		||||
        }
 | 
			
		||||
    } else if (global) {
 | 
			
		||||
        WriteBooleanSetting(std::string(key).append("\\default"),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user