From 7fca6ad333dd2fdfdd675992fd5d1f38997a73f3 Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Sun, 28 Jul 2024 21:05:58 +0200 Subject: [PATCH] Fix check for application id when launching directly from the command line --- src/Ryujinx.Gtk3/Program.cs | 11 ++++------- src/Ryujinx/UI/Windows/MainWindow.axaml.cs | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/Ryujinx.Gtk3/Program.cs b/src/Ryujinx.Gtk3/Program.cs index 8bb6516409..1b7cd3cc18 100644 --- a/src/Ryujinx.Gtk3/Program.cs +++ b/src/Ryujinx.Gtk3/Program.cs @@ -331,15 +331,13 @@ namespace Ryujinx { if (mainWindow.ApplicationLibrary.TryGetApplicationsFromFile(CommandLineState.LaunchPathArg, out List applications)) { - ApplicationData applicationData; - if (CommandLineState.LaunchApplicationId != null) { - applicationData = applications.Find(application => application.IdString == CommandLineState.LaunchApplicationId); + int applicationIndex = applications.FindIndex(application => application.IdString.Equals(CommandLineState.LaunchApplicationId, StringComparison.InvariantCultureIgnoreCase)); - if (applicationData != null) + if (applicationIndex != -1) { - mainWindow.RunApplication(applicationData, CommandLineState.StartFullscreenArg); + mainWindow.RunApplication(applications[applicationIndex], CommandLineState.StartFullscreenArg); } else { @@ -349,8 +347,7 @@ namespace Ryujinx } else { - applicationData = applications[0]; - mainWindow.RunApplication(applicationData, CommandLineState.StartFullscreenArg); + mainWindow.RunApplication(applications[0], CommandLineState.StartFullscreenArg); } } else diff --git a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs index 348412e78c..f5e826c17d 100644 --- a/src/Ryujinx/UI/Windows/MainWindow.axaml.cs +++ b/src/Ryujinx/UI/Windows/MainWindow.axaml.cs @@ -325,15 +325,13 @@ namespace Ryujinx.Ava.UI.Windows if (ApplicationLibrary.TryGetApplicationsFromFile(_launchPath, out List applications)) { - ApplicationData applicationData; - if (_launchApplicationId != null) { - applicationData = applications.Find(application => application.IdString == _launchApplicationId); + int applicationIndex = applications.FindIndex(application => application.IdString.Equals(_launchApplicationId, StringComparison.InvariantCultureIgnoreCase)); - if (applicationData != null) + if (applicationIndex != -1) { - await ViewModel.LoadApplication(applicationData, _startFullscreen); + await ViewModel.LoadApplication(applications[applicationIndex], _startFullscreen); } else { @@ -343,8 +341,7 @@ namespace Ryujinx.Ava.UI.Windows } else { - applicationData = applications[0]; - await ViewModel.LoadApplication(applicationData, _startFullscreen); + await ViewModel.LoadApplication(applications[0], _startFullscreen); } } else