From f1640df97c8588a995c44e96a2bb8986336570db Mon Sep 17 00:00:00 2001 From: lat9nq Date: Thu, 25 Jun 2020 19:28:39 -0400 Subject: [PATCH] fixed custom rtc and rng seed overwriting the global value --- src/yuzu/configuration/config.cpp | 30 ++++++++++++--------- src/yuzu/configuration/configure_system.cpp | 10 +++++-- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index c6c01dff91..551e7e6fae 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -698,23 +698,27 @@ void Config::ReadSystemValues() { bool rng_seed_enabled; ReadSettingGlobal(rng_seed_enabled, QStringLiteral("rng_seed_enabled"), false); - Settings::values.rng_seed.SetGlobal( - global || qt_config->value(QStringLiteral("rng_seed/use_global"), true).toBool()); - if (rng_seed_enabled) { - Settings::values.rng_seed = ReadSetting(QStringLiteral("rng_seed"), 0).toULongLong(); - } else { - Settings::values.rng_seed = std::nullopt; + bool rng_seed_global = global || qt_config->value(QStringLiteral("rng_seed/use_global"), true).toBool(); + Settings::values.rng_seed.SetGlobal(rng_seed_global); + if (global || !rng_seed_global) { + if (rng_seed_enabled) { + Settings::values.rng_seed = ReadSetting(QStringLiteral("rng_seed"), 0).toULongLong(); + } else { + Settings::values.rng_seed = std::nullopt; + } } bool custom_rtc_enabled; ReadSettingGlobal(custom_rtc_enabled, QStringLiteral("custom_rtc_enabled"), false); - Settings::values.custom_rtc.SetGlobal( - global || qt_config->value(QStringLiteral("custom_rtc/use_global"), true).toBool()); - if (custom_rtc_enabled) { - Settings::values.custom_rtc = - std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()); - } else { - Settings::values.custom_rtc = std::nullopt; + bool custom_rtc_global = global || qt_config->value(QStringLiteral("custom_rtc/use_global"), true).toBool(); + Settings::values.custom_rtc.SetGlobal(custom_rtc_global); + if (global || !custom_rtc_global) { + if (custom_rtc_enabled) { + Settings::values.custom_rtc = + std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()); + } else { + Settings::values.custom_rtc = std::nullopt; + } } ReadSettingGlobal(Settings::values.sound_index, QStringLiteral("sound_index"), 1); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index dc372f2ab3..04f10ac5e6 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -136,7 +136,7 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.sound_index = ui->combo_sound->currentIndex(); } - if (!Settings::values.rng_seed.UsingGlobal()) { + if (Settings::values.rng_seed.UsingGlobal()) { if (ui->rng_seed_checkbox->isChecked()) { Settings::values.rng_seed = ui->rng_seed_edit->text().toULongLong(nullptr, 16); } else { @@ -144,7 +144,7 @@ void ConfigureSystem::ApplyConfiguration() { } } - if (!Settings::values.custom_rtc.UsingGlobal()) { + if (Settings::values.custom_rtc.UsingGlobal()) { if (ui->custom_rtc_checkbox->isChecked()) { Settings::values.custom_rtc = std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()); @@ -170,7 +170,10 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.rng_seed = std::nullopt; break; case Qt::PartiallyChecked: + Settings::values.rng_seed.SetGlobal(false); + Settings::values.rng_seed = std::nullopt; Settings::values.rng_seed.SetGlobal(true); + break; } switch (ui->custom_rtc_checkbox->checkState()) { @@ -184,7 +187,10 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.custom_rtc = std::nullopt; break; case Qt::PartiallyChecked: + Settings::values.custom_rtc.SetGlobal(false); + Settings::values.custom_rtc = std::nullopt; Settings::values.custom_rtc.SetGlobal(true); + break; } }