aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx/Program.cs')
-rw-r--r--Ryujinx/Program.cs22
1 files changed, 21 insertions, 1 deletions
diff --git a/Ryujinx/Program.cs b/Ryujinx/Program.cs
index 4dce13c7..335aa0ea 100644
--- a/Ryujinx/Program.cs
+++ b/Ryujinx/Program.cs
@@ -22,7 +22,10 @@ namespace Ryujinx
Config.Read(device);
- Logger.Updated += ConsoleLog.Log;
+ Logger.Updated += Log.LogMessage;
+
+ AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
+ AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
if (args.Length == 1)
{
@@ -87,6 +90,23 @@ namespace Ryujinx
audioOut.Dispose();
}
+ private static void CurrentDomain_ProcessExit(object sender, EventArgs e)
+ {
+ Log.Close();
+ }
+
+ private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
+ {
+ var exception = e.ExceptionObject as Exception;
+
+ Logger.PrintError(LogClass.Emulation, $"Unhandled exception caught: {exception}");
+
+ if (e.IsTerminating)
+ {
+ Log.Close();
+ }
+ }
+
/// <summary>
/// Picks an <see cref="IAalOutput"/> audio output renderer supported on this machine
/// </summary>