mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Make 'load defaults' work for per-game configs. Move 'stop' code into PSP_Shutdown
This commit is contained in:
parent
664ac1061f
commit
a5fcf9dd5f
@ -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;
|
||||
}
|
||||
|
||||
|
@ -441,6 +441,7 @@ void PSP_Shutdown() {
|
||||
pspIsInited = false;
|
||||
pspIsIniting = false;
|
||||
pspIsQuiting = false;
|
||||
g_Config.unloadGameConfig();
|
||||
}
|
||||
|
||||
void PSP_RunLoopUntil(u64 globalticks) {
|
||||
|
@ -116,6 +116,8 @@ UI::EventReturn GameScreen::OnCreateConfig(UI::EventParams &e)
|
||||
{
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(NULL, gamePath_,0);
|
||||
g_Config.createGameConfig(info->id);
|
||||
g_Config.saveGameConfig(info->id);
|
||||
|
||||
screenManager()->topScreen()->RecreateViews();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
@ -1226,7 +1226,6 @@ void GamePauseScreen::onFinish(DialogResult result) {
|
||||
|
||||
UI::EventReturn GamePauseScreen::OnExitToMenu(UI::EventParams &e) {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
NativeMessageReceived("stop","");
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
@ -1272,6 +1271,7 @@ void GamePauseScreen::CallbackDeleteConfig(bool yes)
|
||||
{
|
||||
GameInfo *info = g_gameInfoCache.GetInfo(NULL, gamePath_, 0);
|
||||
g_Config.deleteGameConfig(info->id);
|
||||
g_Config.unloadGameConfig();
|
||||
screenManager()->RecreateAllViews();
|
||||
}
|
||||
}
|
||||
@ -1281,6 +1281,8 @@ UI::EventReturn GamePauseScreen::OnCreateConfig(UI::EventParams &e)
|
||||
std::string gameId = g_paramSFO.GetValueString("DISC_ID");
|
||||
g_Config.createGameConfig(gameId);
|
||||
g_Config.changeGameSpecific(gameId);
|
||||
g_Config.saveGameConfig(gameId);
|
||||
|
||||
screenManager()->topScreen()->RecreateViews();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
@ -760,11 +760,6 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) {
|
||||
if (msg == "inputDeviceConnected") {
|
||||
KeyMap::NotifyPadConnected(value);
|
||||
}
|
||||
else if (msg == "stop")
|
||||
{
|
||||
g_Config.Save();
|
||||
g_Config.unloadGameConfig();
|
||||
}
|
||||
}
|
||||
|
||||
void NativeUpdate(InputState &input) {
|
||||
|
Loading…
Reference in New Issue
Block a user