summaryrefslogtreecommitdiffstats
path: root/src/frontend_common/config.h
diff options
context:
space:
mode:
authort895 <clombardo169@gmail.com>2023-12-29 05:24:23 +0100
committert895 <clombardo169@gmail.com>2023-12-30 21:11:36 +0100
commit051afd21e730005ea24ce3c8743962beb3085031 (patch)
tree268c3ce0d0031e233555389c97a3eed530e9374b /src/frontend_common/config.h
parentandroid: Migrate theme settings to ini (diff)
downloadyuzu-051afd21e730005ea24ce3c8743962beb3085031.tar
yuzu-051afd21e730005ea24ce3c8743962beb3085031.tar.gz
yuzu-051afd21e730005ea24ce3c8743962beb3085031.tar.bz2
yuzu-051afd21e730005ea24ce3c8743962beb3085031.tar.lz
yuzu-051afd21e730005ea24ce3c8743962beb3085031.tar.xz
yuzu-051afd21e730005ea24ce3c8743962beb3085031.tar.zst
yuzu-051afd21e730005ea24ce3c8743962beb3085031.zip
Diffstat (limited to '')
-rw-r--r--src/frontend_common/config.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/frontend_common/config.h b/src/frontend_common/config.h
index b3812af17..e73cf6929 100644
--- a/src/frontend_common/config.h
+++ b/src/frontend_common/config.h
@@ -154,11 +154,20 @@ protected:
* @param use_global Specifies if the custom or global config should be in use, for custom
* configs
*/
- template <typename Type = int>
- void WriteSetting(const std::string& key, const Type& value,
- const std::optional<Type>& default_value = std::nullopt,
- const std::optional<bool>& use_global = std::nullopt);
- void WriteSettingInternal(const std::string& key, const std::string& value);
+ void WriteBooleanSetting(const std::string& key, const bool& value,
+ const std::optional<bool>& default_value = std::nullopt,
+ const std::optional<bool>& use_global = std::nullopt);
+ template <typename T>
+ std::enable_if_t<std::is_integral_v<T>> WriteIntegerSetting(
+ const std::string& key, const T& value,
+ const std::optional<T>& default_value = std::nullopt,
+ const std::optional<bool>& use_global = std::nullopt);
+ void WriteDoubleSetting(const std::string& key, const double& value,
+ const std::optional<double>& default_value = std::nullopt,
+ const std::optional<bool>& use_global = std::nullopt);
+ void WriteStringSetting(const std::string& key, const std::string& value,
+ const std::optional<std::string>& default_value = std::nullopt,
+ const std::optional<bool>& use_global = std::nullopt);
void ReadCategory(Settings::Category category);
void WriteCategory(Settings::Category category);
@@ -175,8 +184,10 @@ protected:
return value_ ? "true" : "false";
} else if constexpr (std::is_same_v<T, u64>) {
return std::to_string(static_cast<u64>(value_));
- } else {
+ } else if constexpr (std::is_same_v<T, s64>) {
return std::to_string(static_cast<s64>(value_));
+ } else {
+ return std::to_string(value_);
}
}
@@ -197,6 +208,11 @@ protected:
const bool global;
private:
+ void WritePreparedSetting(const std::string& key, const std::string& adjusted_value,
+ const std::optional<std::string>& adjusted_default_value,
+ const std::optional<bool>& use_global);
+ void WriteString(const std::string& key, const std::string& value);
+
inline static std::array<char, 19> special_characters = {'!', '#', '$', '%', '^', '&', '*',
'|', ';', '\'', '\"', ',', '<', '.',
'>', '?', '`', '~', '='};