-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicModelPattern.hexpat
More file actions
59 lines (43 loc) · 1.05 KB
/
DynamicModelPattern.hexpat
File metadata and controls
59 lines (43 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma endian big
import std.io;
import std.mem;
struct Shader
{
char name[];
padding[4];
};
struct ObjectName {
char name[0x20];
};
struct FileHeader
{
u32 shaderCount;
Shader shaders[shaderCount];
u32 objectCount;
ObjectName nameTable[objectCount];
padding[4];
};
FileHeader header @ 0x00;
struct MeshHeader {
char animationData[header.objectCount*48];
padding[4];
u32 vertexStride;
u32 verticesSize;
u32 vertexCount = verticesSize/vertexStride;
};
MeshHeader meshHeader @ std::mem::find_sequence(0x00, 0x3F, 0x80, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x00, 0x3F, 0x80);
struct Vertex {
float x;
float y;
float z;
padding[meshHeader.vertexStride-12];
};
struct MeshData {
Vertex vertices[meshHeader.vertexCount];
u32 indicesSize;
u32 indexStride;
u32 indexCount = indicesSize/indexStride;
u16 indices[indexCount];
padding[4]; // index count again
} [[hex::visualize("3d", vertices, indices)]];
MeshData data @ addressof(meshHeader) + sizeof(meshHeader);