From 299c5594e6b36cef70b164e00eb671ed32c0d705 Mon Sep 17 00:00:00 2001 From: lat9nq <22451773+lat9nq@users.noreply.github.com> Date: Wed, 30 Jun 2021 20:16:01 -0400 Subject: [PATCH] yuzu_cmd: config: Pass a reference in Also adds documentation for the ReadSetting function. Address review comments. Co-authored-by: Mai M. --- src/yuzu_cmd/config.cpp | 8 ++++---- src/yuzu_cmd/config.h | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 2c8d3f6839..325584a1a7 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -242,19 +242,19 @@ static const std::array keyboard_mods{ }; template <> -void Config::ReadSetting(const std::string& group, Settings::BasicSetting setting) { +void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault()); } template <> -void Config::ReadSetting(const std::string& group, Settings::BasicSetting setting) { +void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault()); } template <> -void Config::ReadSetting(const std::string& group, Settings::BasicSetting setting) { +void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault()); } template -void Config::ReadSetting(const std::string& group, Settings::BasicSetting setting) { +void Config::ReadSetting(const std::string& group, Settings::BasicSetting& setting) { setting = static_cast(sdl2_config->GetInteger(group, setting.GetLabel(), static_cast(setting.GetDefault()))); } diff --git a/src/yuzu_cmd/config.h b/src/yuzu_cmd/config.h index bf0103dee6..1ee932be2e 100644 --- a/src/yuzu_cmd/config.h +++ b/src/yuzu_cmd/config.h @@ -26,6 +26,12 @@ public: void Reload(); private: + /** + * Applies a value read from the sdl2_config to a BasicSetting. + * + * @param group The name of the INI group + * @param setting The yuzu setting to modify + */ template - void ReadSetting(const std::string& group, Settings::BasicSetting setting); + void ReadSetting(const std::string& group, Settings::BasicSetting& setting); };