diff options
| -rw-r--r-- | src/common/settings.cpp | 63 | ||||
| -rw-r--r-- | src/common/settings.h | 12 |
2 files changed, 14 insertions, 61 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 3f56afe94..e3f30f7e3 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <exception> | 7 | #include <exception> |
| 8 | #include <stdexcept> | 8 | #include <stdexcept> |
| 9 | #endif | 9 | #endif |
| 10 | #include <functional> | ||
| 10 | #include <string_view> | 11 | #include <string_view> |
| 11 | 12 | ||
| 12 | #include "common/assert.h" | 13 | #include "common/assert.h" |
| @@ -210,65 +211,9 @@ void RestoreGlobalState(bool is_powered_on) { | |||
| 210 | return; | 211 | return; |
| 211 | } | 212 | } |
| 212 | 213 | ||
| 213 | // Audio | 214 | for (const auto& reset : global_reset_registry) { |
| 214 | values.volume.SetGlobal(true); | 215 | reset(); |
| 215 | 216 | } | |
| 216 | // Core | ||
| 217 | values.use_multi_core.SetGlobal(true); | ||
| 218 | values.use_unsafe_extended_memory_layout.SetGlobal(true); | ||
| 219 | |||
| 220 | // CPU | ||
| 221 | values.cpu_accuracy.SetGlobal(true); | ||
| 222 | values.cpuopt_unsafe_unfuse_fma.SetGlobal(true); | ||
| 223 | values.cpuopt_unsafe_reduce_fp_error.SetGlobal(true); | ||
| 224 | values.cpuopt_unsafe_ignore_standard_fpcr.SetGlobal(true); | ||
| 225 | values.cpuopt_unsafe_inaccurate_nan.SetGlobal(true); | ||
| 226 | values.cpuopt_unsafe_fastmem_check.SetGlobal(true); | ||
| 227 | values.cpuopt_unsafe_ignore_global_monitor.SetGlobal(true); | ||
| 228 | |||
| 229 | // Renderer | ||
| 230 | values.fsr_sharpening_slider.SetGlobal(true); | ||
| 231 | values.renderer_backend.SetGlobal(true); | ||
| 232 | values.async_presentation.SetGlobal(true); | ||
| 233 | values.renderer_force_max_clock.SetGlobal(true); | ||
| 234 | values.vulkan_device.SetGlobal(true); | ||
| 235 | values.fullscreen_mode.SetGlobal(true); | ||
| 236 | values.aspect_ratio.SetGlobal(true); | ||
| 237 | values.resolution_setup.SetGlobal(true); | ||
| 238 | values.scaling_filter.SetGlobal(true); | ||
| 239 | values.anti_aliasing.SetGlobal(true); | ||
| 240 | values.max_anisotropy.SetGlobal(true); | ||
| 241 | values.use_speed_limit.SetGlobal(true); | ||
| 242 | values.speed_limit.SetGlobal(true); | ||
| 243 | values.use_disk_shader_cache.SetGlobal(true); | ||
| 244 | values.gpu_accuracy.SetGlobal(true); | ||
| 245 | values.use_asynchronous_gpu_emulation.SetGlobal(true); | ||
| 246 | values.nvdec_emulation.SetGlobal(true); | ||
| 247 | values.accelerate_astc.SetGlobal(true); | ||
| 248 | values.astc_recompression.SetGlobal(true); | ||
| 249 | values.use_reactive_flushing.SetGlobal(true); | ||
| 250 | values.shader_backend.SetGlobal(true); | ||
| 251 | values.use_asynchronous_shaders.SetGlobal(true); | ||
| 252 | values.use_fast_gpu_time.SetGlobal(true); | ||
| 253 | values.use_vulkan_driver_pipeline_cache.SetGlobal(true); | ||
| 254 | values.bg_red.SetGlobal(true); | ||
| 255 | values.bg_green.SetGlobal(true); | ||
| 256 | values.bg_blue.SetGlobal(true); | ||
| 257 | values.enable_compute_pipelines.SetGlobal(true); | ||
| 258 | values.use_video_framerate.SetGlobal(true); | ||
| 259 | |||
| 260 | // System | ||
| 261 | values.language_index.SetGlobal(true); | ||
| 262 | values.region_index.SetGlobal(true); | ||
| 263 | values.time_zone_index.SetGlobal(true); | ||
| 264 | values.rng_seed.SetGlobal(true); | ||
| 265 | values.sound_index.SetGlobal(true); | ||
| 266 | |||
| 267 | // Controls | ||
| 268 | values.players.SetGlobal(true); | ||
| 269 | values.use_docked_mode.SetGlobal(true); | ||
| 270 | values.vibration_enabled.SetGlobal(true); | ||
| 271 | values.motion_enabled.SetGlobal(true); | ||
| 272 | } | 217 | } |
| 273 | 218 | ||
| 274 | } // namespace Settings | 219 | } // namespace Settings |
diff --git a/src/common/settings.h b/src/common/settings.h index b8ab34f7f..61d15467d 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -5,6 +5,8 @@ | |||
| 5 | 5 | ||
| 6 | #include <algorithm> | 6 | #include <algorithm> |
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include <forward_list> | ||
| 9 | #include <functional> | ||
| 8 | #include <map> | 10 | #include <map> |
| 9 | #include <optional> | 11 | #include <optional> |
| 10 | #include <string> | 12 | #include <string> |
| @@ -125,6 +127,8 @@ struct ResolutionScalingInfo { | |||
| 125 | } | 127 | } |
| 126 | }; | 128 | }; |
| 127 | 129 | ||
| 130 | static std::forward_list<std::function<void()>> global_reset_registry; | ||
| 131 | |||
| 128 | /** The Setting class is a simple resource manager. It defines a label and default value alongside | 132 | /** The Setting class is a simple resource manager. It defines a label and default value alongside |
| 129 | * the actual value of the setting for simpler and less-error prone use with frontend | 133 | * the actual value of the setting for simpler and less-error prone use with frontend |
| 130 | * configurations. Specifying a default value and label is required. A minimum and maximum range can | 134 | * configurations. Specifying a default value and label is required. A minimum and maximum range can |
| @@ -255,7 +259,9 @@ public: | |||
| 255 | */ | 259 | */ |
| 256 | explicit SwitchableSetting(const Type& default_val, const std::string& name) | 260 | explicit SwitchableSetting(const Type& default_val, const std::string& name) |
| 257 | requires(!ranged) | 261 | requires(!ranged) |
| 258 | : Setting<Type>{default_val, name} {} | 262 | : Setting<Type>{default_val, name} { |
| 263 | global_reset_registry.push_front([this]() { this->SetGlobal(true); }); | ||
| 264 | } | ||
| 259 | virtual ~SwitchableSetting() = default; | 265 | virtual ~SwitchableSetting() = default; |
| 260 | 266 | ||
| 261 | /** | 267 | /** |
| @@ -269,7 +275,9 @@ public: | |||
| 269 | explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, | 275 | explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val, |
| 270 | const std::string& name) | 276 | const std::string& name) |
| 271 | requires(ranged) | 277 | requires(ranged) |
| 272 | : Setting<Type, true>{default_val, min_val, max_val, name} {} | 278 | : Setting<Type, true>{default_val, min_val, max_val, name} { |
| 279 | global_reset_registry.push_front([this]() { this->SetGlobal(true); }); | ||
| 280 | } | ||
| 273 | 281 | ||
| 274 | /** | 282 | /** |
| 275 | * Tells this setting to represent either the global or custom setting when other member | 283 | * Tells this setting to represent either the global or custom setting when other member |