From 4967de61a1e8d456b94a85a291c618d4811dcb62 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 8 Jul 2021 22:42:51 +0200 Subject: [PATCH] early-access version 1862 --- README.md | 2 +- src/common/settings.h | 3 +-- src/core/core.cpp | 4 +-- src/input_common/mouse/mouse_poller.cpp | 4 +-- src/yuzu/configuration/config.cpp | 36 ++++++++++++++----------- 5 files changed, 26 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 07cddb574..4223e7402 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1861. +This is the source code for early-access 1862. ## Legal Notice diff --git a/src/common/settings.h b/src/common/settings.h index c799e6243..bf83186f5 100755 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -155,8 +155,7 @@ public: /** * Tells this setting to represent either the global or custom setting when other member - * functions are used. Setting to_global to true means using the global setting, to false - * false for the custom setting. + * functions are used. * * @param to_global Whether to use the global or custom setting. */ diff --git a/src/core/core.cpp b/src/core/core.cpp index fc6ec9512..891f1cb49 100755 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -264,8 +264,8 @@ struct System::Impl { if (Settings::values.gamecard_current_game) { fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, filepath)); } else if (!Settings::values.gamecard_path.GetValue().empty()) { - fs_controller.SetGameCard(GetGameFileFromPath( - virtual_filesystem, static_cast(Settings::values.gamecard_path))); + const auto gamecard_path = Settings::values.gamecard_path.GetValue(); + fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, gamecard_path)); } } diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp index 4861a131e..45b3d7340 100755 --- a/src/input_common/mouse/mouse_poller.cpp +++ b/src/input_common/mouse/mouse_poller.cpp @@ -84,8 +84,8 @@ public: std::lock_guard lock{mutex}; const auto axis_value = static_cast(mouse_input->GetMouseState(button).axis.at(axis)); - return axis_value * Settings::values.mouse_panning_sensitivity.GetValue() / - (100.0f * range); + const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue(); + return axis_value * sensitivity / (100.0f * range); } std::pair GetAnalog(u32 analog_axis_x, u32 analog_axis_y) const { diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index e21f15c72..1a0f75373 100755 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -282,22 +282,23 @@ void Config::Initialize(const std::string& config_name) { template <> void Config::ReadBasicSetting(Settings::BasicSetting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); + const auto default_value = QString::fromStdString(setting.GetDefault()); if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { - setting.SetValue(setting.GetDefault()); + setting.SetValue(default_value.toStdString()); } else { - setting.SetValue(qt_config->value(name, QString::fromStdString(setting.GetDefault())) - .toString() - .toStdString()); + setting.SetValue(qt_config->value(name, default_value).toString().toStdString()); } } + template void Config::ReadBasicSetting(Settings::BasicSetting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); + const Type default_value = setting.GetDefault(); if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { - setting.SetValue(setting.GetDefault()); + setting.SetValue(default_value); } else { setting.SetValue( - static_cast(qt_config->value(name, setting.GetDefault())).value()); + static_cast(qt_config->value(name, default_value)).value()); } } @@ -305,10 +306,11 @@ void Config::ReadBasicSetting(Settings::BasicSetting& setting) { template <> void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); - qt_config->setValue(name + QStringLiteral("/default"), - setting.GetValue() == setting.GetDefault()); - qt_config->setValue(name, QString::fromStdString(setting.GetValue())); + const std::string& value = setting.GetValue(); + qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); + qt_config->setValue(name, QString::fromStdString(value)); } + // Explicit float definition: use a double as Qt doesn't write legible floats to config files template <> void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { @@ -318,12 +320,13 @@ void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { setting.GetValue() == setting.GetDefault()); qt_config->setValue(name, value); } + template void Config::WriteBasicSetting(const Settings::BasicSetting& setting) { const QString name = QString::fromStdString(setting.GetLabel()); - qt_config->setValue(name + QStringLiteral("/default"), - setting.GetValue() == setting.GetDefault()); - qt_config->setValue(name, setting.GetValue()); + const Type value = setting.GetValue(); + qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); + qt_config->setValue(name, value); } // Explicit float definition: use a double as Qt doesn't write legible floats to config files @@ -340,16 +343,17 @@ void Config::WriteGlobalSetting(const Settings::Setting& setting) { qt_config->setValue(name, value); } } + template void Config::WriteGlobalSetting(const Settings::Setting& setting) { - QString name = QString::fromStdString(setting.GetLabel()); + const QString name = QString::fromStdString(setting.GetLabel()); + const Type& value = setting.GetValue(global); if (!global) { qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); } if (global || !setting.UsingGlobal()) { - qt_config->setValue(name + QStringLiteral("/default"), - setting.GetValue(global) == setting.GetDefault()); - qt_config->setValue(name, setting.GetValue(global)); + qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); + qt_config->setValue(name, value); } }