User chain support

This commit is contained in:
iota97
2020-09-13 21:48:00 +02:00
parent a81991f114
commit 0c885db052
13 changed files with 134 additions and 48 deletions
+39 -1
View File
@@ -805,7 +805,6 @@ static ConfigSetting graphicsSettings[] = {
// Not really a graphics setting...
ReportedConfigSetting("SplineBezierQuality", &g_Config.iSplineBezierQuality, 2, true, true),
ReportedConfigSetting("HardwareTessellation", &g_Config.bHardwareTessellation, false, true, true),
ReportedConfigSetting("PostShader", &g_Config.sPostShaderName, "Off", true, true),
ConfigSetting("TextureShader", &g_Config.sTextureShaderName, "Off", true, true),
ReportedConfigSetting("MemBlockTransferGPU", &g_Config.bBlockTransferGPU, true, true, true),
@@ -1254,6 +1253,14 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) {
mPostShaderSetting[it.first] = std::stof(it.second);
}
auto postShaderChain = iniFile.GetOrCreateSection("PostShaderList")->ToMap();
vPostShaderNames.clear();
for (auto it : postShaderChain) {
vPostShaderNames.push_back(it.second);
}
if (vPostShaderNames.empty())
vPostShaderNames.push_back("Off");
// This caps the exponent 4 (so 16x.)
if (iAnisotropyLevel > 4) {
iAnisotropyLevel = 4;
@@ -1385,6 +1392,13 @@ void Config::Save(const char *saveReason) {
for (auto it = mPostShaderSetting.begin(), end = mPostShaderSetting.end(); it != end; ++it) {
postShaderSetting->Set(it->first.c_str(), it->second);
}
Section *postShaderChain = iniFile.GetOrCreateSection("PostShaderList");
postShaderChain->Clear();
for (size_t i = 0; i < vPostShaderNames.size(); ++i) {
char keyName[64];
snprintf(keyName, sizeof(keyName), "PostShader%d", (int)i+1);
postShaderChain->Set(keyName, vPostShaderNames[i]);
}
}
Section *control = iniFile.GetOrCreateSection("Control");
@@ -1643,6 +1657,14 @@ bool Config::saveGameConfig(const std::string &pGameId, const std::string &title
postShaderSetting->Set(it->first.c_str(), it->second);
}
Section *postShaderChain = iniFile.GetOrCreateSection("PostShaderList");
postShaderChain->Clear();
for (size_t i = 0; i < vPostShaderNames.size(); ++i) {
char keyName[64];
snprintf(keyName, sizeof(keyName), "PostShader%d", (int)i+1);
postShaderChain->Set(keyName, vPostShaderNames[i]);
}
KeyMap::SaveToIni(iniFile);
iniFile.Save(fullIniFilePath);
@@ -1667,6 +1689,14 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title
mPostShaderSetting[it.first] = std::stof(it.second);
}
auto postShaderChain = iniFile.GetOrCreateSection("PostShaderList")->ToMap();
vPostShaderNames.clear();
for (auto it : postShaderChain) {
vPostShaderNames.push_back(it.second);
}
if (vPostShaderNames.empty())
vPostShaderNames.push_back("Off");
IterateSettings(iniFile, [](Section *section, ConfigSetting *setting) {
if (setting->perGame_) {
setting->Get(section);
@@ -1697,6 +1727,14 @@ void Config::unloadGameConfig() {
mPostShaderSetting[it.first] = std::stof(it.second);
}
auto postShaderChain = iniFile.GetOrCreateSection("PostShaderList")->ToMap();
vPostShaderNames.clear();
for (auto it : postShaderChain) {
vPostShaderNames.push_back(it.second);
}
if (vPostShaderNames.empty())
vPostShaderNames.push_back("Off");
LoadStandardControllerIni();
}
}