diff options
| author | 2023-05-07 12:51:12 -0400 | |
|---|---|---|
| committer | 2023-07-21 10:56:07 -0400 | |
| commit | bafd569b4768d3888798db8b8e71359b4b844579 (patch) | |
| tree | e1274bbb98db74995e42b2cc60166b1fdef36f20 /src/common | |
| parent | configure_graphics: Partial runtime implementation (diff) | |
| download | yuzu-bafd569b4768d3888798db8b8e71359b4b844579.tar.gz yuzu-bafd569b4768d3888798db8b8e71359b4b844579.tar.xz yuzu-bafd569b4768d3888798db8b8e71359b4b844579.zip | |
settings,uisettings: Add IDs to settings
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/settings.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index 8f02fa9af..69777421e 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -191,6 +191,7 @@ public: | |||
| 191 | virtual bool IsEnum() const = 0; | 191 | virtual bool IsEnum() const = 0; |
| 192 | virtual bool RuntimeModfiable() const = 0; | 192 | virtual bool RuntimeModfiable() const = 0; |
| 193 | virtual void SetGlobal(bool global) {} | 193 | virtual void SetGlobal(bool global) {} |
| 194 | virtual u32 Id() const = 0; | ||
| 194 | virtual bool UsingGlobal() const { | 195 | virtual bool UsingGlobal() const { |
| 195 | return false; | 196 | return false; |
| 196 | } | 197 | } |
| @@ -200,6 +201,7 @@ class Linkage { | |||
| 200 | public: | 201 | public: |
| 201 | std::map<Category, std::forward_list<BasicSetting*>> by_category; | 202 | std::map<Category, std::forward_list<BasicSetting*>> by_category; |
| 202 | std::vector<std::function<void()>> restore_functions; | 203 | std::vector<std::function<void()>> restore_functions; |
| 204 | u32 count; | ||
| 203 | }; | 205 | }; |
| 204 | 206 | ||
| 205 | /** The Setting class is a simple resource manager. It defines a label and default value | 207 | /** The Setting class is a simple resource manager. It defines a label and default value |
| @@ -232,8 +234,10 @@ public: | |||
| 232 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, | 234 | explicit Setting(Linkage& linkage, const Type& default_val, const std::string& name, |
| 233 | enum Category category_) | 235 | enum Category category_) |
| 234 | requires(!ranged) | 236 | requires(!ranged) |
| 235 | : value{default_val}, default_value{default_val}, label{name}, category{category_} { | 237 | : value{default_val}, |
| 238 | default_value{default_val}, label{name}, category{category_}, id{linkage.count} { | ||
| 236 | linkage.by_category[category].push_front(this); | 239 | linkage.by_category[category].push_front(this); |
| 240 | linkage.count++; | ||
| 237 | } | 241 | } |
| 238 | virtual ~Setting() = default; | 242 | virtual ~Setting() = default; |
| 239 | 243 | ||
| @@ -251,8 +255,9 @@ public: | |||
| 251 | const Type& max_val, const std::string& name, enum Category category_) | 255 | const Type& max_val, const std::string& name, enum Category category_) |
| 252 | requires(ranged) | 256 | requires(ranged) |
| 253 | : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val}, | 257 | : value{default_val}, default_value{default_val}, maximum{max_val}, minimum{min_val}, |
| 254 | label{name}, category{category_} { | 258 | label{name}, category{category_}, id{linkage.count} { |
| 255 | linkage.by_category[category].push_front(this); | 259 | linkage.by_category[category].push_front(this); |
| 260 | linkage.count++; | ||
| 256 | } | 261 | } |
| 257 | 262 | ||
| 258 | /** | 263 | /** |
| @@ -418,6 +423,10 @@ public: | |||
| 418 | return std::type_index(typeid(Type)); | 423 | return std::type_index(typeid(Type)); |
| 419 | } | 424 | } |
| 420 | 425 | ||
| 426 | virtual u32 Id() const override { | ||
| 427 | return id; | ||
| 428 | } | ||
| 429 | |||
| 421 | protected: | 430 | protected: |
| 422 | Type value{}; ///< The setting | 431 | Type value{}; ///< The setting |
| 423 | const Type default_value{}; ///< The default value | 432 | const Type default_value{}; ///< The default value |
| @@ -425,6 +434,7 @@ protected: | |||
| 425 | const Type minimum{}; ///< Minimum allowed value of the setting | 434 | const Type minimum{}; ///< Minimum allowed value of the setting |
| 426 | const std::string label{}; ///< The setting's label | 435 | const std::string label{}; ///< The setting's label |
| 427 | const enum Category category; ///< The setting's category AKA INI group | 436 | const enum Category category; ///< The setting's category AKA INI group |
| 437 | const u32 id; | ||
| 428 | }; | 438 | }; |
| 429 | 439 | ||
| 430 | /** | 440 | /** |
| @@ -728,7 +738,7 @@ struct Values { | |||
| 728 | linkage, VSyncMode::FIFO, VSyncMode::Immediate, VSyncMode::FIFORelaxed, | 738 | linkage, VSyncMode::FIFO, VSyncMode::Immediate, VSyncMode::FIFORelaxed, |
| 729 | "use_vsync", Category::Renderer}; | 739 | "use_vsync", Category::Renderer}; |
| 730 | SwitchableSetting<bool> use_reactive_flushing{linkage, true, "use_reactive_flushing", | 740 | SwitchableSetting<bool> use_reactive_flushing{linkage, true, "use_reactive_flushing", |
| 731 | Category::Renderer}; | 741 | Category::RendererAdvanced}; |
| 732 | SwitchableSetting<ShaderBackend, true> shader_backend{ | 742 | SwitchableSetting<ShaderBackend, true> shader_backend{ |
| 733 | linkage, ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV, | 743 | linkage, ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV, |
| 734 | "shader_backend", Category::Renderer}; | 744 | "shader_backend", Category::Renderer}; |