diff options
author | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-05-16 07:17:18 +0200 |
---|---|---|
committer | lat9nq <22451773+lat9nq@users.noreply.github.com> | 2021-05-17 21:54:30 +0200 |
commit | 339dc4f806b0c39a4ec6460187f345c4e2890d05 (patch) | |
tree | 1e47f2c0afa0a9bc4ecae5f2d9886c71bc6629c4 /src | |
parent | configuration: Add CPU tab to game properties (diff) | |
download | yuzu-339dc4f806b0c39a4ec6460187f345c4e2890d05.tar yuzu-339dc4f806b0c39a4ec6460187f345c4e2890d05.tar.gz yuzu-339dc4f806b0c39a4ec6460187f345c4e2890d05.tar.bz2 yuzu-339dc4f806b0c39a4ec6460187f345c4e2890d05.tar.lz yuzu-339dc4f806b0c39a4ec6460187f345c4e2890d05.tar.xz yuzu-339dc4f806b0c39a4ec6460187f345c4e2890d05.tar.zst yuzu-339dc4f806b0c39a4ec6460187f345c4e2890d05.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/common/settings.cpp | 1 | ||||
-rw-r--r-- | src/common/settings.h | 2 | ||||
-rw-r--r-- | src/core/core.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 31 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 46 | ||||
-rw-r--r-- | src/yuzu_cmd/config.cpp | 6 |
6 files changed, 30 insertions, 58 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 7c8fced59..e29cbf506 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -136,7 +136,6 @@ void RestoreGlobalState(bool is_powered_on) { values.region_index.SetGlobal(true); values.time_zone_index.SetGlobal(true); values.rng_seed.SetGlobal(true); - values.custom_rtc.SetGlobal(true); values.sound_index.SetGlobal(true); // Controls diff --git a/src/common/settings.h b/src/common/settings.h index 68dc2ea7d..48085b9a9 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -157,7 +157,7 @@ struct Values { // System Setting<std::optional<u32>> rng_seed; // Measured in seconds since epoch - Setting<std::optional<std::chrono::seconds>> custom_rtc; + std::optional<std::chrono::seconds> custom_rtc; // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` std::chrono::seconds custom_rtc_differential; diff --git a/src/core/core.cpp b/src/core/core.cpp index 434bf3262..6dadf89f0 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -173,7 +173,7 @@ struct System::Impl { const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( std::chrono::system_clock::now().time_since_epoch()); Settings::values.custom_rtc_differential = - Settings::values.custom_rtc.GetValue().value_or(current_time) - current_time; + Settings::values.custom_rtc.value_or(current_time) - current_time; // Create a default fs if one doesn't already exist. if (virtual_filesystem == nullptr) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index c6135919f..125feb86b 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -868,17 +868,14 @@ void Config::ReadSystemValues() { } } - bool custom_rtc_enabled; - ReadSettingGlobal(custom_rtc_enabled, QStringLiteral("custom_rtc_enabled"), false); - 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 (global) { + const auto custom_rtc_enabled = + ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool(); if (custom_rtc_enabled) { - Settings::values.custom_rtc.SetValue( - std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong())); + Settings::values.custom_rtc = + std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()); } else { - Settings::values.custom_rtc.SetValue(std::nullopt); + Settings::values.custom_rtc = std::nullopt; } } @@ -1433,14 +1430,14 @@ void Config::SaveSystemValues() { Settings::values.rng_seed.GetValue(global).value_or(0), Settings::values.rng_seed.UsingGlobal(), 0); - WriteSettingGlobal(QStringLiteral("custom_rtc_enabled"), - Settings::values.custom_rtc.GetValue(global).has_value(), - Settings::values.custom_rtc.UsingGlobal(), false); - WriteSettingGlobal( - QStringLiteral("custom_rtc"), - QVariant::fromValue<long long>( - Settings::values.custom_rtc.GetValue(global).value_or(std::chrono::seconds{}).count()), - Settings::values.custom_rtc.UsingGlobal(), 0); + if (global) { + WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), + false); + WriteSetting(QStringLiteral("custom_rtc"), + QVariant::fromValue<long long>( + Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count()), + 0); + } WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1); diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index d67ff60b2..85418f969 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -65,7 +65,7 @@ void ConfigureSystem::SetConfiguration() { QStringLiteral("%1") .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) .toUpper(); - const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or( + const auto rtc_time = Settings::values.custom_rtc.value_or( std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); @@ -73,9 +73,8 @@ void ConfigureSystem::SetConfiguration() { Settings::values.rng_seed.UsingGlobal()); ui->rng_seed_edit->setText(rng_seed); - ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value()); - ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() && - Settings::values.rng_seed.UsingGlobal()); + ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); + ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); if (Settings::IsConfiguringGlobal()) { @@ -109,17 +108,17 @@ void ConfigureSystem::ApplyConfiguration() { // Allow setting custom RTC even if system is powered on, // to allow in-game time to be fast forwarded - if (Settings::values.custom_rtc.UsingGlobal()) { + if (Settings::IsConfiguringGlobal()) { if (ui->custom_rtc_checkbox->isChecked()) { - Settings::values.custom_rtc.SetValue( - std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); + Settings::values.custom_rtc = + std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()); if (system.IsPoweredOn()) { - const s64 posix_time{Settings::values.custom_rtc.GetValue()->count() + + const s64 posix_time{Settings::values.custom_rtc->count() + Service::Time::TimeManager::GetExternalTimeZoneOffset()}; system.GetTimeManager().UpdateLocalSystemClockTime(posix_time); } } else { - Settings::values.custom_rtc.SetValue(std::nullopt); + Settings::values.custom_rtc = std::nullopt; } } @@ -163,26 +162,6 @@ void ConfigureSystem::ApplyConfiguration() { case ConfigurationShared::CheckState::Count: break; } - - switch (use_custom_rtc) { - case ConfigurationShared::CheckState::On: - case ConfigurationShared::CheckState::Off: - Settings::values.custom_rtc.SetGlobal(false); - if (ui->custom_rtc_checkbox->isChecked()) { - Settings::values.custom_rtc.SetValue( - std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); - } else { - Settings::values.custom_rtc.SetValue(std::nullopt); - } - break; - case ConfigurationShared::CheckState::Global: - Settings::values.custom_rtc.SetGlobal(false); - Settings::values.custom_rtc.SetValue(std::nullopt); - Settings::values.custom_rtc.SetGlobal(true); - break; - case ConfigurationShared::CheckState::Count: - break; - } } system.ApplySettings(); @@ -213,8 +192,6 @@ void ConfigureSystem::SetupPerGameUI() { ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal()); ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal()); ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal()); - ui->custom_rtc_checkbox->setEnabled(Settings::values.custom_rtc.UsingGlobal()); - ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.UsingGlobal()); return; } @@ -232,8 +209,7 @@ void ConfigureSystem::SetupPerGameUI() { ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(), Settings::values.rng_seed.GetValue().has_value(), Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed); - ConfigurationShared::SetColoredTristate( - ui->custom_rtc_checkbox, Settings::values.custom_rtc.UsingGlobal(), - Settings::values.custom_rtc.GetValue().has_value(), - Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc); + + ui->custom_rtc_checkbox->setVisible(false); + ui->custom_rtc_edit->setVisible(false); } diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp index 7e1d5f379..38d896d65 100644 --- a/src/yuzu_cmd/config.cpp +++ b/src/yuzu_cmd/config.cpp @@ -361,10 +361,10 @@ void Config::ReadValues() { const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); if (custom_rtc_enabled) { - Settings::values.custom_rtc.SetValue( - std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0))); + Settings::values.custom_rtc = + std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)); } else { - Settings::values.custom_rtc.SetValue(std::nullopt); + Settings::values.custom_rtc = std::nullopt; } Settings::values.language_index.SetValue( |