-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtr7ae_section.bt
95 lines (83 loc) · 1.79 KB
/
tr7ae_section.bt
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// This file contains the types for the section header.
// The section header is included in every section in front of the
// section data.
//
// The file is structed with the section info and relocations first
// and the section data after.
//
// --
// [Section info]
// --
// [Relocations]
// --
// [Section data]
// --
//
// See also https://cdcengine.re/docs/files/drm/
//
// The type of the section
enum <byte> SectionType
{
SECTION_GENERAL,
SECTION_EMPTY,
SECTION_ANIMATION,
SECTION_PUSHBUFFER_WC,
SECTION_PUSHBUFFER,
SECTION_TEXTURE,
SECTION_WAVE,
SECTION_DTPDATA,
SECTION_SCRIPT,
SECTION_SHADERLIB
};
// The type of relocation
enum <ushort> RelocationType
{
POINTER,
RESOURCE_ID,
RESOURCE_ID16,
RESOURCE_POINTER
};
// The section info
typedef struct
{
uint32 magic;
int32 size;
SectionType type;
byte skip;
uint16 versionID;
struct
{
uint32 hasDebugInfo : 1;
uint32 resourceType : 7;
uint32 numRelocations : 24;
} packedData;
// The section ID, only useful for != SECTION_GENERAL
uint32 id;
// The specialisation mask
uint32 specMask <format=hex>;
} SectionInfo;
// Single relocations
typedef struct
{
struct
{
RelocationType type : 3;
uint16 sectionIndexOrType : 13;
} typeAndSectionInfo;
uint16 typeSpecific;
uint32 offset;
} Relocation;
// The main "header" with the info and all relocations
typedef struct
{
SectionInfo info <fgcolor=cGreen>;
Relocation relocations[info.packedData.numRelocations] <fgcolor=cRed>;
} SectionHeader;
typedef uint32 uintptr;
// Include in your template like so:
//
// ```
// #include "section.bt"
//
// SectionHeader header;
// ```