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
/
FFX-DLSE.bt
475 lines (401 loc) · 13.7 KB
/
FFX-DLSE.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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
//------------------------------------------------
//--- 010 Editor v9.0.2 Binary Template
//
// File: FFX-DLSE.bt
// Authors: TKGP
// Version:
// Purpose: Dark Souls 2 SFX definitions
// Category: Dantelion
// File Mask: *.ffx
// ID Bytes: 44 4C 73 45 [+23] 46 58 53 65 72 69 61 6C 69 7A 61 62 6C 65 45 66 66 65 63 74
// History:
//------------------------------------------------
LittleEndian();
//------------------------------------------------
typedef struct {
char magic[4]; Assert(magic == "DLsE");
byte unk04; Assert(unk04 == 1);
byte unk05; Assert(unk05 == 3);
byte unk06; Assert(unk06 == 0);
byte unk07; Assert(unk07 == 0);
int unk08; Assert(unk08 == 0);
int unk0C; Assert(unk0C == 0);
byte unk10; Assert(unk10 == 0); // These types aren't exactly right I'm sure
int unk11; Assert(unk11 == 1);
short classCount;
} Header <bgcolor=cLtRed>;
typedef struct {
int length;
char str[length];
} PrefixString <read=ReadPrefixString, optimize=false>;
string ReadPrefixString(PrefixString& ps) {
return ps.str;
}
typedef struct (string assertType) {
local quad start <format=hex> = FTell();
short type; Assert(classes.classes[type - 1].str == assertType);
int version;
int length <format=hex>;
local quad end <format=hex> = start + length;
} Block <read=ReadBlock, bgcolor=cBlack, fgcolor=cWhite>;
string ReadBlock(Block& block) {
string str;
SPrintf(str, "%i %i %Xh", block.type, block.version, block.length);
return str;
}
typedef struct {
short type; Assert(classes.classes[type - 1].str == "DLVector");
int count;
if (count > 0) {
int values[count];
}
} DLVector <read=ReadDLVector, bgcolor=cLtPurple, optimize=false>;
string ReadDLVector(DLVector& vec) {
string str;
SPrintf(str, "[%i]", vec.count);
return str;
}
typedef struct {
Block block("FXSerializablePrimitive<dl_int32>");
int value;
Assert(FTell() == block.end);
} FXSerializablePrimitiveInt <read=ReadPrimitiveInt, bgcolor=cDkGreen, optimize=false>;
string ReadPrimitiveInt(FXSerializablePrimitiveInt& primInt) {
string str;
SPrintf(str, "%i", primInt.value);
return str;
}
typedef struct {
Block block("FXSerializablePrimitive<dl_float32>");
float value;
Assert(FTell() == block.end);
} FXSerializablePrimitiveFloat <read=ReadPrimitiveFloat, bgcolor=cDkGreen, optimize=false>;
string ReadPrimitiveFloat(FXSerializablePrimitiveFloat& primFloat) {
string str;
SPrintf(str, "%f", primFloat.value);
return str;
}
typedef struct {
Block block("FXSerializablePrimitive<FXTick>");
float value;
Assert(FTell() == block.end);
} FXSerializablePrimitiveTick <read=ReadPrimitiveTick, bgcolor=cDkGreen, optimize=false>;
string ReadPrimitiveTick(FXSerializablePrimitiveTick& tick) {
string str;
SPrintf(str, "%f", tick.unk00);
return str;
}
typedef struct {
Block block("FXSerializablePrimitive<FXColorRGBA>");
float r;
float g;
float b;
float a;
Assert(FTell() == block.end);
} FXSerializablePrimitiveColor <read=ReadPrimitiveColor, bgcolor=cDkGreen, optimize=false>;
string ReadPrimitiveColor(FXSerializablePrimitiveColor& color) {
string str;
SPrintf(str, "%f, %f, %f, %f", color.r, color.g, color.b, color.a);
return str;
}
struct FXSerializableParam;
struct FXSerializableParamList;
typedef struct {
Block block("FXSerializableParam");
int type;
if (type == 1) {
FXSerializablePrimitiveInt primInt;
} else if (type == 2) {
int count;
struct {
FXSerializablePrimitiveInt primInts[count];
} primInts;
} else if (type == 5) {
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveInt primInt;
} tickInts[count] <optimize=false>;
} else if (type == 6) {
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveInt primInt;
} tickInts[count] <optimize=false>;
} else if (type == 7) { // Texture scale? Light flicker?
FXSerializablePrimitiveFloat primFloat;
} else if (type == 9) {
int unk04;
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveFloat primFloat;
} else if (type == 11) { // Size
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveFloat primFloat;
} tickFloats[count] <optimize=false>;
} else if (type == 12) {
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveFloat primFloat;
} tickFloats[count] <optimize=false>;
} else if (type == 13) { // Movement
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveFloat primFloat1;
FXSerializablePrimitiveFloat primFloat2;
FXSerializablePrimitiveFloat primFloat3;
} tickFloat3s[count] <optimize=false>;
} else if (type == 15) { // Texture color
FXSerializablePrimitiveColor color;
} else if (type == 17) { // Texture color
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveColor color;
} tickColors[count] <optimize=false>;
} else if (type == 18) {
int unk04;
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveColor color;
} else if (type == 19) { // Light color
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveColor color;
} tickColors[count] <optimize=false>;
} else if (type == 20) { // Texture color
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveColor color;
} tickColors[count] <optimize=false>;
} else if (type == 21) {
int count;
struct {
FXSerializablePrimitiveTick tick;
FXSerializablePrimitiveColor color1;
FXSerializablePrimitiveColor color2;
FXSerializablePrimitiveColor color3;
} tickColor3s[count] <optimize=false>;
} else if (type == 37) {
int unk04;
FXSerializableParamList paramList;
} else if (type == 38) {
int unk04;
FXSerializableParamList paramList;
} else if (type == 40) {
int unk04;
} else if (type == 41) {
int unk04;
} else if (type == 44) {
int unk04;
int unk08;
} else if (type == 45) {
int unk04;
int unk08;
} else if (type == 46) {
int unk04;
int unk08;
} else if (type == 47) {
int unk04;
int unk08;
} else if (type == 59) {
int unk04;
int unk08;
} else if (type == 60) {
int unk04;
int unk08;
} else if (type == 66) {
int unk04;
int unk08;
} else if (type == 68) {
int unk04;
} else if (type == 69) {
int unk04;
} else if (type == 70) {
FXSerializablePrimitiveTick tick;
} else if (type == 71) {
int unk04;
int unk08;
} else if (type == 79) {
FXSerializablePrimitiveInt primInt1;
FXSerializablePrimitiveInt primInt2;
} else if (type == 81) { // Rotation?
FXSerializablePrimitiveFloat primFloat1;
FXSerializablePrimitiveFloat primFloat2;
} else if (type == 82) {
FXSerializableParam param;
FXSerializablePrimitiveFloat primFloat;
} else if (type == 83) {
FXSerializablePrimitiveColor color1;
FXSerializablePrimitiveColor color2;
} else if (type == 84) {
FXSerializableParam param;
FXSerializablePrimitiveColor color;
} else if (type == 85) {
FXSerializablePrimitiveTick tick1;
FXSerializablePrimitiveTick tick2;
} else if (type == 87) {
int unk04;
int unk08;
} else {
Assert(false, "Unknown param type");
}
Assert(FTell() == block.end);
} FXSerializableParam <bgcolor=cGreen, optimize=false>;
typedef struct {
Block block("FXSerializableParamList");
int count;
int unk04; // Usually count, not always
if (count > 0) {
struct { FXSerializableParam params[count]; } params;
}
Assert(FTell() == block.end);
} FXSerializableParamList <bgcolor=cLtGreen, optimize=false>;
typedef struct {
Block block("FXSerializableAction");
int actionID;
FXSerializableParamList paramList;
Assert(FTell() == block.end);
} FXSerializableAction <optimize=false>;
struct FXSerializableEvaluatableInt;
typedef struct {
Block block("FXSerializableEvaluatable<dl_int32>");
int operator;
int type; // 1 int, 2 float, 3 bool
if (operator == 1) { // int literal
int value;
} else if (operator == 2) { // ???
int unk08;
int unk0C;
} else if (operator == 3) { // ???
int unk08;
int unk0C;
} else if (operator == 8 // &&
|| operator == 9 // ||
|| operator == 10 // >=
|| operator == 11 // >
|| operator == 12 // <=
|| operator == 13 // <
|| operator == 14 // ==
|| operator == 15 // !=
) {
FXSerializableEvaluatableInt left;
FXSerializableEvaluatableInt right;
} else if (operator == 20 // !
) {
FXSerializableEvaluatableInt operand;
} else if (operator == 4 // Current tick
|| operator == 5 // Total tick
|| operator == 21 // Child exists
|| operator == 22 // Parent exists
|| operator == 23 // ???
|| operator == 24 // Emitters stopped
) {
// Nullary lul
} else {
Assert(false, "Unknown operator");
}
Assert(FTell() == block.end);
} FXSerializableEvaluatableInt <read=ReadEvaluatableInt, optimize=false>;
string ReadEvaluatableInt(FXSerializableEvaluatableInt& eval) {
string str;
if (eval.operator == 1) {
SPrintf(str, "%i", eval.value);
} else if (eval.operator == 2) {
SPrintf(str, "{2: %i, %i}", eval.unk08, eval.unk0C);
} else if (eval.operator == 3) {
SPrintf(str, "{3: %i, %i}", eval.unk08, eval.unk0C);
} else if (eval.operator == 4) {
str = "CurrentTick";
} else if (eval.operator == 5) {
str = "TotalTick";
} else if (eval.operator == 8) {
SPrintf(str, "(%s) && (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 9) {
SPrintf(str, "(%s) || (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 10) {
SPrintf(str, "(%s) >= (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 11) {
SPrintf(str, "(%s) > (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 12) {
SPrintf(str, "(%s) <= (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 13) {
SPrintf(str, "(%s) < (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 14) {
SPrintf(str, "(%s) == (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 15) {
SPrintf(str, "(%s) != (%s)", ReadEvaluatableInt(eval.left), ReadEvaluatableInt(eval.right));
} else if (eval.operator == 20) {
SPrintf(str, "!(%s)", ReadEvaluatableInt(eval.operand));
} else if (eval.operator == 21) {
str = "ChildExists";
} else if (eval.operator == 22) {
str = "ParentExists";
} else if (eval.operator == 23) {
str = "{23}";
} else if (eval.operator == 24) {
str = "EmittersStopped";
}
return str;
}
typedef struct {
Block block("FXSerializableTrigger");
int destinationState;
FXSerializableEvaluatableInt evaluatableInt;
Assert(FTell() == block.end);
} FXSerializableTrigger <read=ReadTrigger, bgcolor=cDkYellow, optimize=false>;
string ReadTrigger(FXSerializableTrigger& trigger) {
string str;
SPrintf(str, "goto %i when %s", trigger.destinationState, ReadEvaluatableInt(trigger.evaluatableInt));
return str;
}
typedef struct {
Block block("FXSerializableState");
int actionCount;
int triggerCount;
if (actionCount > 0) {
FXSerializableAction actions[actionCount];
}
if (triggerCount > 0) {
FXSerializableTrigger triggers[triggerCount];
}
Assert(FTell() == block.end);
} FXSerializableState <bgcolor=cYellow, optimize=false>;
typedef struct {
Block block("FXSerializableStateMap");
int stateCount;
FXSerializableState states[stateCount];
Assert(FTell() == block.end);
} FXSerializableStateMap <bgcolor=cLtYellow, optimize=false>;
typedef struct {
Block block("FXResourceSet");
DLVector vector1;
DLVector vector2;
DLVector vector3;
DLVector vector4;
DLVector vector5;
Assert(FTell() == block.end);
} FXResourceSet <bgcolor=cPurple, optimize=false>;
typedef struct {
Block block("FXSerializableEffect");
int unk00; Assert(unk00 == 0);
int effectID;
int unk08; Assert(unk08 == 0);
int unk0C; Assert(unk0C == 0);
int count10;
short unk14; Assert(unk14 == 0);
DLVector vector; Assert(vector.count == 0); // This is a bit of a guess based on class name order
struct { FXSerializableParamList paramLists[count10]; } paramLists;
FXSerializableStateMap stateMap;
FXResourceSet resourceSet;
byte terminator; Assert(terminator == 0);
Assert(FTell() == block.end);
} FXSerializableEffect <bgcolor=cAqua, optimize=false>;
//------------------------------------------------
Header header;
struct { PrefixString classes[header.classCount]; } classes <bgcolor=cRed>;
FXSerializableEffect effect;