settings,general: Rename non-confirming enums
This commit is contained in:
parent
9e3c94bb3d
commit
d146dd9d12
23 changed files with 136 additions and 130 deletions
|
@ -122,12 +122,12 @@ void SetConfiguringGlobal(bool is_global) {
|
|||
}
|
||||
|
||||
bool IsGPULevelExtreme() {
|
||||
return values.gpu_accuracy.GetValue() == GPUAccuracy::Extreme;
|
||||
return values.gpu_accuracy.GetValue() == GpuAccuracy::Extreme;
|
||||
}
|
||||
|
||||
bool IsGPULevelHigh() {
|
||||
return values.gpu_accuracy.GetValue() == GPUAccuracy::Extreme ||
|
||||
values.gpu_accuracy.GetValue() == GPUAccuracy::High;
|
||||
return values.gpu_accuracy.GetValue() == GpuAccuracy::Extreme ||
|
||||
values.gpu_accuracy.GetValue() == GpuAccuracy::High;
|
||||
}
|
||||
|
||||
bool IsFastmemEnabled() {
|
||||
|
|
|
@ -91,6 +91,7 @@ public:
|
|||
return {};
|
||||
}
|
||||
virtual void LoadString(const std::string& load) = 0;
|
||||
virtual std::string Canonicalize() const = 0;
|
||||
virtual const std::string& GetLabel() const = 0;
|
||||
virtual std::string DefaultToString() const = 0;
|
||||
virtual bool Save() const = 0;
|
||||
|
@ -102,7 +103,7 @@ public:
|
|||
virtual std::string MinVal() const = 0;
|
||||
virtual std::string MaxVal() const = 0;
|
||||
virtual bool UsingGlobal() const {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -245,7 +246,7 @@ protected:
|
|||
} else if constexpr (std::is_same<Type, bool>()) {
|
||||
return value_ ? "true" : "false";
|
||||
} else if (std::is_same<Type, AudioEngine>()) {
|
||||
return TranslateEnum(value_);
|
||||
return CanonicalizeEnum(value_);
|
||||
} else {
|
||||
return std::to_string(static_cast<u64>(value_));
|
||||
}
|
||||
|
@ -321,6 +322,13 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string constexpr Canonicalize() const override {
|
||||
if constexpr (std::is_enum<Type>::value) {
|
||||
return CanonicalizeEnum(this->GetValue());
|
||||
}
|
||||
return ToString(this->GetValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the save preference of the setting i.e. when saving or reading the setting from a
|
||||
* frontend, whether this setting should be skipped.
|
||||
|
@ -560,8 +568,8 @@ struct Values {
|
|||
linkage, false, "use_unsafe_extended_memory_layout", Category::Core};
|
||||
|
||||
// Cpu
|
||||
SwitchableSetting<CPUAccuracy, true> cpu_accuracy{linkage, CPUAccuracy::Auto,
|
||||
CPUAccuracy::Auto, CPUAccuracy::Paranoid,
|
||||
SwitchableSetting<CpuAccuracy, true> cpu_accuracy{linkage, CpuAccuracy::Auto,
|
||||
CpuAccuracy::Auto, CpuAccuracy::Paranoid,
|
||||
"cpu_accuracy", Category::Cpu};
|
||||
// TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021
|
||||
Setting<bool> cpu_accuracy_first_time{linkage, true, "cpu_accuracy_first_time", Category::Cpu};
|
||||
|
@ -657,28 +665,28 @@ struct Values {
|
|||
linkage, 100, 0, 9999, "speed_limit", Category::Renderer, true, true};
|
||||
SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
|
||||
Category::Renderer};
|
||||
SwitchableSetting<GPUAccuracy, true> gpu_accuracy{linkage,
|
||||
GPUAccuracy::High,
|
||||
GPUAccuracy::Normal,
|
||||
GPUAccuracy::Extreme,
|
||||
SwitchableSetting<GpuAccuracy, true> gpu_accuracy{linkage,
|
||||
GpuAccuracy::High,
|
||||
GpuAccuracy::Normal,
|
||||
GpuAccuracy::Extreme,
|
||||
"gpu_accuracy",
|
||||
Category::RendererAdvanced,
|
||||
true,
|
||||
true};
|
||||
SwitchableSetting<bool> use_asynchronous_gpu_emulation{
|
||||
linkage, true, "use_asynchronous_gpu_emulation", Category::Renderer};
|
||||
SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::GPU,
|
||||
SwitchableSetting<NvdecEmulation> nvdec_emulation{linkage, NvdecEmulation::Gpu,
|
||||
"nvdec_emulation", Category::Renderer};
|
||||
SwitchableSetting<AstcDecodeMode, true> accelerate_astc{linkage,
|
||||
AstcDecodeMode::CPU,
|
||||
AstcDecodeMode::CPU,
|
||||
AstcDecodeMode::CPUAsynchronous,
|
||||
AstcDecodeMode::Cpu,
|
||||
AstcDecodeMode::Cpu,
|
||||
AstcDecodeMode::CpuAsynchronous,
|
||||
"accelerate_astc",
|
||||
Category::Renderer};
|
||||
Setting<VSyncMode, true> vsync_mode{linkage,
|
||||
VSyncMode::FIFO,
|
||||
VSyncMode::Fifo,
|
||||
VSyncMode::Immediate,
|
||||
VSyncMode::FIFORelaxed,
|
||||
VSyncMode::FifoRelaxed,
|
||||
"use_vsync",
|
||||
Category::Renderer,
|
||||
true,
|
||||
|
@ -686,7 +694,7 @@ struct Values {
|
|||
SwitchableSetting<bool> use_reactive_flushing{linkage, true, "use_reactive_flushing",
|
||||
Category::RendererAdvanced};
|
||||
SwitchableSetting<ShaderBackend, true> shader_backend{
|
||||
linkage, ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV,
|
||||
linkage, ShaderBackend::Glsl, ShaderBackend::Glsl, ShaderBackend::SpirV,
|
||||
"shader_backend", Category::Renderer};
|
||||
SwitchableSetting<bool> use_asynchronous_shaders{linkage, false, "use_asynchronous_shaders",
|
||||
Category::RendererAdvanced};
|
||||
|
@ -730,7 +738,7 @@ struct Values {
|
|||
Language::PortugueseBrazilian,
|
||||
"language_index",
|
||||
Category::System};
|
||||
SwitchableSetting<Region, true> region_index{linkage, Region::USA, Region::Japan,
|
||||
SwitchableSetting<Region, true> region_index{linkage, Region::Usa, Region::Japan,
|
||||
Region::Taiwan, "region_index", Category::System};
|
||||
SwitchableSetting<TimeZone, true> time_zone_index{linkage, TimeZone::Auto,
|
||||
TimeZone::Auto, TimeZone::Zulu,
|
||||
|
|
|
@ -47,7 +47,7 @@ enum class Language : u32 {
|
|||
|
||||
enum class Region : u32 {
|
||||
Japan,
|
||||
USA,
|
||||
Usa,
|
||||
Europe,
|
||||
Australia,
|
||||
China,
|
||||
|
@ -114,9 +114,9 @@ enum class AnisotropyMode : u32 {
|
|||
};
|
||||
|
||||
enum class AstcDecodeMode : u32 {
|
||||
CPU = 0,
|
||||
GPU = 1,
|
||||
CPUAsynchronous = 2,
|
||||
Cpu = 0,
|
||||
Gpu = 1,
|
||||
CpuAsynchronous = 2,
|
||||
};
|
||||
|
||||
enum class AstcRecompression : u32 {
|
||||
|
@ -128,8 +128,8 @@ enum class AstcRecompression : u32 {
|
|||
enum class VSyncMode : u32 {
|
||||
Immediate = 0,
|
||||
Mailbox = 1,
|
||||
FIFO = 2,
|
||||
FIFORelaxed = 3,
|
||||
Fifo = 2,
|
||||
FifoRelaxed = 3,
|
||||
};
|
||||
|
||||
enum class RendererBackend : u32 {
|
||||
|
@ -139,19 +139,18 @@ enum class RendererBackend : u32 {
|
|||
};
|
||||
|
||||
enum class ShaderBackend : u32 {
|
||||
GLSL = 0,
|
||||
GLASM = 1,
|
||||
SPIRV = 2,
|
||||
Glsl = 0,
|
||||
Glasm = 1,
|
||||
SpirV = 2,
|
||||
};
|
||||
|
||||
enum class GPUAccuracy : u32 {
|
||||
enum class GpuAccuracy : u32 {
|
||||
Normal = 0,
|
||||
High = 1,
|
||||
Extreme = 2,
|
||||
MaxEnum = 3,
|
||||
};
|
||||
|
||||
enum class CPUAccuracy : u32 {
|
||||
enum class CpuAccuracy : u32 {
|
||||
Auto = 0,
|
||||
Accurate = 1,
|
||||
Unsafe = 2,
|
||||
|
@ -165,8 +164,8 @@ enum class FullscreenMode : u32 {
|
|||
|
||||
enum class NvdecEmulation : u32 {
|
||||
Off = 0,
|
||||
CPU = 1,
|
||||
GPU = 2,
|
||||
Cpu = 1,
|
||||
Gpu = 2,
|
||||
};
|
||||
|
||||
enum class ResolutionSetup : u32 {
|
||||
|
@ -220,18 +219,18 @@ static std::map<std::type_index, std::map<std::string, u32>> translations = {
|
|||
static std::string empty_string{};
|
||||
|
||||
template <typename Type>
|
||||
const std::string& TranslateEnum(Type id) {
|
||||
auto& group = translations.at(typeid(Type));
|
||||
const std::string& CanonicalizeEnum(Type id) {
|
||||
auto& group = canonicalizations.at(typeid(Type));
|
||||
for (auto& [name, value] : group) {
|
||||
if (static_cast<Type>(value) == id) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
return empty_string;
|
||||
return invalid_string;
|
||||
}
|
||||
|
||||
template <typename Type>
|
||||
static Type ToEnum(const std::string& text) {
|
||||
return static_cast<Type>(translations.at(typeid(Type)).at(text));
|
||||
static Type ToEnum(const std::string& canonicalization) {
|
||||
return static_cast<Type>(canonicalizations.at(typeid(Type)).at(canonicalization));
|
||||
}
|
||||
} // namespace Settings
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue