From 04d4b6ab802a1238eaca6c0a16d1a739503b81d9 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sat, 10 Jun 2023 23:40:39 -0400 Subject: (ui,)settings: Use explicit instantiation Reduces compile times a tad on clang. --- src/common/settings_common.h | 78 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 src/common/settings_common.h (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h new file mode 100644 index 000000000..93fddeba6 --- /dev/null +++ b/src/common/settings_common.h @@ -0,0 +1,78 @@ +#pragma once + +#include +#include +#include +#include +#include +#include "common/common_types.h" + +namespace Settings { + +enum class Category : u32 { + Audio, + Core, + Cpu, + CpuDebug, + CpuUnsafe, + Renderer, + RendererAdvanced, + RendererDebug, + System, + SystemAudio, + DataStorage, + Debugging, + DebuggingGraphics, + Miscellaneous, + Network, + WebService, + AddOns, + Controls, + Ui, + UiGeneral, + UiLayout, + UiGameList, + Screenshots, + Shortcuts, + Multiplayer, + Services, + Paths, + MaxEnum, +}; + +class BasicSetting { +protected: + explicit BasicSetting() = default; + +public: + virtual ~BasicSetting() = default; + + virtual Category Category() const = 0; + virtual constexpr bool Switchable() const = 0; + virtual std::string ToString() const = 0; + virtual std::string ToStringGlobal() const; + virtual void LoadString(const std::string& load) = 0; + virtual std::string Canonicalize() const = 0; + virtual const std::string& GetLabel() const = 0; + virtual std::string DefaultToString() const = 0; + virtual bool Save() const = 0; + virtual std::type_index TypeId() const = 0; + virtual constexpr bool IsEnum() const = 0; + virtual bool RuntimeModfiable() const = 0; + virtual void SetGlobal(bool global) {} + virtual constexpr u32 Id() const = 0; + virtual std::string MinVal() const = 0; + virtual std::string MaxVal() const = 0; + virtual bool UsingGlobal() const; +}; + +class Linkage { +public: + explicit Linkage(u32 initial_count = 0); + ~Linkage(); + std::map> by_category{}; + std::vector> restore_functions{}; + u32 count; +}; + +} // namespace Settings -- cgit v1.2.3 From 11e7e1b8cec5a665bdc6c9e702f83ad6ea35dd6b Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Mon, 12 Jun 2023 17:05:30 -0400 Subject: settings: Move some simple data to BasicSetting Reduces the need for the compiler to duplicate this code, by about 100KB executable size. --- src/common/settings_common.h | 96 ++++++++++++++++++++++++++++++++------------ 1 file changed, 71 insertions(+), 25 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 93fddeba6..81d59115d 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include @@ -40,31 +43,7 @@ enum class Category : u32 { MaxEnum, }; -class BasicSetting { -protected: - explicit BasicSetting() = default; - -public: - virtual ~BasicSetting() = default; - - virtual Category Category() const = 0; - virtual constexpr bool Switchable() const = 0; - virtual std::string ToString() const = 0; - virtual std::string ToStringGlobal() const; - virtual void LoadString(const std::string& load) = 0; - virtual std::string Canonicalize() const = 0; - virtual const std::string& GetLabel() const = 0; - virtual std::string DefaultToString() const = 0; - virtual bool Save() const = 0; - virtual std::type_index TypeId() const = 0; - virtual constexpr bool IsEnum() const = 0; - virtual bool RuntimeModfiable() const = 0; - virtual void SetGlobal(bool global) {} - virtual constexpr u32 Id() const = 0; - virtual std::string MinVal() const = 0; - virtual std::string MaxVal() const = 0; - virtual bool UsingGlobal() const; -}; +class BasicSetting; class Linkage { public: @@ -75,4 +54,71 @@ public: u32 count; }; +class BasicSetting { +protected: + explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, + bool save_, bool runtime_modifiable_); + +public: + virtual ~BasicSetting(); + + /* Data retrieval */ + + [[nodiscard]] virtual std::string ToString() const = 0; + [[nodiscard]] virtual std::string ToStringGlobal() const; + [[nodiscard]] virtual std::string DefaultToString() const = 0; + [[nodiscard]] virtual std::string MinVal() const = 0; + [[nodiscard]] virtual std::string MaxVal() const = 0; + virtual void LoadString(const std::string& load) = 0; + [[nodiscard]] virtual std::string Canonicalize() const = 0; + + /* Identification */ + + [[nodiscard]] virtual std::type_index TypeId() const = 0; + [[nodiscard]] virtual constexpr bool IsEnum() const = 0; + /** + * Returns whether the current setting is Switchable. + * + * @returns If the setting is a SwitchableSetting + */ + [[nodiscard]] virtual constexpr bool Switchable() const { + return false; + } + /** + * Returns the save preference of the setting i.e. when saving or reading the setting from a + * frontend, whether this setting should be skipped. + * + * @returns The save preference + */ + [[nodiscard]] bool Save() const; + [[nodiscard]] bool RuntimeModfiable() const; + [[nodiscard]] constexpr u32 Id() const { + return id; + } + /** + * Returns the setting's category AKA INI group. + * + * @returns The setting's category + */ + [[nodiscard]] Category Category() const; + /** + * Returns the label this setting was created with. + * + * @returns A reference to the label + */ + [[nodiscard]] const std::string& GetLabel() const; + + /* Switchable settings */ + + virtual void SetGlobal(bool global); + [[nodiscard]] virtual bool UsingGlobal() const; + +private: + const std::string label; ///< The setting's label + const enum Category category; ///< The setting's category AKA INI group + const u32 id; + const bool save; + const bool runtime_modifiable; +}; + } // namespace Settings -- cgit v1.2.3 From b4f2ad3ff5c49549bc72997360c31d0662a97439 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 13 Jun 2023 19:37:41 -0400 Subject: settings: Move IsConfiguringGlobal to settings_common --- src/common/settings_common.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 81d59115d..9d1044a19 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -43,6 +43,9 @@ enum class Category : u32 { MaxEnum, }; +bool IsConfiguringGlobal(); +void SetConfiguringGlobal(bool is_global); + class BasicSetting; class Linkage { -- cgit v1.2.3 From 27e53990ed7100159cc08fd8470a9faecd011cbe Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 13 Jun 2023 19:37:54 -0400 Subject: settings: Document BasicSetting, add Ranged --- src/common/settings_common.h | 115 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 106 insertions(+), 9 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 9d1044a19..4d6d3021e 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -57,6 +57,10 @@ public: u32 count; }; +/** + * BasicSetting is an abstract class that only keeps track of metadata. The string methods are + * available to get data values out. + */ class BasicSetting { protected: explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, @@ -65,45 +69,117 @@ protected: public: virtual ~BasicSetting(); - /* Data retrieval */ + /* + * Data retrieval + */ + /** + * Returns a string representation of the internal data. If the Setting is Switchable, it + * respects the internal global state: it is based on GetValue(). + * + * @returns A string representation of the internal data. + */ [[nodiscard]] virtual std::string ToString() const = 0; + + /** + * Returns a string representation of the global version of internal data. If the Setting is + * not Switchable, it behaves like ToString. + * + * @returns A string representation of the global version of internal data. + */ [[nodiscard]] virtual std::string ToStringGlobal() const; + + /** + * @returns A string representation of the Setting's default value. + */ [[nodiscard]] virtual std::string DefaultToString() const = 0; + + /** + * Returns a string representation of the minimum value of the setting. If the Setting is not + * ranged, the string represents the default initialization of the data type. + * + * @returns A string representation of the minimum value of the setting. + */ [[nodiscard]] virtual std::string MinVal() const = 0; + + /** + * Returns a string representation of the maximum value of the setting. If the Setting is not + * ranged, the string represents the default initialization of the data type. + * + * @returns A string representation of the maximum value of the setting. + */ [[nodiscard]] virtual std::string MaxVal() const = 0; + + /** + * Takes a string input, converts it to the internal data type if necessary, and then runs + * SetValue with it. + * + * @param load String of the input data. + */ virtual void LoadString(const std::string& load) = 0; + + /** + * Returns a string representation of the data. If the data is an enum, it returns a string of + * the enum value. If the internal data type is not an enum, this is equivalent to ToString. + * + * e.g. renderer_backend.Canonicalize() == "OpenGL" + * + * @returns Canonicalized string representation of the internal data + */ [[nodiscard]] virtual std::string Canonicalize() const = 0; - /* Identification */ + /* + * Metadata + */ + /** + * @returns A unique identifier for the Setting's internal data type. + */ [[nodiscard]] virtual std::type_index TypeId() const = 0; + + /** + * Returns true if the Setting's internal data type is an enum. + * + * @returns True if the Setting's internal data type is an enum + */ [[nodiscard]] virtual constexpr bool IsEnum() const = 0; + /** - * Returns whether the current setting is Switchable. + * Returns true if the current setting is Switchable. * * @returns If the setting is a SwitchableSetting */ [[nodiscard]] virtual constexpr bool Switchable() const { return false; } + /** - * Returns the save preference of the setting i.e. when saving or reading the setting from a - * frontend, whether this setting should be skipped. + * Returns true to suggest that a frontend can read or write the setting to a configuration + * file. * * @returns The save preference */ [[nodiscard]] bool Save() const; + + /** + * @returns true if the current setting can be changed while the guest is running. + */ [[nodiscard]] bool RuntimeModfiable() const; + + /** + * @returns A unique number corresponding to the setting. + */ [[nodiscard]] constexpr u32 Id() const { return id; } + /** * Returns the setting's category AKA INI group. * * @returns The setting's category */ [[nodiscard]] Category Category() const; + /** * Returns the label this setting was created with. * @@ -111,17 +187,38 @@ public: */ [[nodiscard]] const std::string& GetLabel() const; - /* Switchable settings */ + /** + * @returns If the Setting checks input values for valid ranges. + */ + [[nodiscard]] virtual constexpr bool Ranged() const = 0; + + /* + * Switchable settings + */ + /** + * Sets a setting's global state. True means use the normal setting, false to use a custom + * value. Has no effect if the Setting is not Switchable. + * + * @param global The desired state + */ virtual void SetGlobal(bool global); + + /** + * Returns true if the setting is using the normal setting value. Always true if the setting is + * not Switchable. + * + * @returns The Setting's global state + */ [[nodiscard]] virtual bool UsingGlobal() const; private: const std::string label; ///< The setting's label const enum Category category; ///< The setting's category AKA INI group - const u32 id; - const bool save; - const bool runtime_modifiable; + const u32 id; ///< Unique integer for the setting + const bool save; ///< Suggests if the setting should be saved and read to a frontend config + const bool + runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running }; } // namespace Settings -- cgit v1.2.3 From ee32b177823b9b8499c9fd188a571884f00cf655 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sun, 18 Jun 2023 03:52:41 -0400 Subject: common,yuzu-qt: GCC warning silences Fixes -Wshadow, -Wdeprecated, and catch by copy rather than by ref. --- src/common/settings_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 4d6d3021e..2b5c72f41 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -178,7 +178,7 @@ public: * * @returns The setting's category */ - [[nodiscard]] Category Category() const; + [[nodiscard]] enum Category Category() const; /** * Returns the label this setting was created with. -- cgit v1.2.3 From b2438f1fb7d083ffe8c8afdc30e9c612631d6ace Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 21 Jun 2023 03:23:36 -0400 Subject: settings: Define specializations for settings Suggests to a frontend how to represent each setting. --- src/common/settings_common.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 2b5c72f41..664c807f1 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -43,6 +43,17 @@ enum class Category : u32 { MaxEnum, }; +enum class Specialization : u32 { + Default, + Time, + Hex, + List, + RuntimeList, + Scalar, + Countable, + Paired, +}; + bool IsConfiguringGlobal(); void SetConfiguringGlobal(bool is_global); @@ -64,7 +75,7 @@ public: class BasicSetting { protected: explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, - bool save_, bool runtime_modifiable_); + bool save_, bool runtime_modifiable_, Specialization spec); public: virtual ~BasicSetting(); @@ -180,6 +191,11 @@ public: */ [[nodiscard]] enum Category Category() const; + /** + * @returns Extra metadata for data representation in frontend implementations. + */ + [[nodiscard]] enum Specialization Specialization() const; + /** * Returns the label this setting was created with. * @@ -219,6 +235,8 @@ private: const bool save; ///< Suggests if the setting should be saved and read to a frontend config const bool runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running + const enum Specialization + specialization; ///< Extra data to identify representation of a setting }; } // namespace Settings -- cgit v1.2.3 From 7f708e8d77fb6237407f49246622dbe1b445d536 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 21 Jun 2023 04:32:13 -0400 Subject: settings: Define paired settings settings_common: Remove unused optional --- src/common/settings_common.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 664c807f1..ad005ca4e 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -75,7 +75,8 @@ public: class BasicSetting { protected: explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, - bool save_, bool runtime_modifiable_, Specialization spec); + bool save_, bool runtime_modifiable_, Specialization spec, + BasicSetting* other_setting); public: virtual ~BasicSetting(); @@ -196,6 +197,11 @@ public: */ [[nodiscard]] enum Specialization Specialization() const; + /** + * @returns Another BasicSetting if one is paired, or nullptr otherwise. + */ + [[nodiscard]] BasicSetting* PairedSetting() const; + /** * Returns the label this setting was created with. * @@ -236,7 +242,8 @@ private: const bool runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running const enum Specialization - specialization; ///< Extra data to identify representation of a setting + specialization; ///< Extra data to identify representation of a setting + BasicSetting* const other_setting; ///< A paired setting }; } // namespace Settings -- cgit v1.2.3 From 926f3e3d3e6ff57633d2d44085f02754ffe1c988 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 21 Jun 2023 05:04:21 -0400 Subject: settings,configuration: Add a default suffix --- src/common/settings_common.h | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index ad005ca4e..6b717deb1 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -43,15 +43,21 @@ enum class Category : u32 { MaxEnum, }; -enum class Specialization : u32 { - Default, - Time, - Hex, - List, - RuntimeList, - Scalar, - Countable, - Paired, +constexpr u8 SpecializationTypeMask = 0xf; +constexpr u8 SpecializationAttributeMask = 0xf0; +constexpr u8 SpecializationAttributeOffset = 4; + +enum Specialization : u8 { + Default = 0, + Time = 1, + Hex = 2, + List = 3, + RuntimeList = 4, + Scalar = 5, + Countable = 6, + Paired = 7, + + Percentage = (1 << SpecializationAttributeOffset), }; bool IsConfiguringGlobal(); @@ -75,7 +81,7 @@ public: class BasicSetting { protected: explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, - bool save_, bool runtime_modifiable_, Specialization spec, + bool save_, bool runtime_modifiable_, u32 specialization, BasicSetting* other_setting); public: @@ -195,7 +201,7 @@ public: /** * @returns Extra metadata for data representation in frontend implementations. */ - [[nodiscard]] enum Specialization Specialization() const; + [[nodiscard]] u32 Specialization() const; /** * @returns Another BasicSetting if one is paired, or nullptr otherwise. @@ -240,9 +246,8 @@ private: const u32 id; ///< Unique integer for the setting const bool save; ///< Suggests if the setting should be saved and read to a frontend config const bool - runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running - const enum Specialization - specialization; ///< Extra data to identify representation of a setting + runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running + const u32 specialization; ///< Extra data to identify representation of a setting BasicSetting* const other_setting; ///< A paired setting }; -- cgit v1.2.3 From 52cc7b438bbaccb440382d0fd38d2d0805907814 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 21 Jun 2023 17:06:10 -0400 Subject: settings_common: Remove unncessary enum spec --- src/common/settings_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 6b717deb1..669d32204 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -80,8 +80,8 @@ public: */ class BasicSetting { protected: - explicit BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, - bool save_, bool runtime_modifiable_, u32 specialization, + explicit BasicSetting(Linkage& linkage, const std::string& name, Category category_, bool save_, + bool runtime_modifiable_, u32 specialization, BasicSetting* other_setting); public: -- cgit v1.2.3 From e7f01128f181a7b754f6d5f94122cde059c7ed1a Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 21 Jun 2023 21:41:06 -0400 Subject: settings: Give indices to enums --- src/common/settings_common.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 669d32204..b355384a4 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -220,6 +220,11 @@ public: */ [[nodiscard]] virtual constexpr bool Ranged() const = 0; + /** + * @returns The index of the enum if the underlying setting type is an enum, else max of u32. + */ + [[nodiscard]] virtual constexpr u32 EnumIndex() const = 0; + /* * Switchable settings */ -- cgit v1.2.3 From 1e093767a85ee0fdce6f1619e967a6560963dcf3 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:42:59 -0400 Subject: common,configure_system: Rename method to GetCategory Fixes essentially a shadowing issue. --- src/common/settings_common.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index b355384a4..ca218e37b 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -196,7 +196,7 @@ public: * * @returns The setting's category */ - [[nodiscard]] enum Category Category() const; + [[nodiscard]] Category GetCategory() const; /** * @returns Extra metadata for data representation in frontend implementations. @@ -246,9 +246,9 @@ public: [[nodiscard]] virtual bool UsingGlobal() const; private: - const std::string label; ///< The setting's label - const enum Category category; ///< The setting's category AKA INI group - const u32 id; ///< Unique integer for the setting + const std::string label; ///< The setting's label + const Category category; ///< The setting's category AKA INI group + const u32 id; ///< Unique integer for the setting const bool save; ///< Suggests if the setting should be saved and read to a frontend config const bool runtime_modifiable; ///< Suggests if the setting can be modified while a guest is running -- cgit v1.2.3 From 32116231924bfc1ad356fc0f39df327a393b8df1 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:49:36 -0400 Subject: common: Move global configuration state modifiers back to settings --- src/common/settings_common.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index ca218e37b..a7630a97f 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -60,9 +60,6 @@ enum Specialization : u8 { Percentage = (1 << SpecializationAttributeOffset), }; -bool IsConfiguringGlobal(); -void SetConfiguringGlobal(bool is_global); - class BasicSetting; class Linkage { -- cgit v1.2.3 From 2911988b852ec29016780aabb1f46e2d0c231744 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 19 Jul 2023 13:46:48 -0400 Subject: settings_common: Use a vector in category linkage Improve storage requirements. --- src/common/settings_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index a7630a97f..bfd1bad64 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -66,7 +66,7 @@ class Linkage { public: explicit Linkage(u32 initial_count = 0); ~Linkage(); - std::map> by_category{}; + std::map> by_category{}; std::vector> restore_functions{}; u32 count; }; -- cgit v1.2.3 From 17b9c1e1715a16bebcdd92c02ce7f7e503212462 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Fri, 21 Jul 2023 23:09:09 -0400 Subject: common,qt-config: Remove usage of forward_list --- src/common/settings_common.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index bfd1bad64..6f90ae90d 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -3,7 +3,6 @@ #pragma once -#include #include #include #include -- cgit v1.2.3 From f84e7b4656f1e69cced4e58117df920efaec922e Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Sun, 23 Jul 2023 16:21:08 -0400 Subject: settings_common: Document specializations --- src/common/settings_common.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/common/settings_common.h') diff --git a/src/common/settings_common.h b/src/common/settings_common.h index 6f90ae90d..2efb329b0 100644 --- a/src/common/settings_common.h +++ b/src/common/settings_common.h @@ -46,17 +46,18 @@ constexpr u8 SpecializationTypeMask = 0xf; constexpr u8 SpecializationAttributeMask = 0xf0; constexpr u8 SpecializationAttributeOffset = 4; +// Scalar and countable could have better names enum Specialization : u8 { Default = 0, - Time = 1, - Hex = 2, - List = 3, - RuntimeList = 4, - Scalar = 5, - Countable = 6, - Paired = 7, - - Percentage = (1 << SpecializationAttributeOffset), + Time = 1, // Duration or specific moment in time + Hex = 2, // Hexadecimal number + List = 3, // Setting has specific members + RuntimeList = 4, // Members of the list are determined during runtime + Scalar = 5, // Values are continuous + Countable = 6, // Can be stepped through + Paired = 7, // Another setting is associated with this setting + + Percentage = (1 << SpecializationAttributeOffset), // Should be represented as a percentage }; class BasicSetting; -- cgit v1.2.3