From 43feea8cd5821f2d18e7d5f7c0cf59ed683f214a Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Tue, 16 Jul 2024 20:49:49 +0100 Subject: [PATCH] Upstream config changes --- .../Settings/SettingsSystemViewModel.cs | 6 ++- .../Settings/SettingsUIViewModel.cs | 38 +++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/Settings/SettingsSystemViewModel.cs b/src/Ryujinx/UI/ViewModels/Settings/SettingsSystemViewModel.cs index cf6778e2ba..a3881edc8c 100644 --- a/src/Ryujinx/UI/ViewModels/Settings/SettingsSystemViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Settings/SettingsSystemViewModel.cs @@ -141,10 +141,12 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings Language = (int)config.System.Language.Value; TimeZone = config.System.TimeZone; - DateTime currentDateTime = DateTime.Now; + DateTime currentHostDateTime = DateTime.Now; + TimeSpan systemDateTimeOffset = TimeSpan.FromSeconds(config.System.SystemTimeOffset); + DateTime currentDateTime = currentHostDateTime.Add(systemDateTimeOffset); CurrentDate = currentDateTime.Date; - CurrentTime = currentDateTime.TimeOfDay.Add(TimeSpan.FromSeconds(config.System.SystemTimeOffset)); + CurrentTime = currentDateTime.TimeOfDay; EnableVsync = config.Graphics.EnableVsync; EnableFsIntegrityChecks = config.System.EnableFsIntegrityChecks; diff --git a/src/Ryujinx/UI/ViewModels/Settings/SettingsUIViewModel.cs b/src/Ryujinx/UI/ViewModels/Settings/SettingsUIViewModel.cs index f9241f2672..b967afc0fa 100644 --- a/src/Ryujinx/UI/ViewModels/Settings/SettingsUIViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/Settings/SettingsUIViewModel.cs @@ -43,6 +43,17 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings } } + private bool _rememberWindowState; + public bool RememberWindowState + { + get => _rememberWindowState; + set + { + _rememberWindowState = value; + DirtyEvent?.Invoke(); + } + } + private int _hideCursor; public int HideCursor { @@ -78,13 +89,20 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings EnableDiscordIntegration = config.EnableDiscordIntegration; CheckUpdatesOnStart = config.CheckUpdatesOnStart; ShowConfirmExit = config.ShowConfirmExit; + RememberWindowState = config.RememberWindowState; HideCursor = (int)config.HideCursor.Value; GameDirectories.Clear(); GameDirectories.AddRange(config.UI.GameDirs.Value); GameDirectories.CollectionChanged += (_, _) => DirtyEvent?.Invoke(); - BaseStyleIndex = config.UI.BaseStyle == "Light" ? 0 : 1; + BaseStyleIndex = config.UI.BaseStyle.Value switch + { + "Auto" => 0, + "Light" => 1, + "Dark" => 2, + _ => 0 + }; } public bool CheckIfModified(ConfigurationState config) @@ -96,9 +114,16 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings isDirty |= config.EnableDiscordIntegration.Value != EnableDiscordIntegration; isDirty |= config.CheckUpdatesOnStart.Value != CheckUpdatesOnStart; isDirty |= config.ShowConfirmExit.Value != ShowConfirmExit; + isDirty |= config.RememberWindowState.Value != RememberWindowState; isDirty |= config.HideCursor.Value != (HideCursorMode)HideCursor; isDirty |= DirsChanged; - isDirty |= config.UI.BaseStyle.Value != (BaseStyleIndex == 0 ? "Light" : "Dark"); + isDirty |= config.UI.BaseStyle.Value != BaseStyleIndex switch + { + 0 => "Auto", + 1 => "Light", + 2 => "Dark", + _ => "Auto" + }; return isDirty; } @@ -108,9 +133,16 @@ namespace Ryujinx.Ava.UI.ViewModels.Settings config.EnableDiscordIntegration.Value = EnableDiscordIntegration; config.CheckUpdatesOnStart.Value = CheckUpdatesOnStart; config.ShowConfirmExit.Value = ShowConfirmExit; + config.RememberWindowState.Value = RememberWindowState; config.HideCursor.Value = (HideCursorMode)HideCursor; config.UI.GameDirs.Value = GameDirectories.ToList(); - config.UI.BaseStyle.Value = BaseStyleIndex == 0 ? "Light" : "Dark"; + config.UI.BaseStyle.Value = BaseStyleIndex switch + { + 0 => "Auto", + 1 => "Light", + 2 => "Dark", + _ => "Auto" + }; } } }