From a8566755bd4a9c9619dea13ed10ac211de2ad9f1 Mon Sep 17 00:00:00 2001 From: zingballyhoo Date: Thu, 1 Aug 2024 16:43:39 +0100 Subject: [PATCH] update tactlib --- DataTool/Helper/IO.cs | 25 +++++++++++++------ .../Extract/Debug/ExtractDebugNewEntities.cs | 2 +- TACTLib | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/DataTool/Helper/IO.cs b/DataTool/Helper/IO.cs index 03b47d23..1583e5f7 100644 --- a/DataTool/Helper/IO.cs +++ b/DataTool/Helper/IO.cs @@ -275,17 +275,28 @@ public static void WriteFile(Stream? stream, ulong guid, string path) { public static HashSet MissingKeyLog = new (); public static Stream? OpenFile(ulong guid) { + if (guid == 0) return null; + try { - return TankHandler.OpenFile(guid); + var stream = TankHandler.OpenFile(guid); + if (stream == null) TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - returned null"); + return stream; } catch (Exception e) { - if (e is BLTEKeyException keyException) { - if (MissingKeyLog.Add(keyException.MissingKey) && Debugger.IsAttached) { - TankLib.Helpers.Logger.Warn("BLTE", $"Missing key: {keyException.MissingKey:X16}"); + switch (e) { + case BLTEKeyException keyException: { + if (MissingKeyLog.Add(keyException.MissingKey) && Debugger.IsAttached) { + TankLib.Helpers.Logger.Warn("BLTE", $"Missing key: {keyException.MissingKey:X16}"); + } + TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - encrypted"); + return null; } + case FileNotFoundException: + TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - not found"); + return null; + default: + TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - {e}"); + return null; } - - TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X8}"); - return null; } } diff --git a/DataTool/ToolLogic/Extract/Debug/ExtractDebugNewEntities.cs b/DataTool/ToolLogic/Extract/Debug/ExtractDebugNewEntities.cs index 995c0a0e..1bbf92a8 100644 --- a/DataTool/ToolLogic/Extract/Debug/ExtractDebugNewEntities.cs +++ b/DataTool/ToolLogic/Extract/Debug/ExtractDebugNewEntities.cs @@ -28,7 +28,7 @@ public void AddNewByGUID(Combo.ComboInfo info, HashSet lastVerGuids, para public void AddNewByContentHash(Combo.ComboInfo info, HashSet contentHashes, params ushort[] types) { foreach (KeyValuePair asset in TankHandler.m_assets) { - TankHandler.UnpackAsset(asset.Value, out var package, out var record); + TankHandler.UnpackPackageAsset(asset.Value, out var record); ushort fileType = teResourceGUID.Type(asset.Key); if (fileType == 0x9C) continue; // bundle diff --git a/TACTLib b/TACTLib index 05b9da94..4824eb53 160000 --- a/TACTLib +++ b/TACTLib @@ -1 +1 @@ -Subproject commit 05b9da945d0cdf5cffe62e76f2271e8de77498b1 +Subproject commit 4824eb53012da580f0bd6eb322aecd638d1ca58c