mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Config: Force jit off with game-specific configs.
This commit is contained in:
parent
5c9a38d50c
commit
4404b3a5f2
@ -1491,12 +1491,6 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||
g_Config.bSkipBufferEffects = false;
|
||||
}
|
||||
|
||||
// Override ppsspp.ini JIT value to prevent crashing
|
||||
if (DefaultCpuCore() != (int)CPUCore::JIT && g_Config.iCpuCore == (int)CPUCore::JIT) {
|
||||
jitForcedOff = true;
|
||||
g_Config.iCpuCore = (int)CPUCore::IR_JIT;
|
||||
}
|
||||
|
||||
// Automatically silence secondary instances. Could be an option I guess, but meh.
|
||||
if (PPSSPP_ID > 1) {
|
||||
g_Config.iGlobalVolume = 0;
|
||||
@ -1512,6 +1506,8 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||
g_Config.bVSync = false;
|
||||
#endif
|
||||
|
||||
PostLoadCleanup(false);
|
||||
|
||||
INFO_LOG(LOADER, "Config loaded: '%s'", iniFilename_.c_str());
|
||||
}
|
||||
|
||||
@ -1525,13 +1521,11 @@ bool Config::Save(const char *saveReason) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (jitForcedOff) {
|
||||
// if JIT has been forced off, we don't want to screw up the user's ppsspp.ini
|
||||
g_Config.iCpuCore = (int)CPUCore::JIT;
|
||||
}
|
||||
if (!iniFilename_.empty() && g_Config.bSaveSettings) {
|
||||
saveGameConfig(gameId_, gameIdTitle_);
|
||||
|
||||
PreSaveCleanup(false);
|
||||
|
||||
CleanRecent();
|
||||
IniFile iniFile;
|
||||
if (!iniFile.Load(iniFilename_)) {
|
||||
@ -1611,15 +1605,36 @@ bool Config::Save(const char *saveReason) {
|
||||
}
|
||||
INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str());
|
||||
}
|
||||
|
||||
PostSaveCleanup(false);
|
||||
} else {
|
||||
INFO_LOG(LOADER, "Not saving config");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Config::PostLoadCleanup(bool gameSpecific) {
|
||||
// Override ppsspp.ini JIT value to prevent crashing
|
||||
if (DefaultCpuCore() != (int)CPUCore::JIT && g_Config.iCpuCore == (int)CPUCore::JIT) {
|
||||
jitForcedOff = true;
|
||||
g_Config.iCpuCore = (int)CPUCore::IR_JIT;
|
||||
}
|
||||
}
|
||||
|
||||
void Config::PreSaveCleanup(bool gameSpecific) {
|
||||
if (jitForcedOff) {
|
||||
// if JIT has been forced off, we don't want to screw up the user's ppsspp.ini
|
||||
g_Config.iCpuCore = (int)CPUCore::JIT;
|
||||
}
|
||||
}
|
||||
|
||||
void Config::PostSaveCleanup(bool gameSpecific) {
|
||||
if (jitForcedOff) {
|
||||
// force JIT off again just in case Config::Save() is called without exiting PPSSPP
|
||||
if (g_Config.iCpuCore != (int)CPUCore::INTERPRETER)
|
||||
g_Config.iCpuCore = (int)CPUCore::IR_JIT;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Use for debugging the version check without messing with the server
|
||||
@ -1858,6 +1873,8 @@ bool Config::saveGameConfig(const std::string &pGameId, const std::string &title
|
||||
Section *top = iniFile.GetOrCreateSection("");
|
||||
top->AddComment(StringFromFormat("Game config for %s - %s", pGameId.c_str(), title.c_str()));
|
||||
|
||||
PreSaveCleanup(true);
|
||||
|
||||
IterateSettings(iniFile, [](Section *section, ConfigSetting *setting) {
|
||||
if (setting->perGame_) {
|
||||
setting->Set(section);
|
||||
@ -1881,6 +1898,7 @@ bool Config::saveGameConfig(const std::string &pGameId, const std::string &title
|
||||
KeyMap::SaveToIni(iniFile);
|
||||
iniFile.Save(fullIniFilePath);
|
||||
|
||||
PostSaveCleanup(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1921,6 +1939,7 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title
|
||||
});
|
||||
|
||||
KeyMap::LoadFromIni(iniFile);
|
||||
PostLoadCleanup(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1952,6 +1971,7 @@ void Config::unloadGameConfig() {
|
||||
}
|
||||
|
||||
LoadStandardControllerIni();
|
||||
PostLoadCleanup(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -575,6 +575,10 @@ protected:
|
||||
void LoadStandardControllerIni();
|
||||
void LoadLangValuesMapping();
|
||||
|
||||
void PostLoadCleanup(bool gameSpecific);
|
||||
void PreSaveCleanup(bool gameSpecific);
|
||||
void PostSaveCleanup(bool gameSpecific);
|
||||
|
||||
private:
|
||||
bool reload_ = false;
|
||||
std::string gameId_;
|
||||
|
Loading…
Reference in New Issue
Block a user