yuzu_cmd: config: Pass a reference in
Also adds documentation for the ReadSetting function. Address review comments. Co-authored-by: Mai M. <mathew1800@gmail.com>
This commit is contained in:
parent
0e5c74bc9e
commit
299c5594e6
2 changed files with 11 additions and 5 deletions
|
@ -242,19 +242,19 @@ static const std::array<int, 8> keyboard_mods{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<float> setting) {
|
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<float>& setting) {
|
||||||
setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault());
|
setting = sdl2_config->GetReal(group, setting.GetLabel(), setting.GetDefault());
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string> setting) {
|
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<std::string>& setting) {
|
||||||
setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault());
|
setting = sdl2_config->Get(group, setting.GetLabel(), setting.GetDefault());
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool> setting) {
|
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<bool>& setting) {
|
||||||
setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault());
|
setting = sdl2_config->GetBoolean(group, setting.GetLabel(), setting.GetDefault());
|
||||||
}
|
}
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type> setting) {
|
void Config::ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting) {
|
||||||
setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(),
|
setting = static_cast<Type>(sdl2_config->GetInteger(group, setting.GetLabel(),
|
||||||
static_cast<long>(setting.GetDefault())));
|
static_cast<long>(setting.GetDefault())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,12 @@ public:
|
||||||
void Reload();
|
void Reload();
|
||||||
|
|
||||||
private:
|
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 <typename Type>
|
template <typename Type>
|
||||||
void ReadSetting(const std::string& group, Settings::BasicSetting<Type> setting);
|
void ReadSetting(const std::string& group, Settings::BasicSetting<Type>& setting);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue