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