mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
UI: Translate shader setting names.
Also, only save settings in ini that have names.
This commit is contained in:
parent
1e0c5db3a9
commit
ff68a0d50f
@ -43,30 +43,13 @@ void LoadPostShaderInfo(std::vector<std::string> directories) {
|
||||
off.visible = true;
|
||||
off.name = "Off";
|
||||
off.section = "Off";
|
||||
off.outputResolution = false;
|
||||
off.isUpscalingFilter = false;
|
||||
off.SSAAFilterLevel = 0;
|
||||
off.requires60fps = false;
|
||||
off.settingName1 = "";
|
||||
off.settingValue1 = 0.0f;
|
||||
off.minSettingValue1 = -1.0f;
|
||||
off.maxSettingValue1 = 1.0f;
|
||||
off.settingStep1 = 0.01f;
|
||||
off.settingName2 = "";
|
||||
off.settingValue2 = 0.0f;
|
||||
off.minSettingValue2 = -1.0f;
|
||||
off.maxSettingValue2 = 1.0f;
|
||||
off.settingStep2 = 0.01f;
|
||||
off.settingName3 = "";
|
||||
off.settingValue3 = 0.0f;
|
||||
off.minSettingValue3 = -1.0f;
|
||||
off.maxSettingValue3 = 1.0f;
|
||||
off.settingStep3 = 0.01f;
|
||||
off.settingName4 = "";
|
||||
off.settingValue4 = 0.0f;
|
||||
off.minSettingValue4 = -1.0f;
|
||||
off.maxSettingValue4 = 1.0f;
|
||||
off.settingStep4 = 0.01f;
|
||||
for (size_t i = 0; i < ARRAY_SIZE(off.settings); ++i) {
|
||||
off.settings[i].name = "";
|
||||
off.settings[i].value = 0.0f;
|
||||
off.settings[i].minValue = -1.0f;
|
||||
off.settings[i].maxValue = 1.0f;
|
||||
off.settings[i].step = 0.01f;
|
||||
}
|
||||
shaderInfo.push_back(off);
|
||||
|
||||
auto appendShader = [&](const ShaderInfo &info) {
|
||||
@ -123,35 +106,21 @@ void LoadPostShaderInfo(std::vector<std::string> directories) {
|
||||
section.Get("Upscaling", &info.isUpscalingFilter, false);
|
||||
section.Get("SSAA", &info.SSAAFilterLevel, 0);
|
||||
section.Get("60fps", &info.requires60fps, false);
|
||||
section.Get("SettingName1", &info.settingName1, "");
|
||||
section.Get("SettingDefaultValue1", &info.settingValue1, 0.0f);
|
||||
section.Get("SettingMinValue1", &info.minSettingValue1, -1.0f);
|
||||
section.Get("SettingMaxValue1", &info.maxSettingValue1, 1.0f);
|
||||
section.Get("SettingStep1", &info.settingStep1, 0.01f);
|
||||
section.Get("SettingName2", &info.settingName2, "");
|
||||
section.Get("SettingDefaultValue2", &info.settingValue2, 0.0f);
|
||||
section.Get("SettingMinValue2", &info.minSettingValue2, -1.0f);
|
||||
section.Get("SettingMaxValue2", &info.maxSettingValue2, 1.0f);
|
||||
section.Get("SettingStep2", &info.settingStep2, 0.01f);
|
||||
section.Get("SettingName3", &info.settingName3, "");
|
||||
section.Get("SettingDefaultValue3", &info.settingValue3, 0.0f);
|
||||
section.Get("SettingMinValue3", &info.minSettingValue3, -1.0f);
|
||||
section.Get("SettingMaxValue3", &info.maxSettingValue3, 1.0f);
|
||||
section.Get("SettingStep3", &info.settingStep3, 0.01f);
|
||||
section.Get("SettingName4", &info.settingName4, "");
|
||||
section.Get("SettingDefaultValue4", &info.settingValue4, 0.0f);
|
||||
section.Get("SettingMinValue4", &info.minSettingValue4, -1.0f);
|
||||
section.Get("SettingMaxValue4", &info.maxSettingValue4, 1.0f);
|
||||
section.Get("SettingStep4", &info.settingStep4, 0.01f);
|
||||
|
||||
if (g_Config.mPostShaderSetting.find(info.section + "SettingValue1") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(info.section + "SettingValue1", info.settingValue1));
|
||||
if (g_Config.mPostShaderSetting.find(info.section + "SettingValue2") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(info.section + "SettingValue2", info.settingValue2));
|
||||
if (g_Config.mPostShaderSetting.find(info.section + "SettingValue3") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(info.section + "SettingValue3", info.settingValue3));
|
||||
if (g_Config.mPostShaderSetting.find(info.section + "SettingValue4") == g_Config.mPostShaderSetting.end())
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(info.section + "SettingValue4", info.settingValue4));
|
||||
for (size_t i = 0; i < ARRAY_SIZE(info.settings); ++i) {
|
||||
auto &setting = info.settings[i];
|
||||
section.Get(StringFromFormat("SettingName%d", i + 1).c_str(), &setting.name, "");
|
||||
section.Get(StringFromFormat("SettingDefaultValue%d", i + 1).c_str(), &setting.value, 0.0f);
|
||||
section.Get(StringFromFormat("SettingMinValue%d", i + 1).c_str(), &setting.minValue, -1.0f);
|
||||
section.Get(StringFromFormat("SettingMaxValue%d", i + 1).c_str(), &setting.maxValue, 1.0f);
|
||||
section.Get(StringFromFormat("SettingStep%d", i + 1).c_str(), &setting.step, 0.01f);
|
||||
|
||||
// Populate the default setting value.
|
||||
std::string section = StringFromFormat("%sSettingValue%d", info.section.c_str(), i + 1);
|
||||
if (!setting.name.empty() && g_Config.mPostShaderSetting.find(section) == g_Config.mPostShaderSetting.end()) {
|
||||
g_Config.mPostShaderSetting.insert(std::pair<std::string, float>(section, setting.value));
|
||||
}
|
||||
}
|
||||
|
||||
// Let's ignore shaders we can't support. TODO: Not a very good check
|
||||
if (gl_extensions.IsGLES && !gl_extensions.GLES3) {
|
||||
|
@ -44,26 +44,14 @@ struct ShaderInfo {
|
||||
// Force constant/max refresh for animated filters
|
||||
bool requires60fps;
|
||||
|
||||
std::string settingName1;
|
||||
float settingValue1;
|
||||
float maxSettingValue1;
|
||||
float minSettingValue1;
|
||||
float settingStep1;
|
||||
std::string settingName2;
|
||||
float settingValue2;
|
||||
float maxSettingValue2;
|
||||
float minSettingValue2;
|
||||
float settingStep2;
|
||||
std::string settingName3;
|
||||
float settingValue3;
|
||||
float maxSettingValue3;
|
||||
float minSettingValue3;
|
||||
float settingStep3;
|
||||
std::string settingName4;
|
||||
float settingValue4;
|
||||
float maxSettingValue4;
|
||||
float minSettingValue4;
|
||||
float settingStep4;
|
||||
struct Setting {
|
||||
std::string name;
|
||||
float value;
|
||||
float maxValue;
|
||||
float minValue;
|
||||
float step;
|
||||
};
|
||||
Setting settings[4];
|
||||
|
||||
// TODO: Add support for all kinds of fun options like mapping the depth buffer,
|
||||
// SRGB texture reads, etc.
|
||||
|
@ -291,21 +291,12 @@ void GameSettingsScreen::CreateViews() {
|
||||
});
|
||||
|
||||
const ShaderInfo *shaderInfo = GetPostShaderInfo(g_Config.sPostShaderName);
|
||||
if (shaderInfo && !shaderInfo->settingName1.empty()) {
|
||||
auto &value = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue1"];
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&value, shaderInfo->minSettingValue1, shaderInfo->maxSettingValue1, shaderInfo->settingName1, shaderInfo->settingStep1, screenManager()));
|
||||
}
|
||||
if (shaderInfo && !shaderInfo->settingName2.empty()) {
|
||||
auto &value = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue2"];
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&value, shaderInfo->minSettingValue2, shaderInfo->maxSettingValue2, shaderInfo->settingName2, shaderInfo->settingStep2, screenManager()));
|
||||
}
|
||||
if (shaderInfo && !shaderInfo->settingName3.empty()) {
|
||||
auto &value = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue3"];
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&value, shaderInfo->minSettingValue3, shaderInfo->maxSettingValue3, shaderInfo->settingName3, shaderInfo->settingStep3, screenManager()));
|
||||
}
|
||||
if (shaderInfo && !shaderInfo->settingName4.empty()) {
|
||||
auto &value = g_Config.mPostShaderSetting[g_Config.sPostShaderName + "SettingValue4"];
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&value, shaderInfo->minSettingValue4, shaderInfo->maxSettingValue4, shaderInfo->settingName4, shaderInfo->settingStep4, screenManager()));
|
||||
for (size_t i = 0; shaderInfo && i < ARRAY_SIZE(shaderInfo->settings); ++i) {
|
||||
auto &setting = shaderInfo->settings[i];
|
||||
if (!setting.name.empty()) {
|
||||
auto &value = g_Config.mPostShaderSetting[StringFromFormat("%sSettingValue%d", shaderInfo->section.c_str(), i + 1)];
|
||||
graphicsSettings->Add(new PopupSliderChoiceFloat(&value, setting.minValue, setting.maxValue, ps->T(setting.name), setting.step, screenManager()));
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
|
Loading…
Reference in New Issue
Block a user