summaryrefslogtreecommitdiffstats
path: root/src/common/settings.h
diff options
context:
space:
mode:
authorlat9nq <22451773+lat9nq@users.noreply.github.com>2023-05-04 09:44:53 +0200
committerlat9nq <22451773+lat9nq@users.noreply.github.com>2023-07-21 16:56:07 +0200
commit5ccfaf0517ed365e64458783b30f521d3ed21c78 (patch)
tree236082bbd35dd53021f68b4580e4309d42f157d4 /src/common/settings.h
parentsettings,video_core: Consolidate ASTC decoding options (diff)
downloadyuzu-5ccfaf0517ed365e64458783b30f521d3ed21c78.tar
yuzu-5ccfaf0517ed365e64458783b30f521d3ed21c78.tar.gz
yuzu-5ccfaf0517ed365e64458783b30f521d3ed21c78.tar.bz2
yuzu-5ccfaf0517ed365e64458783b30f521d3ed21c78.tar.lz
yuzu-5ccfaf0517ed365e64458783b30f521d3ed21c78.tar.xz
yuzu-5ccfaf0517ed365e64458783b30f521d3ed21c78.tar.zst
yuzu-5ccfaf0517ed365e64458783b30f521d3ed21c78.zip
Diffstat (limited to '')
-rw-r--r--src/common/settings.h12
1 files changed, 10 insertions, 2 deletions
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 @@
#include <algorithm>
#include <array>
+#include <forward_list>
+#include <functional>
#include <map>
#include <optional>
#include <string>
@@ -125,6 +127,8 @@ struct ResolutionScalingInfo {
}
};
+static std::forward_list<std::function<void()>> global_reset_registry;
+
/** The Setting class is a simple resource manager. It defines a label and default value alongside
* the actual value of the setting for simpler and less-error prone use with frontend
* configurations. Specifying a default value and label is required. A minimum and maximum range can
@@ -255,7 +259,9 @@ public:
*/
explicit SwitchableSetting(const Type& default_val, const std::string& name)
requires(!ranged)
- : Setting<Type>{default_val, name} {}
+ : Setting<Type>{default_val, name} {
+ global_reset_registry.push_front([this]() { this->SetGlobal(true); });
+ }
virtual ~SwitchableSetting() = default;
/**
@@ -269,7 +275,9 @@ public:
explicit SwitchableSetting(const Type& default_val, const Type& min_val, const Type& max_val,
const std::string& name)
requires(ranged)
- : Setting<Type, true>{default_val, min_val, max_val, name} {}
+ : Setting<Type, true>{default_val, min_val, max_val, name} {
+ global_reset_registry.push_front([this]() { this->SetGlobal(true); });
+ }
/**
* Tells this setting to represent either the global or custom setting when other member