diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/settings.h | 3 | ||||
| -rw-r--r-- | src/core/core.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/mouse/mouse_poller.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 36 |
4 files changed, 25 insertions, 22 deletions
diff --git a/src/common/settings.h b/src/common/settings.h index c799e6243..bf83186f5 100644 --- a/src/common/settings.h +++ b/src/common/settings.h | |||
| @@ -155,8 +155,7 @@ public: | |||
| 155 | 155 | ||
| 156 | /** | 156 | /** |
| 157 | * Tells this setting to represent either the global or custom setting when other member | 157 | * Tells this setting to represent either the global or custom setting when other member |
| 158 | * functions are used. Setting to_global to true means using the global setting, to false | 158 | * functions are used. |
| 159 | * false for the custom setting. | ||
| 160 | * | 159 | * |
| 161 | * @param to_global Whether to use the global or custom setting. | 160 | * @param to_global Whether to use the global or custom setting. |
| 162 | */ | 161 | */ |
diff --git a/src/core/core.cpp b/src/core/core.cpp index fc6ec9512..891f1cb49 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -264,8 +264,8 @@ struct System::Impl { | |||
| 264 | if (Settings::values.gamecard_current_game) { | 264 | if (Settings::values.gamecard_current_game) { |
| 265 | fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, filepath)); | 265 | fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, filepath)); |
| 266 | } else if (!Settings::values.gamecard_path.GetValue().empty()) { | 266 | } else if (!Settings::values.gamecard_path.GetValue().empty()) { |
| 267 | fs_controller.SetGameCard(GetGameFileFromPath( | 267 | const auto gamecard_path = Settings::values.gamecard_path.GetValue(); |
| 268 | virtual_filesystem, static_cast<std::string>(Settings::values.gamecard_path))); | 268 | fs_controller.SetGameCard(GetGameFileFromPath(virtual_filesystem, gamecard_path)); |
| 269 | } | 269 | } |
| 270 | } | 270 | } |
| 271 | 271 | ||
diff --git a/src/input_common/mouse/mouse_poller.cpp b/src/input_common/mouse/mouse_poller.cpp index 4861a131e..45b3d7340 100644 --- a/src/input_common/mouse/mouse_poller.cpp +++ b/src/input_common/mouse/mouse_poller.cpp | |||
| @@ -84,8 +84,8 @@ public: | |||
| 84 | std::lock_guard lock{mutex}; | 84 | std::lock_guard lock{mutex}; |
| 85 | const auto axis_value = | 85 | const auto axis_value = |
| 86 | static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); | 86 | static_cast<float>(mouse_input->GetMouseState(button).axis.at(axis)); |
| 87 | return axis_value * Settings::values.mouse_panning_sensitivity.GetValue() / | 87 | const float sensitivity = Settings::values.mouse_panning_sensitivity.GetValue(); |
| 88 | (100.0f * range); | 88 | return axis_value * sensitivity / (100.0f * range); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | std::pair<float, float> GetAnalog(u32 analog_axis_x, u32 analog_axis_y) const { | 91 | std::pair<float, float> 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 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -282,22 +282,23 @@ void Config::Initialize(const std::string& config_name) { | |||
| 282 | template <> | 282 | template <> |
| 283 | void Config::ReadBasicSetting(Settings::BasicSetting<std::string>& setting) { | 283 | void Config::ReadBasicSetting(Settings::BasicSetting<std::string>& setting) { |
| 284 | const QString name = QString::fromStdString(setting.GetLabel()); | 284 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 285 | const auto default_value = QString::fromStdString(setting.GetDefault()); | ||
| 285 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | 286 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { |
| 286 | setting.SetValue(setting.GetDefault()); | 287 | setting.SetValue(default_value.toStdString()); |
| 287 | } else { | 288 | } else { |
| 288 | setting.SetValue(qt_config->value(name, QString::fromStdString(setting.GetDefault())) | 289 | setting.SetValue(qt_config->value(name, default_value).toString().toStdString()); |
| 289 | .toString() | ||
| 290 | .toStdString()); | ||
| 291 | } | 290 | } |
| 292 | } | 291 | } |
| 292 | |||
| 293 | template <typename Type> | 293 | template <typename Type> |
| 294 | void Config::ReadBasicSetting(Settings::BasicSetting<Type>& setting) { | 294 | void Config::ReadBasicSetting(Settings::BasicSetting<Type>& setting) { |
| 295 | const QString name = QString::fromStdString(setting.GetLabel()); | 295 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 296 | const Type default_value = setting.GetDefault(); | ||
| 296 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { | 297 | if (qt_config->value(name + QStringLiteral("/default"), false).toBool()) { |
| 297 | setting.SetValue(setting.GetDefault()); | 298 | setting.SetValue(default_value); |
| 298 | } else { | 299 | } else { |
| 299 | setting.SetValue( | 300 | setting.SetValue( |
| 300 | static_cast<QVariant>(qt_config->value(name, setting.GetDefault())).value<Type>()); | 301 | static_cast<QVariant>(qt_config->value(name, default_value)).value<Type>()); |
| 301 | } | 302 | } |
| 302 | } | 303 | } |
| 303 | 304 | ||
| @@ -305,10 +306,11 @@ void Config::ReadBasicSetting(Settings::BasicSetting<Type>& setting) { | |||
| 305 | template <> | 306 | template <> |
| 306 | void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& setting) { | 307 | void Config::WriteBasicSetting(const Settings::BasicSetting<std::string>& setting) { |
| 307 | const QString name = QString::fromStdString(setting.GetLabel()); | 308 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 308 | qt_config->setValue(name + QStringLiteral("/default"), | 309 | const std::string& value = setting.GetValue(); |
| 309 | setting.GetValue() == setting.GetDefault()); | 310 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); |
| 310 | qt_config->setValue(name, QString::fromStdString(setting.GetValue())); | 311 | qt_config->setValue(name, QString::fromStdString(value)); |
| 311 | } | 312 | } |
| 313 | |||
| 312 | // Explicit float definition: use a double as Qt doesn't write legible floats to config files | 314 | // Explicit float definition: use a double as Qt doesn't write legible floats to config files |
| 313 | template <> | 315 | template <> |
| 314 | void Config::WriteBasicSetting(const Settings::BasicSetting<float>& setting) { | 316 | void Config::WriteBasicSetting(const Settings::BasicSetting<float>& setting) { |
| @@ -318,12 +320,13 @@ void Config::WriteBasicSetting(const Settings::BasicSetting<float>& setting) { | |||
| 318 | setting.GetValue() == setting.GetDefault()); | 320 | setting.GetValue() == setting.GetDefault()); |
| 319 | qt_config->setValue(name, value); | 321 | qt_config->setValue(name, value); |
| 320 | } | 322 | } |
| 323 | |||
| 321 | template <typename Type> | 324 | template <typename Type> |
| 322 | void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) { | 325 | void Config::WriteBasicSetting(const Settings::BasicSetting<Type>& setting) { |
| 323 | const QString name = QString::fromStdString(setting.GetLabel()); | 326 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 324 | qt_config->setValue(name + QStringLiteral("/default"), | 327 | const Type value = setting.GetValue(); |
| 325 | setting.GetValue() == setting.GetDefault()); | 328 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); |
| 326 | qt_config->setValue(name, setting.GetValue()); | 329 | qt_config->setValue(name, value); |
| 327 | } | 330 | } |
| 328 | 331 | ||
| 329 | // Explicit float definition: use a double as Qt doesn't write legible floats to config files | 332 | // 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<float>& setting) { | |||
| 340 | qt_config->setValue(name, value); | 343 | qt_config->setValue(name, value); |
| 341 | } | 344 | } |
| 342 | } | 345 | } |
| 346 | |||
| 343 | template <typename Type> | 347 | template <typename Type> |
| 344 | void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) { | 348 | void Config::WriteGlobalSetting(const Settings::Setting<Type>& setting) { |
| 345 | QString name = QString::fromStdString(setting.GetLabel()); | 349 | const QString name = QString::fromStdString(setting.GetLabel()); |
| 350 | const Type& value = setting.GetValue(global); | ||
| 346 | if (!global) { | 351 | if (!global) { |
| 347 | qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); | 352 | qt_config->setValue(name + QStringLiteral("/use_global"), setting.UsingGlobal()); |
| 348 | } | 353 | } |
| 349 | if (global || !setting.UsingGlobal()) { | 354 | if (global || !setting.UsingGlobal()) { |
| 350 | qt_config->setValue(name + QStringLiteral("/default"), | 355 | qt_config->setValue(name + QStringLiteral("/default"), value == setting.GetDefault()); |
| 351 | setting.GetValue(global) == setting.GetDefault()); | 356 | qt_config->setValue(name, value); |
| 352 | qt_config->setValue(name, setting.GetValue(global)); | ||
| 353 | } | 357 | } |
| 354 | } | 358 | } |
| 355 | 359 | ||