Skip to content

Commit

Permalink
update tactlib
Browse files Browse the repository at this point in the history
  • Loading branch information
ZingBallyhoo committed Aug 1, 2024
1 parent 7bc115b commit a856675
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
25 changes: 18 additions & 7 deletions DataTool/Helper/IO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,28 @@ public static void WriteFile(Stream? stream, ulong guid, string path) {
public static HashSet<ulong> 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;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void AddNewByGUID(Combo.ComboInfo info, HashSet<ulong> lastVerGuids, para

public void AddNewByContentHash(Combo.ComboInfo info, HashSet<CKey> contentHashes, params ushort[] types) {
foreach (KeyValuePair<ulong, ProductHandler_Tank.Asset> 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
Expand Down

0 comments on commit a856675

Please sign in to comment.