diff --git a/src/Ryujinx/Assets/Locales/en_US.json b/src/Ryujinx/Assets/Locales/en_US.json index 38e252076f..6f050ec1b3 100644 --- a/src/Ryujinx/Assets/Locales/en_US.json +++ b/src/Ryujinx/Assets/Locales/en_US.json @@ -12,6 +12,8 @@ "MenuBarFileOpenFromFile": "_Load Application From File", "MenuBarFileOpenFromFileError": "No applications found in selected file.", "MenuBarFileOpenUnpacked": "Load _Unpacked Game", + "MenuBarFileLoadDlcFromFolder": "Load DLC From Folder", + "MenuBarFileLoadTitleUpdatesFromFolder": "Load Title Updates From Folder", "MenuBarFileOpenEmuFolder": "Open Ryujinx Folder", "MenuBarFileOpenLogsFolder": "Open Logs Folder", "MenuBarFileExit": "_Exit", @@ -600,6 +602,8 @@ "DebugLogTooltip": "Prints debug log messages in the console.\n\nOnly use this if specifically instructed by a staff member, as it will make logs difficult to read and worsen emulator performance.", "LoadApplicationFileTooltip": "Open a file explorer to choose a Switch compatible file to load", "LoadApplicationFolderTooltip": "Open a file explorer to choose a Switch compatible, unpacked application to load", + "LoadDlcFromFolderTooltip": "Open a file explorer to choose one or more folders to bulk load DLC from", + "LoadTitleUpdatesFromFolderTooltip": "Open a file explorer to choose one or more folders to bulk load title updates from", "OpenRyujinxFolderTooltip": "Open Ryujinx filesystem folder", "OpenRyujinxLogsTooltip": "Opens the folder where logs are written to", "ExitTooltip": "Exit Ryujinx", diff --git a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs index 45a8383bcb..51cd8592b0 100644 --- a/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs +++ b/src/Ryujinx/UI/ViewModels/MainWindowViewModel.cs @@ -1259,6 +1259,29 @@ namespace Ryujinx.Ava.UI.ViewModels _rendererWaitEvent.Set(); } + private async Task LoadContentFromFolder(LocaleKeys localeMessageKey, Func, int> onDirsSelected) + { + var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions + { + Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle], AllowMultiple = true, + }); + + if (result.Count > 0) + { + var dirs = result.Select(it => it.Path.LocalPath).ToList(); + var numAdded = onDirsSelected(dirs); + + var msg = string.Format(LocaleManager.Instance[localeMessageKey], numAdded); + + await Dispatcher.UIThread.InvokeAsync(async () => + { + await ContentDialogHelper.ShowTextDialog( + LocaleManager.Instance[numAdded > 0 ? LocaleKeys.RyujinxConfirm : LocaleKeys.RyujinxInfo], + msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark); + }); + } + } + #endregion #region PublicMethods @@ -1507,30 +1530,16 @@ namespace Ryujinx.Ava.UI.ViewModels } } - public async Task BulkLoadDlc() + public async Task LoadDlcFromFolder() { - var result = await StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions - { - Title = LocaleManager.Instance[LocaleKeys.OpenFolderDialogTitle], AllowMultiple = true, - }); + await LoadContentFromFolder(LocaleKeys.AutoloadDlcAddedMessage, + dirs => ApplicationLibrary.AutoLoadDownloadableContents(dirs)); + } - if (result.Count > 0) - { - var dirs = result.Select(it => it.Path.LocalPath).ToList(); - var numDlcAdded = ApplicationLibrary.AutoLoadDownloadableContents(dirs); - - if (numDlcAdded > 0) - { - var msg = string.Format(LocaleManager.Instance[LocaleKeys.AutoloadDlcAddedMessage], numDlcAdded); - - await Dispatcher.UIThread.InvokeAsync(async () => - { - await ContentDialogHelper.ShowTextDialog( - LocaleManager.Instance[LocaleKeys.DialogConfirmationTitle], - msg, "", "", "", LocaleManager.Instance[LocaleKeys.InputDialogOk], (int)Symbol.Checkmark); - }); - } - } + public async Task LoadTitleUpdatesFromFolder() + { + await LoadContentFromFolder(LocaleKeys.AutoloadUpdateAddedMessage, + dirs => ApplicationLibrary.AutoLoadTitleUpdates(dirs)); } public async Task OpenFolder() diff --git a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml index ac0662982d..e7815bba89 100644 --- a/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml +++ b/src/Ryujinx/UI/Views/Main/MainMenuBarView.axaml @@ -35,10 +35,15 @@ IsEnabled="{Binding EnableNonGameRunningControls}" ToolTip.Tip="{locale:Locale LoadApplicationFolderTooltip}" /> + ToolTip.Tip="{locale:Locale LoadDlcFromFolderTooltip}" /> +