@etothepii/satisfactory-file-parser 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +1 -0
- package/build/index.js +25 -58
- package/build/parser/byte/alignment.enum.js +2 -5
- package/build/parser/byte/binary-operable.interface.js +1 -2
- package/build/parser/byte/binary-readable.interface.js +1 -2
- package/build/parser/byte/byte-reader.class.js +10 -14
- package/build/parser/byte/byte-writer.class.js +10 -13
- package/build/parser/error/parser.error.js +6 -15
- package/build/parser/file.types.js +2 -5
- package/build/parser/parser.d.ts +1 -1
- package/build/parser/parser.js +24 -27
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +28 -36
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +20 -25
- package/build/parser/satisfactory/blueprint/blueprint.types.js +1 -2
- package/build/parser/satisfactory/objects/DataFields.js +79 -83
- package/build/parser/satisfactory/objects/GUIDInfo.js +5 -8
- package/build/parser/satisfactory/objects/ObjectReference.js +2 -5
- package/build/parser/satisfactory/objects/Property.js +91 -120
- package/build/parser/satisfactory/objects/SaveComponent.js +7 -11
- package/build/parser/satisfactory/objects/SaveEntity.js +13 -17
- package/build/parser/satisfactory/objects/SaveObject.js +4 -8
- package/build/parser/satisfactory/objects/ue/GUID.js +2 -5
- package/build/parser/satisfactory/objects/ue/MD5Hash.js +2 -5
- package/build/parser/satisfactory/save/asynchronous-level.class.js +12 -16
- package/build/parser/satisfactory/save/level.class.js +26 -30
- package/build/parser/satisfactory/save/satisfactory-save.d.ts +2 -1
- package/build/parser/satisfactory/save/satisfactory-save.js +3 -6
- package/build/parser/satisfactory/save/save-reader.js +31 -34
- package/build/parser/satisfactory/save/save-writer.js +34 -40
- package/build/parser/satisfactory/save/save.types.js +1 -2
- package/build/parser/satisfactory/structs/util.types.js +37 -63
- package/build/parser/stream/byte-stream-reader.class.js +17 -21
- package/build/parser/stream/json-stream-state-writer.js +2 -6
- package/build/parser/stream/json-stream-writable.js +1 -5
- package/build/parser/stream/json-stream-writer.js +2 -6
- package/build/parser/stream/reworked/readable-stream-parser.d.ts +12 -0
- package/build/parser/stream/reworked/readable-stream-parser.js +201 -0
- package/build/parser/stream/reworked/stream-parser.d.ts +3 -1
- package/build/parser/stream/reworked/stream-parser.js +86 -11
- package/build/parser/stream/save-stream-json-stringifier.js +3 -7
- package/build/parser/stream/save-stream-reader.class.js +18 -24
- package/build/parser/stream/save-stream-writer.class.d.ts +15 -13
- package/build/parser/stream/save-stream-writer.class.js +71 -108
- package/build/parser/stream/stream-level.class.js +11 -15
- package/build/parser/stream/stream-parser.js +11 -15
- package/package.json +4 -2
- package/build/parser/satisfactory/objects/ue/FMD5Hash.d.ts +0 -7
- package/build/parser/satisfactory/objects/ue/FMD5Hash.js +0 -19
|
@@ -1,40 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const GUIDInfo_1 = require("./GUIDInfo");
|
|
7
|
-
const ObjectReference_1 = require("./ObjectReference");
|
|
8
|
-
class AbstractProperty {
|
|
1
|
+
import { ParseCol4BGRA, ParseCol4RGBA, ParseVec3, ParseVec3f, ParseVec4, ParseVec4f, SerializeCol4BGRA, SerializeCol4RGBA, SerializeVec3, SerializeVec3f, SerializeVec4 } from "../structs/util.types";
|
|
2
|
+
import { DataFields } from "./DataFields";
|
|
3
|
+
import { GUIDInfo } from './GUIDInfo';
|
|
4
|
+
import { ObjectReference } from "./ObjectReference";
|
|
5
|
+
export class AbstractProperty {
|
|
9
6
|
constructor(type, index) {
|
|
10
7
|
this.type = type;
|
|
11
8
|
this.index = index;
|
|
12
9
|
}
|
|
13
10
|
}
|
|
14
|
-
|
|
15
|
-
class AbstractBaseProperty extends AbstractProperty {
|
|
11
|
+
export class AbstractBaseProperty extends AbstractProperty {
|
|
16
12
|
constructor(type, ueType, index) {
|
|
17
13
|
super(type, index && index !== 0 ? index : undefined);
|
|
18
14
|
this.ueType = ueType;
|
|
19
15
|
this.name = '';
|
|
20
16
|
}
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
class BasicProperty extends AbstractBaseProperty {
|
|
18
|
+
export class BasicProperty extends AbstractBaseProperty {
|
|
24
19
|
constructor(type, ueType, guidInfo, index = 0) {
|
|
25
20
|
super(type, ueType, index);
|
|
26
21
|
this.guidInfo = guidInfo;
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
|
-
|
|
30
|
-
class BoolProperty extends BasicProperty {
|
|
24
|
+
export class BoolProperty extends BasicProperty {
|
|
31
25
|
constructor(value, ueType = 'BoolProperty', guidInfo = undefined, index = 0) {
|
|
32
26
|
super('BoolProperty', ueType, guidInfo, index);
|
|
33
27
|
this.value = value;
|
|
34
28
|
}
|
|
35
29
|
static Parse(reader, ueType, index = 0) {
|
|
36
30
|
const value = BoolProperty.ReadValue(reader);
|
|
37
|
-
const guidInfo =
|
|
31
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
38
32
|
return new BoolProperty(value, ueType, guidInfo, index);
|
|
39
33
|
}
|
|
40
34
|
static ReadValue(reader) {
|
|
@@ -45,21 +39,20 @@ class BoolProperty extends BasicProperty {
|
|
|
45
39
|
}
|
|
46
40
|
static Serialize(writer, property) {
|
|
47
41
|
BoolProperty.SerializeValue(writer, property.value);
|
|
48
|
-
|
|
42
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
49
43
|
}
|
|
50
44
|
static SerializeValue(writer, value) {
|
|
51
45
|
writer.writeByte(value ? 1 : 0);
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
|
-
|
|
55
|
-
class ByteProperty extends BasicProperty {
|
|
48
|
+
export class ByteProperty extends BasicProperty {
|
|
56
49
|
constructor(value, ueType = 'ByteProperty', guidInfo = undefined, index = 0) {
|
|
57
50
|
super('ByteProperty', ueType, guidInfo, index);
|
|
58
51
|
this.value = value;
|
|
59
52
|
}
|
|
60
53
|
static Parse(reader, ueType, index = 0) {
|
|
61
54
|
const type = reader.readString();
|
|
62
|
-
const guidInfo =
|
|
55
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
63
56
|
let value;
|
|
64
57
|
if (type === 'None') {
|
|
65
58
|
value = {
|
|
@@ -84,7 +77,7 @@ class ByteProperty extends BasicProperty {
|
|
|
84
77
|
}
|
|
85
78
|
static Serialize(writer, property) {
|
|
86
79
|
writer.writeString(property.value.type);
|
|
87
|
-
|
|
80
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
88
81
|
if (property.value.type === 'None') {
|
|
89
82
|
ByteProperty.SerializeValue(writer, property.value.value);
|
|
90
83
|
}
|
|
@@ -96,14 +89,13 @@ class ByteProperty extends BasicProperty {
|
|
|
96
89
|
writer.writeByte(value);
|
|
97
90
|
}
|
|
98
91
|
}
|
|
99
|
-
|
|
100
|
-
class Int8Property extends BasicProperty {
|
|
92
|
+
export class Int8Property extends BasicProperty {
|
|
101
93
|
constructor(value, ueType = 'Int8Property', guidInfo = undefined, index = 0) {
|
|
102
94
|
super('Int8Property', ueType, guidInfo, index);
|
|
103
95
|
this.value = value;
|
|
104
96
|
}
|
|
105
97
|
static Parse(reader, ueType, index = 0) {
|
|
106
|
-
const guidInfo =
|
|
98
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
107
99
|
const value = Int8Property.ReadValue(reader);
|
|
108
100
|
return new Int8Property(value, ueType, guidInfo, index);
|
|
109
101
|
}
|
|
@@ -114,21 +106,20 @@ class Int8Property extends BasicProperty {
|
|
|
114
106
|
return 1;
|
|
115
107
|
}
|
|
116
108
|
static Serialize(writer, property) {
|
|
117
|
-
|
|
109
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
118
110
|
Int8Property.SerializeValue(writer, property.value);
|
|
119
111
|
}
|
|
120
112
|
static SerializeValue(writer, value) {
|
|
121
113
|
writer.writeInt8(value);
|
|
122
114
|
}
|
|
123
115
|
}
|
|
124
|
-
|
|
125
|
-
class Uint8Property extends BasicProperty {
|
|
116
|
+
export class Uint8Property extends BasicProperty {
|
|
126
117
|
constructor(value, ueType = 'UInt8Property', guidInfo = undefined, index = 0) {
|
|
127
118
|
super('UInt8Property', ueType, guidInfo, index);
|
|
128
119
|
this.value = value;
|
|
129
120
|
}
|
|
130
121
|
static Parse(reader, ueType, index = 0) {
|
|
131
|
-
const guidInfo =
|
|
122
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
132
123
|
const value = Uint8Property.ReadValue(reader);
|
|
133
124
|
return new Uint8Property(value, ueType, guidInfo, index);
|
|
134
125
|
}
|
|
@@ -139,21 +130,20 @@ class Uint8Property extends BasicProperty {
|
|
|
139
130
|
throw new Error('Unimplemented.');
|
|
140
131
|
}
|
|
141
132
|
static Serialize(writer, property) {
|
|
142
|
-
|
|
133
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
143
134
|
Uint8Property.SerializeValue(writer, property.value);
|
|
144
135
|
}
|
|
145
136
|
static SerializeValue(writer, value) {
|
|
146
137
|
writer.writeUint8(value);
|
|
147
138
|
}
|
|
148
139
|
}
|
|
149
|
-
|
|
150
|
-
class Int32Property extends BasicProperty {
|
|
140
|
+
export class Int32Property extends BasicProperty {
|
|
151
141
|
constructor(value, ueType = 'IntProperty', guidInfo = undefined, index = 0) {
|
|
152
142
|
super('Int32Property', ueType, guidInfo, index);
|
|
153
143
|
this.value = value;
|
|
154
144
|
}
|
|
155
145
|
static Parse(reader, ueType, index = 0) {
|
|
156
|
-
const guidInfo =
|
|
146
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
157
147
|
const value = Int32Property.ReadValue(reader);
|
|
158
148
|
return new Int32Property(value, ueType, guidInfo, index);
|
|
159
149
|
}
|
|
@@ -164,21 +154,20 @@ class Int32Property extends BasicProperty {
|
|
|
164
154
|
return 1;
|
|
165
155
|
}
|
|
166
156
|
static Serialize(writer, property) {
|
|
167
|
-
|
|
157
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
168
158
|
Int32Property.SerializeValue(writer, property.value);
|
|
169
159
|
}
|
|
170
160
|
static SerializeValue(writer, value) {
|
|
171
161
|
writer.writeInt32(value);
|
|
172
162
|
}
|
|
173
163
|
}
|
|
174
|
-
|
|
175
|
-
class Uint32Property extends BasicProperty {
|
|
164
|
+
export class Uint32Property extends BasicProperty {
|
|
176
165
|
constructor(value, ueType = 'UInt32Property', guidInfo = undefined, index = 0) {
|
|
177
166
|
super('UInt32Property', ueType, guidInfo, index);
|
|
178
167
|
this.value = value;
|
|
179
168
|
}
|
|
180
169
|
static Parse(reader, ueType, index = 0) {
|
|
181
|
-
const guidInfo =
|
|
170
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
182
171
|
const value = Uint32Property.ReadValue(reader);
|
|
183
172
|
return new Uint32Property(value, ueType, guidInfo, index);
|
|
184
173
|
}
|
|
@@ -189,21 +178,20 @@ class Uint32Property extends BasicProperty {
|
|
|
189
178
|
return 1;
|
|
190
179
|
}
|
|
191
180
|
static Serialize(writer, property) {
|
|
192
|
-
|
|
181
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
193
182
|
Uint32Property.SerializeValue(writer, property.value);
|
|
194
183
|
}
|
|
195
184
|
static SerializeValue(writer, value) {
|
|
196
185
|
writer.writeUint32(value);
|
|
197
186
|
}
|
|
198
187
|
}
|
|
199
|
-
|
|
200
|
-
class Int64Property extends BasicProperty {
|
|
188
|
+
export class Int64Property extends BasicProperty {
|
|
201
189
|
constructor(value, ueType = 'Int64Property', guidInfo = undefined, index = 0) {
|
|
202
190
|
super('Int64Property', ueType, guidInfo, index);
|
|
203
191
|
this.value = value;
|
|
204
192
|
}
|
|
205
193
|
static Parse(reader, ueType, index = 0) {
|
|
206
|
-
const guidInfo =
|
|
194
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
207
195
|
const value = Int64Property.ReadValue(reader);
|
|
208
196
|
return new Int64Property(value, ueType, guidInfo, index);
|
|
209
197
|
}
|
|
@@ -214,21 +202,20 @@ class Int64Property extends BasicProperty {
|
|
|
214
202
|
return 1;
|
|
215
203
|
}
|
|
216
204
|
static Serialize(writer, property) {
|
|
217
|
-
|
|
205
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
218
206
|
Int64Property.SerializeValue(writer, property.value);
|
|
219
207
|
}
|
|
220
208
|
static SerializeValue(writer, value) {
|
|
221
209
|
writer.writeInt64(BigInt(value));
|
|
222
210
|
}
|
|
223
211
|
}
|
|
224
|
-
|
|
225
|
-
class FloatProperty extends BasicProperty {
|
|
212
|
+
export class FloatProperty extends BasicProperty {
|
|
226
213
|
constructor(value, ueType = 'FloatProperty', guidInfo = undefined, index = 0) {
|
|
227
214
|
super('FloatProperty', ueType, guidInfo, index);
|
|
228
215
|
this.value = value;
|
|
229
216
|
}
|
|
230
217
|
static Parse(reader, ueType, index = 0) {
|
|
231
|
-
const guidInfo =
|
|
218
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
232
219
|
const value = FloatProperty.ReadValue(reader);
|
|
233
220
|
return new FloatProperty(value, ueType, guidInfo, index);
|
|
234
221
|
}
|
|
@@ -239,21 +226,20 @@ class FloatProperty extends BasicProperty {
|
|
|
239
226
|
return reader.readFloat32();
|
|
240
227
|
}
|
|
241
228
|
static Serialize(writer, property) {
|
|
242
|
-
|
|
229
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
243
230
|
FloatProperty.SerializeValue(writer, property.value);
|
|
244
231
|
}
|
|
245
232
|
static SerializeValue(writer, value) {
|
|
246
233
|
writer.writeFloat(value);
|
|
247
234
|
}
|
|
248
235
|
}
|
|
249
|
-
|
|
250
|
-
class DoubleProperty extends BasicProperty {
|
|
236
|
+
export class DoubleProperty extends BasicProperty {
|
|
251
237
|
constructor(value, ueType = 'DoubleProperty', guidInfo = undefined, index = 0) {
|
|
252
238
|
super('DoubleProperty', ueType, guidInfo, index);
|
|
253
239
|
this.value = value;
|
|
254
240
|
}
|
|
255
241
|
static Parse(reader, ueType, index = 0) {
|
|
256
|
-
const guidInfo =
|
|
242
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
257
243
|
const value = DoubleProperty.ReadValue(reader);
|
|
258
244
|
return new DoubleProperty(value, ueType, guidInfo, index);
|
|
259
245
|
}
|
|
@@ -264,21 +250,20 @@ class DoubleProperty extends BasicProperty {
|
|
|
264
250
|
return 1;
|
|
265
251
|
}
|
|
266
252
|
static Serialize(writer, property) {
|
|
267
|
-
|
|
253
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
268
254
|
DoubleProperty.SerializeValue(writer, property.value);
|
|
269
255
|
}
|
|
270
256
|
static SerializeValue(writer, value) {
|
|
271
257
|
writer.writeDouble(value);
|
|
272
258
|
}
|
|
273
259
|
}
|
|
274
|
-
|
|
275
|
-
class StrProperty extends BasicProperty {
|
|
260
|
+
export class StrProperty extends BasicProperty {
|
|
276
261
|
constructor(value, ueType = 'StrProperty', guidInfo = undefined, index = 0) {
|
|
277
262
|
super('StrProperty', ueType, guidInfo, index);
|
|
278
263
|
this.value = value;
|
|
279
264
|
}
|
|
280
265
|
static Parse(reader, ueType, index = 0) {
|
|
281
|
-
const guidInfo =
|
|
266
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
282
267
|
const value = StrProperty.ReadValue(reader);
|
|
283
268
|
return new StrProperty(value, ueType, guidInfo, index);
|
|
284
269
|
}
|
|
@@ -289,21 +274,20 @@ class StrProperty extends BasicProperty {
|
|
|
289
274
|
return 1;
|
|
290
275
|
}
|
|
291
276
|
static Serialize(writer, property) {
|
|
292
|
-
|
|
277
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
293
278
|
StrProperty.SerializeValue(writer, property.value);
|
|
294
279
|
}
|
|
295
280
|
static SerializeValue(writer, value) {
|
|
296
281
|
writer.writeString(value);
|
|
297
282
|
}
|
|
298
283
|
}
|
|
299
|
-
|
|
300
|
-
class ObjectProperty extends BasicProperty {
|
|
284
|
+
export class ObjectProperty extends BasicProperty {
|
|
301
285
|
constructor(value, ueType = 'ObjectProperty', guidInfo = undefined, index = 0) {
|
|
302
286
|
super('ObjectProperty', ueType, guidInfo, index);
|
|
303
287
|
this.value = value;
|
|
304
288
|
}
|
|
305
289
|
static Parse(reader, ueType, index = 0) {
|
|
306
|
-
const guidInfo =
|
|
290
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
307
291
|
const value = ObjectProperty.ReadValue(reader);
|
|
308
292
|
return new ObjectProperty(value, ueType, guidInfo, index);
|
|
309
293
|
}
|
|
@@ -318,7 +302,7 @@ class ObjectProperty extends BasicProperty {
|
|
|
318
302
|
return 1;
|
|
319
303
|
}
|
|
320
304
|
static Serialize(writer, property) {
|
|
321
|
-
|
|
305
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
322
306
|
ObjectProperty.SerializeValue(writer, property.value);
|
|
323
307
|
}
|
|
324
308
|
static SerializeValue(writer, value) {
|
|
@@ -326,15 +310,14 @@ class ObjectProperty extends BasicProperty {
|
|
|
326
310
|
writer.writeString(value.pathName);
|
|
327
311
|
}
|
|
328
312
|
}
|
|
329
|
-
|
|
330
|
-
class EnumProperty extends BasicProperty {
|
|
313
|
+
export class EnumProperty extends BasicProperty {
|
|
331
314
|
constructor(value, ueType = 'EnumProperty', guidInfo = undefined, index = 0) {
|
|
332
315
|
super('EnumProperty', ueType, guidInfo, index);
|
|
333
316
|
this.value = value;
|
|
334
317
|
}
|
|
335
318
|
static Parse(reader, ueType, index = 0) {
|
|
336
319
|
let name = reader.readString();
|
|
337
|
-
const guidInfo =
|
|
320
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
338
321
|
const value = EnumProperty.ReadValue(reader);
|
|
339
322
|
const property = new EnumProperty({ name, value }, ueType, guidInfo, index);
|
|
340
323
|
return property;
|
|
@@ -347,21 +330,20 @@ class EnumProperty extends BasicProperty {
|
|
|
347
330
|
}
|
|
348
331
|
static Serialize(writer, property) {
|
|
349
332
|
writer.writeString(property.value.name);
|
|
350
|
-
|
|
333
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
351
334
|
EnumProperty.SerializeValue(writer, property.value.value);
|
|
352
335
|
}
|
|
353
336
|
static SerializeValue(writer, value) {
|
|
354
337
|
writer.writeString(value);
|
|
355
338
|
}
|
|
356
339
|
}
|
|
357
|
-
|
|
358
|
-
class TextProperty extends BasicProperty {
|
|
340
|
+
export class TextProperty extends BasicProperty {
|
|
359
341
|
constructor(value, ueType = 'TextProperty', guidInfo = undefined, index = 0) {
|
|
360
342
|
super('TextProperty', ueType, guidInfo, index);
|
|
361
343
|
this.value = value;
|
|
362
344
|
}
|
|
363
345
|
static Parse(reader, ueType, index = 0) {
|
|
364
|
-
const guidInfo =
|
|
346
|
+
const guidInfo = GUIDInfo.read(reader);
|
|
365
347
|
const value = TextProperty.ParseValue(reader);
|
|
366
348
|
return new TextProperty(value, ueType, guidInfo, index);
|
|
367
349
|
}
|
|
@@ -414,7 +396,7 @@ class TextProperty extends BasicProperty {
|
|
|
414
396
|
return 1;
|
|
415
397
|
}
|
|
416
398
|
static Serialize(writer, property) {
|
|
417
|
-
|
|
399
|
+
GUIDInfo.write(writer, property.guidInfo);
|
|
418
400
|
TextProperty.SerializeValue(writer, property.value);
|
|
419
401
|
}
|
|
420
402
|
static SerializeValue(writer, value) {
|
|
@@ -458,8 +440,7 @@ class TextProperty extends BasicProperty {
|
|
|
458
440
|
}
|
|
459
441
|
}
|
|
460
442
|
}
|
|
461
|
-
|
|
462
|
-
class StructProperty extends AbstractBaseProperty {
|
|
443
|
+
export class StructProperty extends AbstractBaseProperty {
|
|
463
444
|
constructor(subtype, ueType = 'StructProperty', index = 0, guid = 0) {
|
|
464
445
|
super('StructProperty', ueType, index);
|
|
465
446
|
this.subtype = subtype;
|
|
@@ -496,29 +477,29 @@ class StructProperty extends AbstractBaseProperty {
|
|
|
496
477
|
let value;
|
|
497
478
|
switch (subtype) {
|
|
498
479
|
case 'Color':
|
|
499
|
-
value =
|
|
480
|
+
value = ParseCol4BGRA(reader);
|
|
500
481
|
break;
|
|
501
482
|
case 'LinearColor':
|
|
502
|
-
value =
|
|
483
|
+
value = ParseCol4RGBA(reader);
|
|
503
484
|
break;
|
|
504
485
|
case 'Vector':
|
|
505
486
|
case 'Rotator':
|
|
506
487
|
case 'Vector2D':
|
|
507
|
-
value = (size === 12) ?
|
|
488
|
+
value = (size === 12) ? ParseVec3f(reader) : ParseVec3(reader);
|
|
508
489
|
break;
|
|
509
490
|
case 'Quat':
|
|
510
491
|
case 'Vector4':
|
|
511
492
|
case 'Vector4D':
|
|
512
|
-
value = (size === 16) ?
|
|
493
|
+
value = (size === 16) ? ParseVec4f(reader) : ParseVec4(reader);
|
|
513
494
|
break;
|
|
514
495
|
case 'Box':
|
|
515
496
|
value = (size === 25) ? {
|
|
516
|
-
min:
|
|
517
|
-
max:
|
|
497
|
+
min: ParseVec3f(reader),
|
|
498
|
+
max: ParseVec3f(reader),
|
|
518
499
|
isValid: reader.readByte() >= 1
|
|
519
500
|
} : {
|
|
520
|
-
min:
|
|
521
|
-
max:
|
|
501
|
+
min: ParseVec3(reader),
|
|
502
|
+
max: ParseVec3(reader),
|
|
522
503
|
isValid: reader.readByte() >= 1
|
|
523
504
|
};
|
|
524
505
|
break;
|
|
@@ -557,11 +538,11 @@ class StructProperty extends AbstractBaseProperty {
|
|
|
557
538
|
value = reader.readInt64().toString();
|
|
558
539
|
break;
|
|
559
540
|
case 'FINNetworkTrace':
|
|
560
|
-
value =
|
|
541
|
+
value = ReadFINNetworkTrace(reader);
|
|
561
542
|
break;
|
|
562
543
|
case 'FINLuaProcessorStateStorage':
|
|
563
544
|
value = {
|
|
564
|
-
values:
|
|
545
|
+
values: ReadFINLuaProcessorStateStorage(reader, size)
|
|
565
546
|
};
|
|
566
547
|
break;
|
|
567
548
|
case 'FICFrameRange':
|
|
@@ -571,7 +552,7 @@ class StructProperty extends AbstractBaseProperty {
|
|
|
571
552
|
};
|
|
572
553
|
break;
|
|
573
554
|
default:
|
|
574
|
-
value =
|
|
555
|
+
value = ParseDynamicStructData(reader, 0, subtype);
|
|
575
556
|
}
|
|
576
557
|
return value;
|
|
577
558
|
}
|
|
@@ -591,28 +572,28 @@ class StructProperty extends AbstractBaseProperty {
|
|
|
591
572
|
switch (subtype) {
|
|
592
573
|
case 'Color':
|
|
593
574
|
value = value;
|
|
594
|
-
|
|
575
|
+
SerializeCol4BGRA(writer, value);
|
|
595
576
|
break;
|
|
596
577
|
case 'LinearColor':
|
|
597
578
|
value = value;
|
|
598
|
-
|
|
579
|
+
SerializeCol4RGBA(writer, value);
|
|
599
580
|
break;
|
|
600
581
|
case 'Vector':
|
|
601
582
|
case 'Rotator':
|
|
602
583
|
case 'Vector2D':
|
|
603
584
|
value = value;
|
|
604
|
-
|
|
585
|
+
SerializeVec3(writer, value);
|
|
605
586
|
break;
|
|
606
587
|
case 'Quat':
|
|
607
588
|
case 'Vector4':
|
|
608
589
|
case 'Vector4D':
|
|
609
590
|
value = value;
|
|
610
|
-
|
|
591
|
+
SerializeVec4(writer, value);
|
|
611
592
|
break;
|
|
612
593
|
case 'Box':
|
|
613
594
|
value = value;
|
|
614
|
-
|
|
615
|
-
|
|
595
|
+
SerializeVec3(writer, value.min);
|
|
596
|
+
SerializeVec3(writer, value.max);
|
|
616
597
|
writer.writeByte(value.isValid ? 1 : 0);
|
|
617
598
|
break;
|
|
618
599
|
case 'RailroadTrackPosition':
|
|
@@ -651,11 +632,11 @@ class StructProperty extends AbstractBaseProperty {
|
|
|
651
632
|
break;
|
|
652
633
|
case 'FINNetworkTrace':
|
|
653
634
|
value = value;
|
|
654
|
-
|
|
635
|
+
SerializeFINNetworkTrace(writer, value);
|
|
655
636
|
break;
|
|
656
637
|
case 'FINLuaProcessorStateStorage':
|
|
657
638
|
value = value;
|
|
658
|
-
|
|
639
|
+
SerializeFINLuaProcessorStateStorage(writer, value.values);
|
|
659
640
|
break;
|
|
660
641
|
case 'FICFrameRange':
|
|
661
642
|
value = value;
|
|
@@ -664,12 +645,11 @@ class StructProperty extends AbstractBaseProperty {
|
|
|
664
645
|
break;
|
|
665
646
|
default:
|
|
666
647
|
value = value;
|
|
667
|
-
|
|
648
|
+
SerializeDynamicStructData(writer, 0, value);
|
|
668
649
|
}
|
|
669
650
|
}
|
|
670
651
|
}
|
|
671
|
-
|
|
672
|
-
class ArrayProperty extends BasicProperty {
|
|
652
|
+
export class ArrayProperty extends BasicProperty {
|
|
673
653
|
constructor(subtype, values, ueType = 'ArrayProperty', index = 0, structValueFields) {
|
|
674
654
|
super('ArrayProperty', ueType, undefined, index);
|
|
675
655
|
this.subtype = subtype;
|
|
@@ -815,8 +795,7 @@ class ArrayProperty extends BasicProperty {
|
|
|
815
795
|
}
|
|
816
796
|
}
|
|
817
797
|
}
|
|
818
|
-
|
|
819
|
-
class SetProperty extends BasicProperty {
|
|
798
|
+
export class SetProperty extends BasicProperty {
|
|
820
799
|
constructor(subtype, values, ueType, index) {
|
|
821
800
|
super('SetProperty', ueType, undefined, index);
|
|
822
801
|
this.subtype = subtype;
|
|
@@ -870,15 +849,14 @@ class SetProperty extends BasicProperty {
|
|
|
870
849
|
property.values.forEach(v => StrProperty.SerializeValue(writer, v));
|
|
871
850
|
break;
|
|
872
851
|
case "StructProperty":
|
|
873
|
-
property.values.forEach(v =>
|
|
852
|
+
property.values.forEach(v => SerializeVec3f(writer, v));
|
|
874
853
|
break;
|
|
875
854
|
default:
|
|
876
855
|
throw new Error(`Not Implemented SetProperty of ${property.subtype}.`);
|
|
877
856
|
}
|
|
878
857
|
}
|
|
879
858
|
}
|
|
880
|
-
|
|
881
|
-
class MapProperty extends BasicProperty {
|
|
859
|
+
export class MapProperty extends BasicProperty {
|
|
882
860
|
constructor(keyType, valueType, ueType, index) {
|
|
883
861
|
super('MapProperty', ueType, undefined, index);
|
|
884
862
|
this.keyType = keyType;
|
|
@@ -905,7 +883,7 @@ class MapProperty extends BasicProperty {
|
|
|
905
883
|
property.structKeyProxy = Array.from(reader.readBytes(12));
|
|
906
884
|
}
|
|
907
885
|
else {
|
|
908
|
-
key =
|
|
886
|
+
key = ParseDynamicStructData(reader, 0, property.keyType);
|
|
909
887
|
}
|
|
910
888
|
break;
|
|
911
889
|
case 'ObjectProperty':
|
|
@@ -930,7 +908,7 @@ class MapProperty extends BasicProperty {
|
|
|
930
908
|
}
|
|
931
909
|
switch (property.valueType) {
|
|
932
910
|
case 'StructProperty':
|
|
933
|
-
value =
|
|
911
|
+
value = ParseDynamicStructData(reader, 0, property.valueType);
|
|
934
912
|
break;
|
|
935
913
|
case 'ObjectProperty':
|
|
936
914
|
value = ObjectProperty.ReadValue(reader);
|
|
@@ -972,7 +950,7 @@ class MapProperty extends BasicProperty {
|
|
|
972
950
|
writer.writeBytesArray(property.structKeyProxy);
|
|
973
951
|
}
|
|
974
952
|
else {
|
|
975
|
-
|
|
953
|
+
SerializeDynamicStructData(writer, 0, entry[0]);
|
|
976
954
|
}
|
|
977
955
|
break;
|
|
978
956
|
case 'ObjectProperty':
|
|
@@ -997,7 +975,7 @@ class MapProperty extends BasicProperty {
|
|
|
997
975
|
}
|
|
998
976
|
switch (property.valueType) {
|
|
999
977
|
case 'StructProperty':
|
|
1000
|
-
|
|
978
|
+
SerializeDynamicStructData(writer, 0, entry[1]);
|
|
1001
979
|
break;
|
|
1002
980
|
case 'ObjectProperty':
|
|
1003
981
|
ObjectProperty.SerializeValue(writer, entry[1]);
|
|
@@ -1022,15 +1000,14 @@ class MapProperty extends BasicProperty {
|
|
|
1022
1000
|
}
|
|
1023
1001
|
}
|
|
1024
1002
|
}
|
|
1025
|
-
|
|
1026
|
-
const ParseDynamicStructData = (reader, buildVersion, type) => {
|
|
1003
|
+
export const ParseDynamicStructData = (reader, buildVersion, type) => {
|
|
1027
1004
|
const data = {
|
|
1028
1005
|
type, properties: {}
|
|
1029
1006
|
};
|
|
1030
1007
|
const pos = reader.getBufferPosition();
|
|
1031
1008
|
let propertyName = reader.readString();
|
|
1032
1009
|
while (propertyName !== 'None') {
|
|
1033
|
-
const parsedProperty =
|
|
1010
|
+
const parsedProperty = DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
1034
1011
|
if (data.properties[propertyName]) {
|
|
1035
1012
|
if (!Array.isArray(data.properties[propertyName])) {
|
|
1036
1013
|
data.properties[propertyName] = [data.properties[propertyName]];
|
|
@@ -1044,23 +1021,21 @@ const ParseDynamicStructData = (reader, buildVersion, type) => {
|
|
|
1044
1021
|
}
|
|
1045
1022
|
return data;
|
|
1046
1023
|
};
|
|
1047
|
-
|
|
1048
|
-
const SerializeDynamicStructData = (writer, buildVersion, data) => {
|
|
1024
|
+
export const SerializeDynamicStructData = (writer, buildVersion, data) => {
|
|
1049
1025
|
for (const key in data.properties) {
|
|
1050
1026
|
for (const prop of (Array.isArray(data.properties[key]) ? data.properties[key] : [data.properties[key]])) {
|
|
1051
1027
|
writer.writeString(key);
|
|
1052
|
-
|
|
1028
|
+
DataFields.SerializeProperty(writer, prop, key, buildVersion);
|
|
1053
1029
|
}
|
|
1054
1030
|
}
|
|
1055
1031
|
writer.writeString('None');
|
|
1056
1032
|
};
|
|
1057
|
-
|
|
1058
|
-
const ReadFINNetworkTrace = (reader) => {
|
|
1033
|
+
export const ReadFINNetworkTrace = (reader) => {
|
|
1059
1034
|
const networkTrace = {};
|
|
1060
|
-
networkTrace.ref =
|
|
1035
|
+
networkTrace.ref = ObjectReference.read(reader);
|
|
1061
1036
|
networkTrace.hasPrev = reader.readInt32();
|
|
1062
1037
|
if (networkTrace.hasPrev) {
|
|
1063
|
-
networkTrace.prev =
|
|
1038
|
+
networkTrace.prev = ReadFINNetworkTrace(reader);
|
|
1064
1039
|
}
|
|
1065
1040
|
networkTrace.hasStep = reader.readInt32();
|
|
1066
1041
|
if (networkTrace.hasStep) {
|
|
@@ -1068,30 +1043,28 @@ const ReadFINNetworkTrace = (reader) => {
|
|
|
1068
1043
|
}
|
|
1069
1044
|
return networkTrace;
|
|
1070
1045
|
};
|
|
1071
|
-
|
|
1072
|
-
const SerializeFINNetworkTrace = (writer, obj) => {
|
|
1046
|
+
export const SerializeFINNetworkTrace = (writer, obj) => {
|
|
1073
1047
|
const networkTrace = {};
|
|
1074
|
-
|
|
1048
|
+
ObjectReference.write(writer, obj.ref);
|
|
1075
1049
|
writer.writeInt32(obj.hasPrev);
|
|
1076
1050
|
if (obj.hasPrev) {
|
|
1077
|
-
|
|
1051
|
+
SerializeFINNetworkTrace(writer, obj.prev);
|
|
1078
1052
|
}
|
|
1079
1053
|
writer.writeInt32(obj.hasStep);
|
|
1080
1054
|
if (obj.hasStep) {
|
|
1081
1055
|
writer.writeString(obj.step);
|
|
1082
1056
|
}
|
|
1083
1057
|
};
|
|
1084
|
-
|
|
1085
|
-
const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
1058
|
+
export const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
1086
1059
|
const stateStorage = { traces: [], references: [], thread: '', globals: '', remainingStructData: {} };
|
|
1087
1060
|
const start = reader.getBufferPosition();
|
|
1088
1061
|
const traceCount = reader.readInt32();
|
|
1089
1062
|
for (let i = 0; i < traceCount; i++) {
|
|
1090
|
-
stateStorage.traces.push(
|
|
1063
|
+
stateStorage.traces.push(ReadFINNetworkTrace(reader));
|
|
1091
1064
|
}
|
|
1092
1065
|
const refCount = reader.readInt32();
|
|
1093
1066
|
for (let i = 0; i < refCount; i++) {
|
|
1094
|
-
stateStorage.references.push(
|
|
1067
|
+
stateStorage.references.push(ObjectReference.read(reader));
|
|
1095
1068
|
}
|
|
1096
1069
|
stateStorage.thread = reader.readString();
|
|
1097
1070
|
stateStorage.globals = reader.readString();
|
|
@@ -1099,18 +1072,16 @@ const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
|
1099
1072
|
stateStorage.remainingStructData = reader.readBytes(remaining);
|
|
1100
1073
|
return stateStorage;
|
|
1101
1074
|
};
|
|
1102
|
-
|
|
1103
|
-
const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
|
|
1075
|
+
export const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
|
|
1104
1076
|
writer.writeInt32(stateStorage.traces.length);
|
|
1105
1077
|
for (const trace of stateStorage.traces) {
|
|
1106
|
-
|
|
1078
|
+
SerializeFINNetworkTrace(writer, trace);
|
|
1107
1079
|
}
|
|
1108
1080
|
writer.writeInt32(stateStorage.references.length);
|
|
1109
1081
|
for (const ref of stateStorage.references) {
|
|
1110
|
-
|
|
1082
|
+
ObjectReference.write(writer, ref);
|
|
1111
1083
|
}
|
|
1112
1084
|
writer.writeString(stateStorage.thread);
|
|
1113
1085
|
writer.writeString(stateStorage.globals);
|
|
1114
1086
|
writer.writeBytes(stateStorage.remainingStructData);
|
|
1115
1087
|
};
|
|
1116
|
-
exports.SerializeFINLuaProcessorStateStorage = SerializeFINLuaProcessorStateStorage;
|