mirror of
https://git.ryujinx.app/kenji-nx/ryujinx.git
synced 2025-12-13 04:37:02 +00:00
UI: Match System Time is now an active setting which you can toggle on/off.
This commit is contained in:
parent
d640f50203
commit
299b4cfe1d
6 changed files with 46 additions and 28 deletions
|
|
@ -16,7 +16,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current version of the file format
|
/// The current version of the file format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const int CurrentVersion = 57;
|
public const int CurrentVersion = 58;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version of the configuration file format
|
/// Version of the configuration file format
|
||||||
|
|
@ -143,6 +143,11 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long SystemTimeOffset { get; set; }
|
public long SystemTimeOffset { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Instead of setting the time via configuration, use the values provided by the system.
|
||||||
|
/// </summary>
|
||||||
|
public bool MatchSystemTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables or disables Docked Mode
|
/// Enables or disables Docked Mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -325,6 +325,11 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ReactiveObject<long> SystemTimeOffset { get; private set; }
|
public ReactiveObject<long> SystemTimeOffset { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Instead of setting the time via configuration, use the values provided by the system.
|
||||||
|
/// </summary>
|
||||||
|
public ReactiveObject<bool> MatchSystemTime { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables or disables Docked Mode
|
/// Enables or disables Docked Mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -391,6 +396,9 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
Region = new ReactiveObject<Region>();
|
Region = new ReactiveObject<Region>();
|
||||||
TimeZone = new ReactiveObject<string>();
|
TimeZone = new ReactiveObject<string>();
|
||||||
SystemTimeOffset = new ReactiveObject<long>();
|
SystemTimeOffset = new ReactiveObject<long>();
|
||||||
|
SystemTimeOffset.Event += static (sender, e) => LogValueChange(e, nameof(SystemTimeOffset));
|
||||||
|
MatchSystemTime = new ReactiveObject<bool>();
|
||||||
|
MatchSystemTime.Event += static (sender, e) => LogValueChange(e, nameof(MatchSystemTime));
|
||||||
EnableDockedMode = new ReactiveObject<bool>();
|
EnableDockedMode = new ReactiveObject<bool>();
|
||||||
EnableDockedMode.Event += static (sender, e) => LogValueChange(e, nameof(EnableDockedMode));
|
EnableDockedMode.Event += static (sender, e) => LogValueChange(e, nameof(EnableDockedMode));
|
||||||
EnablePtc = new ReactiveObject<bool>();
|
EnablePtc = new ReactiveObject<bool>();
|
||||||
|
|
@ -749,6 +757,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
SystemRegion = System.Region,
|
SystemRegion = System.Region,
|
||||||
SystemTimeZone = System.TimeZone,
|
SystemTimeZone = System.TimeZone,
|
||||||
SystemTimeOffset = System.SystemTimeOffset,
|
SystemTimeOffset = System.SystemTimeOffset,
|
||||||
|
MatchSystemTime = System.MatchSystemTime,
|
||||||
DockedMode = System.EnableDockedMode,
|
DockedMode = System.EnableDockedMode,
|
||||||
EnableDiscordIntegration = EnableDiscordIntegration,
|
EnableDiscordIntegration = EnableDiscordIntegration,
|
||||||
CheckUpdatesOnStart = CheckUpdatesOnStart,
|
CheckUpdatesOnStart = CheckUpdatesOnStart,
|
||||||
|
|
@ -1630,6 +1639,15 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
configurationFileUpdated = true;
|
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;
|
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
|
||||||
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
Graphics.ResScale.Value = configurationFileFormat.ResScale;
|
||||||
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
|
||||||
|
|
@ -1656,6 +1674,7 @@ namespace Ryujinx.UI.Common.Configuration
|
||||||
System.Region.Value = configurationFileFormat.SystemRegion;
|
System.Region.Value = configurationFileFormat.SystemRegion;
|
||||||
System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
|
System.TimeZone.Value = configurationFileFormat.SystemTimeZone;
|
||||||
System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
|
System.SystemTimeOffset.Value = configurationFileFormat.SystemTimeOffset;
|
||||||
|
System.MatchSystemTime.Value = configurationFileFormat.MatchSystemTime;
|
||||||
System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
|
System.EnableDockedMode.Value = configurationFileFormat.DockedMode;
|
||||||
EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
|
EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
|
||||||
CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
|
CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
|
||||||
|
|
|
||||||
|
|
@ -923,7 +923,9 @@ namespace Ryujinx.Ava
|
||||||
ConfigurationState.Instance.System.EnableInternetAccess,
|
ConfigurationState.Instance.System.EnableInternetAccess,
|
||||||
ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
|
ConfigurationState.Instance.System.EnableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
|
||||||
ConfigurationState.Instance.System.FsGlobalAccessLogMode,
|
ConfigurationState.Instance.System.FsGlobalAccessLogMode,
|
||||||
ConfigurationState.Instance.System.SystemTimeOffset,
|
ConfigurationState.Instance.System.MatchSystemTime
|
||||||
|
? 0
|
||||||
|
: ConfigurationState.Instance.System.SystemTimeOffset,
|
||||||
ConfigurationState.Instance.System.TimeZone,
|
ConfigurationState.Instance.System.TimeZone,
|
||||||
ConfigurationState.Instance.System.MemoryManagerMode,
|
ConfigurationState.Instance.System.MemoryManagerMode,
|
||||||
ConfigurationState.Instance.System.IgnoreMissingServices,
|
ConfigurationState.Instance.System.IgnoreMissingServices,
|
||||||
|
|
|
||||||
|
|
@ -331,6 +331,8 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
//private DateTimeOffset _currentDate;
|
//private DateTimeOffset _currentDate;
|
||||||
//private TimeSpan _currentTime;
|
//private TimeSpan _currentTime;
|
||||||
|
|
||||||
|
public bool MatchSystemTime { get; set; }
|
||||||
|
|
||||||
public DateTimeOffset CurrentDate { get; set; }
|
public DateTimeOffset CurrentDate { get; set; }
|
||||||
|
|
||||||
public TimeSpan CurrentTime { get; set; }
|
public TimeSpan CurrentTime { get; set; }
|
||||||
|
|
@ -456,18 +458,6 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
Dispatcher.UIThread.Post(() => OnPropertyChanged(nameof(PreferredGpuIndex)));
|
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()
|
public async Task LoadTimeZones()
|
||||||
{
|
{
|
||||||
_timeZoneContentManager = new TimeZoneContentManager();
|
_timeZoneContentManager = new TimeZoneContentManager();
|
||||||
|
|
@ -569,7 +559,9 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
CurrentDate = currentDateTime.Date;
|
CurrentDate = currentDateTime.Date;
|
||||||
CurrentTime = currentDateTime.TimeOfDay;
|
CurrentTime = currentDateTime.TimeOfDay;
|
||||||
|
|
||||||
EnableCustomVSyncInterval = config.Graphics.EnableCustomVSyncInterval.Value;
|
MatchSystemTime = config.System.MatchSystemTime;
|
||||||
|
|
||||||
|
EnableCustomVSyncInterval = config.Graphics.EnableCustomVSyncInterval;
|
||||||
CustomVSyncInterval = config.Graphics.CustomVSyncInterval;
|
CustomVSyncInterval = config.Graphics.CustomVSyncInterval;
|
||||||
VSyncMode = config.Graphics.VSyncMode;
|
VSyncMode = config.Graphics.VSyncMode;
|
||||||
EnableFsIntegrityChecks = config.System.EnableFsIntegrityChecks;
|
EnableFsIntegrityChecks = config.System.EnableFsIntegrityChecks;
|
||||||
|
|
@ -675,6 +667,7 @@ namespace Ryujinx.Ava.UI.ViewModels
|
||||||
config.System.TimeZone.Value = TimeZone;
|
config.System.TimeZone.Value = TimeZone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.System.MatchSystemTime.Value = MatchSystemTime;
|
||||||
config.System.SystemTimeOffset.Value = Convert.ToInt64((CurrentDate.ToUnixTimeSeconds() + CurrentTime.TotalSeconds) - DateTimeOffset.Now.ToUnixTimeSeconds());
|
config.System.SystemTimeOffset.Value = Convert.ToInt64((CurrentDate.ToUnixTimeSeconds() + CurrentTime.TotalSeconds) - DateTimeOffset.Now.ToUnixTimeSeconds());
|
||||||
config.Graphics.VSyncMode.Value = VSyncMode;
|
config.Graphics.VSyncMode.Value = VSyncMode;
|
||||||
config.Graphics.EnableCustomVSyncInterval.Value = EnableCustomVSyncInterval;
|
config.Graphics.EnableCustomVSyncInterval.Value = EnableCustomVSyncInterval;
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,8 @@
|
||||||
ToolTip.Tip="{locale:Locale TimeTooltip}"
|
ToolTip.Tip="{locale:Locale TimeTooltip}"
|
||||||
Width="250"/>
|
Width="250"/>
|
||||||
<DatePicker
|
<DatePicker
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
IsEnabled="{Binding !MatchSystemTime}"
|
||||||
SelectedDate="{Binding CurrentDate}"
|
SelectedDate="{Binding CurrentDate}"
|
||||||
ToolTip.Tip="{locale:Locale TimeTooltip}"
|
ToolTip.Tip="{locale:Locale TimeTooltip}"
|
||||||
Width="350" />
|
Width="350" />
|
||||||
|
|
@ -177,21 +178,21 @@
|
||||||
<TimePicker
|
<TimePicker
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ClockIdentifier="24HourClock"
|
ClockIdentifier="24HourClock"
|
||||||
|
IsEnabled="{Binding !MatchSystemTime}"
|
||||||
SelectedTime="{Binding CurrentTime}"
|
SelectedTime="{Binding CurrentTime}"
|
||||||
Width="350"
|
Width="350"
|
||||||
ToolTip.Tip="{locale:Locale TimeTooltip}" />
|
ToolTip.Tip="{locale:Locale TimeTooltip}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel
|
<StackPanel Orientation="Horizontal">
|
||||||
Margin="250,0,0,10"
|
<TextBlock
|
||||||
Orientation="Horizontal">
|
|
||||||
<Button
|
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Click="MatchSystemTime_OnClick"
|
Text="{locale:Locale SettingsTabSystemSystemTimeMatch}"
|
||||||
Background="{DynamicResource SystemAccentColor}"
|
ToolTip.Tip="{locale:Locale MatchTimeTooltip}"
|
||||||
Width="350"
|
Width="250"/>
|
||||||
ToolTip.Tip="{locale:Locale MatchTimeTooltip}">
|
<CheckBox
|
||||||
<TextBlock Text="{locale:Locale SettingsTabSystemSystemTimeMatch}" />
|
VerticalAlignment="Center"
|
||||||
</Button>
|
IsChecked="{Binding MatchSystemTime}"
|
||||||
|
ToolTip.Tip="{locale:Locale MatchTimeTooltip}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Separator />
|
<Separator />
|
||||||
<StackPanel Margin="0,10,0,10"
|
<StackPanel Margin="0,10,0,10"
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,5 @@ namespace Ryujinx.Ava.UI.Views.Settings
|
||||||
ViewModel.ValidateAndSetTimeZone(timeZone.Location);
|
ViewModel.ValidateAndSetTimeZone(timeZone.Location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MatchSystemTime_OnClick(object sender, RoutedEventArgs e) => ViewModel.MatchSystemTime();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue