add unhandled exception handler

This commit is contained in:
emmaus 2019-01-10 22:03:10 +00:00
parent 8406ec6272
commit 00f03f99ba
2 changed files with 15 additions and 0 deletions

View file

@ -5,6 +5,7 @@ namespace Ryujinx.Common.Logging
Audio,
Cpu,
Font,
Emulation,
Gpu,
Hid,
Kernel,

View file

@ -24,6 +24,8 @@ namespace Ryujinx
Logger.Updated += ConsoleLog.Log;
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
if (args.Length == 1)
{
if (Directory.Exists(args[0]))
@ -86,6 +88,18 @@ namespace Ryujinx
audioOut.Dispose();
}
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
var exception = e.ExceptionObject as Exception;
Logger.PrintError(LogClass.Emulation, $"Unhandled exception caught: {exception}");
Logger.PrintInfo(LogClass.Emulation,"Press any key to close the application...");
Console.ReadKey();
Environment.Exit(0);
}
/// <summary>
/// Picks an <see cref="IAalOutput"/> audio output renderer supported on this machine
/// </summary>