Make 'load defaults' work for per-game configs. Move 'stop' code into PSP_Shutdown

This commit is contained in:
Peter Tissen 2014-12-19 14:52:44 +01:00
parent 664ac1061f
commit a5fcf9dd5f
5 changed files with 18 additions and 17 deletions

View file

@ -1060,10 +1060,18 @@ const std::string Config::FindConfigFile(const std::string &baseFilename) {
}
void Config::RestoreDefaults() {
if(File::Exists(iniFilename_))
File::Delete(iniFilename_);
recentIsos.clear();
currentDirectory = "";
if (bGameSpecific)
{
deleteGameConfig(gameId);
createGameConfig(gameId);
}
else
{
if (File::Exists(iniFilename_))
File::Delete(iniFilename_);
recentIsos.clear();
currentDirectory = "";
}
Load();
}
@ -1092,7 +1100,6 @@ bool Config::createGameConfig(const std::string &pGameId)
}
File::CreateEmptyFile(fullIniFilePath);
g_Config.saveGameConfig(pGameId);
return true;
}
@ -1101,11 +1108,6 @@ bool Config::deleteGameConfig(const std::string& pGameId)
{
std::string fullIniFilePath = getGameConfigFile(pGameId);
if (pGameId == gameId)
{
unloadGameConfig();
Load(iniFilename_.c_str(),controllerIniFilename_.c_str());
}
File::Delete(fullIniFilePath);
return true;
}
@ -1150,7 +1152,6 @@ bool Config::loadGameConfig(const std::string &pGameId)
if (!hasGameConfig(pGameId))
{
INFO_LOG(LOADER, "Failed to read %s. No game-specific settings found, using global defaults.", iniFileNameFull.c_str());
// NO game specific config file found
return false;
}