From f4c5573b81b03f45116d297969eff68d1a1328b7 Mon Sep 17 00:00:00 2001 From: LolHacksRule Date: Tue, 14 Feb 2023 19:55:38 -0800 Subject: [PATCH 1/5] Fix it for DKCTF --- CFormDescriptor.bt | 13 +++++++++ CGraphicsModel.bt | 57 +++++++++++++++++++++++++++++--------- CPakFile.bt | 27 ++++++++++++------ Common.bt | 2 +- Footer.bt | 2 +- MessageStudioBinaryText.bt | 11 +++++--- Meta.bt | 4 +-- NTextureFormat.bt | 48 +++++++++++++++++++++----------- Run.bt | 17 ++++++++++-- 9 files changed, 133 insertions(+), 48 deletions(-) diff --git a/CFormDescriptor.bt b/CFormDescriptor.bt index d156fed..8f5759c 100644 --- a/CFormDescriptor.bt +++ b/CFormDescriptor.bt @@ -1,6 +1,19 @@ 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 + uint32 checkForDKCTF; + FSkip(-4); + if (checkForDKCTF == 0) + { + isDKCTF = 1; + AssetDirEntryChunkSz = 36; + BigEndian(); + } + else + { + AssetDirEntryChunkSz = 52; + } uint64 size ; uint64 unk1; FourCC id; diff --git a/CGraphicsModel.bt b/CGraphicsModel.bt index c2c320b..a691a22 100644 --- a/CGraphicsModel.bt +++ b/CGraphicsModel.bt @@ -27,16 +27,30 @@ struct CustomDataLoader { }; struct ModelHeader { - uint unk1; + if (isDKCTF == 1) + { + uint opaqueMeshes; + uint onePassTransMeshes; + uint TwoPassTransMeshes; + uint oneBitMeshes; + uint additiveMeshes; + } + else + { + uint unk1; + } CAABox bounds; uint dataSourceCount; local int i; for (i = 0; i < dataSourceCount; ++i) { DataSourceLoader dataSource; } - uchar unk2; - if (unk2) { - CustomDataLoader customData; + if (isDKCTF != 1) + { + uchar unk2; + if (unk2) { + CustomDataLoader customData; + } } }; @@ -273,15 +287,29 @@ string CMaterialDataRead(CMaterialData &mat) typedef struct { CStringFixed name; GUID shaderID; - GUID guid2; //unsure - uint unk1; - uint unk2; - //material type list (can be 0) - uint typeCount; + if (isDKCTF == 1) + { + local uint typeCount = 1; //Hack it to 1 + } + else + { + GUID guid2; //unsure + uint unk1; + uint unk2; + //material type list (can be 0) + uint typeCount; + } uint types[typeCount]; - //material data types (with extra value) - uint renderTypeCount; - MaterialRenderTypes renderTypes[renderTypeCount]; + if (isDKCTF == 1) + { + uint flags; + } + else + { + //material data types (with extra value) + uint renderTypeCount; + MaterialRenderTypes renderTypes[renderTypeCount]; + } //material data types uint dataCount; MaterialType dataTypes2[dataCount]; @@ -313,7 +341,10 @@ typedef struct { ModelHeader header; break; case "MTRL": - uint unk; + if (isDKCTF != 1) + { + uint unk; + } uint numMaterials; CMaterialCache materials[numMaterials]; break; diff --git a/CPakFile.bt b/CPakFile.bt index 59e8059..082b801 100644 --- a/CPakFile.bt +++ b/CPakFile.bt @@ -5,15 +5,24 @@ typedef struct { FourCC type; GUID id; - uint32 versionA; - uint32 versionB; + if (isDKCTF == 0) + { + uint32 versionA; + uint32 versionB; + } uint64 offset; - uint64 decompressedSize; + if (isDKCTF == 0) + { + uint64 decompressedSize; + } + else + { + local uint decompressedSize = 0; //hack + } uint64 size; - local uint64 pos