Skip to content

Commit a856675

Browse files
committed
update tactlib
1 parent 7bc115b commit a856675

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

DataTool/Helper/IO.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,17 +275,28 @@ public static void WriteFile(Stream? stream, ulong guid, string path) {
275275
public static HashSet<ulong> MissingKeyLog = new ();
276276

277277
public static Stream? OpenFile(ulong guid) {
278+
if (guid == 0) return null;
279+
278280
try {
279-
return TankHandler.OpenFile(guid);
281+
var stream = TankHandler.OpenFile(guid);
282+
if (stream == null) TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - returned null");
283+
return stream;
280284
} catch (Exception e) {
281-
if (e is BLTEKeyException keyException) {
282-
if (MissingKeyLog.Add(keyException.MissingKey) && Debugger.IsAttached) {
283-
TankLib.Helpers.Logger.Warn("BLTE", $"Missing key: {keyException.MissingKey:X16}");
285+
switch (e) {
286+
case BLTEKeyException keyException: {
287+
if (MissingKeyLog.Add(keyException.MissingKey) && Debugger.IsAttached) {
288+
TankLib.Helpers.Logger.Warn("BLTE", $"Missing key: {keyException.MissingKey:X16}");
289+
}
290+
TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - encrypted");
291+
return null;
284292
}
293+
case FileNotFoundException:
294+
TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - not found");
295+
return null;
296+
default:
297+
TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X16} - {e}");
298+
return null;
285299
}
286-
287-
TankLib.Helpers.Logger.Debug("Core", $"Unable to load file: {guid:X8}");
288-
return null;
289300
}
290301
}
291302

DataTool/ToolLogic/Extract/Debug/ExtractDebugNewEntities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void AddNewByGUID(Combo.ComboInfo info, HashSet<ulong> lastVerGuids, para
2828

2929
public void AddNewByContentHash(Combo.ComboInfo info, HashSet<CKey> contentHashes, params ushort[] types) {
3030
foreach (KeyValuePair<ulong, ProductHandler_Tank.Asset> asset in TankHandler.m_assets) {
31-
TankHandler.UnpackAsset(asset.Value, out var package, out var record);
31+
TankHandler.UnpackPackageAsset(asset.Value, out var record);
3232

3333
ushort fileType = teResourceGUID.Type(asset.Key);
3434
if (fileType == 0x9C) continue; // bundle

0 commit comments

Comments
 (0)