diff options
| author | bunnei <bunneidev@gmail.com> | 2020-10-22 20:46:54 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-22 20:46:54 -0700 |
| commit | e7042163c85c4cb239b9c65e9b03238987ec36d8 (patch) | |
| tree | e8054756584af4b9a27af22d22d960f09e7c9473 /src/yuzu/configuration/configure_system.cpp | |
| parent | ea20b5c970cb261df93743803a227fafd5403d02 (diff) | |
| parent | 62c6c9f6a6dbc44de5fa8e03187fb34037958d5f (diff) | |
Merge pull request #4792 from bunnei/rtc-fix
service: time: Update current time with changes to RTC setting.
Diffstat (limited to 'src/yuzu/configuration/configure_system.cpp')
| -rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 9ad43ed8f..5e8e201dc 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -12,6 +12,7 @@ #include "common/assert.h" #include "common/file_util.h" #include "core/core.h" +#include "core/hle/service/time/time.h" #include "core/settings.h" #include "ui_configure_system.h" #include "yuzu/configuration/configuration_shared.h" @@ -104,6 +105,22 @@ void ConfigureSystem::SetConfiguration() { void ConfigureSystem::ReadSystemSettings() {} void ConfigureSystem::ApplyConfiguration() { + // Allow setting custom RTC even if system is powered on, to allow in-game time to be fast + // forwared + if (Settings::values.custom_rtc.UsingGlobal()) { + if (ui->custom_rtc_checkbox->isChecked()) { + Settings::values.custom_rtc.SetValue( + std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); + if (Core::System::GetInstance().IsPoweredOn()) { + const s64 posix_time{Settings::values.custom_rtc.GetValue()->count() + + Service::Time::TimeManager::GetExternalTimeZoneOffset()}; + Core::System::GetInstance().GetTimeManager().UpdateLocalSystemClockTime(posix_time); + } + } else { + Settings::values.custom_rtc.SetValue(std::nullopt); + } + } + if (!enabled) { return; } @@ -131,15 +148,6 @@ void ConfigureSystem::ApplyConfiguration() { Settings::values.rng_seed.SetValue(std::nullopt); } } - - if (Settings::values.custom_rtc.UsingGlobal()) { - 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); - } - } } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.language_index, ui->combo_language); |
