From ba96b7b31c65fdda67be16c09734f18232edc5aa Mon Sep 17 00:00:00 2001 From: Peter Tissen Date: Sat, 14 Feb 2015 19:21:26 +0100 Subject: [PATCH] Just save the current config every time the config file is switched also undo #7473 because it would now introduce redundant writes. --- Core/Config.cpp | 1 + Core/System.cpp | 1 - UI/GameInfoCache.cpp | 1 - UI/GameScreen.cpp | 1 - UI/GameSettingsScreen.cpp | 1 - UI/PauseScreen.cpp | 2 +- 6 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index cc410dc67f..fb7b743df6 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -1104,6 +1104,7 @@ bool Config::hasGameConfig(const std::string &pGameId) void Config::changeGameSpecific(const std::string &pGameId) { + Save(); gameId_ = pGameId; bGameSpecific = !pGameId.empty(); } diff --git a/Core/System.cpp b/Core/System.cpp index 8fb985b30f..7f192f4573 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -230,7 +230,6 @@ void CPU_Init() { if (coreParameter.updateRecent) { g_Config.AddRecent(filename); - g_Config.Save(); } coreState = coreParameter.startPaused ? CORE_STEPPING : CORE_RUNNING; diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index e8ff6efe24..e825ae6610 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -59,7 +59,6 @@ bool GameInfo::DeleteGame() { auto i = std::find(g_Config.recentIsos.begin(), g_Config.recentIsos.end(), fileToRemove); if (i != g_Config.recentIsos.end()) { g_Config.recentIsos.erase(i); - g_Config.Save(); } return true; } diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 562e1f16ac..a4ac8931d7 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -301,7 +301,6 @@ UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) { if (!strcmp((*it).c_str(), gamePath_.c_str())) { #endif g_Config.recentIsos.erase(it); - g_Config.Save(); screenManager()->switchScreen(new MainScreen()); return UI::EVENT_DONE; } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 93f96afba2..f402af511d 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -76,7 +76,6 @@ void GameSettingsScreen::CreateViews() { if (bEditThenRestore) { - g_Config.changeGameSpecific(gameID_); g_Config.loadGameConfig(gameID_); } diff --git a/UI/PauseScreen.cpp b/UI/PauseScreen.cpp index e6c22b6286..48100ec78a 100644 --- a/UI/PauseScreen.cpp +++ b/UI/PauseScreen.cpp @@ -395,8 +395,8 @@ void GamePauseScreen::CallbackDeleteConfig(bool yes) { if (yes) { GameInfo *info = g_gameInfoCache.GetInfo(NULL, gamePath_, 0); - g_Config.deleteGameConfig(info->id); g_Config.unloadGameConfig(); + g_Config.deleteGameConfig(info->id); screenManager()->RecreateAllViews(); } }