mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2025-02-24 06:04:33 +01:00
HLE: misc: throw a more descriptive error when the loaded processes doesn't contain _latestPid (likely missing FW)
This commit is contained in:
parent
fd4d801bfd
commit
017f46f318
10
src/Ryujinx.Common/RyujinxException.cs
Normal file
10
src/Ryujinx.Common/RyujinxException.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Ryujinx.Common
|
||||||
|
{
|
||||||
|
public class RyujinxException : Exception
|
||||||
|
{
|
||||||
|
public RyujinxException(string message) : base(message)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -26,7 +26,17 @@ namespace Ryujinx.HLE.Loaders.Processes
|
|||||||
|
|
||||||
private ulong _latestPid;
|
private ulong _latestPid;
|
||||||
|
|
||||||
public ProcessResult ActiveApplication => _processesByPid[_latestPid];
|
public ProcessResult ActiveApplication
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!_processesByPid.TryGetValue(_latestPid, out ProcessResult value))
|
||||||
|
throw new RyujinxException(
|
||||||
|
$"The HLE Process map did not have a process with ID {_latestPid}. Are you missing firmware?");
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ProcessLoader(Switch device)
|
public ProcessLoader(Switch device)
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,7 @@ using Ryujinx.Graphics.Vulkan.MoltenVK;
|
|||||||
using Ryujinx.Headless;
|
using Ryujinx.Headless;
|
||||||
using Ryujinx.SDL2.Common;
|
using Ryujinx.SDL2.Common;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@ -243,16 +244,33 @@ namespace Ryujinx.Ava
|
|||||||
: $"Launch Mode: {AppDataManager.Mode}");
|
: $"Launch Mode: {AppDataManager.Mode}");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void ProcessUnhandledException(object sender, Exception ex, bool isTerminating)
|
internal static void ProcessUnhandledException(object sender, Exception initialException, bool isTerminating)
|
||||||
{
|
{
|
||||||
Logger.Log log = Logger.Error ?? Logger.Notice;
|
Logger.Log log = Logger.Error ?? Logger.Notice;
|
||||||
string message = $"Unhandled exception caught: {ex}";
|
|
||||||
|
|
||||||
// ReSharper disable once ConstantConditionalAccessQualifier
|
List<Exception> exceptions = [];
|
||||||
if (sender?.GetType()?.AsPrettyString() is { } senderName)
|
|
||||||
log.Print(LogClass.Application, message, senderName);
|
if (initialException is AggregateException ae)
|
||||||
|
{
|
||||||
|
exceptions.AddRange(ae.InnerExceptions);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
log.PrintMsg(LogClass.Application, message);
|
{
|
||||||
|
exceptions.Add(initialException);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var e in exceptions)
|
||||||
|
{
|
||||||
|
string message = $"Unhandled exception caught: {e}";
|
||||||
|
// ReSharper disable once ConstantConditionalAccessQualifier
|
||||||
|
if (sender?.GetType()?.AsPrettyString() is { } senderName)
|
||||||
|
log.Print(LogClass.Application, message, senderName);
|
||||||
|
else
|
||||||
|
log.PrintMsg(LogClass.Application, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isTerminating)
|
if (isTerminating)
|
||||||
Exit();
|
Exit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user