Add setting "Show Folders" to toggle using folders based on system directories

This commit is contained in:
Luke44565 2024-03-14 21:36:09 -04:00
parent 8282c7b6c6
commit 820d11fbca
22 changed files with 77 additions and 19 deletions

View file

@ -118,30 +118,37 @@ namespace Ryujinx.UI.App.Common
try
{
IEnumerable<string> folders = Directory.EnumerateDirectories(appDir, "*", SearchOption.TopDirectoryOnly);
foreach (string folder in folders)
var FileSearchOption = SearchOption.AllDirectories;
if (ConfigurationState.Instance.UI.UseSystemGameFolders)
{
if (_cancellationToken.Token.IsCancellationRequested)
IEnumerable<string> folders = Directory.EnumerateDirectories(appDir, "*", SearchOption.TopDirectoryOnly);
foreach (string folder in folders)
{
return;
if (_cancellationToken.Token.IsCancellationRequested)
{
return;
}
var fileInfo = new FileInfo(folder);
var fullPath = fileInfo.ResolveLinkTarget(true)?.FullName ?? fileInfo.FullName;
ApplicationData folderData = new()
{
TitleName = fileInfo.Name,
FileExtension = "Folder",
Path = fullPath,
};
OnApplicationAdded(new ApplicationAddedEventArgs
{
AppData = folderData,
});
}
var fileInfo = new FileInfo(folder);
var fullPath = fileInfo.ResolveLinkTarget(true)?.FullName ?? fileInfo.FullName;
ApplicationData folderData = new()
{
TitleName = fileInfo.Name,
FileExtension = "Folder",
Path = fullPath,
};
OnApplicationAdded(new ApplicationAddedEventArgs
{
AppData = folderData,
});
FileSearchOption = SearchOption.TopDirectoryOnly;
}
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", SearchOption.TopDirectoryOnly).Where(file =>
IEnumerable<string> files = Directory.EnumerateFiles(appDir, "*", FileSearchOption).Where(file =>
{
return
(Path.GetExtension(file).ToLower() is ".nsp" && ConfigurationState.Instance.UI.ShownFileTypes.NSP.Value) ||

View file

@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common.Configuration
/// <summary>
/// The current version of the file format
/// </summary>
public const int CurrentVersion = 49;
public const int CurrentVersion = 50;
/// <summary>
/// Version of the configuration file format
@ -317,6 +317,11 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public bool ShowConsole { get; set; }
/// <summary>
/// use system directories when listing games
/// </summary>
public bool UseSystemGameFolders { get; set; }
/// <summary>
/// Enable or disable keyboard support (Independent from controllers binding)
/// </summary>

View file

@ -186,6 +186,11 @@ namespace Ryujinx.UI.Common.Configuration
/// </summary>
public ReactiveObject<bool> IsAscendingOrder { get; private set; }
/// <summary>
/// use system directories when listing games
/// </summary>
public ReactiveObject<bool> UseSystemGameFolders { get; private set; }
public UISection()
{
GuiColumns = new Columns();
@ -204,6 +209,7 @@ namespace Ryujinx.UI.Common.Configuration
IsAscendingOrder = new ReactiveObject<bool>();
LanguageCode = new ReactiveObject<string>();
ShowConsole = new ReactiveObject<bool>();
UseSystemGameFolders = new ReactiveObject<bool>();
ShowConsole.Event += static (s, e) => { ConsoleHelper.SetConsoleWindowState(e.NewValue); };
}
}
@ -741,6 +747,7 @@ namespace Ryujinx.UI.Common.Configuration
IsAscendingOrder = UI.IsAscendingOrder,
StartFullscreen = UI.StartFullscreen,
ShowConsole = UI.ShowConsole,
UseSystemGameFolders = UI.UseSystemGameFolders,
EnableKeyboard = Hid.EnableKeyboard,
EnableMouse = Hid.EnableMouse,
Hotkeys = Hid.Hotkeys,
@ -836,6 +843,7 @@ namespace Ryujinx.UI.Common.Configuration
UI.IsAscendingOrder.Value = true;
UI.StartFullscreen.Value = false;
UI.ShowConsole.Value = true;
UI.UseSystemGameFolders.Value = true;
UI.WindowStartup.WindowSizeWidth.Value = 1280;
UI.WindowStartup.WindowSizeHeight.Value = 760;
UI.WindowStartup.WindowPositionX.Value = 0;
@ -1442,6 +1450,15 @@ namespace Ryujinx.UI.Common.Configuration
configurationFileUpdated = true;
}
if (configurationFileFormat.Version < 50)
{
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 50.");
configurationFileFormat.UseSystemGameFolders = true;
configurationFileUpdated = true;
}
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
Graphics.ResScale.Value = configurationFileFormat.ResScale;
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
@ -1518,6 +1535,7 @@ namespace Ryujinx.UI.Common.Configuration
UI.ApplicationSort.Value = configurationFileFormat.ApplicationSort;
UI.StartFullscreen.Value = configurationFileFormat.StartFullscreen;
UI.ShowConsole.Value = configurationFileFormat.ShowConsole;
UI.UseSystemGameFolders.Value = configurationFileFormat.UseSystemGameFolders;
UI.WindowStartup.WindowSizeWidth.Value = configurationFileFormat.WindowStartup.WindowSizeWidth;
UI.WindowStartup.WindowSizeHeight.Value = configurationFileFormat.WindowStartup.WindowSizeHeight;
UI.WindowStartup.WindowPositionX.Value = configurationFileFormat.WindowStartup.WindowPositionX;

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Oberfläche",
"SettingsTabGeneralGeneral": "Allgemein",
"SettingsTabGeneralEnableDiscordRichPresence": "Aktiviere die Statusanzeige für Discord",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Beim Start nach Updates suchen",
"SettingsTabGeneralShowConfirmExitDialog": "Zeige den \"Beenden bestätigen\"-Dialog",
"SettingsTabGeneralHideCursor": "Mauszeiger ausblenden",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Εμφάνιση",
"SettingsTabGeneralGeneral": "Γενικά",
"SettingsTabGeneralEnableDiscordRichPresence": "Ενεργοποίηση Εμπλουτισμένης Παρουσίας Discord",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Έλεγχος για Ενημερώσεις στην Εκκίνηση",
"SettingsTabGeneralShowConfirmExitDialog": "Εμφάνιση διαλόγου \"Επιβεβαίωση Εξόδου\".",
"SettingsTabGeneralHideCursor": "Απόκρυψη Κέρσορα:",

View file

@ -90,6 +90,7 @@
"SettingsTabGeneral": "User Interface",
"SettingsTabGeneralGeneral": "General",
"SettingsTabGeneralEnableDiscordRichPresence": "Enable Discord Rich Presence",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Check for Updates on Launch",
"SettingsTabGeneralShowConfirmExitDialog": "Show \"Confirm Exit\" Dialog",
"SettingsTabGeneralHideCursor": "Hide Cursor:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Interfaz de usuario",
"SettingsTabGeneralGeneral": "General",
"SettingsTabGeneralEnableDiscordRichPresence": "Habilitar estado en Discord",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Buscar actualizaciones al iniciar",
"SettingsTabGeneralShowConfirmExitDialog": "Mostrar diálogo de confirmación al cerrar",
"SettingsTabGeneralHideCursor": "Esconder el cursor:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Interface Utilisateur",
"SettingsTabGeneralGeneral": "Général",
"SettingsTabGeneralEnableDiscordRichPresence": "Activer Discord Rich Presence",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Vérifier les mises à jour au démarrage",
"SettingsTabGeneralShowConfirmExitDialog": "Afficher le message de \"Confirmation de sortie\"",
"SettingsTabGeneralHideCursor": "Masquer le Curseur :",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "ממשק משתמש",
"SettingsTabGeneralGeneral": "כללי",
"SettingsTabGeneralEnableDiscordRichPresence": "הפעלת תצוגה עשירה בדיסקורד",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "בדוק אם קיימים עדכונים בהפעלה",
"SettingsTabGeneralShowConfirmExitDialog": "הראה דיאלוג \"אשר יציאה\"",
"SettingsTabGeneralHideCursor": "הסתר את הסמן",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Interfaccia utente",
"SettingsTabGeneralGeneral": "Generali",
"SettingsTabGeneralEnableDiscordRichPresence": "Attiva Discord Rich Presence",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Controlla aggiornamenti all'avvio",
"SettingsTabGeneralShowConfirmExitDialog": "Mostra dialogo \"Conferma Uscita\"",
"SettingsTabGeneralHideCursor": "Nascondi il cursore:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "ユーザインタフェース",
"SettingsTabGeneralGeneral": "一般",
"SettingsTabGeneralEnableDiscordRichPresence": "Discord リッチプレゼンスを有効にする",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "起動時にアップデートを確認する",
"SettingsTabGeneralShowConfirmExitDialog": "\"終了を確認\" ダイアログを表示する",
"SettingsTabGeneralHideCursor": "マウスカーソルを非表示",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "사용자 인터페이스",
"SettingsTabGeneralGeneral": "일반",
"SettingsTabGeneralEnableDiscordRichPresence": "디스코드 활동 상태 활성화",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "시작 시, 업데이트 확인",
"SettingsTabGeneralShowConfirmExitDialog": "\"종료 확인\" 대화 상자 표시",
"SettingsTabGeneralHideCursor": "마우스 커서 숨기기",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Interfejs Użytkownika",
"SettingsTabGeneralGeneral": "Ogólne",
"SettingsTabGeneralEnableDiscordRichPresence": "Włącz Bogatą Obecność Discord",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Sprawdź Aktualizacje przy Uruchomieniu",
"SettingsTabGeneralShowConfirmExitDialog": "Pokaż Okno Dialogowe \"Potwierdzenia Wyjścia\"",
"SettingsTabGeneralHideCursor": "Ukryj kursor:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Geral",
"SettingsTabGeneralGeneral": "Geral",
"SettingsTabGeneralEnableDiscordRichPresence": "Habilitar Rich Presence do Discord",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Verificar se há atualizações ao iniciar",
"SettingsTabGeneralShowConfirmExitDialog": "Exibir diálogo de confirmação ao sair",
"SettingsTabGeneralHideCursor": "Esconder o cursor do mouse:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Пользовательский интерфейс",
"SettingsTabGeneralGeneral": "Общее",
"SettingsTabGeneralEnableDiscordRichPresence": "Включить Discord Rich Presence",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Проверять наличие обновлений при запуске",
"SettingsTabGeneralShowConfirmExitDialog": "Показать диалоговое окно \"Подтвердить выход\"",
"SettingsTabGeneralHideCursor": "Скрыть курсор",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Kullancı Arayüzü",
"SettingsTabGeneralGeneral": "Genel",
"SettingsTabGeneralEnableDiscordRichPresence": "Discord Zengin İçerik'i Etkinleştir",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Her Açılışta Güncellemeleri Denetle",
"SettingsTabGeneralShowConfirmExitDialog": "\"Çıkışı Onayla\" Diyaloğunu Göster",
"SettingsTabGeneralHideCursor": "İşaretçiyi Gizle:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "Інтерфейс користувача",
"SettingsTabGeneralGeneral": "Загальні",
"SettingsTabGeneralEnableDiscordRichPresence": "Увімкнути розширену присутність Discord",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "Перевіряти наявність оновлень під час запуску",
"SettingsTabGeneralShowConfirmExitDialog": "Показати діалогове вікно «Підтвердити вихід».",
"SettingsTabGeneralHideCursor": "Hide Cursor:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "用户界面",
"SettingsTabGeneralGeneral": "常规",
"SettingsTabGeneralEnableDiscordRichPresence": "启用 Discord 在线状态展示",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "自动检查更新",
"SettingsTabGeneralShowConfirmExitDialog": "显示 \"确认退出\" 对话框",
"SettingsTabGeneralHideCursor": "隐藏鼠标指针:",

View file

@ -85,6 +85,7 @@
"SettingsTabGeneral": "使用者介面",
"SettingsTabGeneralGeneral": "一般",
"SettingsTabGeneralEnableDiscordRichPresence": "啟用 Discord 動態狀態展示",
"SettingsTabGeneralUseSystemGameFolders": "Show Folders",
"SettingsTabGeneralCheckUpdatesOnLaunch": "自動檢查更新",
"SettingsTabGeneralShowConfirmExitDialog": "顯示「確認離開」對話框",
"SettingsTabGeneralHideCursor": "隱藏滑鼠遊標:",

View file

@ -132,6 +132,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool EnableDiscordIntegration { get; set; }
public bool CheckUpdatesOnStart { get; set; }
public bool ShowConfirmExit { get; set; }
public bool UseSystemGameFolders { get; set; }
public int HideCursor { get; set; }
public bool EnableDockedMode { get; set; }
public bool EnableKeyboard { get; set; }
@ -405,6 +406,7 @@ namespace Ryujinx.Ava.UI.ViewModels
EnableDiscordIntegration = config.EnableDiscordIntegration;
CheckUpdatesOnStart = config.CheckUpdatesOnStart;
ShowConfirmExit = config.ShowConfirmExit;
UseSystemGameFolders = config.UI.UseSystemGameFolders;
HideCursor = (int)config.HideCursor.Value;
GameDirectories.Clear();
@ -489,6 +491,7 @@ 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)

View file

@ -36,6 +36,9 @@
<CheckBox IsChecked="{Binding ShowConfirmExit}">
<TextBlock Text="{locale:Locale SettingsTabGeneralShowConfirmExitDialog}" />
</CheckBox>
<CheckBox IsChecked="{Binding UseSystemGameFolders}">
<TextBlock Text="{locale:Locale SettingsTabGeneralUseSystemGameFolders}" />
</CheckBox>
<StackPanel Margin="0, 15, 0, 0" Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
Text="{locale:Locale SettingsTabGeneralHideCursor}"

View file

@ -541,6 +541,12 @@ namespace Ryujinx.Ava.UI.Windows
_isLoading = true;
if (ViewModel.IsInFolder && !ConfigurationState.Instance.UI.UseSystemGameFolders)
{
ViewModel.PathHistory.Clear();
ViewModel.IsInFolder = false;
}
Thread applicationLibraryThread = new(() =>
{
if (ViewModel.IsInFolder)