/
RageParser.h
174 lines (141 loc) · 2.86 KB
/
RageParser.h
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#pragma once
#include <atArray.h>
#ifdef COMPILING_GTA_CORE_FIVE
#define GTA_CORE_EXPORT DLL_EXPORT
#else
#define GTA_CORE_EXPORT DLL_IMPORT
#endif
namespace rage
{
enum class parMemberType : uint8_t
{
Bool = 0,
Int8 = 1,
UInt8 = 2,
Int16 = 3,
UInt16 = 4,
Int32 = 5,
UInt32 = 6,
Float = 7,
Vector2 = 8,
Vector3 = 9,
Vector4 = 10,
String = 11,
Struct = 12,
Array = 13,
Enum = 14,
Bitset = 15,
Map = 16,
Matrix4x3 = 17,
Matrix4x4 = 18,
Vector2_Padded = 19,
Vector3_Padded = 20,
Vector4_Padded = 21,
Matrix3x4 = 22,
Matrix4x3_2 = 23,
Matrix4x4_2 = 24,
Vector1_Padded = 25,
Flag1_Padded = 26, // for shaders?
Flag4_Padded = 27,
Int32_64 = 28,
Int32_U64 = 29,
Half = 30,
Int64 = 31,
UInt64 = 32,
Double = 33
};
struct parEnumField
{
uint32_t hash;
uint32_t index; // 0xFFFFFFFF for last
};
struct parEnumDefinition
{
parEnumField* fields;
const char** names; // NULL if there are no names
};
enum class parArrayType : uint8_t
{
// type is atArray
atArray = 0,
// count*size, trailing integer (after alignment)
FixedTrailingCount = 1,
// count*size, fixed
Fixed = 2,
// pointer to count*size
FixedPointer = 3,
// unknown difference from 2
Fixed_2 = 4,
// atArray but with uint32_t index
atArray32 = 5,
// pointer with a trailing count at +size
TrailerInt = 6,
TrailerByte = 7,
TrailerShort = 8
};
enum class parStructType : uint8_t
{
// not a pointer, just the offset
Inline = 0,
// other types
Struct_1 = 1,
Struct_2 = 2,
Struct_3 = 3,
Struct_4 = 4,
};
class parStructure;
struct parMemberDefinition
{
uint32_t hash; // +0
uint32_t pad; // +4
uint64_t offset; // +8
parMemberType type; // +16
union
{
parArrayType arrayType; // +17
parStructType structType;
};
uint8_t pad2[2]; // +18
uint8_t pad3[12]; // +20
union // +32
{
uint32_t arrayElemSize;
uint64_t __pad;
parStructure* structure;
};
union // +40
{
parEnumDefinition* enumData;
uint32_t arrayElemCount;
};
uint16_t enumElemCount; // +48 for enum defs
};
class parMember
{
public:
virtual ~parMember() = default;
parMemberDefinition* m_definition;
parMember* m_arrayDefinition; // in case of array
};
class parStructure
{
public:
virtual ~parStructure() = default;
uint32_t m_nameHash; // +8
char m_pad[4]; // +12
parStructure* m_baseClass; // +16
char m_pad2[24]; // +24
atArray<rage::parMember*> m_members; // +48
char m_pad3[8];
void* m_newPtr; // +72
void* (*m_new)();
void* m_placementNewPtr;
void* (*m_placementNew)(void*);
void* m_getTypePtr;
parStructure* (*m_getType)(void*);
void* m_deletePtr;
void(*m_delete)(void*);
};
GTA_CORE_EXPORT rage::parStructure* GetStructureDefinition(const char* structType);
GTA_CORE_EXPORT rage::parStructure* GetStructureDefinition(uint32_t structHash);
}