Convert to/from old EFB scale numbering

This commit is contained in:
JosJuice
2017-07-03 22:44:13 +02:00
parent f090a94319
commit 1fc910b3ea
8 changed files with 99 additions and 16 deletions

View File

@ -84,7 +84,7 @@ static const INIToLocationMap& GetINIToLocationMap()
{{"Video_Settings", "MSAA"}, {Config::GFX_MSAA.location}},
{{"Video_Settings", "SSAA"}, {Config::GFX_SSAA.location}},
{{"Video_Settings", "ForceTrueColor"}, {Config::GFX_ENHANCE_FORCE_TRUE_COLOR.location}},
{{"Video_Settings", "InternalResolution"}, {Config::GFX_EFB_SCALE.location}},
{{"Video_Settings", "EFBScale"}, {Config::GFX_EFB_SCALE.location}},
{{"Video_Settings", "DisableFog"}, {Config::GFX_DISABLE_FOG.location}},
{{"Video_Settings", "BackendMultithreading"}, {Config::GFX_BACKEND_MULTITHREADING.location}},
{{"Video_Settings", "CommandBufferExecuteInterval"},
@ -312,7 +312,17 @@ private:
auto* config_section =
config_layer->GetOrCreateSection(mapped_config.system, mapped_config.section);
config_section->Set(mapped_config.key, value.second);
if (mapped_config == Config::GFX_EFB_SCALE.location)
{
std::optional<int> efb_scale = Config::ConvertFromLegacyEFBScale(value.second);
if (efb_scale)
config_section->Set(mapped_config.key, *efb_scale);
}
else
{
config_section->Set(mapped_config.key, value.second);
}
}
}
@ -335,16 +345,25 @@ void INIGameConfigLayerLoader::Save(Config::Layer* config_layer)
{
for (const auto& value : section->GetValues())
{
if (!IsSettingSaveable({system.first, section->GetName(), value.first}))
const Config::ConfigLocation location{system.first, section->GetName(), value.first};
if (!IsSettingSaveable(location))
continue;
const auto ini_location =
GetINILocationFromConfig({system.first, section->GetName(), value.first});
const auto ini_location = GetINILocationFromConfig(location);
if (ini_location.first.empty() && ini_location.second.empty())
continue;
IniFile::Section* ini_section = ini.GetOrCreateSection(ini_location.first);
ini_section->Set(ini_location.second, value.second);
if (location == Config::GFX_EFB_SCALE.location)
{
std::optional<int> efb_scale = Config::ConvertToLegacyEFBScale(value.second);
if (efb_scale)
ini_section->Set(ini_location.second, *efb_scale);
}
else
{
ini_section->Set(ini_location.second, value.second);
}
}
}
}