From 3a7a5edceaec30b0c34c492724068a8dc20eb181 Mon Sep 17 00:00:00 2001
From: lat9nq <22451773+lat9nq@users.noreply.github.com>
Date: Mon, 8 May 2023 10:03:40 -0400
Subject: [PATCH] settings: Define base renderer runtime modifiable settings

---
 src/common/settings.h                         | 43 ++++++++++---------
 src/yuzu/configuration/configuration_shared.h |  9 ++--
 2 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/src/common/settings.h b/src/common/settings.h
index 1c26081c9..2879237cc 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -701,32 +701,33 @@ struct Values {
     ResolutionScalingInfo resolution_info{};
     SwitchableSetting<ResolutionSetup> resolution_setup{linkage, ResolutionSetup::Res1X,
                                                         "resolution_setup", Category::Renderer};
-    SwitchableSetting<ScalingFilter> scaling_filter{linkage, ScalingFilter::Bilinear,
-                                                    "scaling_filter", Category::Renderer};
-    SwitchableSetting<int, true> fsr_sharpening_slider{
+    SwitchableSetting<ScalingFilter, false, true, true> scaling_filter{
+        linkage, ScalingFilter::Bilinear, "scaling_filter", Category::Renderer};
+    SwitchableSetting<int, true, true, true> fsr_sharpening_slider{
         linkage, 25, 0, 200, "fsr_sharpening_slider", Category::Renderer};
-    SwitchableSetting<AntiAliasing> anti_aliasing{linkage, AntiAliasing::None, "anti_aliasing",
-                                                  Category::Renderer};
+    SwitchableSetting<AntiAliasing, false, true, true> anti_aliasing{
+        linkage, AntiAliasing::None, "anti_aliasing", Category::Renderer};
     // *nix platforms may have issues with the borderless windowed fullscreen mode.
     // Default to exclusive fullscreen on these platforms for now.
-    SwitchableSetting<FullscreenMode, true> fullscreen_mode{linkage,
+    SwitchableSetting<FullscreenMode, true, true, true> fullscreen_mode{linkage,
 #ifdef _WIN32
-                                                            FullscreenMode::Borderless,
+                                                                        FullscreenMode::Borderless,
 #else
-                                                            FullscreenMode::Exclusive,
+                                                                        FullscreenMode::Exclusive,
 #endif
-                                                            FullscreenMode::Borderless,
-                                                            FullscreenMode::Exclusive,
-                                                            "fullscreen_mode",
-                                                            Category::Renderer};
-    SwitchableSetting<int, true> aspect_ratio{linkage, 0, 0, 4, "aspect_ratio", Category::Renderer};
+                                                                        FullscreenMode::Borderless,
+                                                                        FullscreenMode::Exclusive,
+                                                                        "fullscreen_mode",
+                                                                        Category::Renderer};
+    SwitchableSetting<int, true, true, true> aspect_ratio{
+        linkage, 0, 0, 4, "aspect_ratio", Category::Renderer};
     SwitchableSetting<AnisotropyMode, true> max_anisotropy{
         linkage,          AnisotropyMode::Automatic, AnisotropyMode::Automatic, AnisotropyMode::X16,
         "max_anisotropy", Category::RendererAdvanced};
-    SwitchableSetting<bool, false, false> use_speed_limit{linkage, true, "use_speed_limit",
-                                                          Category::Renderer};
-    SwitchableSetting<u16, true> speed_limit{linkage, 100,           0,
-                                             9999,    "speed_limit", Category::Renderer};
+    SwitchableSetting<bool, false, false, true> use_speed_limit{linkage, true, "use_speed_limit",
+                                                                Category::Renderer};
+    SwitchableSetting<u16, true, true, true> speed_limit{
+        linkage, 100, 0, 9999, "speed_limit", Category::Renderer};
     SwitchableSetting<bool> use_disk_shader_cache{linkage, true, "use_disk_shader_cache",
                                                   Category::Renderer};
     SwitchableSetting<GPUAccuracy, true, true, true> gpu_accuracy{
@@ -742,7 +743,7 @@ struct Values {
                                                             AstcDecodeMode::CPUAsynchronous,
                                                             "accelerate_astc",
                                                             Category::Renderer};
-    Setting<VSyncMode, true> vsync_mode{
+    Setting<VSyncMode, true, true, true> vsync_mode{
         linkage,     VSyncMode::FIFO,   VSyncMode::Immediate, VSyncMode::FIFORelaxed,
         "use_vsync", Category::Renderer};
     SwitchableSetting<bool> use_reactive_flushing{linkage, true, "use_reactive_flushing",
@@ -769,9 +770,9 @@ struct Values {
     SwitchableSetting<bool> barrier_feedback_loops{linkage, true, "barrier_feedback_loops",
                                                    Category::RendererAdvanced};
 
-    SwitchableSetting<u8> bg_red{linkage, 0, "bg_red", Category::Renderer};
-    SwitchableSetting<u8> bg_green{linkage, 0, "bg_green", Category::Renderer};
-    SwitchableSetting<u8> bg_blue{linkage, 0, "bg_blue", Category::Renderer};
+    SwitchableSetting<u8, false, true, true> bg_red{linkage, 0, "bg_red", Category::Renderer};
+    SwitchableSetting<u8, false, true, true> bg_green{linkage, 0, "bg_green", Category::Renderer};
+    SwitchableSetting<u8, false, true, true> bg_blue{linkage, 0, "bg_blue", Category::Renderer};
 
     // System
     SwitchableSetting<bool> rng_seed_enabled{linkage, false, "rng_seed_enabled", Category::System};
diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h
index d0fe6ea38..d70828935 100644
--- a/src/yuzu/configuration/configuration_shared.h
+++ b/src/yuzu/configuration/configuration_shared.h
@@ -92,10 +92,11 @@ void SetPerGameSetting(QComboBox* combobox,
 void SetHighlight(QWidget* widget, bool highlighted);
 
 // Sets up a QCheckBox like a tristate one, given a Setting
-template <bool ranged, bool save>
-void SetColoredTristate(QCheckBox* checkbox,
-                        const Settings::SwitchableSetting<bool, ranged, save>& setting,
-                        CheckState& tracker) {
+template <bool ranged, bool save, bool runtime_modifiable>
+void SetColoredTristate(
+    QCheckBox* checkbox,
+    const Settings::SwitchableSetting<bool, ranged, save, runtime_modifiable>& setting,
+    CheckState& tracker) {
     if (setting.UsingGlobal()) {
         tracker = CheckState::Global;
     } else {