diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/settings.h | 26 | ||||
| -rw-r--r-- | src/common/settings_common.cpp | 6 | ||||
| -rw-r--r-- | src/common/settings_common.h | 33 | ||||
| -rw-r--r-- | src/common/settings_setting.h | 15 |
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 { | |||
| 137 | SwitchableSetting<AudioMode, true> sound_index{linkage, AudioMode::Stereo, | 137 | SwitchableSetting<AudioMode, true> sound_index{linkage, AudioMode::Stereo, |
| 138 | AudioMode::Mono, AudioMode::Surround, | 138 | AudioMode::Mono, AudioMode::Surround, |
| 139 | "sound_index", Category::SystemAudio}; | 139 | "sound_index", Category::SystemAudio}; |
| 140 | SwitchableSetting<u8, true> volume{ | 140 | SwitchableSetting<u8, true> volume{linkage, |
| 141 | linkage, 100, 0, 200, "volume", Category::Audio, Specialization::Scalar, true, true}; | 141 | 100, |
| 142 | 0, | ||
| 143 | 200, | ||
| 144 | "volume", | ||
| 145 | Category::Audio, | ||
| 146 | Specialization::Scalar | Specialization::Percentage, | ||
| 147 | true, | ||
| 148 | true}; | ||
| 142 | Setting<bool, false> audio_muted{ | 149 | Setting<bool, false> audio_muted{ |
| 143 | linkage, false, "audio_muted", Category::Audio, Specialization::Default, false}; | 150 | linkage, false, "audio_muted", Category::Audio, Specialization::Default, false}; |
| 144 | Setting<bool, false> dump_audio_commands{ | 151 | Setting<bool, false> dump_audio_commands{ |
| @@ -156,7 +163,7 @@ struct Values { | |||
| 156 | 9999, | 163 | 9999, |
| 157 | "speed_limit", | 164 | "speed_limit", |
| 158 | Category::Core, | 165 | Category::Core, |
| 159 | Specialization::Countable, | 166 | Specialization::Countable | Specialization::Percentage, |
| 160 | true, | 167 | true, |
| 161 | true, | 168 | true, |
| 162 | &use_speed_limit}; | 169 | &use_speed_limit}; |
| @@ -268,9 +275,16 @@ struct Values { | |||
| 268 | Specialization::Default, | 275 | Specialization::Default, |
| 269 | true, | 276 | true, |
| 270 | true}; | 277 | true}; |
| 271 | SwitchableSetting<int, true> fsr_sharpening_slider{ | 278 | SwitchableSetting<int, true> fsr_sharpening_slider{linkage, |
| 272 | linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer, Specialization::Scalar, | 279 | 25, |
| 273 | true, true}; | 280 | 0, |
| 281 | 200, | ||
| 282 | "fsr_sharpening_slider", | ||
| 283 | Category::Renderer, | ||
| 284 | Specialization::Scalar | | ||
| 285 | Specialization::Percentage, | ||
| 286 | true, | ||
| 287 | true}; | ||
| 274 | 288 | ||
| 275 | SwitchableSetting<u8, false> bg_red{ | 289 | SwitchableSetting<u8, false> bg_red{ |
| 276 | linkage, 0, "bg_red", Category::Renderer, Specialization::Default, true, true}; | 290 | 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 @@ | |||
| 7 | namespace Settings { | 7 | namespace Settings { |
| 8 | 8 | ||
| 9 | BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, | 9 | BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, |
| 10 | bool save_, bool runtime_modifiable_, | 10 | bool save_, bool runtime_modifiable_, u32 specialization_, |
| 11 | enum Specialization specialization_, BasicSetting* other_setting_) | 11 | BasicSetting* other_setting_) |
| 12 | : label{name}, category{category_}, id{linkage.count}, save{save_}, | 12 | : label{name}, category{category_}, id{linkage.count}, save{save_}, |
| 13 | runtime_modifiable{runtime_modifiable_}, specialization{specialization_}, | 13 | runtime_modifiable{runtime_modifiable_}, specialization{specialization_}, |
| 14 | other_setting{other_setting_} { | 14 | other_setting{other_setting_} { |
| @@ -40,7 +40,7 @@ Category BasicSetting::Category() const { | |||
| 40 | return category; | 40 | return category; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | Specialization BasicSetting::Specialization() const { | 43 | u32 BasicSetting::Specialization() const { |
| 44 | return specialization; | 44 | return specialization; |
| 45 | } | 45 | } |
| 46 | 46 | ||
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 { | |||
| 43 | MaxEnum, | 43 | MaxEnum, |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | enum class Specialization : u32 { | 46 | constexpr u8 SpecializationTypeMask = 0xf; |
| 47 | Default, | 47 | constexpr u8 SpecializationAttributeMask = 0xf0; |
| 48 | Time, | 48 | constexpr u8 SpecializationAttributeOffset = 4; |
| 49 | Hex, | 49 | |
| 50 | List, | 50 | enum Specialization : u8 { |
| 51 | RuntimeList, | 51 | Default = 0, |
| 52 | Scalar, | 52 | Time = 1, |
| 53 | Countable, | 53 | Hex = 2, |
| 54 | Paired, | 54 | List = 3, |
| 55 | RuntimeList = 4, | ||
| 56 | Scalar = 5, | ||
| 57 | Countable = 6, | ||
| 58 | Paired = 7, | ||
| 59 | |||
| 60 | Percentage = (1 << SpecializationAttributeOffset), | ||
| 55 | }; | 61 | }; |
| 56 | 62 | ||
| 57 | bool IsConfiguringGlobal(); | 63 | bool IsConfiguringGlobal(); |
| @@ -75,7 +81,7 @@ public: | |||
| 75 | class BasicSetting { | 81 | class BasicSetting { |
| 76 | protected: | 82 | protected: |
| 77 | explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, | 83 | explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, |
| 78 | bool save_, bool runtime_modifiable_, Specialization spec, | 84 | bool save_, bool runtime_modifiable_, u32 specialization, |
| 79 | BasicSetting* other_setting); | 85 | BasicSetting* other_setting); |
| 80 | 86 | ||
| 81 | public: | 87 | public: |
| @@ -195,7 +201,7 @@ public: | |||
| 195 | /** | 201 | /** |
| 196 | * @returns Extra metadata for data representation in frontend implementations. | 202 | * @returns Extra metadata for data representation in frontend implementations. |
| 197 | */ | 203 | */ |
| 198 | [[nodiscard]] enum Specialization Specialization() const; | 204 | [[nodiscard]] u32 Specialization() const; |
| 199 | 205 | ||
| 200 | /** | 206 | /** |
| 201 | * @returns Another BasicSetting if one is paired, or nullptr otherwise. | 207 | * @returns Another BasicSetting if one is paired, or nullptr otherwise. |
| @@ -240,9 +246,8 @@ private: | |||
| 240 | const u32 id; ///< Unique integer for the setting | 246 | const u32 id; ///< Unique integer for the setting |
| 241 | const bool save; ///< Suggests if the setting should be saved and read to a frontend config | 247 | const bool save; ///< Suggests if the setting should be saved and read to a frontend config |
| 242 | const bool | 248 | const bool |
| 243 | runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running | 249 | runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running |
| 244 | const enum Specialization | 250 | const u32 specialization; ///< Extra data to identify representation of a setting |
| 245 | specialization; ///< Extra data to identify representation of a setting | ||
| 246 | BasicSetting* const other_setting; ///< A paired setting | 251 | BasicSetting* const other_setting; ///< A paired setting |
| 247 | }; | 252 | }; |
| 248 | 253 | ||
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: | |||
| 35 | * @param category_ Category of the setting AKA INI group | 35 | * @param category_ Category of the setting AKA INI group |
| 36 | */ | 36 | */ |
| 37 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, | 37 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, |
| 38 | enum Category category_, | 38 | enum Category category_, u32 specialization = Specialization::Default, |
| 39 | enum Specialization specialization = Specialization::Default, | ||
| 40 | bool save_ = true, bool runtime_modifiable_ = false, | 39 | bool save_ = true, bool runtime_modifiable_ = false, |
| 41 | BasicSetting* other_setting = nullptr) | 40 | BasicSetting* other_setting = nullptr) |
| 42 | requires(!ranged) | 41 | requires(!ranged) |
| @@ -57,9 +56,8 @@ public: | |||
| 57 | */ | 56 | */ |
| 58 | explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val, | 57 | explicit Setting(Linkage& linkage, const Type& default_val, const Type& min_val, |
| 59 | const Type& max_val, const std::string& name, enum Category category_, | 58 | const Type& max_val, const std::string& name, enum Category category_, |
| 60 | enum Specialization specialization = Specialization::Default, | 59 | u32 specialization = Specialization::Default, bool save_ = true, |
| 61 | bool save_ = true, bool runtime_modifiable_ = false, | 60 | bool runtime_modifiable_ = false, BasicSetting* other_setting = nullptr) |
| 62 | BasicSetting* other_setting = nullptr) | ||
| 63 | requires(ranged) | 61 | requires(ranged) |
| 64 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_, specialization, | 62 | : BasicSetting(linkage, name, category_, save_, runtime_modifiable_, specialization, |
| 65 | other_setting), | 63 | other_setting), |
| @@ -237,8 +235,7 @@ public: | |||
| 237 | * @param category_ Category of the setting AKA INI group | 235 | * @param category_ Category of the setting AKA INI group |
| 238 | */ | 236 | */ |
| 239 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name, | 237 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const std::string& name, |
| 240 | Category category_, | 238 | Category category_, u32 specialization = Specialization::Default, |
| 241 | enum Specialization specialization = Specialization::Default, | ||
| 242 | bool save_ = true, bool runtime_modifiable_ = false, | 239 | bool save_ = true, bool runtime_modifiable_ = false, |
| 243 | BasicSetting* other_setting = nullptr) | 240 | BasicSetting* other_setting = nullptr) |
| 244 | requires(!ranged) | 241 | requires(!ranged) |
| @@ -261,8 +258,8 @@ public: | |||
| 261 | */ | 258 | */ |
| 262 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val, | 259 | explicit SwitchableSetting(Linkage& linkage, const Type& default_val, const Type& min_val, |
| 263 | const Type& max_val, const std::string& name, Category category_, | 260 | const Type& max_val, const std::string& name, Category category_, |
| 264 | enum Specialization specialization = Specialization::Default, | 261 | u32 specialization = Specialization::Default, bool save_ = true, |
| 265 | bool save_ = true, bool runtime_modifiable_ = false, | 262 | bool runtime_modifiable_ = false, |
| 266 | BasicSetting* other_setting = nullptr) | 263 | BasicSetting* other_setting = nullptr) |
| 267 | requires(ranged) | 264 | requires(ranged) |
| 268 | : Setting<Type, true>{ | 265 | : Setting<Type, true>{ |