mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-30 01:29:42 -06:00
Merge pull request #5744 from JosJuice/remove-non-integer-irs
Remove non-integer IRs
This commit is contained in:
@ -4,13 +4,48 @@
|
||||
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Common/StringUtil.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
std::optional<int> ConvertFromLegacyEFBScale(int efb_scale)
|
||||
{
|
||||
// In game INIs, -1 was used as a special value meaning
|
||||
// "use the value from the base layer but round it to an integer scale".
|
||||
// We only support integer scales nowadays, so we can simply ignore -1
|
||||
// in game INIs in order to automatically use a previous layer's value.
|
||||
if (efb_scale < 0)
|
||||
return {};
|
||||
|
||||
return efb_scale - (efb_scale > 0) - (efb_scale > 2) - (efb_scale > 4);
|
||||
}
|
||||
|
||||
std::optional<int> ConvertFromLegacyEFBScale(const std::string& efb_scale)
|
||||
{
|
||||
int efb_scale_int;
|
||||
if (!TryParse(efb_scale, &efb_scale_int))
|
||||
return {};
|
||||
return ConvertFromLegacyEFBScale(efb_scale_int);
|
||||
}
|
||||
|
||||
int ConvertToLegacyEFBScale(int efb_scale)
|
||||
{
|
||||
return efb_scale + (efb_scale >= 0) + (efb_scale > 1) + (efb_scale > 2);
|
||||
}
|
||||
|
||||
std::optional<int> ConvertToLegacyEFBScale(const std::string& efb_scale)
|
||||
{
|
||||
int efb_scale_int;
|
||||
if (!TryParse(efb_scale, &efb_scale_int))
|
||||
return {};
|
||||
return ConvertToLegacyEFBScale(efb_scale_int);
|
||||
}
|
||||
|
||||
// Configuration Information
|
||||
|
||||
// Graphics.Hardware
|
||||
@ -60,8 +95,7 @@ const ConfigInfo<bool> GFX_ENABLE_PIXEL_LIGHTING{{System::GFX, "Settings", "Enab
|
||||
const ConfigInfo<bool> GFX_FAST_DEPTH_CALC{{System::GFX, "Settings", "FastDepthCalc"}, true};
|
||||
const ConfigInfo<u32> GFX_MSAA{{System::GFX, "Settings", "MSAA"}, 1};
|
||||
const ConfigInfo<bool> GFX_SSAA{{System::GFX, "Settings", "SSAA"}, false};
|
||||
const ConfigInfo<int> GFX_EFB_SCALE{{System::GFX, "Settings", "EFBScale"},
|
||||
static_cast<int>(SCALE_1X)};
|
||||
const ConfigInfo<int> GFX_EFB_SCALE{{System::GFX, "Settings", "EFBScale"}, 1};
|
||||
const ConfigInfo<bool> GFX_TEXFMT_OVERLAY_ENABLE{{System::GFX, "Settings", "TexFmtOverlayEnable"},
|
||||
false};
|
||||
const ConfigInfo<bool> GFX_TEXFMT_OVERLAY_CENTER{{System::GFX, "Settings", "TexFmtOverlayCenter"},
|
||||
|
@ -4,12 +4,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
|
||||
namespace Config
|
||||
{
|
||||
std::optional<int> ConvertFromLegacyEFBScale(int efb_scale);
|
||||
std::optional<int> ConvertFromLegacyEFBScale(const std::string& efb_scale);
|
||||
int ConvertToLegacyEFBScale(int efb_scale);
|
||||
std::optional<int> ConvertToLegacyEFBScale(const std::string& efb_scale);
|
||||
|
||||
// Configuration Information
|
||||
|
||||
// Graphics.Hardware
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Common/Logging/Log.h"
|
||||
|
||||
#include "Common/Config/Config.h"
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/ConfigLoaders/IsSettingSaveable.h"
|
||||
|
||||
namespace ConfigLoaders
|
||||
@ -53,7 +54,19 @@ public:
|
||||
const IniFile::Section::SectionMap& section_map = section.GetValues();
|
||||
|
||||
for (const auto& value : section_map)
|
||||
config_section->Set(value.first, value.second);
|
||||
{
|
||||
const Config::ConfigLocation location{system.first, section_name, value.first};
|
||||
if (location == Config::GFX_EFB_SCALE.location)
|
||||
{
|
||||
std::optional<int> efb_scale = Config::ConvertFromLegacyEFBScale(value.second);
|
||||
if (efb_scale)
|
||||
config_section->Set(value.first, *efb_scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
config_section->Set(value.first, value.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -83,10 +96,20 @@ public:
|
||||
|
||||
for (const auto& value : section_values)
|
||||
{
|
||||
if (!IsSettingSaveable({system.first, section->GetName(), value.first}))
|
||||
const Config::ConfigLocation location{system.first, section->GetName(), value.first};
|
||||
if (!IsSettingSaveable(location))
|
||||
continue;
|
||||
|
||||
ini_section->Set(value.first, value.second);
|
||||
if (location == Config::GFX_EFB_SCALE.location)
|
||||
{
|
||||
std::optional<int> efb_scale = Config::ConvertToLegacyEFBScale(value.second);
|
||||
if (efb_scale)
|
||||
ini_section->Set(value.first, *efb_scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
ini_section->Set(value.first, value.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user