mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Use map for settings
This commit is contained in:
parent
a666635fa2
commit
6c9eb4764c
@ -1214,6 +1214,12 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
|
||||
}
|
||||
}
|
||||
|
||||
auto postShaderSetting = iniFile.GetOrCreateSection("PostShaderSetting")->ToMap();
|
||||
mPostShaderSetting.clear();
|
||||
for (auto it = postShaderSetting.begin(), end = postShaderSetting.end(); it != end; ++it) {
|
||||
mPostShaderSetting.insert(std::pair<std::string, float>(it->first, std::stof(it->second)));
|
||||
}
|
||||
|
||||
// This caps the exponent 4 (so 16x.)
|
||||
if (iAnisotropyLevel > 4) {
|
||||
iAnisotropyLevel = 4;
|
||||
@ -1325,6 +1331,14 @@ void Config::Save(const char *saveReason) {
|
||||
pinnedPaths->Set(keyName, vPinnedPaths[i]);
|
||||
}
|
||||
|
||||
if (!bGameSpecific) {
|
||||
IniFile::Section *postShaderSetting = iniFile.GetOrCreateSection("PostShaderSetting");
|
||||
postShaderSetting->Clear();
|
||||
for (auto it = mPostShaderSetting.begin(), end = mPostShaderSetting.end(); it != end; ++it) {
|
||||
postShaderSetting->Set(it->first.c_str(), it->second);
|
||||
}
|
||||
}
|
||||
|
||||
IniFile::Section *control = iniFile.GetOrCreateSection("Control");
|
||||
control->Delete("DPadRadius");
|
||||
|
||||
@ -1575,6 +1589,12 @@ bool Config::saveGameConfig(const std::string &pGameId, const std::string &title
|
||||
}
|
||||
});
|
||||
|
||||
IniFile::Section *postShaderSetting = iniFile.GetOrCreateSection("PostShaderSetting");
|
||||
postShaderSetting->Clear();
|
||||
for (auto it = mPostShaderSetting.begin(), end = mPostShaderSetting.end(); it != end; ++it) {
|
||||
postShaderSetting->Set(it->first.c_str(), it->second);
|
||||
}
|
||||
|
||||
KeyMap::SaveToIni(iniFile);
|
||||
iniFile.Save(fullIniFilePath);
|
||||
|
||||
@ -1593,6 +1613,12 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title
|
||||
IniFile iniFile;
|
||||
iniFile.Load(iniFileNameFull);
|
||||
|
||||
auto postShaderSetting = iniFile.GetOrCreateSection("PostShaderSetting")->ToMap();
|
||||
mPostShaderSetting.clear();
|
||||
for (auto it = postShaderSetting.begin(), end = postShaderSetting.end(); it != end; ++it) {
|
||||
mPostShaderSetting.insert(std::pair<std::string, float>(it->first, std::stof(it->second)));
|
||||
}
|
||||
|
||||
IterateSettings(iniFile, [](IniFile::Section *section, ConfigSetting *setting) {
|
||||
if (setting->perGame_) {
|
||||
setting->Get(section);
|
||||
|
@ -225,6 +225,7 @@ public:
|
||||
float fPostShaderMaxSettingValue4;
|
||||
float fPostShaderMinSettingValue4;
|
||||
float fPostShaderSettingStep4;
|
||||
std::map<std::string, float> mPostShaderSetting;
|
||||
bool bGfxDebugOutput;
|
||||
bool bGfxDebugSplitSubmit;
|
||||
int iInflightFrames;
|
||||
|
@ -290,15 +290,34 @@ void GameSettingsScreen::CreateViews() {
|
||||
return g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
||||
});
|
||||
|
||||
if (g_Config.sPostShaderSettingName1 != "")
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue1, g_Config.fPostShaderMinSettingValue1, g_Config.fPostShaderMaxSettingValue1, g_Config.sPostShaderSettingName1, g_Config.fPostShaderSettingStep1, screenManager()));
|
||||
if (g_Config.sPostShaderSettingName2 != "")
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue2, g_Config.fPostShaderMinSettingValue2, g_Config.fPostShaderMaxSettingValue2, g_Config.sPostShaderSettingName2, g_Config.fPostShaderSettingStep2, screenManager()));
|
||||
if (g_Config.sPostShaderSettingName3 != "")
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue3, g_Config.fPostShaderMinSettingValue3, g_Config.fPostShaderMaxSettingValue3, g_Config.sPostShaderSettingName3, g_Config.fPostShaderSettingStep3, screenManager()));
|
||||
if (g_Config.sPostShaderSettingName4 != "")
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue4, g_Config.fPostShaderMinSettingValue4, g_Config.fPostShaderMaxSettingValue4, g_Config.sPostShaderSettingName4, g_Config.fPostShaderSettingStep4, screenManager()));
|
||||
|
||||
if (g_Config.sPostShaderSettingName1 != "") {
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue1, g_Config.fPostShaderMinSettingValue1, g_Config.fPostShaderMaxSettingValue1,
|
||||
g_Config.sPostShaderSettingName1, g_Config.fPostShaderSettingStep1, screenManager()))->OnChange.Add([=](EventParams &e) {
|
||||
g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue1"] = g_Config.fPostShaderSettingValue1;
|
||||
return UI::EVENT_CONTINUE;
|
||||
});;
|
||||
}
|
||||
if (g_Config.sPostShaderSettingName2 != "") {
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue2, g_Config.fPostShaderMinSettingValue2, g_Config.fPostShaderMaxSettingValue2,
|
||||
g_Config.sPostShaderSettingName2, g_Config.fPostShaderSettingStep2, screenManager()))->OnChange.Add([=](EventParams &e) {
|
||||
g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue2"] = g_Config.fPostShaderSettingValue2;
|
||||
return UI::EVENT_CONTINUE;
|
||||
});;
|
||||
}
|
||||
if (g_Config.sPostShaderSettingName3 != "") {
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue3, g_Config.fPostShaderMinSettingValue3, g_Config.fPostShaderMaxSettingValue3,
|
||||
g_Config.sPostShaderSettingName3, g_Config.fPostShaderSettingStep3, screenManager()))->OnChange.Add([=](EventParams &e) {
|
||||
g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue3"] = g_Config.fPostShaderSettingValue3;
|
||||
return UI::EVENT_CONTINUE;
|
||||
});;
|
||||
}
|
||||
if (g_Config.sPostShaderSettingName4 != "") {
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&g_Config.fPostShaderSettingValue4, g_Config.fPostShaderMinSettingValue4, g_Config.fPostShaderMaxSettingValue4,
|
||||
g_Config.sPostShaderSettingName4, g_Config.fPostShaderSettingStep4, screenManager()))->OnChange.Add([=](EventParams &e) {
|
||||
g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue4"] = g_Config.fPostShaderSettingValue4;
|
||||
return UI::EVENT_CONTINUE;
|
||||
});;
|
||||
}
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
graphicsSettings->Add(new CheckBox(&g_Config.bFullScreen, gr->T("FullScreen", "Full Screen")))->OnClick.Handle(this, &GameSettingsScreen::OnFullscreenChange);
|
||||
if (System_GetPropertyInt(SYSPROP_DISPLAY_COUNT) > 1) {
|
||||
|
@ -318,26 +318,35 @@ void PostProcScreen::OnCompleted(DialogResult result) {
|
||||
return;
|
||||
g_Config.sPostShaderName = shaders_[listView_->GetSelected()].section;
|
||||
|
||||
if (g_Config.mPostShaderSetting.find(g_Config.sPostShaderName + "SettingValue1") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(g_Config.sPostShaderName + "SettingValue1", shaders_[listView_->GetSelected()].settingValue1));
|
||||
if (g_Config.mPostShaderSetting.find(g_Config.sPostShaderName + "SettingValue2") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(g_Config.sPostShaderName + "SettingValue2", shaders_[listView_->GetSelected()].settingValue2));
|
||||
if (g_Config.mPostShaderSetting.find(g_Config.sPostShaderName + "SettingValue3") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(g_Config.sPostShaderName + "SettingValue3", shaders_[listView_->GetSelected()].settingValue3));
|
||||
if (g_Config.mPostShaderSetting.find(g_Config.sPostShaderName + "SettingValue4") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(g_Config.sPostShaderName + "SettingValue4", shaders_[listView_->GetSelected()].settingValue4));
|
||||
|
||||
g_Config.sPostShaderSettingName1 = shaders_[listView_->GetSelected()].settingName1;
|
||||
g_Config.fPostShaderSettingValue1 = shaders_[listView_->GetSelected()].settingValue1;
|
||||
g_Config.fPostShaderSettingValue1 = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue1"];
|
||||
g_Config.fPostShaderMaxSettingValue1 = shaders_[listView_->GetSelected()].maxSettingValue1;
|
||||
g_Config.fPostShaderMinSettingValue1 = shaders_[listView_->GetSelected()].minSettingValue1;
|
||||
g_Config.fPostShaderSettingStep1 = shaders_[listView_->GetSelected()].settingStep1;
|
||||
|
||||
g_Config.sPostShaderSettingName2 = shaders_[listView_->GetSelected()].settingName2;
|
||||
g_Config.fPostShaderSettingValue2 = shaders_[listView_->GetSelected()].settingValue2;
|
||||
g_Config.fPostShaderSettingValue2 = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue2"];
|
||||
g_Config.fPostShaderMaxSettingValue2 = shaders_[listView_->GetSelected()].maxSettingValue2;
|
||||
g_Config.fPostShaderMinSettingValue2 = shaders_[listView_->GetSelected()].minSettingValue2;
|
||||
g_Config.fPostShaderSettingStep2 = shaders_[listView_->GetSelected()].settingStep2;
|
||||
|
||||
g_Config.sPostShaderSettingName3 = shaders_[listView_->GetSelected()].settingName3;
|
||||
g_Config.fPostShaderSettingValue3 = shaders_[listView_->GetSelected()].settingValue3;
|
||||
g_Config.fPostShaderSettingValue3 = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue3"];
|
||||
g_Config.fPostShaderMaxSettingValue3 = shaders_[listView_->GetSelected()].maxSettingValue3;
|
||||
g_Config.fPostShaderMinSettingValue3 = shaders_[listView_->GetSelected()].minSettingValue3;
|
||||
g_Config.fPostShaderSettingStep3 = shaders_[listView_->GetSelected()].settingStep3;
|
||||
|
||||
g_Config.sPostShaderSettingName4 = shaders_[listView_->GetSelected()].settingName4;
|
||||
g_Config.fPostShaderSettingValue4 = shaders_[listView_->GetSelected()].settingValue4;
|
||||
g_Config.fPostShaderSettingValue4 = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue4"];
|
||||
g_Config.fPostShaderMaxSettingValue4 = shaders_[listView_->GetSelected()].maxSettingValue4;
|
||||
g_Config.fPostShaderMinSettingValue4 = shaders_[listView_->GetSelected()].minSettingValue4;
|
||||
g_Config.fPostShaderSettingStep4 = shaders_[listView_->GetSelected()].settingStep4;
|
||||
|
Loading…
Reference in New Issue
Block a user