Sfoglia il codice sorgente

UI: Refresh game list when emulated Switch language is changed (to show different logos/names)

Evan Husted 1 anno fa
parent
commit
a4b5304935

+ 8 - 15
src/Ryujinx/UI/ViewModels/SettingsViewModel.cs

@@ -49,8 +49,7 @@ namespace Ryujinx.Ava.UI.ViewModels
         private int _graphicsBackendMultithreadingIndex;
         private float _volume;
         [ObservableProperty] private bool _isVulkanAvailable = true;
-        [ObservableProperty] private bool _gameDirectoryChanged;
-        [ObservableProperty] private bool _autoloadDirectoryChanged;
+        [ObservableProperty] private bool _gameListNeedsRefresh;
         private readonly List<string> _gpuIds = [];
         private int _graphicsBackendIndex;
         private int _scalingFilter;
@@ -593,16 +592,8 @@ namespace Ryujinx.Ava.UI.ViewModels
             config.HideCursor.Value = (HideCursorMode)HideCursor;
             config.UpdateCheckerType.Value = (UpdaterType)UpdateCheckerType;
             config.FocusLostActionType.Value = (FocusLostType)FocusLostActionType;
-
-            if (GameDirectoryChanged)
-            {
-                config.UI.GameDirs.Value = [..GameDirectories];
-            }
-
-            if (AutoloadDirectoryChanged)
-            {
-                config.UI.AutoloadDirs.Value = [..AutoloadDirectories];
-            }
+            config.UI.GameDirs.Value = [..GameDirectories];
+            config.UI.AutoloadDirs.Value = [..AutoloadDirectories];
 
             config.UI.BaseStyle.Value = BaseStyleIndex switch
             {
@@ -623,8 +614,11 @@ namespace Ryujinx.Ava.UI.ViewModels
 
             // System
             config.System.Region.Value = (Region)Region;
+            
+            if (config.System.Language.Value != (Language)Language)
+                GameListNeedsRefresh = true;
+            
             config.System.Language.Value = (Language)Language;
-
             if (_validTzRegions.Contains(TimeZone))
             {
                 config.System.TimeZone.Value = TimeZone;
@@ -715,8 +709,7 @@ namespace Ryujinx.Ava.UI.ViewModels
 
             SaveSettingsEvent?.Invoke();
 
-            GameDirectoryChanged = false;
-            AutoloadDirectoryChanged = false;
+            GameListNeedsRefresh = false;
         }
 
         private static void RevertIfNotSaved()

+ 5 - 11
src/Ryujinx/UI/Views/Settings/SettingsUIView.axaml.cs

@@ -36,11 +36,8 @@ namespace Ryujinx.Ava.UI.Views.Settings
                 directories.Add(path);
                 
                 addDirBox.Clear();
-                
-                if (isGameList)
-                    ViewModel.GameDirectoryChanged = true;
-                else
-                    ViewModel.AutoloadDirectoryChanged = true;
+
+                ViewModel.GameListNeedsRefresh = true;
             }
             else
             {
@@ -50,10 +47,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
                 {
                     directories.Add(folder.Value.Path.LocalPath);
                         
-                    if (isGameList)
-                        ViewModel.GameDirectoryChanged = true;
-                    else
-                        ViewModel.AutoloadDirectoryChanged = true;
+                    ViewModel.GameListNeedsRefresh = true;
                 }
             }
         }
@@ -65,7 +59,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
             foreach (string path in new List<string>(GameDirsList.SelectedItems.Cast<string>()))
             {
                 ViewModel.GameDirectories.Remove(path);
-                ViewModel.GameDirectoryChanged = true;
+                ViewModel.GameListNeedsRefresh = true;
             }
 
             if (GameDirsList.ItemCount > 0)
@@ -81,7 +75,7 @@ namespace Ryujinx.Ava.UI.Views.Settings
             foreach (string path in new List<string>(AutoloadDirsList.SelectedItems.Cast<string>()))
             {
                 ViewModel.AutoloadDirectories.Remove(path);
-                ViewModel.AutoloadDirectoryChanged = true;
+                ViewModel.GameListNeedsRefresh = true;
             }
 
             if (AutoloadDirsList.ItemCount > 0)

+ 1 - 1
src/Ryujinx/UI/Windows/SettingsWindow.axaml.cs

@@ -45,7 +45,7 @@ namespace Ryujinx.Ava.UI.Windows
         {
             InputPage.InputView?.SaveCurrentProfile();
 
-            if (Owner is MainWindow window && (ViewModel.GameDirectoryChanged || ViewModel.AutoloadDirectoryChanged))
+            if (Owner is MainWindow window && ViewModel.GameListNeedsRefresh)
             {
                 window.LoadApplications();
             }