From a5e19a66928e6c34602d4676b0d46be456fe513a Mon Sep 17 00:00:00 2001 From: Naomi Date: Sat, 19 Sep 2020 16:09:39 +0100 Subject: [PATCH] [datatool] dump blte if blte crashes --- CASCEncDump/Program.cs | 1 + DataTool/Helper/IO.cs | 1 + DataTool/Program.cs | 7 ++++++- TACTLib | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CASCEncDump/Program.cs b/CASCEncDump/Program.cs index eba1ba72b..9b2ce38f6 100644 --- a/CASCEncDump/Program.cs +++ b/CASCEncDump/Program.cs @@ -13,6 +13,7 @@ using TACTLib.Container; using TACTLib.Core; using TACTLib.Core.Product.Tank; +using TACTLib.Exceptions; namespace CASCEncDump { internal class Program { diff --git a/DataTool/Helper/IO.cs b/DataTool/Helper/IO.cs index e1913aa0b..d056ac2eb 100644 --- a/DataTool/Helper/IO.cs +++ b/DataTool/Helper/IO.cs @@ -8,6 +8,7 @@ using System.Text.RegularExpressions; using TankLib; using TACTLib.Core; +using TACTLib.Exceptions; using static DataTool.Program; namespace DataTool.Helper { diff --git a/DataTool/Program.cs b/DataTool/Program.cs index 0aacab1b0..f8715c8d0 100644 --- a/DataTool/Program.cs +++ b/DataTool/Program.cs @@ -17,6 +17,7 @@ using TACTLib.Client; using TACTLib.Client.HandlerArgs; using TACTLib.Core.Product.Tank; +using TACTLib.Exceptions; using static DataTool.Helper.Logger; using static DataTool.Helper.STUHelper; using Logger = TankLib.Helpers.Logger; @@ -309,11 +310,15 @@ private static void TryFetchLocaleFromRegistry() { private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs e) { if (e.ExceptionObject is Exception ex) { Logger.Error(null, ex.ToString()); + if (ex is BLTEDecoderException decoder) { + File.WriteAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"BLTEDump-{AppDomain.CurrentDomain.FriendlyName}_{DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}.blte"), decoder.GetBLTEData()); + } + if (Debugger.IsAttached) throw ex; } unchecked { - Environment.Exit((int) 0xDEADBEEF); + Environment.Exit(-1); } } diff --git a/TACTLib b/TACTLib index 9ed628fea..13d613dd9 160000 --- a/TACTLib +++ b/TACTLib @@ -1 +1 @@ -Subproject commit 9ed628fea3d8dcba7b744a4c11fbac88f2541ccb +Subproject commit 13d613dd9a30be517f68784228d9857a2a03773f