diff options
| -rw-r--r-- | src/common/settings.h | 452 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 12 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 8 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 10 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 54 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu_cmd/config.h | 4 |
8 files changed, 232 insertions, 320 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index a507744a2..3583a2e70 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -101,15 +101,15 @@ struct ResolutionScalingInfo { | |||
| 101 | } | 101 | } |
| 102 | }; | 102 | }; |
| 103 | 103 | ||
| 104 | /** The BasicSetting class is a simple resource manager. It defines a label and default value | 104 | /** The Setting class is a simple resource manager. It defines a label and default value alongside |
| 105 | * alongside the actual value of the setting for simpler and less-error prone use with frontend | 105 | * the actual value of the setting for simpler and less-error prone use with frontend |
| 106 | * configurations. Setting a default value and label is required, though subclasses may deviate from | 106 | * configurations. Specifying a default value and label is required. A minimum and maximum range can |
| 107 | * this requirement. | 107 | * be specified for sanitization. |
| 108 | */ | 108 | */ |
| 109 | template <typename Type> | 109 | template <typename Type> |
| 110 | class BasicSetting { | 110 | class Setting { |
| 111 | protected: | 111 | protected: |
| 112 | BasicSetting() = default; | 112 | Setting() = default; |
| 113 | 113 | ||
| 114 | /** | 114 | /** |
| 115 | * Only sets the setting to the given initializer, leaving the other members to their default | 115 | * Only sets the setting to the given initializer, leaving the other members to their default |
| @@ -117,7 +117,7 @@ protected: | |||
| 117 | * | 117 | * |
| 118 | * @param global_val Initial value of the setting | 118 | * @param global_val Initial value of the setting |
| 119 | */ | 119 | */ |
| 120 | explicit BasicSetting(const Type& global_val) : global{global_val} {} | 120 | explicit Setting(const Type& val) : value{val} {} |
| 121 | 121 | ||
| 122 | public: | 122 | public: |
| 123 | /** | 123 | /** |
| @@ -126,9 +126,22 @@ public: | |||
| 126 | * @param default_val Intial value of the setting, and default value of the setting | 126 | * @param default_val Intial value of the setting, and default value of the setting |
| 127 | * @param name Label for the setting | 127 | * @param name Label for the setting |
| 128 | */ | 128 | */ |
| 129 | explicit BasicSetting(const Type& default_val, const std::string& name) | 129 | explicit Setting(const Type& default_val, const std::string& name) |
| 130 | : default_value{default_val}, global{default_val}, label{name} {} | 130 | : value{default_val}, default_value{default_val}, ranged{false}, label{name} {} |
| 131 | virtual ~BasicSetting() = default; | 131 | virtual ~Setting() = default; |
| 132 | |||
| 133 | /** | ||
| 134 | * Sets a default value, minimum value, maximum value, and label. | ||
| 135 | * | ||
| 136 | * @param default_val Intial value of the setting, and default value of the setting | ||
| 137 | * @param min_val Sets the minimum allowed value of the setting | ||
| 138 | * @param max_val Sets the maximum allowed value of the setting | ||
| 139 | * @param name Label for the setting | ||
| 140 | */ | ||
| 141 | explicit Setting(const Type& default_val, const Type& min_val, const Type& max_val, | ||
| 142 | const std::string& name) | ||
| 143 | : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val}, | ||
| 144 | ranged{true}, label{name} {} | ||
| 132 | 145 | ||
| 133 | /** | 146 | /** |
| 134 | * Returns a reference to the setting's value. | 147 | * Returns a reference to the setting's value. |
| @@ -136,17 +149,17 @@ public: | |||
| 136 | * @returns A reference to the setting | 149 | * @returns A reference to the setting |
| 137 | */ | 150 | */ |
| 138 | [[nodiscard]] virtual const Type& GetValue() const { | 151 | [[nodiscard]] virtual const Type& GetValue() const { |
| 139 | return global; | 152 | return value; |
| 140 | } | 153 | } |
| 141 | 154 | ||
| 142 | /** | 155 | /** |
| 143 | * Sets the setting to the given value. | 156 | * Sets the setting to the given value. |
| 144 | * | 157 | * |
| 145 | * @param value The desired value | 158 | * @param val The desired value |
| 146 | */ | 159 | */ |
| 147 | virtual void SetValue(const Type& value) { | 160 | virtual void SetValue(const Type& val) { |
| 148 | Type temp{value}; | 161 | Type temp{(ranged) ? std::clamp(val, minimum, maximum) : val}; |
| 149 | std::swap(global, temp); | 162 | std::swap(value, temp); |
| 150 | } | 163 | } |
| 151 | 164 | ||
| 152 | /** | 165 | /** |
| @@ -170,14 +183,14 @@ public: | |||
| 170 | /** | 183 | /** |
| 171 | * Assigns a value to the setting. | 184 | * Assigns a value to the setting. |
| 172 | * | 185 | * |
| 173 | * @param value The desired setting value | 186 | * @param val The desired setting value |
| 174 | * | 187 | * |
| 175 | * @returns A reference to the setting | 188 | * @returns A reference to the setting |
| 176 | */ | 189 | */ |
| 177 | virtual const Type& operator=(const Type& value) { | 190 | virtual const Type& operator=(const Type& val) { |
| 178 | Type temp{value}; | 191 | Type temp{(ranged) ? std::clamp(val, minimum, maximum) : val}; |
| 179 | std::swap(global, temp); | 192 | std::swap(value, temp); |
| 180 | return global; | 193 | return value; |
| 181 | } | 194 | } |
| 182 | 195 | ||
| 183 | /** | 196 | /** |
| @@ -186,72 +199,28 @@ public: | |||
| 186 | * @returns A reference to the setting | 199 | * @returns A reference to the setting |
| 187 | */ | 200 | */ |
| 188 | explicit virtual operator const Type&() const { | 201 | explicit virtual operator const Type&() const { |
| 189 | return global; | 202 | return value; |
| 190 | } | 203 | } |
| 191 | 204 | ||
| 192 | protected: | 205 | protected: |
| 206 | Type value{}; ///< The setting | ||
| 193 | const Type default_value{}; ///< The default value | 207 | const Type default_value{}; ///< The default value |
| 194 | Type global{}; ///< The setting | 208 | const Type maximum{}; ///< Maximum allowed value of the setting |
| 209 | const Type minimum{}; ///< Minimum allowed value of the setting | ||
| 210 | const bool ranged; ///< The setting has sanitization ranges | ||
| 195 | const std::string label{}; ///< The setting's label | 211 | const std::string label{}; ///< The setting's label |
| 196 | }; | 212 | }; |
| 197 | 213 | ||
| 198 | /** | 214 | /** |
| 199 | * BasicRangedSetting class is intended for use with quantifiable settings that need a more | 215 | * The SwitchableSetting class is a slightly more complex version of the Setting class. This adds a |
| 200 | * restrictive range than implicitly defined by its type. Implements a minimum and maximum that is | ||
| 201 | * simply used to sanitize SetValue and the assignment overload. | ||
| 202 | */ | ||
| 203 | template <typename Type> | ||
| 204 | class BasicRangedSetting : virtual public BasicSetting<Type> { | ||
| 205 | public: | ||
| 206 | /** | ||
| 207 | * Sets a default value, minimum value, maximum value, and label. | ||
| 208 | * | ||
| 209 | * @param default_val Intial value of the setting, and default value of the setting | ||
| 210 | * @param min_val Sets the minimum allowed value of the setting | ||
| 211 | * @param max_val Sets the maximum allowed value of the setting | ||
| 212 | * @param name Label for the setting | ||
| 213 | */ | ||
| 214 | explicit BasicRangedSetting(const Type& default_val, const Type& min_val, const Type& max_val, | ||
| 215 | const std::string& name) | ||
| 216 | : BasicSetting<Type>{default_val, name}, minimum{min_val}, maximum{max_val} {} | ||
| 217 | virtual ~BasicRangedSetting() = default; | ||
| 218 | |||
| 219 | /** | ||
| 220 | * Like BasicSetting's SetValue, except value is clamped to the range of the setting. | ||
| 221 | * | ||
| 222 | * @param value The desired value | ||
| 223 | */ | ||
| 224 | void SetValue(const Type& value) override { | ||
| 225 | this->global = std::clamp(value, minimum, maximum); | ||
| 226 | } | ||
| 227 | |||
| 228 | /** | ||
| 229 | * Like BasicSetting's assignment overload, except value is clamped to the range of the setting. | ||
| 230 | * | ||
| 231 | * @param value The desired value | ||
| 232 | * @returns A reference to the setting's value | ||
| 233 | */ | ||
| 234 | const Type& operator=(const Type& value) override { | ||
| 235 | this->global = std::clamp(value, minimum, maximum); | ||
| 236 | return this->global; | ||
| 237 | } | ||
| 238 | |||
| 239 | const Type minimum; ///< Minimum allowed value of the setting | ||
| 240 | const Type maximum; ///< Maximum allowed value of the setting | ||
| 241 | }; | ||
| 242 | |||
| 243 | /** | ||
| 244 | * The Setting class is a slightly more complex version of the BasicSetting class. This adds a | ||
| 245 | * custom setting to switch to when a guest application specifically requires it. The effect is that | 216 | * custom setting to switch to when a guest application specifically requires it. The effect is that |
| 246 | * other components of the emulator can access the setting's intended value without any need for the | 217 | * other components of the emulator can access the setting's intended value without any need for the |
| 247 | * component to ask whether the custom or global setting is needed at the moment. | 218 | * component to ask whether the custom or global setting is needed at the moment. |
| 248 | * | 219 | * |
| 249 | * By default, the global setting is used. | 220 | * By default, the global setting is used. |
| 250 | * | ||
| 251 | * Like the BasicSetting, this requires setting a default value and label to use. | ||
| 252 | */ | 221 | */ |
| 253 | template <typename Type> | 222 | template <typename Type> |
| 254 | class Setting : virtual public BasicSetting<Type> { | 223 | class SwitchableSetting : virtual public Setting<Type> { |
| 255 | public: | 224 | public: |
| 256 | /** | 225 | /** |
| 257 | * Sets a default value, label, and setting value. | 226 | * Sets a default value, label, and setting value. |
| @@ -259,9 +228,21 @@ public: | |||
| 259 | * @param default_val Intial value of the setting, and default value of the setting | 228 | * @param default_val Intial value of the setting, and default value of the setting |
| 260 | * @param name Label for the setting | 229 | * @param name Label for the setting |
| 261 | */ | 230 | */ |
| 262 | explicit Setting(const Type& default_val, const std::string& name) | 231 | explicit SwitchableSetting(const Type& default_val, const std::string& name) |
| 263 | : BasicSetting<Type>(default_val, name) {} | 232 | : Setting<Type>{default_val, name} {} |
| 264 | virtual ~Setting() = default; | 233 | virtual ~SwitchableSetting() = default; |
| 234 | |||
| 235 | /** | ||
| 236 | * Sets a default value, minimum value, maximum value, and label. | ||
| 237 | * | ||
| 238 | * @param default_val Intial value of the setting, and default value of the setting | ||
| 239 | * @param min_val Sets the minimum allowed value of the setting | ||
| 240 | * @param max_val Sets the maximum allowed value of the setting | ||
| 241 | * @param name Label for the setting | ||
| 242 | */ | ||
| 243 | explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, | ||
| 244 | const std::string& name) | ||
| 245 | : Setting<Type>{default_val, min_val, max_val, name} {} | ||
| 265 | 246 | ||
| 266 | /** | 247 | /** |
| 267 | * Tells this setting to represent either the global or custom setting when other member | 248 | * Tells this setting to represent either the global or custom setting when other member |
| @@ -292,13 +273,13 @@ public: | |||
| 292 | */ | 273 | */ |
| 293 | [[nodiscard]] virtual const Type& GetValue() const override { | 274 | [[nodiscard]] virtual const Type& GetValue() const override { |
| 294 | if (use_global) { | 275 | if (use_global) { |
| 295 | return this->global; | 276 | return this->value; |
| 296 | } | 277 | } |
| 297 | return custom; | 278 | return custom; |
| 298 | } | 279 | } |
| 299 | [[nodiscard]] virtual const Type& GetValue(bool need_global) const { | 280 | [[nodiscard]] virtual const Type& GetValue(bool need_global) const { |
| 300 | if (use_global || need_global) { | 281 | if (use_global || need_global) { |
| 301 | return this->global; | 282 | return this->value; |
| 302 | } | 283 | } |
| 303 | return custom; | 284 | return custom; |
| 304 | } | 285 | } |
| @@ -306,12 +287,12 @@ public: | |||
| 306 | /** | 287 | /** |
| 307 | * Sets the current setting value depending on the global state. | 288 | * Sets the current setting value depending on the global state. |
| 308 | * | 289 | * |
| 309 | * @param value The new value | 290 | * @param val The new value |
| 310 | */ | 291 | */ |
| 311 | void SetValue(const Type& value) override { | 292 | void SetValue(const Type& val) override { |
| 312 | Type temp{value}; | 293 | Type temp{(this->ranged) ? std::clamp(val, this->minimum, this->maximum) : val}; |
| 313 | if (use_global) { | 294 | if (use_global) { |
| 314 | std::swap(this->global, temp); | 295 | std::swap(this->value, temp); |
| 315 | } else { | 296 | } else { |
| 316 | std::swap(custom, temp); | 297 | std::swap(custom, temp); |
| 317 | } | 298 | } |
| @@ -320,15 +301,15 @@ public: | |||
| 320 | /** | 301 | /** |
| 321 | * Assigns the current setting value depending on the global state. | 302 | * Assigns the current setting value depending on the global state. |
| 322 | * | 303 | * |
| 323 | * @param value The new value | 304 | * @param val The new value |
| 324 | * | 305 | * |
| 325 | * @returns A reference to the current setting value | 306 | * @returns A reference to the current setting value |
| 326 | */ | 307 | */ |
| 327 | const Type& operator=(const Type& value) override { | 308 | const Type& operator=(const Type& val) override { |
| 328 | Type temp{value}; | 309 | Type temp{(this->ranged) ? std::clamp(val, this->minimum, this->maximum) : val}; |
| 329 | if (use_global) { | 310 | if (use_global) { |
| 330 | std::swap(this->global, temp); | 311 | std::swap(this->value, temp); |
| 331 | return this->global; | 312 | return this->value; |
| 332 | } | 313 | } |
| 333 | std::swap(custom, temp); | 314 | std::swap(custom, temp); |
| 334 | return custom; | 315 | return custom; |
| @@ -341,7 +322,7 @@ public: | |||
| 341 | */ | 322 | */ |
| 342 | virtual explicit operator const Type&() const override { | 323 | virtual explicit operator const Type&() const override { |
| 343 | if (use_global) { | 324 | if (use_global) { |
| 344 | return this->global; | 325 | return this->value; |
| 345 | } | 326 | } |
| 346 | return custom; | 327 | return custom; |
| 347 | } | 328 | } |
| @@ -352,75 +333,6 @@ protected: | |||
| 352 | }; | 333 | }; |
| 353 | 334 | ||
| 354 | /** | 335 | /** |
| 355 | * RangedSetting is a Setting that implements a maximum and minimum value for its setting. Intended | ||
| 356 | * for use with quantifiable settings. | ||
| 357 | */ | ||
| 358 | template <typename Type> | ||
| 359 | class RangedSetting final : public BasicRangedSetting<Type>, public Setting<Type> { | ||
| 360 | public: | ||
| 361 | /** | ||
| 362 | * Sets a default value, minimum value, maximum value, and label. | ||
| 363 | * | ||
| 364 | * @param default_val Intial value of the setting, and default value of the setting | ||
| 365 | * @param min_val Sets the minimum allowed value of the setting | ||
| 366 | * @param max_val Sets the maximum allowed value of the setting | ||
| 367 | * @param name Label for the setting | ||
| 368 | */ | ||
| 369 | explicit RangedSetting(const Type& default_val, const Type& min_val, const Type& max_val, | ||
| 370 | const std::string& name) | ||
| 371 | : BasicSetting<Type>{default_val, name}, | ||
| 372 | BasicRangedSetting<Type>{default_val, min_val, max_val, name}, Setting<Type>{default_val, | ||
| 373 | name} {} | ||
| 374 | virtual ~RangedSetting() = default; | ||
| 375 | |||
| 376 | // The following are needed to avoid a MSVC bug | ||
| 377 | // (source: https://stackoverflow.com/questions/469508) | ||
| 378 | [[nodiscard]] const Type& GetValue() const override { | ||
| 379 | return Setting<Type>::GetValue(); | ||
| 380 | } | ||
| 381 | [[nodiscard]] const Type& GetValue(bool need_global) const override { | ||
| 382 | return Setting<Type>::GetValue(need_global); | ||
| 383 | } | ||
| 384 | explicit operator const Type&() const override { | ||
| 385 | if (this->use_global) { | ||
| 386 | return this->global; | ||
| 387 | } | ||
| 388 | return this->custom; | ||
| 389 | } | ||
| 390 | |||
| 391 | /** | ||
| 392 | * Like BasicSetting's SetValue, except value is clamped to the range of the setting. Sets the | ||
| 393 | * appropriate value depending on the global state. | ||
| 394 | * | ||
| 395 | * @param value The desired value | ||
| 396 | */ | ||
| 397 | void SetValue(const Type& value) override { | ||
| 398 | const Type temp = std::clamp(value, this->minimum, this->maximum); | ||
| 399 | if (this->use_global) { | ||
| 400 | this->global = temp; | ||
| 401 | } | ||
| 402 | this->custom = temp; | ||
| 403 | } | ||
| 404 | |||
| 405 | /** | ||
| 406 | * Like BasicSetting's assignment overload, except value is clamped to the range of the setting. | ||
| 407 | * Uses the appropriate value depending on the global state. | ||
| 408 | * | ||
| 409 | * @param value The desired value | ||
| 410 | * @returns A reference to the setting's value | ||
| 411 | */ | ||
| 412 | const Type& operator=(const Type& value) override { | ||
| 413 | const Type temp = std::clamp(value, this->minimum, this->maximum); | ||
| 414 | if (this->use_global) { | ||
| 415 | this->global = temp; | ||
| 416 | return this->global; | ||
| 417 | } | ||
| 418 | this->custom = temp; | ||
| 419 | return this->custom; | ||
| 420 | } | ||
| 421 | }; | ||
| 422 | |||
| 423 | /** | ||
| 424 | * The InputSetting class allows for getting a reference to either the global or custom members. | 336 | * The InputSetting class allows for getting a reference to either the global or custom members. |
| 425 | * This is required as we cannot easily modify the values of user-defined types within containers | 337 | * This is required as we cannot easily modify the values of user-defined types within containers |
| 426 | * using the SetValue() member function found in the Setting class. The primary purpose of this | 338 | * using the SetValue() member function found in the Setting class. The primary purpose of this |
| @@ -431,7 +343,7 @@ template <typename Type> | |||
| 431 | class InputSetting final { | 343 | class InputSetting final { |
| 432 | public: | 344 | public: |
| 433 | InputSetting() = default; | 345 | InputSetting() = default; |
| 434 | explicit InputSetting(Type val) : BasicSetting<Type>(val) {} | 346 | explicit InputSetting(Type val) : Setting<Type>(val) {} |
| 435 | ~InputSetting() = default; | 347 | ~InputSetting() = default; |
| 436 | void SetGlobal(bool to_global) { | 348 | void SetGlobal(bool to_global) { |
| 437 | use_global = to_global; | 349 | use_global = to_global; |
| @@ -459,175 +371,175 @@ struct TouchFromButtonMap { | |||
| 459 | 371 | ||
| 460 | struct Values { | 372 | struct Values { |
| 461 | // Audio | 373 | // Audio |
| 462 | BasicSetting<std::string> audio_device_id{"auto", "output_device"}; | 374 | Setting<std::string> audio_device_id{"auto", "output_device"}; |
| 463 | BasicSetting<std::string> sink_id{"auto", "output_engine"}; | 375 | Setting<std::string> sink_id{"auto", "output_engine"}; |
| 464 | BasicSetting<bool> audio_muted{false, "audio_muted"}; | 376 | Setting<bool> audio_muted{false, "audio_muted"}; |
| 465 | RangedSetting<u8> volume{100, 0, 100, "volume"}; | 377 | SwitchableSetting<u8> volume{100, 0, 100, "volume"}; |
| 466 | 378 | ||
| 467 | // Core | 379 | // Core |
| 468 | Setting<bool> use_multi_core{true, "use_multi_core"}; | 380 | SwitchableSetting<bool> use_multi_core{true, "use_multi_core"}; |
| 469 | Setting<bool> use_extended_memory_layout{false, "use_extended_memory_layout"}; | 381 | SwitchableSetting<bool> use_extended_memory_layout{false, "use_extended_memory_layout"}; |
| 470 | 382 | ||
| 471 | // Cpu | 383 | // Cpu |
| 472 | RangedSetting<CPUAccuracy> cpu_accuracy{CPUAccuracy::Auto, CPUAccuracy::Auto, | 384 | SwitchableSetting<CPUAccuracy> cpu_accuracy{CPUAccuracy::Auto, CPUAccuracy::Auto, |
| 473 | CPUAccuracy::Paranoid, "cpu_accuracy"}; | 385 | CPUAccuracy::Paranoid, "cpu_accuracy"}; |
| 474 | // TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021 | 386 | // TODO: remove cpu_accuracy_first_time, migration setting added 8 July 2021 |
| 475 | BasicSetting<bool> cpu_accuracy_first_time{true, "cpu_accuracy_first_time"}; | 387 | Setting<bool> cpu_accuracy_first_time{true, "cpu_accuracy_first_time"}; |
| 476 | BasicSetting<bool> cpu_debug_mode{false, "cpu_debug_mode"}; | 388 | Setting<bool> cpu_debug_mode{false, "cpu_debug_mode"}; |
| 477 | 389 | ||
| 478 | BasicSetting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"}; | 390 | Setting<bool> cpuopt_page_tables{true, "cpuopt_page_tables"}; |
| 479 | BasicSetting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"}; | 391 | Setting<bool> cpuopt_block_linking{true, "cpuopt_block_linking"}; |
| 480 | BasicSetting<bool> cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"}; | 392 | Setting<bool> cpuopt_return_stack_buffer{true, "cpuopt_return_stack_buffer"}; |
| 481 | BasicSetting<bool> cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"}; | 393 | Setting<bool> cpuopt_fast_dispatcher{true, "cpuopt_fast_dispatcher"}; |
| 482 | BasicSetting<bool> cpuopt_context_elimination{true, "cpuopt_context_elimination"}; | 394 | Setting<bool> cpuopt_context_elimination{true, "cpuopt_context_elimination"}; |
| 483 | BasicSetting<bool> cpuopt_const_prop{true, "cpuopt_const_prop"}; | 395 | Setting<bool> cpuopt_const_prop{true, "cpuopt_const_prop"}; |
| 484 | BasicSetting<bool> cpuopt_misc_ir{true, "cpuopt_misc_ir"}; | 396 | Setting<bool> cpuopt_misc_ir{true, "cpuopt_misc_ir"}; |
| 485 | BasicSetting<bool> cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"}; | 397 | Setting<bool> cpuopt_reduce_misalign_checks{true, "cpuopt_reduce_misalign_checks"}; |
| 486 | BasicSetting<bool> cpuopt_fastmem{true, "cpuopt_fastmem"}; | 398 | Setting<bool> cpuopt_fastmem{true, "cpuopt_fastmem"}; |
| 487 | BasicSetting<bool> cpuopt_fastmem_exclusives{true, "cpuopt_fastmem_exclusives"}; | 399 | Setting<bool> cpuopt_fastmem_exclusives{true, "cpuopt_fastmem_exclusives"}; |
| 488 | BasicSetting<bool> cpuopt_recompile_exclusives{true, "cpuopt_recompile_exclusives"}; | 400 | Setting<bool> cpuopt_recompile_exclusives{true, "cpuopt_recompile_exclusives"}; |
| 489 | 401 | ||
| 490 | Setting<bool> cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"}; | 402 | SwitchableSetting<bool> cpuopt_unsafe_unfuse_fma{true, "cpuopt_unsafe_unfuse_fma"}; |
| 491 | Setting<bool> cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"}; | 403 | SwitchableSetting<bool> cpuopt_unsafe_reduce_fp_error{true, "cpuopt_unsafe_reduce_fp_error"}; |
| 492 | Setting<bool> cpuopt_unsafe_ignore_standard_fpcr{true, "cpuopt_unsafe_ignore_standard_fpcr"}; | 404 | SwitchableSetting<bool> cpuopt_unsafe_ignore_standard_fpcr{ |
| 493 | Setting<bool> cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"}; | 405 | true, "cpuopt_unsafe_ignore_standard_fpcr"}; |
| 494 | Setting<bool> cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"}; | 406 | SwitchableSetting<bool> cpuopt_unsafe_inaccurate_nan{true, "cpuopt_unsafe_inaccurate_nan"}; |
| 495 | Setting<bool> cpuopt_unsafe_ignore_global_monitor{true, "cpuopt_unsafe_ignore_global_monitor"}; | 407 | SwitchableSetting<bool> cpuopt_unsafe_fastmem_check{true, "cpuopt_unsafe_fastmem_check"}; |
| 408 | SwitchableSetting<bool> cpuopt_unsafe_ignore_global_monitor{ | ||
| 409 | true, "cpuopt_unsafe_ignore_global_monitor"}; | ||
| 496 | 410 | ||
| 497 | // Renderer | 411 | // Renderer |
| 498 | RangedSetting<RendererBackend> renderer_backend{ | 412 | SwitchableSetting<RendererBackend> renderer_backend{ |
| 499 | RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Vulkan, "backend"}; | 413 | RendererBackend::Vulkan, RendererBackend::OpenGL, RendererBackend::Vulkan, "backend"}; |
| 500 | BasicSetting<bool> renderer_debug{false, "debug"}; | 414 | Setting<bool> renderer_debug{false, "debug"}; |
| 501 | BasicSetting<bool> renderer_shader_feedback{false, "shader_feedback"}; | 415 | Setting<bool> renderer_shader_feedback{false, "shader_feedback"}; |
| 502 | BasicSetting<bool> enable_nsight_aftermath{false, "nsight_aftermath"}; | 416 | Setting<bool> enable_nsight_aftermath{false, "nsight_aftermath"}; |
| 503 | BasicSetting<bool> disable_shader_loop_safety_checks{false, | 417 | Setting<bool> disable_shader_loop_safety_checks{false, "disable_shader_loop_safety_checks"}; |
| 504 | "disable_shader_loop_safety_checks"}; | 418 | SwitchableSetting<int> vulkan_device{0, "vulkan_device"}; |
| 505 | Setting<int> vulkan_device{0, "vulkan_device"}; | ||
| 506 | 419 | ||
| 507 | ResolutionScalingInfo resolution_info{}; | 420 | ResolutionScalingInfo resolution_info{}; |
| 508 | Setting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; | 421 | SwitchableSetting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; |
| 509 | Setting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"}; | 422 | SwitchableSetting<ScalingFilter> scaling_filter{ScalingFilter::Bilinear, "scaling_filter"}; |
| 510 | Setting<AntiAliasing> anti_aliasing{AntiAliasing::None, "anti_aliasing"}; | 423 | SwitchableSetting<AntiAliasing> anti_aliasing{AntiAliasing::None, "anti_aliasing"}; |
| 511 | // *nix platforms may have issues with the borderless windowed fullscreen mode. | 424 | // *nix platforms may have issues with the borderless windowed fullscreen mode. |
| 512 | // Default to exclusive fullscreen on these platforms for now. | 425 | // Default to exclusive fullscreen on these platforms for now. |
| 513 | RangedSetting<FullscreenMode> fullscreen_mode{ | 426 | SwitchableSetting<FullscreenMode> fullscreen_mode{ |
| 514 | #ifdef _WIN32 | 427 | #ifdef _WIN32 |
| 515 | FullscreenMode::Borderless, | 428 | FullscreenMode::Borderless, |
| 516 | #else | 429 | #else |
| 517 | FullscreenMode::Exclusive, | 430 | FullscreenMode::Exclusive, |
| 518 | #endif | 431 | #endif |
| 519 | FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"}; | 432 | FullscreenMode::Borderless, FullscreenMode::Exclusive, "fullscreen_mode"}; |
| 520 | RangedSetting<int> aspect_ratio{0, 0, 3, "aspect_ratio"}; | 433 | SwitchableSetting<int> aspect_ratio{0, 0, 3, "aspect_ratio"}; |
| 521 | RangedSetting<int> max_anisotropy{0, 0, 5, "max_anisotropy"}; | 434 | SwitchableSetting<int> max_anisotropy{0, 0, 5, "max_anisotropy"}; |
| 522 | Setting<bool> use_speed_limit{true, "use_speed_limit"}; | 435 | SwitchableSetting<bool> use_speed_limit{true, "use_speed_limit"}; |
| 523 | RangedSetting<u16> speed_limit{100, 0, 9999, "speed_limit"}; | 436 | SwitchableSetting<u16> speed_limit{100, 0, 9999, "speed_limit"}; |
| 524 | Setting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; | 437 | SwitchableSetting<bool> use_disk_shader_cache{true, "use_disk_shader_cache"}; |
| 525 | RangedSetting<GPUAccuracy> gpu_accuracy{GPUAccuracy::High, GPUAccuracy::Normal, | 438 | SwitchableSetting<GPUAccuracy> gpu_accuracy{GPUAccuracy::High, GPUAccuracy::Normal, |
| 526 | GPUAccuracy::Extreme, "gpu_accuracy"}; | 439 | GPUAccuracy::Extreme, "gpu_accuracy"}; |
| 527 | Setting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; | 440 | SwitchableSetting<bool> use_asynchronous_gpu_emulation{true, "use_asynchronous_gpu_emulation"}; |
| 528 | Setting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; | 441 | SwitchableSetting<NvdecEmulation> nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; |
| 529 | Setting<bool> accelerate_astc{true, "accelerate_astc"}; | 442 | SwitchableSetting<bool> accelerate_astc{true, "accelerate_astc"}; |
| 530 | Setting<bool> use_vsync{true, "use_vsync"}; | 443 | SwitchableSetting<bool> use_vsync{true, "use_vsync"}; |
| 531 | RangedSetting<u16> fps_cap{1000, 1, 1000, "fps_cap"}; | 444 | SwitchableSetting<u16> fps_cap{1000, 1, 1000, "fps_cap"}; |
| 532 | BasicSetting<bool> disable_fps_limit{false, "disable_fps_limit"}; | 445 | Setting<bool> disable_fps_limit{false, "disable_fps_limit"}; |
| 533 | RangedSetting<ShaderBackend> shader_backend{ShaderBackend::GLASM, ShaderBackend::GLSL, | 446 | SwitchableSetting<ShaderBackend> shader_backend{ShaderBackend::GLASM, ShaderBackend::GLSL, |
| 534 | ShaderBackend::SPIRV, "shader_backend"}; | 447 | ShaderBackend::SPIRV, "shader_backend"}; |
| 535 | Setting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"}; | 448 | SwitchableSetting<bool> use_asynchronous_shaders{false, "use_asynchronous_shaders"}; |
| 536 | Setting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; | 449 | SwitchableSetting<bool> use_fast_gpu_time{true, "use_fast_gpu_time"}; |
| 537 | 450 | ||
| 538 | Setting<u8> bg_red{0, "bg_red"}; | 451 | SwitchableSetting<u8> bg_red{0, "bg_red"}; |
| 539 | Setting<u8> bg_green{0, "bg_green"}; | 452 | SwitchableSetting<u8> bg_green{0, "bg_green"}; |
| 540 | Setting<u8> bg_blue{0, "bg_blue"}; | 453 | SwitchableSetting<u8> bg_blue{0, "bg_blue"}; |
| 541 | 454 | ||
| 542 | // System | 455 | // System |
| 543 | Setting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; | 456 | SwitchableSetting<std::optional<u32>> rng_seed{std::optional<u32>(), "rng_seed"}; |
| 544 | // Measured in seconds since epoch | 457 | // Measured in seconds since epoch |
| 545 | std::optional<s64> custom_rtc; | 458 | std::optional<s64> custom_rtc; |
| 546 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 459 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 547 | s64 custom_rtc_differential; | 460 | s64 custom_rtc_differential; |
| 548 | 461 | ||
| 549 | BasicSetting<s32> current_user{0, "current_user"}; | 462 | Setting<s32> current_user{0, "current_user"}; |
| 550 | RangedSetting<s32> language_index{1, 0, 17, "language_index"}; | 463 | SwitchableSetting<s32> language_index{1, 0, 17, "language_index"}; |
| 551 | RangedSetting<s32> region_index{1, 0, 6, "region_index"}; | 464 | SwitchableSetting<s32> region_index{1, 0, 6, "region_index"}; |
| 552 | RangedSetting<s32> time_zone_index{0, 0, 45, "time_zone_index"}; | 465 | SwitchableSetting<s32> time_zone_index{0, 0, 45, "time_zone_index"}; |
| 553 | RangedSetting<s32> sound_index{1, 0, 2, "sound_index"}; | 466 | SwitchableSetting<s32> sound_index{1, 0, 2, "sound_index"}; |
| 554 | 467 | ||
| 555 | // Controls | 468 | // Controls |
| 556 | InputSetting<std::array<PlayerInput, 10>> players; | 469 | InputSetting<std::array<PlayerInput, 10>> players; |
| 557 | 470 | ||
| 558 | Setting<bool> use_docked_mode{true, "use_docked_mode"}; | 471 | SwitchableSetting<bool> use_docked_mode{true, "use_docked_mode"}; |
| 559 | 472 | ||
| 560 | BasicSetting<bool> enable_raw_input{false, "enable_raw_input"}; | 473 | Setting<bool> enable_raw_input{false, "enable_raw_input"}; |
| 561 | BasicSetting<bool> controller_navigation{true, "controller_navigation"}; | 474 | Setting<bool> controller_navigation{true, "controller_navigation"}; |
| 562 | 475 | ||
| 563 | Setting<bool> vibration_enabled{true, "vibration_enabled"}; | 476 | SwitchableSetting<bool> vibration_enabled{true, "vibration_enabled"}; |
| 564 | Setting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; | 477 | SwitchableSetting<bool> enable_accurate_vibrations{false, "enable_accurate_vibrations"}; |
| 565 | 478 | ||
| 566 | Setting<bool> motion_enabled{true, "motion_enabled"}; | 479 | SwitchableSetting<bool> motion_enabled{true, "motion_enabled"}; |
| 567 | BasicSetting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"}; | 480 | Setting<std::string> udp_input_servers{"127.0.0.1:26760", "udp_input_servers"}; |
| 568 | BasicSetting<bool> enable_udp_controller{false, "enable_udp_controller"}; | 481 | Setting<bool> enable_udp_controller{false, "enable_udp_controller"}; |
| 569 | 482 | ||
| 570 | BasicSetting<bool> pause_tas_on_load{true, "pause_tas_on_load"}; | 483 | Setting<bool> pause_tas_on_load{true, "pause_tas_on_load"}; |
| 571 | BasicSetting<bool> tas_enable{false, "tas_enable"}; | 484 | Setting<bool> tas_enable{false, "tas_enable"}; |
| 572 | BasicSetting<bool> tas_loop{false, "tas_loop"}; | 485 | Setting<bool> tas_loop{false, "tas_loop"}; |
| 573 | 486 | ||
| 574 | BasicSetting<bool> mouse_panning{false, "mouse_panning"}; | 487 | Setting<bool> mouse_panning{false, "mouse_panning"}; |
| 575 | BasicRangedSetting<u8> mouse_panning_sensitivity{10, 1, 100, "mouse_panning_sensitivity"}; | 488 | Setting<u8> mouse_panning_sensitivity{10, 1, 100, "mouse_panning_sensitivity"}; |
| 576 | BasicSetting<bool> mouse_enabled{false, "mouse_enabled"}; | 489 | Setting<bool> mouse_enabled{false, "mouse_enabled"}; |
| 577 | 490 | ||
| 578 | BasicSetting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"}; | 491 | Setting<bool> emulate_analog_keyboard{false, "emulate_analog_keyboard"}; |
| 579 | BasicSetting<bool> keyboard_enabled{false, "keyboard_enabled"}; | 492 | Setting<bool> keyboard_enabled{false, "keyboard_enabled"}; |
| 580 | 493 | ||
| 581 | BasicSetting<bool> debug_pad_enabled{false, "debug_pad_enabled"}; | 494 | Setting<bool> debug_pad_enabled{false, "debug_pad_enabled"}; |
| 582 | ButtonsRaw debug_pad_buttons; | 495 | ButtonsRaw debug_pad_buttons; |
| 583 | AnalogsRaw debug_pad_analogs; | 496 | AnalogsRaw debug_pad_analogs; |
| 584 | 497 | ||
| 585 | TouchscreenInput touchscreen; | 498 | TouchscreenInput touchscreen; |
| 586 | 499 | ||
| 587 | BasicSetting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", | 500 | Setting<std::string> touch_device{"min_x:100,min_y:50,max_x:1800,max_y:850", "touch_device"}; |
| 588 | "touch_device"}; | 501 | Setting<int> touch_from_button_map_index{0, "touch_from_button_map"}; |
| 589 | BasicSetting<int> touch_from_button_map_index{0, "touch_from_button_map"}; | ||
| 590 | std::vector<TouchFromButtonMap> touch_from_button_maps; | 502 | std::vector<TouchFromButtonMap> touch_from_button_maps; |
| 591 | 503 | ||
| 592 | BasicSetting<bool> enable_ring_controller{true, "enable_ring_controller"}; | 504 | Setting<bool> enable_ring_controller{true, "enable_ring_controller"}; |
| 593 | RingconRaw ringcon_analogs; | 505 | RingconRaw ringcon_analogs; |
| 594 | 506 | ||
| 595 | // Data Storage | 507 | // Data Storage |
| 596 | BasicSetting<bool> use_virtual_sd{true, "use_virtual_sd"}; | 508 | Setting<bool> use_virtual_sd{true, "use_virtual_sd"}; |
| 597 | BasicSetting<bool> gamecard_inserted{false, "gamecard_inserted"}; | 509 | Setting<bool> gamecard_inserted{false, "gamecard_inserted"}; |
| 598 | BasicSetting<bool> gamecard_current_game{false, "gamecard_current_game"}; | 510 | Setting<bool> gamecard_current_game{false, "gamecard_current_game"}; |
| 599 | BasicSetting<std::string> gamecard_path{std::string(), "gamecard_path"}; | 511 | Setting<std::string> gamecard_path{std::string(), "gamecard_path"}; |
| 600 | 512 | ||
| 601 | // Debugging | 513 | // Debugging |
| 602 | bool record_frame_times; | 514 | bool record_frame_times; |
| 603 | BasicSetting<bool> use_gdbstub{false, "use_gdbstub"}; | 515 | Setting<bool> use_gdbstub{false, "use_gdbstub"}; |
| 604 | BasicSetting<u16> gdbstub_port{6543, "gdbstub_port"}; | 516 | Setting<u16> gdbstub_port{6543, "gdbstub_port"}; |
| 605 | BasicSetting<std::string> program_args{std::string(), "program_args"}; | 517 | Setting<std::string> program_args{std::string(), "program_args"}; |
| 606 | BasicSetting<bool> dump_exefs{false, "dump_exefs"}; | 518 | Setting<bool> dump_exefs{false, "dump_exefs"}; |
| 607 | BasicSetting<bool> dump_nso{false, "dump_nso"}; | 519 | Setting<bool> dump_nso{false, "dump_nso"}; |
| 608 | BasicSetting<bool> dump_shaders{false, "dump_shaders"}; | 520 | Setting<bool> dump_shaders{false, "dump_shaders"}; |
| 609 | BasicSetting<bool> dump_macros{false, "dump_macros"}; | 521 | Setting<bool> dump_macros{false, "dump_macros"}; |
| 610 | BasicSetting<bool> enable_fs_access_log{false, "enable_fs_access_log"}; | 522 | Setting<bool> enable_fs_access_log{false, "enable_fs_access_log"}; |
| 611 | BasicSetting<bool> reporting_services{false, "reporting_services"}; | 523 | Setting<bool> reporting_services{false, "reporting_services"}; |
| 612 | BasicSetting<bool> quest_flag{false, "quest_flag"}; | 524 | Setting<bool> quest_flag{false, "quest_flag"}; |
| 613 | BasicSetting<bool> disable_macro_jit{false, "disable_macro_jit"}; | 525 | Setting<bool> disable_macro_jit{false, "disable_macro_jit"}; |
| 614 | BasicSetting<bool> extended_logging{false, "extended_logging"}; | 526 | Setting<bool> extended_logging{false, "extended_logging"}; |
| 615 | BasicSetting<bool> use_debug_asserts{false, "use_debug_asserts"}; | 527 | Setting<bool> use_debug_asserts{false, "use_debug_asserts"}; |
| 616 | BasicSetting<bool> use_auto_stub{false, "use_auto_stub"}; | 528 | Setting<bool> use_auto_stub{false, "use_auto_stub"}; |
| 617 | BasicSetting<bool> enable_all_controllers{false, "enable_all_controllers"}; | 529 | Setting<bool> enable_all_controllers{false, "enable_all_controllers"}; |
| 618 | 530 | ||
| 619 | // Miscellaneous | 531 | // Miscellaneous |
| 620 | BasicSetting<std::string> log_filter{"*:Info", "log_filter"}; | 532 | Setting<std::string> log_filter{"*:Info", "log_filter"}; |
| 621 | BasicSetting<bool> use_dev_keys{false, "use_dev_keys"}; | 533 | Setting<bool> use_dev_keys{false, "use_dev_keys"}; |
| 622 | 534 | ||
| 623 | // Network | 535 | // Network |
| 624 | BasicSetting<std::string> network_interface{std::string(), "network_interface"}; | 536 | Setting<std::string> network_interface{std::string(), "network_interface"}; |
| 625 | 537 | ||
| 626 | // WebService | 538 | // WebService |
| 627 | BasicSetting<bool> enable_telemetry{true, "enable_telemetry"}; | 539 | Setting<bool> enable_telemetry{true, "enable_telemetry"}; |
| 628 | BasicSetting<std::string> web_api_url{"https://api.yuzu-emu.org", "web_api_url"}; | 540 | Setting<std::string> web_api_url{"https://api.yuzu-emu.org", "web_api_url"}; |
| 629 | BasicSetting<std::string> yuzu_username{std::string(), "yuzu_username"}; | 541 | Setting<std::string> yuzu_username{std::string(), "yuzu_username"}; |
| 630 | BasicSetting<std::string> yuzu_token{std::string(), "yuzu_token"}; | 542 | Setting<std::string> yuzu_token{std::string(), "yuzu_token"}; |
| 631 | 543 | ||
| 632 | // Add-Ons | 544 | // Add-Ons |
| 633 | std::map<u64, std::vector<std::string>> disabled_addons; | 545 | std::map<u64, std::vector<std::string>> disabled_addons; |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 9df4752be..9686412d0 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -133,7 +133,7 @@ void Config::Initialize(const std::string& config_name) { | |||
| 133 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant, nor | 133 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant, nor |
| 134 | // can it implicitly convert a QVariant back to a {std::,Q}string | 134 | // can it implicitly convert a QVariant back to a {std::,Q}string |
| 135 | template <> | 135 | template <> |
| 136 | void Config::ReadBasicSetting(Settings::BasicSetting<std::string>& setting) { | 136 | void Config::ReadBasicSetting(Settings::Setting<std::string>& setting) { |
| 137 | const QString name = QString::fromStdString(setting.GetLabel()); | 137 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 138 | const auto default_value = QString::fromStdString(setting.GetDefault()); | 138 | const auto default_value = QString::fromStdString(setting.GetDefault()); |
| 139 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | 139 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { |
| @@ -144,7 +144,7 @@ void Config::ReadBasicSetting(Settings::BasicSetting<std::string>& setting) { | |||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | template <typename Type> | 146 | template <typename Type> |
| 147 | void Config::ReadBasicSetting(Settings::BasicSetting<Type>& setting) { | 147 | void Config::ReadBasicSetting(Settings::Setting<Type>& setting) { |
| 148 | const QString name = QString::fromStdString(setting.GetLabel()); | 148 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 149 | const Type default_value = setting.GetDefault(); | 149 | const Type default_value = setting.GetDefault(); |
| 150 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | 150 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { |
| @@ -157,7 +157,7 @@ void Config::ReadBasicSetting(Settings::BasicSetting<Type>& setting) { | |||
| 157 | 157 | ||
| 158 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant | 158 | // Explicit std::string definition: Qt can't implicitly convert a std::string to a QVariant |
| 159 | template <> | 159 | template <> |
| 160 | void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& setting) { | 160 | void Config::WriteBasicSetting(const Settings::Setting<std::string>& setting) { |
| 161 | const QString name = QString::fromStdString(setting.GetLabel()); | 161 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 162 | const std::string& value = setting.GetValue(); | 162 | const std::string& value = setting.GetValue(); |
| 163 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | 163 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); |
| @@ -165,7 +165,7 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& settin | |||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | template <typename Type> | 167 | template <typename Type> |
| 168 | void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) { | 168 | void Config::WriteBasicSetting(const Settings::Setting<Type>& setting) { |
| 169 | const QString name = QString::fromStdString(setting.GetLabel()); | 169 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 170 | const Type value = setting.GetValue(); | 170 | const Type value = setting.GetValue(); |
| 171 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); | 171 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); |
| @@ -173,7 +173,7 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) { | |||
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | template <typename Type> | 175 | template <typename Type> |
| 176 | void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) { | 176 | void Config::WriteGlobalSetting(const Settings::SwitchableSetting<Type>& setting) { |
| 177 | const QString name = QString::fromStdString(setting.GetLabel()); | 177 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 178 | const Type& value = setting.GetValue(global); | 178 | const Type& value = setting.GetValue(global); |
| 179 | if (!global) { | 179 | if (!global) { |
| @@ -1422,7 +1422,7 @@ QVariant Config::ReadSetting(const QString& name, const QVariant& default_value) | |||
| 1422 | } | 1422 | } |
| 1423 | 1423 | ||
| 1424 | template <typename Type> | 1424 | template <typename Type> |
| 1425 | void Config::ReadGlobalSetting(Settings::Setting<Type>& setting) { | 1425 | void Config::ReadGlobalSetting(Settings::SwitchableSetting<Type>& setting) { |
| 1426 | QString name = QString::fromStdString(setting.GetLabel()); | 1426 | QString name = QString::fromStdString(setting.GetLabel()); |
| 1427 | const bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool(); | 1427 | const bool use_global = qt_config->value(name + QStringLiteral("/use_global"), true).toBool(); |
| 1428 | setting.SetGlobal(use_global); | 1428 | setting.SetGlobal(use_global); |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index f0ab6bdaa..9ca878d23 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -160,7 +160,7 @@ private: | |||
| 160 | * @param The setting | 160 | * @param The setting |
| 161 | */ | 161 | */ |
| 162 | template <typename Type> | 162 | template <typename Type> |
| 163 | void ReadGlobalSetting(Settings::Setting<Type>& setting); | 163 | void ReadGlobalSetting(Settings::SwitchableSetting<Type>& setting); |
| 164 | 164 | ||
| 165 | /** | 165 | /** |
| 166 | * Sets a value to the qt_config using the setting's label and default value. If the config is a | 166 | * Sets a value to the qt_config using the setting's label and default value. If the config is a |
| @@ -169,7 +169,7 @@ private: | |||
| 169 | * @param The setting | 169 | * @param The setting |
| 170 | */ | 170 | */ |
| 171 | template <typename Type> | 171 | template <typename Type> |
| 172 | void WriteGlobalSetting(const Settings::Setting<Type>& setting); | 172 | void WriteGlobalSetting(const Settings::SwitchableSetting<Type>& setting); |
| 173 | 173 | ||
| 174 | /** | 174 | /** |
| 175 | * Reads a value from the qt_config using the setting's label and default value and applies the | 175 | * Reads a value from the qt_config using the setting's label and default value and applies the |
| @@ -178,14 +178,14 @@ private: | |||
| 178 | * @param The setting | 178 | * @param The setting |
| 179 | */ | 179 | */ |
| 180 | template <typename Type> | 180 | template <typename Type> |
| 181 | void ReadBasicSetting(Settings::BasicSetting<Type>& setting); | 181 | void ReadBasicSetting(Settings::Setting<Type>& setting); |
| 182 | 182 | ||
| 183 | /** Sets a value from the setting in the qt_config using the setting's label and default value. | 183 | /** Sets a value from the setting in the qt_config using the setting's label and default value. |
| 184 | * | 184 | * |
| 185 | * @param The setting | 185 | * @param The setting |
| 186 | */ | 186 | */ |
| 187 | template <typename Type> | 187 | template <typename Type> |
| 188 | void WriteBasicSetting(const Settings::BasicSetting<Type>& setting); | 188 | void WriteBasicSetting(const Settings::Setting<Type>& setting); |
| 189 | 189 | ||
| 190 | ConfigType type; | 190 | ConfigType type; |
| 191 | std::unique_ptr<QSettings> qt_config; | 191 | std::unique_ptr<QSettings> qt_config; |
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 5190bd18b..dd4959417 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #include "yuzu/configuration/configuration_shared.h" | 9 | #include "yuzu/configuration/configuration_shared.h" |
| 10 | #include "yuzu/configuration/configure_per_game.h" | 10 | #include "yuzu/configuration/configure_per_game.h" |
| 11 | 11 | ||
| 12 | void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting, | 12 | void ConfigurationShared::ApplyPerGameSetting(Settings::SwitchableSetting<bool>* setting, |
| 13 | const QCheckBox* checkbox, | 13 | const QCheckBox* checkbox, |
| 14 | const CheckState& tracker) { | 14 | const CheckState& tracker) { |
| 15 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { | 15 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { |
| @@ -25,7 +25,7 @@ void ConfigurationShared::ApplyPerGameSetting(Settings::Setting<bool>* setting, | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, | 27 | void ConfigurationShared::SetPerGameSetting(QCheckBox* checkbox, |
| 28 | const Settings::Setting<bool>* setting) { | 28 | const Settings::SwitchableSetting<bool>* setting) { |
| 29 | if (setting->UsingGlobal()) { | 29 | if (setting->UsingGlobal()) { |
| 30 | checkbox->setCheckState(Qt::PartiallyChecked); | 30 | checkbox->setCheckState(Qt::PartiallyChecked); |
| 31 | } else { | 31 | } else { |
| @@ -45,7 +45,7 @@ void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { | |||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, | 47 | void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, |
| 48 | const Settings::Setting<bool>& setting, | 48 | const Settings::SwitchableSetting<bool>& setting, |
| 49 | CheckState& tracker) { | 49 | CheckState& tracker) { |
| 50 | if (setting.UsingGlobal()) { | 50 | if (setting.UsingGlobal()) { |
| 51 | tracker = CheckState::Global; | 51 | tracker = CheckState::Global; |
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 903a9baae..77802a367 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h | |||
| @@ -25,10 +25,10 @@ enum class CheckState { | |||
| 25 | // Global-aware apply and set functions | 25 | // Global-aware apply and set functions |
| 26 | 26 | ||
| 27 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting | 27 | // ApplyPerGameSetting, given a Settings::Setting and a Qt UI element, properly applies a Setting |
| 28 | void ApplyPerGameSetting(Settings::Setting<bool>* setting, const QCheckBox* checkbox, | 28 | void ApplyPerGameSetting(Settings::SwitchableSetting<bool>* setting, const QCheckBox* checkbox, |
| 29 | const CheckState& tracker); | 29 | const CheckState& tracker); |
| 30 | template <typename Type> | 30 | template <typename Type> |
| 31 | void ApplyPerGameSetting(Settings::Setting<Type>* setting, const QComboBox* combobox) { | 31 | void ApplyPerGameSetting(Settings::SwitchableSetting<Type>* setting, const QComboBox* combobox) { |
| 32 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { | 32 | if (Settings::IsConfiguringGlobal() && setting->UsingGlobal()) { |
| 33 | setting->SetValue(static_cast<Type>(combobox->currentIndex())); | 33 | setting->SetValue(static_cast<Type>(combobox->currentIndex())); |
| 34 | } else if (!Settings::IsConfiguringGlobal()) { | 34 | } else if (!Settings::IsConfiguringGlobal()) { |
| @@ -43,10 +43,10 @@ void ApplyPerGameSetting(Settings::Setting<Type>* setting, const QComboBox* comb | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // Sets a Qt UI element given a Settings::Setting | 45 | // Sets a Qt UI element given a Settings::Setting |
| 46 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::Setting<bool>* setting); | 46 | void SetPerGameSetting(QCheckBox* checkbox, const Settings::SwitchableSetting<bool>* setting); |
| 47 | 47 | ||
| 48 | template <typename Type> | 48 | template <typename Type> |
| 49 | void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<Type>* setting) { | 49 | void SetPerGameSetting(QComboBox* combobox, const Settings::SwitchableSetting<Type>* setting) { |
| 50 | combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX | 50 | combobox->setCurrentIndex(setting->UsingGlobal() ? ConfigurationShared::USE_GLOBAL_INDEX |
| 51 | : static_cast<int>(setting->GetValue()) + | 51 | : static_cast<int>(setting->GetValue()) + |
| 52 | ConfigurationShared::USE_GLOBAL_OFFSET); | 52 | ConfigurationShared::USE_GLOBAL_OFFSET); |
| @@ -56,7 +56,7 @@ void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<Type>* setti | |||
| 56 | void SetHighlight(QWidget* widget, bool highlighted); | 56 | void SetHighlight(QWidget* widget, bool highlighted); |
| 57 | 57 | ||
| 58 | // Sets up a QCheckBox like a tristate one, given a Setting | 58 | // Sets up a QCheckBox like a tristate one, given a Setting |
| 59 | void SetColoredTristate(QCheckBox* checkbox, const Settings::Setting<bool>& setting, | 59 | void SetColoredTristate(QCheckBox* checkbox, const Settings::SwitchableSetting<bool>& setting, |
| 60 | CheckState& tracker); | 60 | CheckState& tracker); |
| 61 | void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state, | 61 | void SetColoredTristate(QCheckBox* checkbox, bool global, bool state, bool global_state, |
| 62 | CheckState& tracker); | 62 | CheckState& tracker); |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index c64d87ace..044d88ca6 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -64,28 +64,28 @@ struct Values { | |||
| 64 | QByteArray gamelist_header_state; | 64 | QByteArray gamelist_header_state; |
| 65 | 65 | ||
| 66 | QByteArray microprofile_geometry; | 66 | QByteArray microprofile_geometry; |
| 67 | Settings::BasicSetting<bool> microprofile_visible{false, "microProfileDialogVisible"}; | 67 | Settings::Setting<bool> microprofile_visible{false, "microProfileDialogVisible"}; |
| 68 | 68 | ||
| 69 | Settings::BasicSetting<bool> single_window_mode{true, "singleWindowMode"}; | 69 | Settings::Setting<bool> single_window_mode{true, "singleWindowMode"}; |
| 70 | Settings::BasicSetting<bool> fullscreen{false, "fullscreen"}; | 70 | Settings::Setting<bool> fullscreen{false, "fullscreen"}; |
| 71 | Settings::BasicSetting<bool> display_titlebar{true, "displayTitleBars"}; | 71 | Settings::Setting<bool> display_titlebar{true, "displayTitleBars"}; |
| 72 | Settings::BasicSetting<bool> show_filter_bar{true, "showFilterBar"}; | 72 | Settings::Setting<bool> show_filter_bar{true, "showFilterBar"}; |
| 73 | Settings::BasicSetting<bool> show_status_bar{true, "showStatusBar"}; | 73 | Settings::Setting<bool> show_status_bar{true, "showStatusBar"}; |
| 74 | 74 | ||
| 75 | Settings::BasicSetting<bool> confirm_before_closing{true, "confirmClose"}; | 75 | Settings::Setting<bool> confirm_before_closing{true, "confirmClose"}; |
| 76 | Settings::BasicSetting<bool> first_start{true, "firstStart"}; | 76 | Settings::Setting<bool> first_start{true, "firstStart"}; |
| 77 | Settings::BasicSetting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; | 77 | Settings::Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; |
| 78 | Settings::BasicSetting<bool> mute_when_in_background{false, "muteWhenInBackground"}; | 78 | Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"}; |
| 79 | Settings::BasicSetting<bool> hide_mouse{true, "hideInactiveMouse"}; | 79 | Settings::Setting<bool> hide_mouse{true, "hideInactiveMouse"}; |
| 80 | // Set when Vulkan is known to crash the application | 80 | // Set when Vulkan is known to crash the application |
| 81 | Settings::BasicSetting<bool> has_broken_vulkan{false, "has_broken_vulkan"}; | 81 | Settings::Setting<bool> has_broken_vulkan{false, "has_broken_vulkan"}; |
| 82 | 82 | ||
| 83 | Settings::BasicSetting<bool> select_user_on_boot{false, "select_user_on_boot"}; | 83 | Settings::Setting<bool> select_user_on_boot{false, "select_user_on_boot"}; |
| 84 | 84 | ||
| 85 | // Discord RPC | 85 | // Discord RPC |
| 86 | Settings::BasicSetting<bool> enable_discord_presence{true, "enable_discord_presence"}; | 86 | Settings::Setting<bool> enable_discord_presence{true, "enable_discord_presence"}; |
| 87 | 87 | ||
| 88 | Settings::BasicSetting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"}; | 88 | Settings::Setting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"}; |
| 89 | 89 | ||
| 90 | QString roms_path; | 90 | QString roms_path; |
| 91 | QString symbols_path; | 91 | QString symbols_path; |
| @@ -100,25 +100,25 @@ struct Values { | |||
| 100 | // Shortcut name <Shortcut, context> | 100 | // Shortcut name <Shortcut, context> |
| 101 | std::vector<Shortcut> shortcuts; | 101 | std::vector<Shortcut> shortcuts; |
| 102 | 102 | ||
| 103 | Settings::BasicSetting<uint32_t> callout_flags{0, "calloutFlags"}; | 103 | Settings::Setting<uint32_t> callout_flags{0, "calloutFlags"}; |
| 104 | 104 | ||
| 105 | // logging | 105 | // logging |
| 106 | Settings::BasicSetting<bool> show_console{false, "showConsole"}; | 106 | Settings::Setting<bool> show_console{false, "showConsole"}; |
| 107 | 107 | ||
| 108 | // Game List | 108 | // Game List |
| 109 | Settings::BasicSetting<bool> show_add_ons{true, "show_add_ons"}; | 109 | Settings::Setting<bool> show_add_ons{true, "show_add_ons"}; |
| 110 | Settings::BasicSetting<uint32_t> game_icon_size{64, "game_icon_size"}; | 110 | Settings::Setting<uint32_t> game_icon_size{64, "game_icon_size"}; |
| 111 | Settings::BasicSetting<uint32_t> folder_icon_size{48, "folder_icon_size"}; | 111 | Settings::Setting<uint32_t> folder_icon_size{48, "folder_icon_size"}; |
| 112 | Settings::BasicSetting<uint8_t> row_1_text_id{3, "row_1_text_id"}; | 112 | Settings::Setting<uint8_t> row_1_text_id{3, "row_1_text_id"}; |
| 113 | Settings::BasicSetting<uint8_t> row_2_text_id{2, "row_2_text_id"}; | 113 | Settings::Setting<uint8_t> row_2_text_id{2, "row_2_text_id"}; |
| 114 | std::atomic_bool is_game_list_reload_pending{false}; | 114 | std::atomic_bool is_game_list_reload_pending{false}; |
| 115 | Settings::BasicSetting<bool> cache_game_list{true, "cache_game_list"}; | 115 | Settings::Setting<bool> cache_game_list{true, "cache_game_list"}; |
| 116 | Settings::BasicSetting<bool> favorites_expanded{true, "favorites_expanded"}; | 116 | Settings::Setting<bool> favorites_expanded{true, "favorites_expanded"}; |
| 117 | QVector<u64> favorited_ids; | 117 | QVector<u64> favorited_ids; |
| 118 | 118 | ||
| 119 | bool configuration_applied; | 119 | bool configuration_applied; |
| 120 | bool reset_to_defaults; | 120 | bool reset_to_defaults; |
| 121 | Settings::BasicSetting<bool> disable_web_applet{true, "disable_web_applet"}; | 121 | Settings::Setting<bool> disable_web_applet{true, "disable_web_applet"}; |
| 122 | }; | 122 | }; |
| 123 | 123 | ||
| 124 | extern Values values; | 124 | extern Values values; |
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index fc4744fb0..903e02297 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp | |||
| @@ -90,17 +90,17 @@ static const std::array<std::array<int, 5>, Settings::NativeAnalog::NumAnalogs> | |||
| 90 | }}; | 90 | }}; |
| 91 | 91 | ||
| 92 | template <> | 92 | template <> |
| 93 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) { | 93 | void Config::ReadSetting(const std::string& group, Settings::Setting<std::string>& setting) { |
| 94 | setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); | 94 | setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | template <> | 97 | template <> |
| 98 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) { | 98 | void Config::ReadSetting(const std::string& group, Settings::Setting<bool>& setting) { |
| 99 | setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); | 99 | setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | template <typename Type> | 102 | template <typename Type> |
| 103 | void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) { | 103 | void Config::ReadSetting(const std::string& group, Settings::Setting<Type>& setting) { |
| 104 | setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(), | 104 | setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(), |
| 105 | static_cast<long>(setting.GetDefault()))); | 105 | static_cast<long>(setting.GetDefault()))); |
| 106 | } | 106 | } |
diff --git a/src/yuzu_cmd/config.h b/src/yuzu_cmd/config.h index f61ba23ec..ccf77d668 100644 --- a/src/yuzu_cmd/config.h +++ b/src/yuzu_cmd/config.h | |||
| @@ -28,11 +28,11 @@ public: | |||
| 28 | 28 | ||
| 29 | private: | 29 | private: |
| 30 | /** | 30 | /** |
| 31 | * Applies a value read from the sdl2_config to a BasicSetting. | 31 | * Applies a value read from the sdl2_config to a Setting. |
| 32 | * | 32 | * |
| 33 | * @param group The name of the INI group | 33 | * @param group The name of the INI group |
| 34 | * @param setting The yuzu setting to modify | 34 | * @param setting The yuzu setting to modify |
| 35 | */ | 35 | */ |
| 36 | template <typename Type> | 36 | template <typename Type> |
| 37 | void ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting); | 37 | void ReadSetting(const std::string& group, Settings::Setting<Type>& setting); |
| 38 | }; | 38 | }; |