From 2e93c96c866d07ad12bdd695e4bfbef3bd6c1216 Mon Sep 17 00:00:00 2001 From: Jimmy Reichley Date: Wed, 14 Aug 2024 21:54:58 -0400 Subject: [PATCH] Trigger DLC/update load on games refresh --- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 348412e78..884b717c7 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -144,6 +144,16 @@ namespace Ryujinx.Ava.UI.Windows }); } + private void ApplicationLibrary_DownloadableContentAdded(object sender, DownloadableContentAddedEventArgs e) + { + // Console.WriteLine("[{0}]: {1} ({2})", e.TitleId, e.ContainerFilePath, e.NcaPath); + } + + private void ApplicationLibrary_TitleUpdateAdded(object sender, TitleUpdateAddedEventArgs e) + { + // Console.WriteLine("[{0}]: {1}", e.TitleId, e.FilePath); + } + private void ApplicationLibrary_ApplicationCountUpdated(object sender, ApplicationCountUpdatedEventArgs e) { LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.StatusBarGamesLoaded, e.NumAppsLoaded, e.NumAppsFound); @@ -473,6 +483,8 @@ namespace Ryujinx.Ava.UI.Windows ApplicationLibrary.ApplicationCountUpdated += ApplicationLibrary_ApplicationCountUpdated; ApplicationLibrary.ApplicationAdded += ApplicationLibrary_ApplicationAdded; + ApplicationLibrary.DownloadableContentAdded += ApplicationLibrary_DownloadableContentAdded; + ApplicationLibrary.TitleUpdateAdded += ApplicationLibrary_TitleUpdateAdded; ViewModel.RefreshFirmwareStatus(); @@ -638,7 +650,9 @@ namespace Ryujinx.Ava.UI.Windows Thread applicationLibraryThread = new(() => { ApplicationLibrary.DesiredLanguage = ConfigurationState.Instance.System.Language; - ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs); + TimeIt("games", () => ApplicationLibrary.LoadApplications(ConfigurationState.Instance.UI.GameDirs)); + TimeIt("updates", () => ApplicationLibrary.LoadTitleUpdates(ConfigurationState.Instance.UI.GameDirs)); + TimeIt("DLC", () => ApplicationLibrary.LoadDownloadableContents(ConfigurationState.Instance.UI.GameDirs)); _isLoading = false; }) @@ -648,5 +662,14 @@ namespace Ryujinx.Ava.UI.Windows }; applicationLibraryThread.Start(); } + + private static void TimeIt(string tag, Action act) + { + var watch = System.Diagnostics.Stopwatch.StartNew(); + act(); + watch.Stop(); + var elapsedMs = watch.ElapsedMilliseconds; + Console.WriteLine("[{0}] {1} ms", tag, elapsedMs); + } } }