This commit is contained in:
TSRBerry 2024-09-28 16:01:10 +02:00 committed by GitHub
commit 31a9eb9419
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 32 additions and 26 deletions

View File

@ -318,15 +318,13 @@ namespace Ryujinx
{
if (mainWindow.ApplicationLibrary.TryGetApplicationsFromFile(CommandLineState.LaunchPathArg, out List<ApplicationData> 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

View File

@ -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}\"";

View File

@ -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
{

View File

@ -325,15 +325,13 @@ namespace Ryujinx.Ava.UI.Windows
if (ApplicationLibrary.TryGetApplicationsFromFile(_launchPath, out List<ApplicationData> 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