diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs
index bfea1e37d..725197469 100644
--- a/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs
+++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationFileFormat.cs
@@ -16,7 +16,7 @@ namespace Ryujinx.UI.Common.Configuration
///
/// The current version of the file format
///
- public const int CurrentVersion = 57;
+ public const int CurrentVersion = 58;
///
/// Version of the configuration file format
@@ -143,6 +143,11 @@ namespace Ryujinx.UI.Common.Configuration
///
public long SystemTimeOffset { get; set; }
+ ///
+ /// Instead of setting the time via configuration, use the values provided by the system.
+ ///
+ public bool MatchSystemTime { get; set; }
+
///
/// Enables or disables Docked Mode
///
diff --git a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
index b04ce6d72..b95606687 100644
--- a/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
+++ b/src/Ryujinx.UI.Common/Configuration/ConfigurationState.cs
@@ -325,6 +325,11 @@ namespace Ryujinx.UI.Common.Configuration
///
public ReactiveObject SystemTimeOffset { get; private set; }
+ ///
+ /// Instead of setting the time via configuration, use the values provided by the system.
+ ///
+ public ReactiveObject MatchSystemTime { get; private set; }
+
///
/// Enables or disables Docked Mode
///
@@ -391,6 +396,9 @@ namespace Ryujinx.UI.Common.Configuration
Region = new ReactiveObject();
TimeZone = new ReactiveObject();
SystemTimeOffset = new ReactiveObject();
+ SystemTimeOffset.Event += static (sender, e) => LogValueChange(e, nameof(SystemTimeOffset));
+ MatchSystemTime = new ReactiveObject();
+ MatchSystemTime.Event += static (sender, e) => LogValueChange(e, nameof(MatchSystemTime));
EnableDockedMode = new ReactiveObject();
EnableDockedMode.Event += static (sender, e) => LogValueChange(e, nameof(EnableDockedMode));
EnablePtc = new ReactiveObject();
@@ -749,6 +757,7 @@ namespace Ryujinx.UI.Common.Configuration
SystemRegion = System.Region,
SystemTimeZone = System.TimeZone,
SystemTimeOffset = System.SystemTimeOffset,
+ MatchSystemTime = System.MatchSystemTime,
DockedMode = System.EnableDockedMode,
EnableDiscordIntegration = EnableDiscordIntegration,
CheckUpdatesOnStart = CheckUpdatesOnStart,
@@ -1630,6 +1639,15 @@ namespace Ryujinx.UI.Common.Configuration
configurationFileUpdated = true;
}
+ if (configurationFileFormat.Version < 58)
+ {
+ Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 58.");
+
+ configurationFileFormat.MatchSystemTime = false;
+
+ configurationFileUpdated = true;
+ }
+
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
Graphics.ResScale.Value = configurationFileFormat.ResScale;
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
@@ -1656,6 +1674,7 @@ namespace Ryujinx.UI.Common.Configuration
System.Region.Value = configurationFileFormat.SystemRegion;
System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
+ System.MatchSystemTime.Value = configurationFileFormat.MatchSystemTime;
System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
diff --git a/src/Ryujinx/AppHost.cs b/src/Ryujinx/AppHost.cs
index a08928e03..bb4dcc934 100644
--- a/src/Ryujinx/AppHost.cs
+++ b/src/Ryujinx/AppHost.cs
@@ -923,7 +923,9 @@ namespace Ryujinx.Ava
ConfigurationState.Instance.System.EnableInternetAccess,
ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
ConfigurationState.Instance.System.FsGlobalAccessLogMode,
- ConfigurationState.Instance.System.SystemTimeOffset,
+ ConfigurationState.Instance.System.MatchSystemTime
+ ? 0
+ : ConfigurationState.Instance.System.SystemTimeOffset,
ConfigurationState.Instance.System.TimeZone,
ConfigurationState.Instance.System.MemoryManagerMode,
ConfigurationState.Instance.System.IgnoreMissingServices,
diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs
index dfa75de4b..cd18471c5 100644
--- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs
+++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs
@@ -331,6 +331,8 @@ namespace Ryujinx.Ava.UI.ViewModels
//private DateTimeOffset _currentDate;
//private TimeSpan _currentTime;
+ public bool MatchSystemTime { get; set; }
+
public DateTimeOffset CurrentDate { get; set; }
public TimeSpan CurrentTime { get; set; }
@@ -456,18 +458,6 @@ namespace Ryujinx.Ava.UI.ViewModels
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(PreferredGpuIndex)));
}
- public void MatchSystemTime()
- {
- var dto = DateTimeOffset.Now;
-
- CurrentDate = new DateTimeOffset(dto.Year, dto.Month, dto.Day, 0, 0, 0, dto.Offset);
-
- CurrentTime = dto.TimeOfDay;
-
- OnPropertyChanged(nameof(CurrentDate));
- OnPropertyChanged(nameof(CurrentTime));
- }
-
public async Task LoadTimeZones()
{
_timeZoneContentManager = new TimeZoneContentManager();
@@ -569,7 +559,9 @@ namespace Ryujinx.Ava.UI.ViewModels
CurrentDate = currentDateTime.Date;
CurrentTime = currentDateTime.TimeOfDay;
- EnableCustomVSyncInterval = config.Graphics.EnableCustomVSyncInterval.Value;
+ MatchSystemTime = config.System.MatchSystemTime;
+
+ EnableCustomVSyncInterval = config.Graphics.EnableCustomVSyncInterval;
CustomVSyncInterval = config.Graphics.CustomVSyncInterval;
VSyncMode = config.Graphics.VSyncMode;
EnableFsIntegrityChecks = config.System.EnableFsIntegrityChecks;
@@ -675,6 +667,7 @@ namespace Ryujinx.Ava.UI.ViewModels
config.System.TimeZone.Value = TimeZone;
}
+ config.System.MatchSystemTime.Value = MatchSystemTime;
config.System.SystemTimeOffset.Value = Convert.ToInt64((CurrentDate.ToUnixTimeSeconds() + CurrentTime.TotalSeconds) - DateTimeOffset.Now.ToUnixTimeSeconds());
config.Graphics.VSyncMode.Value = VSyncMode;
config.Graphics.EnableCustomVSyncInterval.Value = EnableCustomVSyncInterval;
diff --git a/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml b/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml
index 6e2155238..5db6cdcff 100644
--- a/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml
+++ b/src/Ryujinx/UI/Views/Settings/SettingsSystemView.axaml
@@ -166,7 +166,8 @@
ToolTip.Tip="{locale:Locale TimeTooltip}"
Width="250"/>
@@ -177,21 +178,21 @@
-
-
+ Text="{locale:Locale SettingsTabSystemSystemTimeMatch}"
+ ToolTip.Tip="{locale:Locale MatchTimeTooltip}"
+ Width="250"/>
+
ViewModel.MatchSystemTime();
}
}