@etothepii/satisfactory-file-parser 0.0.11 → 0.0.13
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/.README.md +41 -0
- package/build/index.d.ts +5 -1
- package/build/index.js +46 -9
- package/build/parser/blueprint-reader.js +28 -20
- package/build/parser/blueprint-writer.js +20 -15
- package/build/parser/byte/alignment.enum.js +5 -2
- package/build/parser/byte/byte-reader.class.js +13 -9
- package/build/parser/byte/byte-writer.class.js +13 -10
- package/build/parser/error/parser.error.js +11 -4
- package/build/parser/parser.js +15 -12
- package/build/parser/satisfactory/blueprint/blueprint.js +2 -1
- package/build/parser/satisfactory/level.class.js +28 -24
- package/build/parser/satisfactory/objects/DataFields.js +76 -72
- package/build/parser/satisfactory/objects/ObjectReference.js +5 -1
- package/build/parser/satisfactory/objects/Property.js +118 -87
- package/build/parser/satisfactory/objects/SaveComponent.js +11 -7
- package/build/parser/satisfactory/objects/SaveEntity.js +17 -13
- package/build/parser/satisfactory/objects/SaveObject.js +9 -5
- package/build/parser/satisfactory/satisfactory-save.js +5 -1
- package/build/parser/satisfactory/static-data.js +2 -1
- package/build/parser/satisfactory/structs/util.types.js +47 -27
- package/build/parser/save-reader.js +34 -26
- package/build/parser/save-writer.js +33 -26
- package/package.json +1 -2
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SerializeFINLuaProcessorStateStorage = exports.ReadFINLuaProcessorStateStorage = exports.SerializeFINNetworkTrace = exports.ReadFINNetworkTrace = exports.SerializeDynamicStructData = exports.ParseDynamicStructData = exports.MapProperty = exports.SetProperty = exports.ArrayProperty = exports.StructProperty = exports.TextProperty = exports.EnumProperty = exports.ObjectProperty = exports.StrProperty = exports.DoubleProperty = exports.FloatProperty = exports.Int64Property = exports.Uint32Property = exports.Int32Property = exports.Uint8Property = exports.Int8Property = exports.ByteProperty = exports.BoolProperty = exports.SerializeGUID = exports.ParseGUID = exports.BasicProperty = exports.AbstractBaseProperty = exports.AbstractProperty = void 0;
|
|
4
|
+
const util_types_1 = require("../structs/util.types");
|
|
5
|
+
const DataFields_1 = require("./DataFields");
|
|
6
|
+
const ObjectReference_1 = require("./ObjectReference");
|
|
7
|
+
class AbstractProperty {
|
|
5
8
|
constructor(type, index) {
|
|
6
9
|
this.type = type;
|
|
7
10
|
this.index = index;
|
|
8
11
|
}
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
exports.AbstractProperty = AbstractProperty;
|
|
14
|
+
class AbstractBaseProperty extends AbstractProperty {
|
|
11
15
|
// overhead like Guid is not calculated into property size
|
|
12
16
|
constructor(type, ueType, index) {
|
|
13
17
|
super(type, index && index !== 0 ? index : undefined);
|
|
@@ -15,13 +19,15 @@ export class AbstractBaseProperty extends AbstractProperty {
|
|
|
15
19
|
this.name = '';
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
|
-
|
|
22
|
+
exports.AbstractBaseProperty = AbstractBaseProperty;
|
|
23
|
+
class BasicProperty extends AbstractBaseProperty {
|
|
19
24
|
constructor(type, ueType, guidInfo, index = 0) {
|
|
20
25
|
super(type, ueType, index);
|
|
21
26
|
this.guidInfo = guidInfo;
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
|
-
|
|
29
|
+
exports.BasicProperty = BasicProperty;
|
|
30
|
+
const ParseGUID = (reader) => {
|
|
25
31
|
const hasGuid = reader.readByte() === 1;
|
|
26
32
|
let guid;
|
|
27
33
|
if (hasGuid) {
|
|
@@ -30,20 +36,22 @@ export const ParseGUID = (reader) => {
|
|
|
30
36
|
}
|
|
31
37
|
return guid;
|
|
32
38
|
};
|
|
33
|
-
|
|
39
|
+
exports.ParseGUID = ParseGUID;
|
|
40
|
+
const SerializeGUID = (writer, guid) => {
|
|
34
41
|
writer.writeByte(guid ? 1 : 0);
|
|
35
42
|
if (guid) {
|
|
36
43
|
writer.writeBytes(guid);
|
|
37
44
|
}
|
|
38
45
|
};
|
|
39
|
-
|
|
46
|
+
exports.SerializeGUID = SerializeGUID;
|
|
47
|
+
class BoolProperty extends BasicProperty {
|
|
40
48
|
constructor(value, ueType = 'BoolProperty', guidInfo = undefined, index = 0) {
|
|
41
49
|
super('BoolProperty', ueType, guidInfo, index);
|
|
42
50
|
this.value = value;
|
|
43
51
|
}
|
|
44
52
|
static Parse(reader, ueType, index = 0) {
|
|
45
53
|
const value = BoolProperty.ReadValue(reader);
|
|
46
|
-
const guidInfo = ParseGUID(reader);
|
|
54
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
47
55
|
return new BoolProperty(value, ueType, guidInfo, index);
|
|
48
56
|
}
|
|
49
57
|
static ReadValue(reader) {
|
|
@@ -54,20 +62,21 @@ export class BoolProperty extends BasicProperty {
|
|
|
54
62
|
}
|
|
55
63
|
static Serialize(writer, property) {
|
|
56
64
|
BoolProperty.SerializeValue(writer, property.value);
|
|
57
|
-
SerializeGUID(writer, property.guidInfo);
|
|
65
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
58
66
|
}
|
|
59
67
|
static SerializeValue(writer, value) {
|
|
60
68
|
writer.writeByte(value ? 1 : 0);
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
|
-
|
|
71
|
+
exports.BoolProperty = BoolProperty;
|
|
72
|
+
class ByteProperty extends BasicProperty {
|
|
64
73
|
constructor(value, ueType = 'ByteProperty', guidInfo = undefined, index = 0) {
|
|
65
74
|
super('ByteProperty', ueType, guidInfo, index);
|
|
66
75
|
this.value = value;
|
|
67
76
|
}
|
|
68
77
|
static Parse(reader, ueType, index = 0) {
|
|
69
78
|
const type = reader.readString();
|
|
70
|
-
const guidInfo = ParseGUID(reader);
|
|
79
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
71
80
|
let value;
|
|
72
81
|
if (type === 'None') {
|
|
73
82
|
value = {
|
|
@@ -92,7 +101,7 @@ export class ByteProperty extends BasicProperty {
|
|
|
92
101
|
}
|
|
93
102
|
static Serialize(writer, property) {
|
|
94
103
|
writer.writeString(property.value.type);
|
|
95
|
-
SerializeGUID(writer, property.guidInfo);
|
|
104
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
96
105
|
if (property.value.type === 'None') {
|
|
97
106
|
ByteProperty.SerializeValue(writer, property.value.value);
|
|
98
107
|
}
|
|
@@ -104,13 +113,14 @@ export class ByteProperty extends BasicProperty {
|
|
|
104
113
|
writer.writeByte(value);
|
|
105
114
|
}
|
|
106
115
|
}
|
|
107
|
-
|
|
116
|
+
exports.ByteProperty = ByteProperty;
|
|
117
|
+
class Int8Property extends BasicProperty {
|
|
108
118
|
constructor(value, ueType = 'Int8Property', guidInfo = undefined, index = 0) {
|
|
109
119
|
super('Int8Property', ueType, guidInfo, index);
|
|
110
120
|
this.value = value;
|
|
111
121
|
}
|
|
112
122
|
static Parse(reader, ueType, index = 0) {
|
|
113
|
-
const guidInfo = ParseGUID(reader);
|
|
123
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
114
124
|
const value = Int8Property.ReadValue(reader);
|
|
115
125
|
return new Int8Property(value, ueType, guidInfo, index);
|
|
116
126
|
}
|
|
@@ -121,20 +131,21 @@ export class Int8Property extends BasicProperty {
|
|
|
121
131
|
return 1;
|
|
122
132
|
}
|
|
123
133
|
static Serialize(writer, property) {
|
|
124
|
-
SerializeGUID(writer, property.guidInfo);
|
|
134
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
125
135
|
Int8Property.SerializeValue(writer, property.value);
|
|
126
136
|
}
|
|
127
137
|
static SerializeValue(writer, value) {
|
|
128
138
|
writer.writeInt8(value);
|
|
129
139
|
}
|
|
130
140
|
}
|
|
131
|
-
|
|
141
|
+
exports.Int8Property = Int8Property;
|
|
142
|
+
class Uint8Property extends BasicProperty {
|
|
132
143
|
constructor(value, ueType = 'UInt8Property', guidInfo = undefined, index = 0) {
|
|
133
144
|
super('UInt8Property', ueType, guidInfo, index);
|
|
134
145
|
this.value = value;
|
|
135
146
|
}
|
|
136
147
|
static Parse(reader, ueType, index = 0) {
|
|
137
|
-
const guidInfo = ParseGUID(reader);
|
|
148
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
138
149
|
const value = Uint8Property.ReadValue(reader);
|
|
139
150
|
return new Uint8Property(value, ueType, guidInfo, index);
|
|
140
151
|
}
|
|
@@ -145,20 +156,21 @@ export class Uint8Property extends BasicProperty {
|
|
|
145
156
|
throw new Error('Unimplemented.');
|
|
146
157
|
}
|
|
147
158
|
static Serialize(writer, property) {
|
|
148
|
-
SerializeGUID(writer, property.guidInfo);
|
|
159
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
149
160
|
Uint8Property.SerializeValue(writer, property.value);
|
|
150
161
|
}
|
|
151
162
|
static SerializeValue(writer, value) {
|
|
152
163
|
writer.writeUint8(value);
|
|
153
164
|
}
|
|
154
165
|
}
|
|
155
|
-
|
|
166
|
+
exports.Uint8Property = Uint8Property;
|
|
167
|
+
class Int32Property extends BasicProperty {
|
|
156
168
|
constructor(value, ueType = 'IntProperty', guidInfo = undefined, index = 0) {
|
|
157
169
|
super('Int32Property', ueType, guidInfo, index);
|
|
158
170
|
this.value = value;
|
|
159
171
|
}
|
|
160
172
|
static Parse(reader, ueType, index = 0) {
|
|
161
|
-
const guidInfo = ParseGUID(reader);
|
|
173
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
162
174
|
const value = Int32Property.ReadValue(reader);
|
|
163
175
|
return new Int32Property(value, ueType, guidInfo, index);
|
|
164
176
|
}
|
|
@@ -169,20 +181,21 @@ export class Int32Property extends BasicProperty {
|
|
|
169
181
|
return 1;
|
|
170
182
|
}
|
|
171
183
|
static Serialize(writer, property) {
|
|
172
|
-
SerializeGUID(writer, property.guidInfo);
|
|
184
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
173
185
|
Int32Property.SerializeValue(writer, property.value);
|
|
174
186
|
}
|
|
175
187
|
static SerializeValue(writer, value) {
|
|
176
188
|
writer.writeInt32(value);
|
|
177
189
|
}
|
|
178
190
|
}
|
|
179
|
-
|
|
191
|
+
exports.Int32Property = Int32Property;
|
|
192
|
+
class Uint32Property extends BasicProperty {
|
|
180
193
|
constructor(value, ueType = 'UInt32Property', guidInfo = undefined, index = 0) {
|
|
181
194
|
super('UInt32Property', ueType, guidInfo, index);
|
|
182
195
|
this.value = value;
|
|
183
196
|
}
|
|
184
197
|
static Parse(reader, ueType, index = 0) {
|
|
185
|
-
const guidInfo = ParseGUID(reader);
|
|
198
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
186
199
|
const value = Uint32Property.ReadValue(reader);
|
|
187
200
|
return new Uint32Property(value, ueType, guidInfo, index);
|
|
188
201
|
}
|
|
@@ -193,20 +206,21 @@ export class Uint32Property extends BasicProperty {
|
|
|
193
206
|
throw new Error('unimplemented');
|
|
194
207
|
}
|
|
195
208
|
static Serialize(writer, property) {
|
|
196
|
-
SerializeGUID(writer, property.guidInfo);
|
|
209
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
197
210
|
Uint32Property.SerializeValue(writer, property.value);
|
|
198
211
|
}
|
|
199
212
|
static SerializeValue(writer, value) {
|
|
200
213
|
writer.writeUint32(value);
|
|
201
214
|
}
|
|
202
215
|
}
|
|
203
|
-
|
|
216
|
+
exports.Uint32Property = Uint32Property;
|
|
217
|
+
class Int64Property extends BasicProperty {
|
|
204
218
|
constructor(value, ueType = 'Int64Property', guidInfo = undefined, index = 0) {
|
|
205
219
|
super('Int64Property', ueType, guidInfo, index);
|
|
206
220
|
this.value = value;
|
|
207
221
|
}
|
|
208
222
|
static Parse(reader, ueType, index = 0) {
|
|
209
|
-
const guidInfo = ParseGUID(reader);
|
|
223
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
210
224
|
const value = Int64Property.ReadValue(reader);
|
|
211
225
|
return new Int64Property(value, ueType, guidInfo, index);
|
|
212
226
|
}
|
|
@@ -217,20 +231,21 @@ export class Int64Property extends BasicProperty {
|
|
|
217
231
|
return 1;
|
|
218
232
|
}
|
|
219
233
|
static Serialize(writer, property) {
|
|
220
|
-
SerializeGUID(writer, property.guidInfo);
|
|
234
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
221
235
|
Int64Property.SerializeValue(writer, property.value);
|
|
222
236
|
}
|
|
223
237
|
static SerializeValue(writer, value) {
|
|
224
238
|
writer.writeInt64(BigInt(value));
|
|
225
239
|
}
|
|
226
240
|
}
|
|
227
|
-
|
|
241
|
+
exports.Int64Property = Int64Property;
|
|
242
|
+
class FloatProperty extends BasicProperty {
|
|
228
243
|
constructor(value, ueType = 'FloatProperty', guidInfo = undefined, index = 0) {
|
|
229
244
|
super('FloatProperty', ueType, guidInfo, index);
|
|
230
245
|
this.value = value;
|
|
231
246
|
}
|
|
232
247
|
static Parse(reader, ueType, index = 0) {
|
|
233
|
-
const guidInfo = ParseGUID(reader);
|
|
248
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
234
249
|
const value = FloatProperty.ReadValue(reader);
|
|
235
250
|
return new FloatProperty(value, ueType, guidInfo, index);
|
|
236
251
|
}
|
|
@@ -241,20 +256,21 @@ export class FloatProperty extends BasicProperty {
|
|
|
241
256
|
return reader.readFloat();
|
|
242
257
|
}
|
|
243
258
|
static Serialize(writer, property) {
|
|
244
|
-
SerializeGUID(writer, property.guidInfo);
|
|
259
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
245
260
|
FloatProperty.SerializeValue(writer, property.value);
|
|
246
261
|
}
|
|
247
262
|
static SerializeValue(writer, value) {
|
|
248
263
|
writer.writeFloat(value);
|
|
249
264
|
}
|
|
250
265
|
}
|
|
251
|
-
|
|
266
|
+
exports.FloatProperty = FloatProperty;
|
|
267
|
+
class DoubleProperty extends BasicProperty {
|
|
252
268
|
constructor(value, ueType = 'DoubleProperty', guidInfo = undefined, index = 0) {
|
|
253
269
|
super('DoubleProperty', ueType, guidInfo, index);
|
|
254
270
|
this.value = value;
|
|
255
271
|
}
|
|
256
272
|
static Parse(reader, ueType, index = 0) {
|
|
257
|
-
const guidInfo = ParseGUID(reader);
|
|
273
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
258
274
|
const value = DoubleProperty.ReadValue(reader);
|
|
259
275
|
return new DoubleProperty(value, ueType, guidInfo, index);
|
|
260
276
|
}
|
|
@@ -265,20 +281,21 @@ export class DoubleProperty extends BasicProperty {
|
|
|
265
281
|
return 1;
|
|
266
282
|
}
|
|
267
283
|
static Serialize(writer, property) {
|
|
268
|
-
SerializeGUID(writer, property.guidInfo);
|
|
284
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
269
285
|
DoubleProperty.SerializeValue(writer, property.value);
|
|
270
286
|
}
|
|
271
287
|
static SerializeValue(writer, value) {
|
|
272
288
|
writer.writeDouble(value);
|
|
273
289
|
}
|
|
274
290
|
}
|
|
275
|
-
|
|
291
|
+
exports.DoubleProperty = DoubleProperty;
|
|
292
|
+
class StrProperty extends BasicProperty {
|
|
276
293
|
constructor(value, ueType = 'StrProperty', guidInfo = undefined, index = 0) {
|
|
277
294
|
super('StrProperty', ueType, guidInfo, index);
|
|
278
295
|
this.value = value;
|
|
279
296
|
}
|
|
280
297
|
static Parse(reader, ueType, index = 0) {
|
|
281
|
-
const guidInfo = ParseGUID(reader);
|
|
298
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
282
299
|
const value = StrProperty.ReadValue(reader);
|
|
283
300
|
return new StrProperty(value, ueType, guidInfo, index);
|
|
284
301
|
}
|
|
@@ -289,20 +306,21 @@ export class StrProperty extends BasicProperty {
|
|
|
289
306
|
return 1;
|
|
290
307
|
}
|
|
291
308
|
static Serialize(writer, property) {
|
|
292
|
-
SerializeGUID(writer, property.guidInfo);
|
|
309
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
293
310
|
StrProperty.SerializeValue(writer, property.value);
|
|
294
311
|
}
|
|
295
312
|
static SerializeValue(writer, value) {
|
|
296
313
|
writer.writeString(value);
|
|
297
314
|
}
|
|
298
315
|
}
|
|
299
|
-
|
|
316
|
+
exports.StrProperty = StrProperty;
|
|
317
|
+
class ObjectProperty extends BasicProperty {
|
|
300
318
|
constructor(value, ueType = 'ObjectProperty', guidInfo = undefined, index = 0) {
|
|
301
319
|
super('ObjectProperty', ueType, guidInfo, index);
|
|
302
320
|
this.value = value;
|
|
303
321
|
}
|
|
304
322
|
static Parse(reader, ueType, index = 0) {
|
|
305
|
-
const guidInfo = ParseGUID(reader);
|
|
323
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
306
324
|
const value = ObjectProperty.ReadValue(reader);
|
|
307
325
|
return new ObjectProperty(value, ueType, guidInfo, index);
|
|
308
326
|
}
|
|
@@ -317,7 +335,7 @@ export class ObjectProperty extends BasicProperty {
|
|
|
317
335
|
return 1;
|
|
318
336
|
}
|
|
319
337
|
static Serialize(writer, property) {
|
|
320
|
-
SerializeGUID(writer, property.guidInfo);
|
|
338
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
321
339
|
ObjectProperty.SerializeValue(writer, property.value);
|
|
322
340
|
}
|
|
323
341
|
static SerializeValue(writer, value) {
|
|
@@ -325,14 +343,15 @@ export class ObjectProperty extends BasicProperty {
|
|
|
325
343
|
writer.writeString(value.pathName);
|
|
326
344
|
}
|
|
327
345
|
}
|
|
328
|
-
|
|
346
|
+
exports.ObjectProperty = ObjectProperty;
|
|
347
|
+
class EnumProperty extends BasicProperty {
|
|
329
348
|
constructor(value, ueType = 'EnumProperty', guidInfo = undefined, index = 0) {
|
|
330
349
|
super('EnumProperty', ueType, guidInfo, index);
|
|
331
350
|
this.value = value;
|
|
332
351
|
}
|
|
333
352
|
static Parse(reader, ueType, index = 0) {
|
|
334
353
|
let name = reader.readString();
|
|
335
|
-
const guidInfo = ParseGUID(reader);
|
|
354
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
336
355
|
const value = EnumProperty.ReadValue(reader);
|
|
337
356
|
const property = new EnumProperty({ name, value }, ueType, guidInfo, index);
|
|
338
357
|
return property;
|
|
@@ -345,21 +364,22 @@ export class EnumProperty extends BasicProperty {
|
|
|
345
364
|
}
|
|
346
365
|
static Serialize(writer, property) {
|
|
347
366
|
writer.writeString(property.value.name);
|
|
348
|
-
SerializeGUID(writer, property.guidInfo);
|
|
367
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
349
368
|
EnumProperty.SerializeValue(writer, property.value.value);
|
|
350
369
|
}
|
|
351
370
|
static SerializeValue(writer, value) {
|
|
352
371
|
writer.writeString(value);
|
|
353
372
|
}
|
|
354
373
|
}
|
|
355
|
-
|
|
374
|
+
exports.EnumProperty = EnumProperty;
|
|
375
|
+
class TextProperty extends BasicProperty {
|
|
356
376
|
constructor(value, ueType = 'TextProperty', guidInfo = undefined, index = 0) {
|
|
357
377
|
super('TextProperty', ueType, guidInfo, index);
|
|
358
378
|
this.value = value;
|
|
359
379
|
}
|
|
360
380
|
static Parse(reader, ueType, index = 0) {
|
|
361
381
|
//let name = reader.readString();
|
|
362
|
-
const guidInfo = ParseGUID(reader);
|
|
382
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
363
383
|
const value = TextProperty.ParseValue(reader);
|
|
364
384
|
return new TextProperty(value, ueType, guidInfo, index);
|
|
365
385
|
}
|
|
@@ -422,7 +442,7 @@ export class TextProperty extends BasicProperty {
|
|
|
422
442
|
return 1;
|
|
423
443
|
}
|
|
424
444
|
static Serialize(writer, property) {
|
|
425
|
-
SerializeGUID(writer, property.guidInfo);
|
|
445
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
426
446
|
TextProperty.SerializeValue(writer, property.value);
|
|
427
447
|
}
|
|
428
448
|
static SerializeValue(writer, value) {
|
|
@@ -476,7 +496,8 @@ export class TextProperty extends BasicProperty {
|
|
|
476
496
|
}
|
|
477
497
|
}
|
|
478
498
|
}
|
|
479
|
-
|
|
499
|
+
exports.TextProperty = TextProperty;
|
|
500
|
+
class StructProperty extends AbstractBaseProperty {
|
|
480
501
|
constructor(subtype, ueType = 'StructProperty', index = 0, guid = 0) {
|
|
481
502
|
super('StructProperty', ueType, index);
|
|
482
503
|
this.subtype = subtype;
|
|
@@ -513,25 +534,25 @@ export class StructProperty extends AbstractBaseProperty {
|
|
|
513
534
|
let value;
|
|
514
535
|
switch (subtype) {
|
|
515
536
|
case 'Color':
|
|
516
|
-
value = ParseCol4BGRA(reader);
|
|
537
|
+
value = (0, util_types_1.ParseCol4BGRA)(reader);
|
|
517
538
|
break;
|
|
518
539
|
case 'LinearColor':
|
|
519
|
-
value = ParseCol4RGBA(reader);
|
|
540
|
+
value = (0, util_types_1.ParseCol4RGBA)(reader);
|
|
520
541
|
break;
|
|
521
542
|
case 'Vector':
|
|
522
543
|
case 'Rotator':
|
|
523
544
|
case 'Vector2D':
|
|
524
|
-
value = ParseVec3(reader);
|
|
545
|
+
value = (0, util_types_1.ParseVec3)(reader);
|
|
525
546
|
break;
|
|
526
547
|
case 'Quat':
|
|
527
548
|
case 'Vector4':
|
|
528
549
|
case 'Vector4D':
|
|
529
|
-
value = ParseVec4(reader);
|
|
550
|
+
value = (0, util_types_1.ParseVec4)(reader);
|
|
530
551
|
break;
|
|
531
552
|
case 'Box':
|
|
532
553
|
value = {
|
|
533
|
-
min: ParseVec3(reader),
|
|
534
|
-
max: ParseVec3(reader),
|
|
554
|
+
min: (0, util_types_1.ParseVec3)(reader),
|
|
555
|
+
max: (0, util_types_1.ParseVec3)(reader),
|
|
535
556
|
isValid: reader.readByte() >= 1
|
|
536
557
|
};
|
|
537
558
|
break;
|
|
@@ -572,11 +593,11 @@ export class StructProperty extends AbstractBaseProperty {
|
|
|
572
593
|
break;
|
|
573
594
|
// MODS
|
|
574
595
|
case 'FINNetworkTrace':
|
|
575
|
-
value = ReadFINNetworkTrace(reader);
|
|
596
|
+
value = (0, exports.ReadFINNetworkTrace)(reader);
|
|
576
597
|
break;
|
|
577
598
|
case 'FINLuaProcessorStateStorage':
|
|
578
599
|
value = {
|
|
579
|
-
values: ReadFINLuaProcessorStateStorage(reader, size)
|
|
600
|
+
values: (0, exports.ReadFINLuaProcessorStateStorage)(reader, size)
|
|
580
601
|
};
|
|
581
602
|
break;
|
|
582
603
|
case 'FICFrameRange': // https://github.com/Panakotta00/FicsIt-Cam/blob/c55e254a84722c56e1badabcfaef1159cd7d2ef1/Source/FicsItCam/Public/Data/FICTypes.h#L34
|
|
@@ -587,7 +608,7 @@ export class StructProperty extends AbstractBaseProperty {
|
|
|
587
608
|
break;
|
|
588
609
|
default:
|
|
589
610
|
//TODO: use buildversion
|
|
590
|
-
value = ParseDynamicStructData(reader, 0, subtype);
|
|
611
|
+
value = (0, exports.ParseDynamicStructData)(reader, 0, subtype);
|
|
591
612
|
}
|
|
592
613
|
return value;
|
|
593
614
|
}
|
|
@@ -607,28 +628,28 @@ export class StructProperty extends AbstractBaseProperty {
|
|
|
607
628
|
switch (subtype) {
|
|
608
629
|
case 'Color':
|
|
609
630
|
value = value;
|
|
610
|
-
SerializeCol4BGRA(writer, value);
|
|
631
|
+
(0, util_types_1.SerializeCol4BGRA)(writer, value);
|
|
611
632
|
break;
|
|
612
633
|
case 'LinearColor':
|
|
613
634
|
value = value;
|
|
614
|
-
SerializeCol4RGBA(writer, value);
|
|
635
|
+
(0, util_types_1.SerializeCol4RGBA)(writer, value);
|
|
615
636
|
break;
|
|
616
637
|
case 'Vector':
|
|
617
638
|
case 'Rotator':
|
|
618
639
|
case 'Vector2D':
|
|
619
640
|
value = value;
|
|
620
|
-
SerializeVec3(writer, value);
|
|
641
|
+
(0, util_types_1.SerializeVec3)(writer, value);
|
|
621
642
|
break;
|
|
622
643
|
case 'Quat':
|
|
623
644
|
case 'Vector4':
|
|
624
645
|
case 'Vector4D':
|
|
625
646
|
value = value;
|
|
626
|
-
SerializeVec4(writer, value);
|
|
647
|
+
(0, util_types_1.SerializeVec4)(writer, value);
|
|
627
648
|
break;
|
|
628
649
|
case 'Box':
|
|
629
650
|
value = value;
|
|
630
|
-
SerializeVec3(writer, value.min);
|
|
631
|
-
SerializeVec3(writer, value.max);
|
|
651
|
+
(0, util_types_1.SerializeVec3)(writer, value.min);
|
|
652
|
+
(0, util_types_1.SerializeVec3)(writer, value.max);
|
|
632
653
|
writer.writeByte(value.isValid ? 1 : 0);
|
|
633
654
|
break;
|
|
634
655
|
case 'RailroadTrackPosition':
|
|
@@ -669,11 +690,11 @@ export class StructProperty extends AbstractBaseProperty {
|
|
|
669
690
|
// MODS
|
|
670
691
|
case 'FINNetworkTrace':
|
|
671
692
|
value = value;
|
|
672
|
-
SerializeFINNetworkTrace(writer, value);
|
|
693
|
+
(0, exports.SerializeFINNetworkTrace)(writer, value);
|
|
673
694
|
break;
|
|
674
695
|
case 'FINLuaProcessorStateStorage':
|
|
675
696
|
value = value;
|
|
676
|
-
SerializeFINLuaProcessorStateStorage(writer, value.values);
|
|
697
|
+
(0, exports.SerializeFINLuaProcessorStateStorage)(writer, value.values);
|
|
677
698
|
break;
|
|
678
699
|
case 'FICFrameRange': // https://github.com/Panakotta00/FicsIt-Cam/blob/c55e254a84722c56e1badabcfaef1159cd7d2ef1/Source/FicsItCam/Public/Data/FICTypes.h#L34
|
|
679
700
|
value = value;
|
|
@@ -683,11 +704,12 @@ export class StructProperty extends AbstractBaseProperty {
|
|
|
683
704
|
default:
|
|
684
705
|
//TODO: use buildversion
|
|
685
706
|
value = value;
|
|
686
|
-
SerializeDynamicStructData(writer, 0, value);
|
|
707
|
+
(0, exports.SerializeDynamicStructData)(writer, 0, value);
|
|
687
708
|
}
|
|
688
709
|
}
|
|
689
710
|
}
|
|
690
|
-
|
|
711
|
+
exports.StructProperty = StructProperty;
|
|
712
|
+
class ArrayProperty extends BasicProperty {
|
|
691
713
|
constructor(subtype, values, ueType = 'ArrayProperty', index = 0, structValueFields) {
|
|
692
714
|
super('ArrayProperty', ueType, undefined, index);
|
|
693
715
|
this.subtype = subtype;
|
|
@@ -840,7 +862,8 @@ export class ArrayProperty extends BasicProperty {
|
|
|
840
862
|
}
|
|
841
863
|
}
|
|
842
864
|
}
|
|
843
|
-
|
|
865
|
+
exports.ArrayProperty = ArrayProperty;
|
|
866
|
+
class SetProperty extends BasicProperty {
|
|
844
867
|
constructor(subtype, values, ueType, index) {
|
|
845
868
|
super('SetProperty', ueType, undefined, index);
|
|
846
869
|
this.subtype = subtype;
|
|
@@ -864,7 +887,7 @@ export class SetProperty extends BasicProperty {
|
|
|
864
887
|
break;
|
|
865
888
|
case "StructProperty":
|
|
866
889
|
if (propertyName === 'mRemovalLocations') {
|
|
867
|
-
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => ParseVec3(reader)), ueType, index);
|
|
890
|
+
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => (0, util_types_1.ParseVec3)(reader)), ueType, index);
|
|
868
891
|
}
|
|
869
892
|
break;
|
|
870
893
|
default:
|
|
@@ -893,14 +916,15 @@ export class SetProperty extends BasicProperty {
|
|
|
893
916
|
break;
|
|
894
917
|
case "StructProperty":
|
|
895
918
|
//TODO: this would only work for mRemovalLocations. Get a way to check for propertyname at least.
|
|
896
|
-
property.values.forEach(v => SerializeVec3(writer, v));
|
|
919
|
+
property.values.forEach(v => (0, util_types_1.SerializeVec3)(writer, v));
|
|
897
920
|
break;
|
|
898
921
|
default:
|
|
899
922
|
throw new Error('Not Implemented.');
|
|
900
923
|
}
|
|
901
924
|
}
|
|
902
925
|
}
|
|
903
|
-
|
|
926
|
+
exports.SetProperty = SetProperty;
|
|
927
|
+
class MapProperty extends BasicProperty {
|
|
904
928
|
constructor(keyType, valueType, ueType, index) {
|
|
905
929
|
super('MapProperty', ueType, undefined, index);
|
|
906
930
|
this.keyType = keyType;
|
|
@@ -1043,31 +1067,34 @@ property.values.push({
|
|
|
1043
1067
|
//TODO: do the actual serialization.
|
|
1044
1068
|
}
|
|
1045
1069
|
}
|
|
1046
|
-
|
|
1070
|
+
exports.MapProperty = MapProperty;
|
|
1071
|
+
const ParseDynamicStructData = (reader, buildVersion, type) => {
|
|
1047
1072
|
const data = {
|
|
1048
1073
|
type, properties: {}
|
|
1049
1074
|
};
|
|
1050
1075
|
let propertyName = reader.readString();
|
|
1051
1076
|
while (propertyName !== 'None') {
|
|
1052
|
-
const property = DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
1077
|
+
const property = DataFields_1.DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
1053
1078
|
data.properties[propertyName] = property;
|
|
1054
1079
|
propertyName = reader.readString();
|
|
1055
1080
|
}
|
|
1056
1081
|
return data;
|
|
1057
1082
|
};
|
|
1058
|
-
|
|
1083
|
+
exports.ParseDynamicStructData = ParseDynamicStructData;
|
|
1084
|
+
const SerializeDynamicStructData = (writer, buildVersion, data) => {
|
|
1059
1085
|
for (const key in data.properties) {
|
|
1060
1086
|
writer.writeString(key);
|
|
1061
|
-
DataFields.SerializeProperty(writer, data.properties[key], key, buildVersion);
|
|
1087
|
+
DataFields_1.DataFields.SerializeProperty(writer, data.properties[key], key, buildVersion);
|
|
1062
1088
|
}
|
|
1063
1089
|
writer.writeString('None');
|
|
1064
1090
|
};
|
|
1065
|
-
|
|
1091
|
+
exports.SerializeDynamicStructData = SerializeDynamicStructData;
|
|
1092
|
+
const ReadFINNetworkTrace = (reader) => {
|
|
1066
1093
|
const networkTrace = {};
|
|
1067
|
-
networkTrace.ref = ObjectReference.Parse(reader);
|
|
1094
|
+
networkTrace.ref = ObjectReference_1.ObjectReference.Parse(reader);
|
|
1068
1095
|
networkTrace.hasPrev = reader.readInt32();
|
|
1069
1096
|
if (networkTrace.hasPrev) {
|
|
1070
|
-
networkTrace.prev = ReadFINNetworkTrace(reader);
|
|
1097
|
+
networkTrace.prev = (0, exports.ReadFINNetworkTrace)(reader);
|
|
1071
1098
|
}
|
|
1072
1099
|
networkTrace.hasStep = reader.readInt32();
|
|
1073
1100
|
if (networkTrace.hasStep) {
|
|
@@ -1075,28 +1102,30 @@ export const ReadFINNetworkTrace = (reader) => {
|
|
|
1075
1102
|
}
|
|
1076
1103
|
return networkTrace;
|
|
1077
1104
|
};
|
|
1078
|
-
|
|
1105
|
+
exports.ReadFINNetworkTrace = ReadFINNetworkTrace;
|
|
1106
|
+
const SerializeFINNetworkTrace = (writer, obj) => {
|
|
1079
1107
|
const networkTrace = {};
|
|
1080
|
-
ObjectReference.Serialize(writer, obj.ref);
|
|
1108
|
+
ObjectReference_1.ObjectReference.Serialize(writer, obj.ref);
|
|
1081
1109
|
writer.writeInt32(obj.hasPrev);
|
|
1082
1110
|
if (obj.hasPrev) {
|
|
1083
|
-
SerializeFINNetworkTrace(writer, obj.prev);
|
|
1111
|
+
(0, exports.SerializeFINNetworkTrace)(writer, obj.prev);
|
|
1084
1112
|
}
|
|
1085
1113
|
writer.writeInt32(obj.hasStep);
|
|
1086
1114
|
if (obj.hasStep) {
|
|
1087
1115
|
writer.writeString(obj.step);
|
|
1088
1116
|
}
|
|
1089
1117
|
};
|
|
1090
|
-
|
|
1118
|
+
exports.SerializeFINNetworkTrace = SerializeFINNetworkTrace;
|
|
1119
|
+
const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
1091
1120
|
const stateStorage = { traces: [], references: [], thread: '', globals: '', remainingStructData: {} };
|
|
1092
1121
|
const start = reader.getBufferPosition();
|
|
1093
1122
|
const traceCount = reader.readInt32();
|
|
1094
1123
|
for (let i = 0; i < traceCount; i++) {
|
|
1095
|
-
stateStorage.traces.push(ReadFINNetworkTrace(reader));
|
|
1124
|
+
stateStorage.traces.push((0, exports.ReadFINNetworkTrace)(reader));
|
|
1096
1125
|
}
|
|
1097
1126
|
const refCount = reader.readInt32();
|
|
1098
1127
|
for (let i = 0; i < refCount; i++) {
|
|
1099
|
-
stateStorage.references.push(ObjectReference.Parse(reader));
|
|
1128
|
+
stateStorage.references.push(ObjectReference_1.ObjectReference.Parse(reader));
|
|
1100
1129
|
}
|
|
1101
1130
|
stateStorage.thread = reader.readString();
|
|
1102
1131
|
stateStorage.globals = reader.readString();
|
|
@@ -1104,16 +1133,18 @@ export const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
|
1104
1133
|
stateStorage.remainingStructData = reader.readBytes(remaining);
|
|
1105
1134
|
return stateStorage;
|
|
1106
1135
|
};
|
|
1107
|
-
|
|
1136
|
+
exports.ReadFINLuaProcessorStateStorage = ReadFINLuaProcessorStateStorage;
|
|
1137
|
+
const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
|
|
1108
1138
|
writer.writeInt32(stateStorage.traces.length);
|
|
1109
1139
|
for (const trace of stateStorage.traces) {
|
|
1110
|
-
SerializeFINNetworkTrace(writer, trace);
|
|
1140
|
+
(0, exports.SerializeFINNetworkTrace)(writer, trace);
|
|
1111
1141
|
}
|
|
1112
1142
|
writer.writeInt32(stateStorage.references.length);
|
|
1113
1143
|
for (const ref of stateStorage.references) {
|
|
1114
|
-
ObjectReference.Serialize(writer, ref);
|
|
1144
|
+
ObjectReference_1.ObjectReference.Serialize(writer, ref);
|
|
1115
1145
|
}
|
|
1116
1146
|
writer.writeString(stateStorage.thread);
|
|
1117
1147
|
writer.writeString(stateStorage.globals);
|
|
1118
1148
|
writer.writeBytes(stateStorage.remainingStructData);
|
|
1119
1149
|
};
|
|
1150
|
+
exports.SerializeFINLuaProcessorStateStorage = SerializeFINLuaProcessorStateStorage;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaveComponent = exports.isSaveComponent = void 0;
|
|
4
|
+
const SaveObject_1 = require("./SaveObject");
|
|
5
|
+
const isSaveComponent = (obj) => {
|
|
3
6
|
return obj.type === 'SaveComponent';
|
|
4
7
|
};
|
|
5
|
-
|
|
8
|
+
exports.isSaveComponent = isSaveComponent;
|
|
9
|
+
class SaveComponent extends SaveObject_1.SaveObject {
|
|
6
10
|
constructor(typePath, rootObject, instanceName, parentEntityName = '') {
|
|
7
11
|
super(typePath, rootObject, instanceName);
|
|
8
12
|
this.typePath = typePath;
|
|
@@ -12,16 +16,16 @@ class SaveComponent extends SaveObject {
|
|
|
12
16
|
this.type = 'SaveComponent';
|
|
13
17
|
}
|
|
14
18
|
static ParseHeader(reader, obj) {
|
|
15
|
-
SaveObject.ParseHeader(reader, obj);
|
|
19
|
+
SaveObject_1.SaveObject.ParseHeader(reader, obj);
|
|
16
20
|
obj.parentEntityName = reader.readString();
|
|
17
21
|
}
|
|
18
22
|
static SerializeHeader(writer, component) {
|
|
19
|
-
SaveObject.SerializeHeader(writer, component);
|
|
23
|
+
SaveObject_1.SaveObject.SerializeHeader(writer, component);
|
|
20
24
|
writer.writeString(component.parentEntityName);
|
|
21
25
|
}
|
|
22
26
|
static ParseData(component, length, reader, buildVersion) {
|
|
23
|
-
SaveObject.ParseData(component, length, reader, buildVersion);
|
|
27
|
+
SaveObject_1.SaveObject.ParseData(component, length, reader, buildVersion);
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
SaveComponent.TypeID = 0;
|
|
27
|
-
|
|
31
|
+
exports.SaveComponent = SaveComponent;
|