From 77613827401082e9f2872fa2b4f36f66ea5e007b Mon Sep 17 00:00:00 2001 From: Luke44565 Date: Mon, 18 Mar 2024 17:42:32 -0400 Subject: [PATCH] Hide back button when folders are disabled, reload game list when the folder setting is changed --- src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs | 12 ++++++++++++ src/Ryujinx/UI/ViewModels/SettingsViewModel.cs | 9 ++++++++- src/Ryujinx/UI/Views/Main/MainViewControls.axaml | 1 + src/Ryujinx/UI/Windows/SettingsWindow.axaml.cs | 13 +++++++++++-- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 94f7dc800..463872401 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -86,6 +86,7 @@ namespace Ryujinx.Ava.UI.ViewModels private string _lastScannedAmiiboId; private bool _statusBarVisible; private bool _isInFolder; + private bool _foldersEnabled; private ReadOnlyObservableCollection _appsObservableList; private string _showUiKey = "F4"; @@ -123,6 +124,7 @@ namespace Ryujinx.Ava.UI.ViewModels _rendererWaitEvent = new AutoResetEvent(false); _pathHistory = new Stack(); + FoldersEnabled = ConfigurationState.Instance.UI.UseSystemGameFolders; if (Program.PreviewerDetached) { @@ -683,6 +685,16 @@ namespace Ryujinx.Ava.UI.ViewModels OnPropertyChanged(); } } + public bool FoldersEnabled + { + get => _foldersEnabled; + set + { + _foldersEnabled = value; + + OnPropertyChanged(); + } + } internal void Sort(bool isAscending) { diff --git a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs index 2a6149981..8c61104bb 100644 --- a/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/SettingsViewModel.cs @@ -116,6 +116,7 @@ namespace Ryujinx.Ava.UI.ViewModels public bool IsHypervisorAvailable => OperatingSystem.IsMacOS() && RuntimeInformation.ProcessArchitecture == Architecture.Arm64; + public bool FolderModeChanged; public bool DirectoryChanged { get => _directoryChanged; @@ -491,7 +492,6 @@ namespace Ryujinx.Ava.UI.ViewModels config.EnableDiscordIntegration.Value = EnableDiscordIntegration; config.CheckUpdatesOnStart.Value = CheckUpdatesOnStart; config.ShowConfirmExit.Value = ShowConfirmExit; - config.UI.UseSystemGameFolders.Value = UseSystemGameFolders; config.HideCursor.Value = (HideCursorMode)HideCursor; if (_directoryChanged) @@ -500,6 +500,12 @@ namespace Ryujinx.Ava.UI.ViewModels config.UI.GameDirs.Value = gameDirs; } + if (UseSystemGameFolders != config.UI.UseSystemGameFolders.Value) + { + FolderModeChanged = true; + } + config.UI.UseSystemGameFolders.Value = UseSystemGameFolders; + config.UI.BaseStyle.Value = BaseStyleIndex == 0 ? "Light" : "Dark"; // Input @@ -590,6 +596,7 @@ namespace Ryujinx.Ava.UI.ViewModels SaveSettingsEvent?.Invoke(); _directoryChanged = false; + FolderModeChanged = false; } private static void RevertIfNotSaved() diff --git a/src/Ryujinx/UI/Views/Main/MainViewControls.axaml b/src/Ryujinx/UI/Views/Main/MainViewControls.axaml index cbd89de0e..5b232af92 100644 --- a/src/Ryujinx/UI/Views/Main/MainViewControls.axaml +++ b/src/Ryujinx/UI/Views/Main/MainViewControls.axaml @@ -24,6 +24,7 @@ Margin="5,2,0,2" VerticalAlignment="Stretch" Command="{Binding NavigateBack}" + IsVisible="{Binding FoldersEnabled}" IsEnabled="{Binding IsInFolder}">