From 2a8cb827fe2c9fb71f6efb672faf031e2894f98b Mon Sep 17 00:00:00 2001 From: Luke Street Date: Wed, 15 Feb 2023 13:02:51 -0500 Subject: [PATCH] Rework DKCTF detection & many fixes --- CFormDescriptor.bt | 17 ----------------- CGraphicsModel.bt | 6 +++--- CPakFile.bt | 46 ++++++++++++++++++++++++++-------------------- Common.bt | 10 ++++++++++ Footer.bt | 3 ++- NTextureFormat.bt | 23 ++++++++++++++--------- Run.bt | 12 +++++------- 7 files changed, 60 insertions(+), 57 deletions(-) diff --git a/CFormDescriptor.bt b/CFormDescriptor.bt index 3915d66..d156fed 100644 --- a/CFormDescriptor.bt +++ b/CFormDescriptor.bt @@ -1,23 +1,6 @@ typedef struct { FourCC type; - //So this is a check for DKCTF (Big Endian), basically 0x04 should be 0, if that's true, assume DKCTF, strange for DKCTF on NS was in BE, I'll prob fix this memory usage later - if (isDKCTF == -1) //Like this - { - uint32 checkForDKCTF; - FSkip(-4); - if (checkForDKCTF == 0) - { - isDKCTF = 1; - AssetDirEntryChunkSz = 36; - BigEndian(); - } - else - { - isDKCTF = 0; - AssetDirEntryChunkSz = 52; - } - } uint64 size ; uint64 unk1; FourCC id; diff --git a/CGraphicsModel.bt b/CGraphicsModel.bt index 47674a0..e107c71 100644 --- a/CGraphicsModel.bt +++ b/CGraphicsModel.bt @@ -106,11 +106,11 @@ typedef struct{ float color3[4]; byte flags; GUID texture1ID; - if (texture1ID != 0) CMaterialTextureTokenData texture1; + if (texture1ID != GUIDZero) CMaterialTextureTokenData texture1; GUID texture2ID; - if (texture2ID != 0) CMaterialTextureTokenData texture2; + if (texture2ID != GUIDZero) CMaterialTextureTokenData texture2; GUID texture3ID; - if (texture3ID != 0) CMaterialTextureTokenData texture3; + if (texture3ID != GUIDZero) CMaterialTextureTokenData texture3; break; } diff --git a/CPakFile.bt b/CPakFile.bt index 082b801..976710b 100644 --- a/CPakFile.bt +++ b/CPakFile.bt @@ -5,46 +5,52 @@ typedef struct { FourCC type; GUID id; - if (isDKCTF == 0) + if (!isDKCTF) { uint32 versionA; uint32 versionB; } - uint64 offset; - if (isDKCTF == 0) + uint64 offset ; + if (!isDKCTF) { - uint64 decompressedSize; + uint64 decompressedSize ; } - else + uint64 size ; + if (isDKCTF) { - local uint decompressedSize = 0; //hack + local uint64 decompressedSize = size; } - uint64 size; + local uint64 pos