diff --git a/CGraphicsModel.bt b/CGraphicsModel.bt index 1e99e3f..69ab8b1 100644 --- a/CGraphicsModel.bt +++ b/CGraphicsModel.bt @@ -114,7 +114,7 @@ struct ModelHeader { } }; -typedef struct { +typedef struct(int readerVersion, int writerVersion) { FourCC id ; FourCC type ; } MaterialType ; @@ -258,7 +258,7 @@ struct CLayeredTextureData CMaterialTextureTokenData textures[3]; }; -typedef struct { +typedef struct(int readerVersion, int writerVersion) { FourCC id ; if (ReadByte() == 0) //Fix DKCTF WiiU models { @@ -351,9 +351,10 @@ string CMaterialDataRead(CMaterialData &mat) { case DATA_TYPE_COMPLEX: return Str("Complex %s", mat.id); } + return ""; } -typedef struct { +typedef struct(int readerVersion, int writerVersion) { if (ReadByte() == 0 || !isDKCTF) //NS, use anti isDKCTF so MP1R models don't break { local uint useMaterialTypeChunk = 1; @@ -391,13 +392,18 @@ typedef struct { } } //material data types - uint dataCount; - if (useMaterialTypeChunk || !isDKCTF) - { - MaterialType dataTypes[dataCount]; + if (readerVersion != 163) { + // Metroid Prime remastered and earlier + uint dataCount; + if (useMaterialTypeChunk || !isDKCTF) + { + MaterialType dataTypes(readerVersion, writerVersion)[dataCount]; + } + } else { + uint dataCount; } - //data parse - CMaterialData data[dataCount] ; + // data parse + CMaterialData materialData(readerVersion, writerVersion)[dataCount] ; } CMaterialCache ; typedef struct { @@ -517,7 +523,7 @@ struct CGraphicsIndexBufferToken { EBufferType type[count]; }; -typedef struct { +typedef struct(int readerVersion, int writerVersion) { ChunkDescriptor chunk; local uint pos