diff --git a/src/Ryujinx.Gtk3/Program.cs b/src/Ryujinx.Gtk3/Program.cs index 2d350374bf..514f516508 100644 --- a/src/Ryujinx.Gtk3/Program.cs +++ b/src/Ryujinx.Gtk3/Program.cs @@ -318,15 +318,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 { @@ -336,8 +334,7 @@ namespace Ryujinx } else { - applicationData = applications[0]; - mainWindow.RunApplication(applicationData, CommandLineState.StartFullscreenArg); + mainWindow.RunApplication(applications[0], CommandLineState.StartFullscreenArg); } } else diff --git a/src/Ryujinx.HLE/Loaders/Processes/Extensions/PartitionFileSystemExtensions.cs b/src/Ryujinx.HLE/Loaders/Processes/Extensions/PartitionFileSystemExtensions.cs index b3590d9bd7..b3d409e082 100644 --- a/src/Ryujinx.HLE/Loaders/Processes/Extensions/PartitionFileSystemExtensions.cs +++ b/src/Ryujinx.HLE/Loaders/Processes/Extensions/PartitionFileSystemExtensions.cs @@ -71,10 +71,11 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions if (applicationId == 0) { - foreach ((ulong _, ContentMetaData content) in applications) + foreach ((ulong id, ContentMetaData content) in applications) { mainNca = content.GetNcaByType(device.FileSystem.KeySet, ContentType.Program, device.Configuration.UserChannelPersistence.Index); controlNca = content.GetNcaByType(device.FileSystem.KeySet, ContentType.Control, device.Configuration.UserChannelPersistence.Index); + applicationId = id; break; } } @@ -142,7 +143,24 @@ namespace Ryujinx.HLE.Loaders.Processes.Extensions } } - return (true, mainNca.Load(device, patchNca, controlNca)); + try + { + return (true, mainNca.Load(device, patchNca, controlNca)); + } + catch (HorizonResultException ex) + { + // The exception message already contains enough information here. + errorMessage = $"Failed to load: {ex.Message}"; + + return (false, ProcessResult.Failed); + } + catch (Exception ex) + { + // Add the stacktrace in addition to the exception message. + errorMessage = $"Failed to load: {ex}"; + + return (false, ProcessResult.Failed); + } } errorMessage = $"Unable to load: Could not find Main NCA for title \"{applicationId:X16}\""; diff --git a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs index 2defc1f6c8..89d2326c37 100644 --- a/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs +++ b/src/Ryujinx.UI.Common/App/ApplicationLibrary.cs @@ -576,19 +576,13 @@ namespace Ryujinx.UI.App.Common { AppData = application, }); - } - if (applications.Count > 1) - { - numApplicationsFound += applications.Count - 1; + numApplicationsFound++; + numApplicationsLoaded++; } + } - numApplicationsLoaded += applications.Count; - } - else - { - numApplicationsFound--; - } + numApplicationsFound--; OnApplicationCountUpdated(new ApplicationCountUpdatedEventArgs { 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