This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
GPARAM.bt
209 lines (174 loc) · 5.36 KB
/
GPARAM.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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
// File: GPARAM.bt
// Authors: TKGP
// Version:
// Purpose: BB/DS3 drawparams
// Category: Dark Souls
// File Mask: *.gparam
// ID Bytes: 66 00 69 00 6C 00 74 00 03 00 00 00 00 00 00 00
// History:
//------------------------------------------------
#include "Util.bt"
typedef struct {
float x;
float y;
int unk08; Assert(unk08 == 0);
int unk0C; Assert(unk0C == 0);
} PaddedVector2 <optimize=false>;
typedef struct {
float x;
float y;
float z;
int unk0C; Assert(unk0C == 0);
} PaddedVector3 <optimize=false>;
typedef struct {
wchar_t magic[4]; Assert(magic == "filt");
int version; Assert(version == 3 || version == 5);
int unk0C;
int groupCount;
int unk14;
int headerSize <format=hex>; Assert(headerSize == (version == 3 ? 0x50 : 0x54));
int groupHeadersOffset <format=hex>;
int paramHeaderOffsetsOffset <format=hex>;
int paramHeadersOffset <format=hex>;
int valuesOffset <format=hex>;
int unkOffset1 <format=hex>;
int unkOffset2 <format=hex>;
int unk3Count;
int unkOffset3 <format=hex>;
int unkOffset4 <format=hex>;
int unk40; Assert(unk40 == 0);
int commentOffsetsOffsetsOffset <format=hex>;
int commentOffsetsOffset <format=hex>;
int commentsOffset <format=hex>;
if (version == 5) {
float unk50;
}
} Header <bgcolor=cLtRed>;
typedef struct (Header& header) {
int paramHeaderOffset <format=hex>;
local quad pos <hidden=true> = FTell();
FSeek(header.paramHeadersOffset + paramHeaderOffset);
int valuesOffset <format=hex>;
int unkOffset1 <format=hex>;
byte type;
byte valueCount;
short unk0A <hidden=true>; Assert(unk0A == 0);
wstring name1;
wstring name2;
if (valueCount > 0) {
local int color <hidden=true> = GetBackColor();
SetBackColor(cLtBlue);
FSeek(header.valuesOffset + valuesOffset);
switch (type) {
case 0x1:
byte values[valueCount];
break;
case 0x2:
short values[valueCount];
break;
case 0x3:
int values[valueCount];
break;
case 0x5:
byte values[valueCount];
break;
case 0x7:
int values[valueCount];
break;
case 0x9:
float values[valueCount];
break;
case 0xB:
byte values[valueCount];
break;
case 0xC:
struct {
PaddedVector2 values[valueCount];
} values;
break;
case 0xD:
struct {
PaddedVector3 values[valueCount];
} values;
break;
case 0xE:
Vector4 values[valueCount];
break;
case 0xF:
int values[valueCount];
break;
default:
Assert(false);
}
SetBackColor(color);
FSeek(header.unkOffset1 + unkOffset1);
if (header.version == 3)
int ids[valueCount] <bgcolor=cRed>;
else if (header.version == 5)
quad ids[valueCount] <bgcolor=cRed>;
}
FSeek(pos);
} Param <read=ReadParam, bgcolor=cAqua, optimize=false>;
wstring ReadParam(Param& param) {
string str;
SPrintf(str, "%X ", param.type);
return str + param.name1 + " | " + param.name2;
}
typedef struct (Header& header, int index) {
int groupHeaderOffset <format=hex>;
local quad pos <hidden=true> = FTell();
FSeek(header.groupHeadersOffset + groupHeaderOffset);
int paramCount;
int paramHeaderOffsetsOffset <format=hex>;
wstring name1;
wstring name2;
if (paramCount > 0) {
FSeek(header.paramHeaderOffsetsOffset + paramHeaderOffsetsOffset);
struct {
Param params(header)[paramCount];
} params;
/*
FSeek(header.commentOffsetsOffsetsOffset + index * 4);
int commentOffsetsOffset;
FSeek(header.commentOffsetsOffset + commentOffsetsOffset);
struct {
int commentOffset;
local quad pos2 <hidden=true> = FTell();
FSeek(header.commentsOffset + commentOffset);
wstring comment;
FSeek(pos2);
} comments[params.params[0].valueCount] <bgcolor=cLtYellow, optimize=false>;
*/
}
FSeek(pos);
} Group <read=ReadGroup, bgcolor=cLtGreen, optimize=false>;
wstring ReadGroup(Group& group) {
return group.name1 + " | " + group.name2;
}
typedef struct (Header& header) {
int id;
int count;
int unkOffset4 <format=hex>;
if (header.version == 5) {
int unk0C;
}
if (count > 0) {
local quad pos <hidden=true> = FTell();
FSeek(header.unkOffset4 + unkOffset4);
int data[count] <bgcolor=cLtGray>;
FSeek(pos);
}
} Unk3 <bgcolor=cGray, optimize=false>;
Header header;
struct {
local int i <hidden=true>;
for (i = 0; i < header.groupCount; i++)
Group groups(header, i);
} groups;
FSeek(header.unkOffset3);
struct {
Unk3 unk3s(header)[header.unk3Count];
} unk3s;