diff options
Diffstat (limited to 'src/common/settings.h')
| -rw-r--r-- | src/common/settings.h | 452 |
1 files changed, 182 insertions, 270 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; |