Load applications when necessary

This prevents loading applications when launching an application
directly from the command line (or a shortcut).
Instead, applications will be loaded after the emulation was stopped by the user.
This commit is contained in:
TSR Berry 2024-07-27 01:29:53 +02:00
parent bcfe4f6b8a
commit 49e390b1d5
No known key found for this signature in database
GPG key ID: 52353C0A4CCA15E2
3 changed files with 19 additions and 2 deletions

View file

@ -256,6 +256,12 @@ namespace Ryujinx
MainWindow mainWindow = new();
mainWindow.Show();
// Load the game table if no application was requested by the command line
if (CommandLineState.LaunchPathArg == null)
{
mainWindow.UpdateGameTable();
}
if (OperatingSystem.IsLinux())
{
int currentVmMaxMapCount = LinuxHelper.VmMaxMapCount;

View file

@ -325,7 +325,6 @@ namespace Ryujinx.UI
_hideUI.Label = _hideUI.Label.Replace("SHOWUIKEY", ConfigurationState.Instance.Hid.Hotkeys.Value.ShowUI.ToString());
UpdateColumns();
UpdateGameTable();
ConfigurationState.Instance.UI.GameDirs.Event += (sender, args) =>
{

View file

@ -37,6 +37,7 @@ namespace Ryujinx.Ava.UI.Windows
internal static MainWindowViewModel MainWindowViewModel { get; private set; }
private bool _isLoading;
private bool _applicationsLoadedOnce;
private UserChannelPersistence _userChannelPersistence;
private static bool _deferLoad;
@ -472,7 +473,11 @@ namespace Ryujinx.Ava.UI.Windows
ViewModel.RefreshFirmwareStatus();
LoadApplications();
// Load applications if no application was requested by the command line
if (!_deferLoad)
{
LoadApplications();
}
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
CheckLaunchState();
@ -485,6 +490,12 @@ namespace Ryujinx.Ava.UI.Windows
if (MainContent.Content != content)
{
// Load applications while switching to the GameLibrary if we haven't done that yet
if (!_applicationsLoadedOnce && content == GameLibrary)
{
LoadApplications();
}
MainContent.Content = content;
}
}
@ -581,6 +592,7 @@ namespace Ryujinx.Ava.UI.Windows
public void LoadApplications()
{
_applicationsLoadedOnce = true;
ViewModel.Applications.Clear();
StatusBarView.LoadProgressBar.IsVisible = true;