summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/settings.h26
-rw-r--r--src/common/settings_common.cpp6
-rw-r--r--src/common/settings_common.h33
-rw-r--r--src/common/settings_setting.h15
4 files changed, 48 insertions, 32 deletions
diff --git a/src/common/settings.h b/src/common/settings.h
index b87301d4e..c4339cb1f 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -137,8 +137,15 @@ struct Values {
SwitchableSetting<AudioMode, true> sound_index{linkage, AudioMode::Stereo,
AudioMode::Mono, AudioMode::Surround,
"sound_index", Category::SystemAudio};
- SwitchableSetting<u8, true> volume{
- linkage, 100, 0, 200, "volume", Category::Audio, Specialization::Scalar, true, true};
+ SwitchableSetting<u8, true> volume{linkage,
+ 100,
+ 0,
+ 200,
+ "volume",
+ Category::Audio,
+ Specialization::Scalar | Specialization::Percentage,
+ true,
+ true};
Setting<bool, false> audio_muted{
linkage, false, "audio_muted", Category::Audio, Specialization::Default, false};
Setting<bool, false> dump_audio_commands{
@@ -156,7 +163,7 @@ struct Values {
9999,
"speed_limit",
Category::Core,
- Specialization::Countable,
+ Specialization::Countable | Specialization::Percentage,
true,
true,
&use_speed_limit};
@@ -268,9 +275,16 @@ struct Values {
Specialization::Default,
true,
true};
- SwitchableSetting<int, true> fsr_sharpening_slider{
- linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer, Specialization::Scalar,
- true, true};
+ SwitchableSetting<int, true> fsr_sharpening_slider{linkage,
+ 25,
+ 0,
+ 200,
+ "fsr_sharpening_slider",
+ Category::Renderer,
+ Specialization::Scalar |
+ Specialization::Percentage,
+ true,
+ true};
SwitchableSetting<u8, false> bg_red{
linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true};
diff --git a/src/common/settings_common.cpp b/src/common/settings_common.cpp
index 53d4548f5..799942980 100644
--- a/src/common/settings_common.cpp
+++ b/src/common/settings_common.cpp
@@ -7,8 +7,8 @@
namespace Settings {
BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_,
- bool save_, bool runtime_modifiable_,
- enum Specialization specialization_, BasicSetting* other_setting_)
+ bool save_, bool runtime_modifiable_, u32 specialization_,
+ BasicSetting* other_setting_)
: label{name}, category{category_}, id{linkage.count}, save{save_},
runtime_modifiable{runtime_modifiable_}, specialization{specialization_},
other_setting{other_setting_} {
@@ -40,7 +40,7 @@ Category BasicSetting::Category() const {
return category;
}
-Specialization BasicSetting::Specialization() const {
+u32 BasicSetting::Specialization() const {
return specialization;
}
diff --git a/src/common/settings_common.h b/src/common/settings_common.h
index ad005ca4e..6b717deb1 100644
--- a/src/common/settings_common.h
+++ b/src/common/settings_common.h
@@ -43,15 +43,21 @@ enum class Category : u32 {
MaxEnum,
};
-enum class Specialization : u32 {
- Default,
- Time,
- Hex,
- List,
- RuntimeList,
- Scalar,
- Countable,
- Paired,
+constexpr u8 SpecializationTypeMask = 0xf;
+constexpr u8 SpecializationAttributeMask = 0xf0;
+constexpr u8 SpecializationAttributeOffset = 4;
+
+enum Specialization : u8 {
+ Default = 0,
+ Time = 1,
+ Hex = 2,
+ List = 3,
+ RuntimeList = 4,
+ Scalar = 5,
+ Countable = 6,
+ Paired = 7,
+
+ Percentage = (1 << SpecializationAttributeOffset),
};
bool IsConfiguringGlobal();
@@ -75,7 +81,7 @@ public:
class BasicSetting {
protected:
explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_,
- bool save_, bool runtime_modifiable_, Specialization spec,
+ bool save_, bool runtime_modifiable_, u32 specialization,
BasicSetting* other_setting);
public:
@@ -195,7 +201,7 @@ public:
/**
* @returns Extra metadata for data representation in frontend implementations.
*/
- [[nodiscard]] enum Specialization Specialization() const;
+ [[nodiscard]] u32 Specialization() const;
/**
* @returns Another BasicSetting if one is paired, or nullptr otherwise.
@@ -240,9 +246,8 @@ private:
const u32 id; ///< Unique integer for the setting
const bool save; ///< Suggests if the setting should be saved and read to a frontend config
const bool
- runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running
- const enum Specialization
- specialization; ///< Extra data to identify representation of a setting
+ runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running
+ const u32 specialization; ///< Extra data to identify representation of a setting
BasicSetting* const other_setting; ///< A paired setting
};
diff --git a/src/common/settings_setting.h b/src/common/settings_setting.h
index dd91250a1..d1915cb43 100644
--- a/src/common/settings_setting.h
+++ b/src/common/settings_setting.h
@@ -35,8 +35,7 @@ public:
* @param category_ Category of the setting AKA INI group
*/
explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name,
- enum Category category_,
- enum Specialization specialization = Specialization::Default,
+ enum Category category_, u32 specialization = Specialization::Default,
bool save_ = true, bool runtime_modifiable_ = false,
BasicSetting* other_setting = nullptr)
requires(!ranged)
@@ -57,9 +56,8 @@ public:
*/
explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val,
const Type& max_val, const std::string& name, enum Category category_,
- enum Specialization specialization = Specialization::Default,
- bool save_ = true, bool runtime_modifiable_ = false,
- BasicSetting* other_setting = nullptr)
+ u32 specialization = Specialization::Default, bool save_ = true,
+ bool runtime_modifiable_ = false, BasicSetting* other_setting = nullptr)
requires(ranged)
: BasicSetting(linkage, name, category_, save_, runtime_modifiable_, specialization,
other_setting),
@@ -237,8 +235,7 @@ public:
* @param category_ Category of the setting AKA INI group
*/
explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name,
- Category category_,
- enum Specialization specialization = Specialization::Default,
+ Category category_, u32 specialization = Specialization::Default,
bool save_ = true, bool runtime_modifiable_ = false,
BasicSetting* other_setting = nullptr)
requires(!ranged)
@@ -261,8 +258,8 @@ public:
*/
explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val,
const Type& max_val, const std::string& name, Category category_,
- enum Specialization specialization = Specialization::Default,
- bool save_ = true, bool runtime_modifiable_ = false,
+ u32 specialization = Specialization::Default, bool save_ = true,
+ bool runtime_modifiable_ = false,
BasicSetting* other_setting = nullptr)
requires(ranged)
: Setting<Type, true>{