diff --git a/Ryujinx.Common/Logging/LogClass.cs b/Ryujinx.Common/Logging/LogClass.cs index 8739fbc677..f20347b6b5 100644 --- a/Ryujinx.Common/Logging/LogClass.cs +++ b/Ryujinx.Common/Logging/LogClass.cs @@ -5,6 +5,7 @@ namespace Ryujinx.Common.Logging Audio, Cpu, Font, + Emulation, Gpu, Hid, Kernel, diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs index f1d0a2ff9d..be5d3ba7c4 100644 --- a/Ryujinx/Program.cs +++ b/Ryujinx/Program.cs @@ -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); + } + /// /// Picks an audio output renderer supported on this machine ///