Add CVectorField, use header guards

This commit is contained in:
Phillip Stephens
2023-02-15 10:09:07 -08:00
parent 2a8cb827fe
commit 4fac8378f1
17 changed files with 179 additions and 22 deletions
+6
View File
@@ -0,0 +1,6 @@
{
"recommendations": [
"akiramiyakoda.cppincludeguard",
]
}
+11 -1
View File
@@ -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
}
+7 -1
View File
@@ -1,3 +1,6 @@
#ifndef _CCHARINFO
#define _CCHARINFO
struct SAnimContext
{
@@ -62,4 +65,7 @@ struct FCharInf
byte count;
CCharInfo charInfo[count] <optimize=false>;
};
};
#endif// _CCHARINFO
+5
View File
@@ -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
+5
View File
@@ -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
+21 -1
View File
@@ -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 <name=(Str("%s", GUIDToString(this.id)))>;
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 <name="Model chunks">;
} ModelFile <name="Model chunks">;
#endif// _CGRAPHICSMODEL
+5
View File
@@ -1,3 +1,5 @@
#ifndef _CPAKFILE
#define _CPAKFILE
struct File;
struct CPakFile;
@@ -121,3 +123,6 @@ typedef struct
TOCChunk chunk(this);
}
} CPakFile <name="PACK chunks">;
#endif// _CPAKFILE
+21 -15
View File
@@ -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] <optimize = false>;
} rtxrs;
CStringFixed theSWFName;
FSkip(4); //Skip ahead to see the SWF size
LittleEndian(); //temp swap endian
uint32 swfSize<hidden=true>; //Pull SWF size
BigEndian(); //temp swap endian
FSkip(-8); //Go back to GFX
CStringFixed texName;
} rtxtr[referencedTextures] <optimize = false>;
} rtxrs;
CStringFixed theSWFName;
FSkip(4); //Skip ahead to see the SWF size
LittleEndian(); //temp swap endian
uint32 swfSize<hidden=true>; //Pull SWF size
BigEndian(); //temp swap endian
FSkip(-8); //Go back to GFX
byte theGFXFile[swfSize]; //History
} GFXLChunk;
} CScaleformFlashLibrary;
} CScaleformFlashLibrary;
#endif// _CSCALEFORMFLASHLIBRARY
+11
View File
@@ -0,0 +1,11 @@
#ifndef _CVECTOR3I
#define _CVECTOR3I
typedef struct {
int x;
int y;
int z;
} CVector3i;
#endif// _CVECTOR3I
+25
View File
@@ -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
+4
View File
@@ -1,3 +1,5 @@
#ifndef _COMMON
#define _COMMON
typedef struct
{
string text;
@@ -75,3 +77,5 @@ typedef enum <byte>
LZSS_32 = 0x3,
ZLIB = 0xD,
} CompressionType;
#endif// _COMMON
+5
View File
@@ -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 <name="Extracted file info">;
#endif// _FOOTER
+26 -1
View File
@@ -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;
}
};
};
#endif// _MATERIALARCHIVE
+6 -1
View File
@@ -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");
}
};
};
#endif// _MESSAGESTUDIOBINARYTEXT
+5
View File
@@ -1,3 +1,5 @@
#ifndef _META
#define _META
typedef struct(FourCC type, uint64 size, uint64 fileStart)
{
local uint64 start <format=hex, hidden=true> = FTell();
@@ -12,3 +14,6 @@ typedef struct(FourCC type, uint64 size, uint64 fileStart)
}
FSeek(start + size);
} Meta <open=true>;
#endif// _META
+5
View File
@@ -1,3 +1,5 @@
#ifndef _NTEXTUREFORMAT
#define _NTEXTUREFORMAT
struct STextureReadInfo
{
byte index;
@@ -255,3 +257,6 @@ typedef struct(uint64 size)
TXTRChunk chunk;
}
} NTextureFormat <name="TXTR chunks">;
#endif// _NTEXTUREFORMAT
+11 -2
View File
@@ -13,6 +13,7 @@
#include "CPakFile.bt"
#include "MessageStudioBinaryText.bt"
#include "MaterialArchive.bt"
#include "CVectorField.bt"
//#include "CRuleSet.bt"
#include "CScaleformFlashLibrary.bt"
@@ -26,8 +27,13 @@ typedef struct
switch (form.id)
{
case "MTRL":
byte MTRLRaw [form.size]; //For now
//MaterialArchive materialArchive(form.size);
if (form.versionA == 168) {
byte MTRLRaw [form.size]; //For now
} else if (form.versionA == 22) {
MaterialArchive materialArchive(form.size);
} else {
Assert("Invalid version!");
}
break;
case "CHPR":
FCharInf charInfo;
@@ -54,6 +60,9 @@ typedef struct
/*case "GFX ":
CFlashMovieResource flashmovieresource(form.size);
break;*/
case "VECF":
CVectorField vectorField;
break;
}
FSeek(start + form.size);
} File <open=true, bgcolor=cSilver>;