Trigger DLC/update load on games refresh

This commit is contained in:
Jimmy Reichley 2024-08-14 21:54:58 -04:00
parent 5e0b1ccd6e
commit 2e93c96c86
No known key found for this signature in database
GPG key ID: 67715DC5A329803C

View file

@ -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);
}
}
}