diff options
Diffstat (limited to '')
| -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) { | |||
| 136 | values.region_index.SetGlobal(true); | 136 | values.region_index.SetGlobal(true); |
| 137 | values.time_zone_index.SetGlobal(true); | 137 | values.time_zone_index.SetGlobal(true); |
| 138 | values.rng_seed.SetGlobal(true); | 138 | values.rng_seed.SetGlobal(true); |
| 139 | values.custom_rtc.SetGlobal(true); | ||
| 140 | values.sound_index.SetGlobal(true); | 139 | values.sound_index.SetGlobal(true); |
| 141 | 140 | ||
| 142 | // Controls | 141 | // 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 { | |||
| 157 | // System | 157 | // System |
| 158 | Setting<std::optional<u32>> rng_seed; | 158 | Setting<std::optional<u32>> rng_seed; |
| 159 | // Measured in seconds since epoch | 159 | // Measured in seconds since epoch |
| 160 | Setting<std::optional<std::chrono::seconds>> custom_rtc; | 160 | std::optional<std::chrono::seconds> custom_rtc; |
| 161 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` | 161 | // Set on game boot, reset on stop. Seconds difference between current time and `custom_rtc` |
| 162 | std::chrono::seconds custom_rtc_differential; | 162 | std::chrono::seconds custom_rtc_differential; |
| 163 | 163 | ||
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 { | |||
| 173 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( | 173 | const auto current_time = std::chrono::duration_cast<std::chrono::seconds>( |
| 174 | std::chrono::system_clock::now().time_since_epoch()); | 174 | std::chrono::system_clock::now().time_since_epoch()); |
| 175 | Settings::values.custom_rtc_differential = | 175 | Settings::values.custom_rtc_differential = |
| 176 | Settings::values.custom_rtc.GetValue().value_or(current_time) - current_time; | 176 | Settings::values.custom_rtc.value_or(current_time) - current_time; |
| 177 | 177 | ||
| 178 | // Create a default fs if one doesn't already exist. | 178 | // Create a default fs if one doesn't already exist. |
| 179 | if (virtual_filesystem == nullptr) | 179 | 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() { | |||
| 868 | } | 868 | } |
| 869 | } | 869 | } |
| 870 | 870 | ||
| 871 | bool custom_rtc_enabled; | 871 | if (global) { |
| 872 | ReadSettingGlobal(custom_rtc_enabled, QStringLiteral("custom_rtc_enabled"), false); | 872 | const auto custom_rtc_enabled = |
| 873 | bool custom_rtc_global = | 873 | ReadSetting(QStringLiteral("custom_rtc_enabled"), false).toBool(); |
| 874 | global || qt_config->value(QStringLiteral("custom_rtc/use_global"), true).toBool(); | ||
| 875 | Settings::values.custom_rtc.SetGlobal(custom_rtc_global); | ||
| 876 | if (global || !custom_rtc_global) { | ||
| 877 | if (custom_rtc_enabled) { | 874 | if (custom_rtc_enabled) { |
| 878 | Settings::values.custom_rtc.SetValue( | 875 | Settings::values.custom_rtc = |
| 879 | std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong())); | 876 | std::chrono::seconds(ReadSetting(QStringLiteral("custom_rtc"), 0).toULongLong()); |
| 880 | } else { | 877 | } else { |
| 881 | Settings::values.custom_rtc.SetValue(std::nullopt); | 878 | Settings::values.custom_rtc = std::nullopt; |
| 882 | } | 879 | } |
| 883 | } | 880 | } |
| 884 | 881 | ||
| @@ -1433,14 +1430,14 @@ void Config::SaveSystemValues() { | |||
| 1433 | Settings::values.rng_seed.GetValue(global).value_or(0), | 1430 | Settings::values.rng_seed.GetValue(global).value_or(0), |
| 1434 | Settings::values.rng_seed.UsingGlobal(), 0); | 1431 | Settings::values.rng_seed.UsingGlobal(), 0); |
| 1435 | 1432 | ||
| 1436 | WriteSettingGlobal(QStringLiteral("custom_rtc_enabled"), | 1433 | if (global) { |
| 1437 | Settings::values.custom_rtc.GetValue(global).has_value(), | 1434 | WriteSetting(QStringLiteral("custom_rtc_enabled"), Settings::values.custom_rtc.has_value(), |
| 1438 | Settings::values.custom_rtc.UsingGlobal(), false); | 1435 | false); |
| 1439 | WriteSettingGlobal( | 1436 | WriteSetting(QStringLiteral("custom_rtc"), |
| 1440 | QStringLiteral("custom_rtc"), | 1437 | QVariant::fromValue<long long>( |
| 1441 | QVariant::fromValue<long long>( | 1438 | Settings::values.custom_rtc.value_or(std::chrono::seconds{}).count()), |
| 1442 | Settings::values.custom_rtc.GetValue(global).value_or(std::chrono::seconds{}).count()), | 1439 | 0); |
| 1443 | Settings::values.custom_rtc.UsingGlobal(), 0); | 1440 | } |
| 1444 | 1441 | ||
| 1445 | WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1); | 1442 | WriteSettingGlobal(QStringLiteral("sound_index"), Settings::values.sound_index, 1); |
| 1446 | 1443 | ||
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() { | |||
| 65 | QStringLiteral("%1") | 65 | QStringLiteral("%1") |
| 66 | .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) | 66 | .arg(Settings::values.rng_seed.GetValue().value_or(0), 8, 16, QLatin1Char{'0'}) |
| 67 | .toUpper(); | 67 | .toUpper(); |
| 68 | const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or( | 68 | const auto rtc_time = Settings::values.custom_rtc.value_or( |
| 69 | std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); | 69 | std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); |
| 70 | 70 | ||
| 71 | ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); | 71 | ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); |
| @@ -73,9 +73,8 @@ void ConfigureSystem::SetConfiguration() { | |||
| 73 | Settings::values.rng_seed.UsingGlobal()); | 73 | Settings::values.rng_seed.UsingGlobal()); |
| 74 | ui->rng_seed_edit->setText(rng_seed); | 74 | ui->rng_seed_edit->setText(rng_seed); |
| 75 | 75 | ||
| 76 | ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value()); | 76 | ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.has_value()); |
| 77 | ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() && | 77 | ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.has_value()); |
| 78 | Settings::values.rng_seed.UsingGlobal()); | ||
| 79 | ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); | 78 | ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); |
| 80 | 79 | ||
| 81 | if (Settings::IsConfiguringGlobal()) { | 80 | if (Settings::IsConfiguringGlobal()) { |
| @@ -109,17 +108,17 @@ void ConfigureSystem::ApplyConfiguration() { | |||
| 109 | 108 | ||
| 110 | // Allow setting custom RTC even if system is powered on, | 109 | // Allow setting custom RTC even if system is powered on, |
| 111 | // to allow in-game time to be fast forwarded | 110 | // to allow in-game time to be fast forwarded |
| 112 | if (Settings::values.custom_rtc.UsingGlobal()) { | 111 | if (Settings::IsConfiguringGlobal()) { |
| 113 | if (ui->custom_rtc_checkbox->isChecked()) { | 112 | if (ui->custom_rtc_checkbox->isChecked()) { |
| 114 | Settings::values.custom_rtc.SetValue( | 113 | Settings::values.custom_rtc = |
| 115 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); | 114 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch()); |
| 116 | if (system.IsPoweredOn()) { | 115 | if (system.IsPoweredOn()) { |
| 117 | const s64 posix_time{Settings::values.custom_rtc.GetValue()->count() + | 116 | const s64 posix_time{Settings::values.custom_rtc->count() + |
| 118 | Service::Time::TimeManager::GetExternalTimeZoneOffset()}; | 117 | Service::Time::TimeManager::GetExternalTimeZoneOffset()}; |
| 119 | system.GetTimeManager().UpdateLocalSystemClockTime(posix_time); | 118 | system.GetTimeManager().UpdateLocalSystemClockTime(posix_time); |
| 120 | } | 119 | } |
| 121 | } else { | 120 | } else { |
| 122 | Settings::values.custom_rtc.SetValue(std::nullopt); | 121 | Settings::values.custom_rtc = std::nullopt; |
| 123 | } | 122 | } |
| 124 | } | 123 | } |
| 125 | 124 | ||
| @@ -163,26 +162,6 @@ void ConfigureSystem::ApplyConfiguration() { | |||
| 163 | case ConfigurationShared::CheckState::Count: | 162 | case ConfigurationShared::CheckState::Count: |
| 164 | break; | 163 | break; |
| 165 | } | 164 | } |
| 166 | |||
| 167 | switch (use_custom_rtc) { | ||
| 168 | case ConfigurationShared::CheckState::On: | ||
| 169 | case ConfigurationShared::CheckState::Off: | ||
| 170 | Settings::values.custom_rtc.SetGlobal(false); | ||
| 171 | if (ui->custom_rtc_checkbox->isChecked()) { | ||
| 172 | Settings::values.custom_rtc.SetValue( | ||
| 173 | std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); | ||
| 174 | } else { | ||
| 175 | Settings::values.custom_rtc.SetValue(std::nullopt); | ||
| 176 | } | ||
| 177 | break; | ||
| 178 | case ConfigurationShared::CheckState::Global: | ||
| 179 | Settings::values.custom_rtc.SetGlobal(false); | ||
| 180 | Settings::values.custom_rtc.SetValue(std::nullopt); | ||
| 181 | Settings::values.custom_rtc.SetGlobal(true); | ||
| 182 | break; | ||
| 183 | case ConfigurationShared::CheckState::Count: | ||
| 184 | break; | ||
| 185 | } | ||
| 186 | } | 165 | } |
| 187 | 166 | ||
| 188 | system.ApplySettings(); | 167 | system.ApplySettings(); |
| @@ -213,8 +192,6 @@ void ConfigureSystem::SetupPerGameUI() { | |||
| 213 | ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal()); | 192 | ui->combo_sound->setEnabled(Settings::values.sound_index.UsingGlobal()); |
| 214 | ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal()); | 193 | ui->rng_seed_checkbox->setEnabled(Settings::values.rng_seed.UsingGlobal()); |
| 215 | ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal()); | 194 | ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.UsingGlobal()); |
| 216 | ui->custom_rtc_checkbox->setEnabled(Settings::values.custom_rtc.UsingGlobal()); | ||
| 217 | ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.UsingGlobal()); | ||
| 218 | 195 | ||
| 219 | return; | 196 | return; |
| 220 | } | 197 | } |
| @@ -232,8 +209,7 @@ void ConfigureSystem::SetupPerGameUI() { | |||
| 232 | ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(), | 209 | ui->rng_seed_checkbox, Settings::values.rng_seed.UsingGlobal(), |
| 233 | Settings::values.rng_seed.GetValue().has_value(), | 210 | Settings::values.rng_seed.GetValue().has_value(), |
| 234 | Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed); | 211 | Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed); |
| 235 | ConfigurationShared::SetColoredTristate( | 212 | |
| 236 | ui->custom_rtc_checkbox, Settings::values.custom_rtc.UsingGlobal(), | 213 | ui->custom_rtc_checkbox->setVisible(false); |
| 237 | Settings::values.custom_rtc.GetValue().has_value(), | 214 | ui->custom_rtc_edit->setVisible(false); |
| 238 | Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc); | ||
| 239 | } | 215 | } |
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() { | |||
| 361 | 361 | ||
| 362 | const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); | 362 | const auto custom_rtc_enabled = sdl2_config->GetBoolean("System", "custom_rtc_enabled", false); |
| 363 | if (custom_rtc_enabled) { | 363 | if (custom_rtc_enabled) { |
| 364 | Settings::values.custom_rtc.SetValue( | 364 | Settings::values.custom_rtc = |
| 365 | std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0))); | 365 | std::chrono::seconds(sdl2_config->GetInteger("System", "custom_rtc", 0)); |
| 366 | } else { | 366 | } else { |
| 367 | Settings::values.custom_rtc.SetValue(std::nullopt); | 367 | Settings::values.custom_rtc = std::nullopt; |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | Settings::values.language_index.SetValue( | 370 | Settings::values.language_index.SetValue( |