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
/
Copy pathFXR3.bt
338 lines (295 loc) · 10.7 KB
/
FXR3.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
// File: FXR3.bt
// Authors: TKGP
// Version: 1.01
// Purpose: DS3 sfx definition files
// Category: Dark Souls
// File Mask: *.fxr
// ID Bytes: 46 58 52 00
// History:
//------------------------------------------------
LittleEndian();
typedef struct {
char magic[4]; Assert(magic == "FXR\0");
short unk04; Assert(unk04 == 0);
short version; Assert(version == 4 || version == 5);
int unk08; Assert(unk08 == 1);
int ffxID;
int section1Offset <format=hex>;
int section1Count; Assert(section1Count == 1);
int section2Offset <format=hex>;
int section2Count;
int section3Offset <format=hex>;
int section3Count;
int section4Offset <format=hex>;
int section4Count;
int section5Offset <format=hex>;
int section5Count;
int section6Offset <format=hex>;
int section6Count;
int section7Offset <format=hex>;
int section7Count;
int section8Offset <format=hex>;
int section8Count;
int section9Offset <format=hex>;
int section9Count;
int section10Offset <format=hex>;
int section10Count;
int section11Offset <format=hex>;
int section11Count;
int unk68; Assert(unk68 == 1);
int unk70; Assert(unk70 == 0);
if (version == 5) {
int section12Offset <format=hex>;
int section12Count; Assert(section12Count <= 2); // If these fail please tell me
int section13Offset <format=hex>;
int section13Count; Assert(section13Count <= 2);
int section14Offset <format=hex>;
int section14Count; Assert(section14Count == 0);
int unk88; Assert(unk88 == 0);
int unk8C; Assert(unk8C == 0);
}
} Header <bgcolor=cSilver>;
struct Section1;
struct Section2;
struct Section3;
struct Section4;
struct Section5;
struct Section6;
struct Section7;
struct Section8;
struct Section9;
struct Section10;
typedef struct {
int unk00 <fgcolor=cLtRed, hidden=true>; Assert(unk00 == 0);
int section2Count <hidden=true>;
int section2Offset <format=hex, hidden=true>;
int unk0C <fgcolor=cLtRed, hidden=true>; Assert(unk0C == 0);
if (section2Count > 0) {
local quad pos <hidden=true> = FTell();
FSeek(section2Offset);
Section2 section2s[section2Count];
FSeek(pos);
}
} Section1 <bgcolor=cLtRed, optimize=false>;
typedef struct {
int unk00 <fgcolor=cRed, hidden=true>; Assert(unk00 == 0);
int section3Count <hidden=true>;
int section3Offset <format=hex, hidden=true>;
int unk0C <fgcolor=cRed, hidden=true>; Assert(unk0C == 0);
if (section3Count > 0) {
local quad pos <hidden=true> = FTell();
FSeek(section3Offset);
Section3 section3s[section3Count];
FSeek(pos);
}
} Section2 <bgcolor=cRed, optimize=false>;
typedef struct {
short unk00; Assert(unk00 == 11);
byte unk01; Assert(unk01 == 0);
byte unk02; Assert(unk02 == 1);
int unk04 <fgcolor=cLtYellow, hidden=true>; Assert(unk04 == 0);
int unk08;
int unk0C <fgcolor=cLtYellow, hidden=true>; Assert(unk0C == 0);
int unk10 <format=hex>;
int unk14 <fgcolor=cLtYellow, hidden=true>; Assert(unk14 == 0);
int unk18; Assert(unk18 == 1);
int unk1C <fgcolor=cLtYellow, hidden=true>; Assert(unk1C == 0);
int section11Offset1 <format=hex>;
int unk24 <fgcolor=cLtYellow, hidden=true>; Assert(unk24 == 0);
int unk28 <fgcolor=cLtYellow, hidden=true>; Assert(unk28 == 0);
int unk2C <fgcolor=cLtYellow, hidden=true>; Assert(unk2C == 0);
int unk30 <fgcolor=cLtYellow, hidden=true>; Assert(unk30 == 0);
int unk34 <fgcolor=cLtYellow, hidden=true>; Assert(unk34 == 0);
int unk38 <format=hex>; Assert(unk38 == 0x100FFFC || unk38 == 0x100FFFD || unk38 == 0x100FFFF);
int unk3C <fgcolor=cLtYellow, hidden=true>; Assert(unk3C == 0);
int unk40; Assert(unk40 == 0 || unk40 == 1);
int unk44 <fgcolor=cLtYellow, hidden=true>; Assert(unk44 == 0);
int section11Offset2 <format=hex>;
int unk4C <fgcolor=cLtYellow, hidden=true>; Assert(unk4C == 0);
int unk50 <fgcolor=cLtYellow, hidden=true>; Assert(unk50 == 0);
int unk54 <fgcolor=cLtYellow, hidden=true>; Assert(unk54 == 0);
int unk58 <fgcolor=cLtYellow, hidden=true>; Assert(unk58 == 0);
int unk5C <fgcolor=cLtYellow, hidden=true>; Assert(unk5C == 0);
local quad pos <hidden=true> = FTell();
// Usually (but not always) a float
FSeek(section11Offset1);
int section11Data1 <format=hex>;
// Usually (but not always) an int
FSeek(section11Offset2);
int section11Data2 <format=hex>;
FSeek(pos);
} Section3 <bgcolor=cLtYellow, optimize=false>;
typedef struct {
short unk00;
byte unk02;
byte unk03;
int unk04 <fgcolor=cLtGreen, hidden=true>; Assert(unk04 == 0);
int section5Count <hidden=true>;
int section6Count <hidden=true>;
int section4Count <hidden=true>;
int unk14 <fgcolor=cLtGreen, hidden=true>; Assert(unk14 == 0);
int section5Offset <format=hex, hidden=true>;
int unk1C <fgcolor=cLtGreen, hidden=true>; Assert(unk1C == 0);
int section6Offset <format=hex, hidden=true>;
int unk24 <fgcolor=cLtGreen, hidden=true>; Assert(unk24 == 0);
int section4Offset <format=hex, hidden=true>;
int unk2C <fgcolor=cLtGreen, hidden=true>; Assert(unk2C == 0);
local quad pos <hidden=true> = FTell();
if (section4Count > 0) {
FSeek(section4Offset);
Section4 section4s[section4Count];
}
if (section5Count > 0) {
FSeek(section5Offset);
Section5 section5s[section5Count];
}
if (section6Count > 0) {
FSeek(section6Offset);
Section6 section6s[section6Count];
}
FSeek(pos);
} Section4 <bgcolor=cLtGreen, optimize=false>;
typedef struct {
short unk00;
byte unk02;
byte unk03;
int unk04 <fgcolor=cGreen, hidden=true>; Assert(unk04 == 0);
int unk08 <fgcolor=cGreen, hidden=true>; Assert(unk08 == 0);
int section6Count <hidden=true>;
int unk10 <fgcolor=cGreen, hidden=true>; Assert(unk10 == 0);
int unk14 <fgcolor=cGreen, hidden=true>; Assert(unk14 == 0);
int section6Offset <format=hex, hidden=true>;
int unk1C <fgcolor=cGreen, hidden=true>; Assert(unk1C == 0);
if (section6Count > 0) {
local quad pos <hidden=true> = FTell();
FSeek(section6Offset);
Section6 section6s[section6Count];
FSeek(pos);
}
} Section5 <bgcolor=cGreen, optimize=false>;
typedef struct {
short unk00;
byte unk02;
byte unk03;
int unk04;
int section11Count1 <hidden=true>;
int section10Count <hidden=true>;
int section7Count1 <hidden=true>;
int section11Count2 <hidden=true>; //Assert(section11Count2 == 0 || section11Count2 == 43);
int unk18 <fgcolor=cAqua, hidden=true>; Assert(unk18 == 0);
int section7Count2 <hidden=true>;
int section11Offset <format=hex, hidden=true>;
int unk24 <fgcolor=cAqua, hidden=true>; Assert(unk24 == 0);
int section10Offset <format=hex, hidden=true>;
int unk2C <fgcolor=cAqua, hidden=true>; Assert(unk2C == 0);
int section7Offset <format=hex, hidden=true>;
int unk34 <fgcolor=cAqua, hidden=true>; Assert(unk34 == 0);
int unk38 <fgcolor=cAqua, hidden=true>; Assert(unk38 == 0);
int unk3C <fgcolor=cAqua, hidden=true>; Assert(unk3C == 0);
local quad pos <hidden=true> = FTell();
FSeek(section7Offset);
if (section7Count1 > 0)
Section7 section7s1[section7Count1];
if (section7Count2 > 0)
Section7 section7s2[section7Count2];
if (section10Count > 0) {
FSeek(section10Offset);
Section10 section10s[section10Count];
}
FSeek(section11Offset);
if (section11Count1 > 0)
int section11Data1[section11Count1];
if (section11Count2 > 0)
int section11Data2[section11Count2];
FSeek(pos);
} Section6 <bgcolor=cAqua, optimize=false>;
typedef struct {
int unk00 <format=hex>;
int unk04;
int section11Count <hidden=true>;
int unk0C <fgcolor=cLtBlue, hidden=true>; Assert(unk0C == 0);
int section11Offset <format=hex, hidden=true>;
int unk14 <fgcolor=cLtBlue, hidden=true>; Assert(unk14 == 0);
int section8Offset <format=hex, hidden=true>;
int unk1C <fgcolor=cLtBlue, hidden=true>; Assert(unk1C == 0);
int section8Count <hidden=true>;
int unk24 <fgcolor=cLtBlue, hidden=true>; Assert(unk24 == 0);
local quad pos <hidden=true> = FTell();
if (section8Count > 0) {
FSeek(section8Offset);
Section8 section8s[section8Count];
}
if (section11Count > 0) {
FSeek(section11Offset);
// Lifetime?
int section11Data[section11Count];
}
FSeek(pos);
} Section7 <bgcolor=cLtBlue, optimize=false>;
typedef struct {
byte unk00;
byte unk01;
byte unk02;
byte unk03;
int unk04;
int section11Count <hidden=true>;
int section9Count <hidden=true>;
int section11Offset <format=hex, hidden=true>;
int unk14 <fgcolor=cPurple, hidden=true>; Assert(unk14 == 0);
int section9Offset <format=hex, hidden=true>;
int unk1C <fgcolor=cPurple, hidden=true>; Assert(unk1C == 0);
local quad pos <hidden=true> = FTell();
if (section9Count > 0) {
FSeek(section9Offset);
Section9 section9s[section9Count];
}
if (section11Count > 0) {
FSeek(section11Offset);
int section11Data[section11Count];
}
FSeek(pos);
} Section8 <bgcolor=cPurple, optimize=false>;
typedef struct {
int unk00 <format=hex>;
int unk04;
int section11Count <hidden=true>;
int unk0C <fgcolor=cBlack, hidden=true>; Assert(unk18 == 0);
int section11Offset <format=hex, hidden=true>;
int unk14 <fgcolor=cBlack, hidden=true>; Assert(unk18 == 0);
if (section11Count > 0) {
local quad pos <hidden=true> = FTell();
FSeek(section11Offset);
int section11Data[section11Count];
FSeek(pos);
}
} Section9 <bgcolor=cBlack, fgcolor=cWhite, optimize=false>;
typedef struct {
int section11Offset <format=hex, hidden=true>;
int unk04 <fgcolor=cGray, hidden=true>; Assert(unk04 == 0);
int section11Count <hidden=true>;
int unk0C <fgcolor=cGray, hidden=true>; Assert(unk0C == 0);
if (section11Count > 0) {
local quad pos <hidden=true> = FTell();
FSeek(section11Offset);
int section11Data[section11Count];
FSeek(pos);
}
} Section10 <bgcolor=cGray, optimize=false>;
Header header;
FSeek(header.section1Offset);
Section1 section1Tree;
FSeek(header.section4Offset);
Section4 section4Tree;
if (header.version == 5) {
if (header.section12Count > 0) {
FSeek(header.section12Offset);
int section12s[header.section12Count];
}
if (header.section13Count > 0) {
FSeek(header.section13Offset);
int section13s[header.section13Count];
}
}