diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..061e391 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "akiramiyakoda.cppincludeguard", + ] + } + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 4747316..8091898 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,15 @@ { "files.associations": { "*.bt": "c", - } + }, + "C/C++ Include Guard.Header Extensions": [ + ".h", + ".hpp", + ".h++", + ".hh", + ".bt" + ], + "C/C++ Include Guard.Path Depth": 0, + "C/C++ Include Guard.Path Skip": 0, + "C/C++ Include Guard.Spaces After Endif": 0 } \ No newline at end of file diff --git a/CCharInfo.bt b/CCharInfo.bt index 570cce1..12cc970 100644 --- a/CCharInfo.bt +++ b/CCharInfo.bt @@ -1,3 +1,6 @@ +#ifndef _CCHARINFO +#define _CCHARINFO + struct SAnimContext { @@ -62,4 +65,7 @@ struct FCharInf byte count; CCharInfo charInfo[count] ; -}; \ No newline at end of file +}; + + +#endif// _CCHARINFO diff --git a/CChunkDescriptor.bt b/CChunkDescriptor.bt index 0f7a0e5..ebab9f0 100644 --- a/CChunkDescriptor.bt +++ b/CChunkDescriptor.bt @@ -1,3 +1,5 @@ +#ifndef _CCHUNKDESCRIPTOR +#define _CCHUNKDESCRIPTOR typedef struct { FourCC id; @@ -10,3 +12,6 @@ typedef struct comment=(SizeComment(size)), bgcolor=cDkAqua >; + + +#endif// _CCHUNKDESCRIPTOR diff --git a/CFormDescriptor.bt b/CFormDescriptor.bt index d156fed..15092f2 100644 --- a/CFormDescriptor.bt +++ b/CFormDescriptor.bt @@ -1,3 +1,5 @@ +#ifndef _CFORMDESCRIPTOR +#define _CFORMDESCRIPTOR typedef struct { FourCC type; @@ -11,3 +13,6 @@ typedef struct comment=(SizeComment(size)), bgcolor=cLtAqua >; + + +#endif// _CFORMDESCRIPTOR diff --git a/CGraphicsModel.bt b/CGraphicsModel.bt index e107c71..321a24a 100644 --- a/CGraphicsModel.bt +++ b/CGraphicsModel.bt @@ -1,3 +1,5 @@ +#ifndef _CGRAPHICSMODEL +#define _CGRAPHICSMODEL #include "CAABox.bt" #include "CEvalSystem.bt" #include "CVector4i.bt" @@ -79,6 +81,17 @@ typedef struct{ STextureUsageInfo usage; } CMaterialTextureTokenData ; +struct SSkinnedModelHeader { + uint unk; + uint unk; + uint unk; + uint unk; + uint uintsCount; + uint uints[uintsCount]; + uint dataCount; + uint data[dataCount]; +}; + typedef struct{ char type[4]; char format[4]; @@ -330,6 +343,7 @@ typedef struct { struct SMeshLoadInformation { uint meshCount; CRenderMesh meshes[meshCount]; + uint unk; }; typedef struct { @@ -340,6 +354,9 @@ typedef struct { case "HEAD": ModelHeader header; break; + case "SKHD": + SSkinnedModelHeader skinnedModelHeader; + break; case "MTRL": if (isDKCTF == 0) { @@ -360,4 +377,7 @@ typedef struct(uint64 size) { while (FTell() < start + size) { ModelChunk chunk; } -} ModelFile ; \ No newline at end of file +} ModelFile ; + + +#endif// _CGRAPHICSMODEL diff --git a/CPakFile.bt b/CPakFile.bt index 976710b..af6a5cb 100644 --- a/CPakFile.bt +++ b/CPakFile.bt @@ -1,3 +1,5 @@ +#ifndef _CPAKFILE +#define _CPAKFILE struct File; struct CPakFile; @@ -121,3 +123,6 @@ typedef struct TOCChunk chunk(this); } } CPakFile ; + + +#endif// _CPAKFILE diff --git a/CScaleformFlashLibrary.bt b/CScaleformFlashLibrary.bt index 17e260e..9d293ad 100644 --- a/CScaleformFlashLibrary.bt +++ b/CScaleformFlashLibrary.bt @@ -11,25 +11,31 @@ // History: //------------------------------------------------ +#ifndef _CSCALEFORMFLASHLIBRARY +#define _CSCALEFORMFLASHLIBRARY + typedef struct { ChunkDescriptor chunk; struct CScaleformFlashLibraryChunk { - uint32 referencedTextures; - struct ReferencedTxtrs - { - struct ReferencedTxtr - { + uint32 referencedTextures; + struct ReferencedTxtrs + { + struct ReferencedTxtr + { GUID texRef; - CStringFixed texName; - } rtxtr[referencedTextures] ; - } rtxrs; - CStringFixed theSWFName; - FSkip(4); //Skip ahead to see the SWF size - LittleEndian(); //temp swap endian - uint32 swfSize; //Pull SWF size - BigEndian(); //temp swap endian - FSkip(-8); //Go back to GFX + CStringFixed texName; + } rtxtr[referencedTextures] ; + } rtxrs; + CStringFixed theSWFName; + FSkip(4); //Skip ahead to see the SWF size + LittleEndian(); //temp swap endian + uint32 swfSize; //Pull SWF size + BigEndian(); //temp swap endian + FSkip(-8); //Go back to GFX byte theGFXFile[swfSize]; //History } GFXLChunk; -} CScaleformFlashLibrary; \ No newline at end of file +} CScaleformFlashLibrary; + + +#endif// _CSCALEFORMFLASHLIBRARY diff --git a/CVector3i.bt b/CVector3i.bt new file mode 100644 index 0000000..d54a99f --- /dev/null +++ b/CVector3i.bt @@ -0,0 +1,11 @@ +#ifndef _CVECTOR3I +#define _CVECTOR3I + + +typedef struct { + int x; + int y; + int z; +} CVector3i; + +#endif// _CVECTOR3I diff --git a/CVectorField.bt b/CVectorField.bt new file mode 100644 index 0000000..f4cc934 --- /dev/null +++ b/CVectorField.bt @@ -0,0 +1,25 @@ +#ifndef _CVECTORFIELD +#define _CVECTORFIELD + +#include "CAABox.bt" +#include "CVector3f.bt" +#include "CVector3i.bt" + +struct CVectorField { + CVector3i unk; + CAABox bounds; + uint vectorCount; + CVector3f vectors[vectorCount]; + + local int i = 0; + for (i = 0; i < vectorCount; ++i) { + Printf("v %f %f %f\n", vectors[i].x - 0.00005, vectors[i].y - 0.00005, vectors[i].z - 0.00005); + Printf("v %f %f %f\n", vectors[i].x, vectors[i].y, vectors[i].z); + Printf("v %f %f %f\n", vectors[i].x + 0.00005, vectors[i].y + 0.00005, vectors[i].z + 0.00005); + } + for (i = 0; i < vectorCount; ++i) { + Printf("f %i %i %i\n", i + 1, i + 2, i + 3); + } +}; + +#endif // _CVECTORFIELD diff --git a/Common.bt b/Common.bt index 9139dd3..80ea25d 100644 --- a/Common.bt +++ b/Common.bt @@ -1,3 +1,5 @@ +#ifndef _COMMON +#define _COMMON typedef struct { string text; @@ -75,3 +77,5 @@ typedef enum LZSS_32 = 0x3, ZLIB = 0xD, } CompressionType; + +#endif// _COMMON diff --git a/Footer.bt b/Footer.bt index 66fcefa..9756cbc 100644 --- a/Footer.bt +++ b/Footer.bt @@ -1,3 +1,5 @@ +#ifndef _FOOTER +#define _FOOTER struct AssetInfo { GUID id; @@ -35,3 +37,6 @@ typedef struct(FourCC type) } FSeek(start + form.size); } Footer ; + + +#endif// _FOOTER diff --git a/MaterialArchive.bt b/MaterialArchive.bt index 8afa011..4312bdb 100644 --- a/MaterialArchive.bt +++ b/MaterialArchive.bt @@ -1,3 +1,5 @@ +#ifndef _MATERIALARCHIVE +#define _MATERIALARCHIVE struct SBufferTOCEntry { uint unk1; uint unk2; @@ -197,7 +199,22 @@ struct IFeatureInstance { } }; +struct SDepthModeState { +}; + +struct SStencilModeState { + +}; + +struct CGraphicsState { + uint flags; +}; + +struct SOverrideState { + CBooleanExpressionEvaluator evaluator; + CGraphicsState state; +}; struct SMaterialImportDesc { GUID guid; uint unk1; @@ -213,6 +230,11 @@ struct SMaterialImportDesc { if (hasFeatureSet) { CFeatureSet featureSet; } + CGraphicsState state; + uint overrideStateCount; + if (overrideStateCount) { + SOverrideState overrideStates; + } } meta; char data[dataSize]; } data; @@ -246,4 +268,7 @@ struct MaterialArchive(uint64 size) { while (FTell() < start + size) { MaterialBackend backend; } -}; \ No newline at end of file +}; + + +#endif// _MATERIALARCHIVE diff --git a/MessageStudioBinaryText.bt b/MessageStudioBinaryText.bt index f5c4a5e..f5b5871 100644 --- a/MessageStudioBinaryText.bt +++ b/MessageStudioBinaryText.bt @@ -1,3 +1,5 @@ +#ifndef _MESSAGESTUDIOBINARYTEXT +#define _MESSAGESTUDIOBINARYTEXT struct LanguageHeader(string expectedLanguage) { char magic[4]; Assert(magic == expectedLanguage); @@ -162,4 +164,7 @@ struct MessageStudioBinaryText Language ch_simplifiedchinese("CHSC"); Language us_spanish("USSP"); } -}; \ No newline at end of file +}; + + +#endif// _MESSAGESTUDIOBINARYTEXT diff --git a/Meta.bt b/Meta.bt index 7ea21e3..b6a2b64 100644 --- a/Meta.bt +++ b/Meta.bt @@ -1,3 +1,5 @@ +#ifndef _META +#define _META typedef struct(FourCC type, uint64 size, uint64 fileStart) { local uint64 start