@etothepii/satisfactory-file-parser 0.0.32 → 0.0.34
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.js +41 -51
- package/build/parser/byte/alignment.enum.js +8 -18
- package/build/parser/byte/binary-operable.interface.js +2 -12
- package/build/parser/byte/binary-readable.interface.js +2 -12
- package/build/parser/byte/byte-reader.class.js +122 -132
- package/build/parser/byte/byte-writer.class.js +133 -143
- package/build/parser/error/parser.error.js +40 -50
- package/build/parser/file.types.js +2 -12
- package/build/parser/parser.d.ts +0 -9
- package/build/parser/parser.js +84 -192
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +109 -119
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +56 -66
- package/build/parser/satisfactory/blueprint/blueprint.types.js +2 -12
- package/build/parser/satisfactory/objects/DataFields.js +297 -307
- package/build/parser/satisfactory/objects/ObjectReference.js +14 -24
- package/build/parser/satisfactory/objects/Property.js +967 -977
- package/build/parser/satisfactory/objects/SaveComponent.js +28 -38
- package/build/parser/satisfactory/objects/SaveEntity.js +65 -75
- package/build/parser/satisfactory/objects/SaveObject.js +26 -36
- package/build/parser/satisfactory/save/asynchronous-level.class.js +60 -70
- package/build/parser/satisfactory/save/level.class.js +122 -133
- package/build/parser/satisfactory/save/satisfactory-save.js +10 -20
- package/build/parser/satisfactory/save/save-reader.js +158 -168
- package/build/parser/satisfactory/save/save-writer.js +97 -107
- package/build/parser/satisfactory/save/save.types.js +2 -12
- package/build/parser/satisfactory/structs/util.types.js +89 -99
- package/build/parser/stream/byte-stream-reader.class.js +217 -227
- package/build/parser/stream/json-stream-state-writer.js +15 -25
- package/build/parser/stream/json-stream-writable.js +72 -82
- package/build/parser/stream/json-stream-writer.js +122 -132
- package/build/parser/stream/save-stream-json-stringifier.js +29 -39
- package/build/parser/stream/save-stream-reader.class.js +106 -116
- package/build/parser/stream/save-stream-writer.class.js +90 -100
- package/build/parser/stream/stream-level.class.js +93 -103
- package/package.json +1 -1
|
@@ -1,1012 +1,1002 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
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;
|
|
13
|
-
const util_types_1 = require("../structs/util.types");
|
|
14
|
-
const DataFields_1 = require("./DataFields");
|
|
15
|
-
const ObjectReference_1 = require("./ObjectReference");
|
|
16
|
-
class AbstractProperty {
|
|
17
|
-
constructor(type, index) {
|
|
18
|
-
this.type = type;
|
|
19
|
-
this.index = index;
|
|
20
|
-
}
|
|
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 {
|
|
8
|
+
constructor(type, index) {
|
|
9
|
+
this.type = type;
|
|
10
|
+
this.index = index;
|
|
21
11
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
}
|
|
13
|
+
exports.AbstractProperty = AbstractProperty;
|
|
14
|
+
class AbstractBaseProperty extends AbstractProperty {
|
|
15
|
+
constructor(type, ueType, index) {
|
|
16
|
+
super(type, index && index !== 0 ? index : undefined);
|
|
17
|
+
this.ueType = ueType;
|
|
18
|
+
this.name = '';
|
|
29
19
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
}
|
|
21
|
+
exports.AbstractBaseProperty = AbstractBaseProperty;
|
|
22
|
+
class BasicProperty extends AbstractBaseProperty {
|
|
23
|
+
constructor(type, ueType, guidInfo, index = 0) {
|
|
24
|
+
super(type, ueType, index);
|
|
25
|
+
this.guidInfo = guidInfo;
|
|
36
26
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
27
|
+
}
|
|
28
|
+
exports.BasicProperty = BasicProperty;
|
|
29
|
+
const ParseGUID = (reader) => {
|
|
30
|
+
const hasGuid = reader.readByte() === 1;
|
|
31
|
+
let guid;
|
|
32
|
+
if (hasGuid) {
|
|
33
|
+
throw new Error('Unexpected!');
|
|
34
|
+
guid = reader.readBytes(16);
|
|
35
|
+
}
|
|
36
|
+
return guid;
|
|
37
|
+
};
|
|
38
|
+
exports.ParseGUID = ParseGUID;
|
|
39
|
+
const SerializeGUID = (writer, guid) => {
|
|
40
|
+
writer.writeByte(guid ? 1 : 0);
|
|
41
|
+
if (guid) {
|
|
42
|
+
writer.writeBytes(guid);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
exports.SerializeGUID = SerializeGUID;
|
|
46
|
+
class BoolProperty extends BasicProperty {
|
|
47
|
+
constructor(value, ueType = 'BoolProperty', guidInfo = undefined, index = 0) {
|
|
48
|
+
super('BoolProperty', ueType, guidInfo, index);
|
|
49
|
+
this.value = value;
|
|
50
|
+
}
|
|
51
|
+
static Parse(reader, ueType, index = 0) {
|
|
52
|
+
const value = BoolProperty.ReadValue(reader);
|
|
53
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
54
|
+
return new BoolProperty(value, ueType, guidInfo, index);
|
|
55
|
+
}
|
|
56
|
+
static ReadValue(reader) {
|
|
57
|
+
return reader.readByte() > 0;
|
|
58
|
+
}
|
|
59
|
+
static CalcOverhead(property) {
|
|
60
|
+
return 2;
|
|
61
|
+
}
|
|
62
|
+
static Serialize(writer, property) {
|
|
63
|
+
BoolProperty.SerializeValue(writer, property.value);
|
|
64
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
65
|
+
}
|
|
66
|
+
static SerializeValue(writer, value) {
|
|
67
|
+
writer.writeByte(value ? 1 : 0);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.BoolProperty = BoolProperty;
|
|
71
|
+
class ByteProperty extends BasicProperty {
|
|
72
|
+
constructor(value, ueType = 'ByteProperty', guidInfo = undefined, index = 0) {
|
|
73
|
+
super('ByteProperty', ueType, guidInfo, index);
|
|
74
|
+
this.value = value;
|
|
75
|
+
}
|
|
76
|
+
static Parse(reader, ueType, index = 0) {
|
|
77
|
+
const type = reader.readString();
|
|
78
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
79
|
+
let value;
|
|
80
|
+
if (type === 'None') {
|
|
81
|
+
value = {
|
|
82
|
+
type,
|
|
83
|
+
value: ByteProperty.ReadValue(reader)
|
|
84
|
+
};
|
|
64
85
|
}
|
|
65
|
-
|
|
66
|
-
|
|
86
|
+
else {
|
|
87
|
+
value = {
|
|
88
|
+
type,
|
|
89
|
+
value: reader.readString()
|
|
90
|
+
};
|
|
67
91
|
}
|
|
68
|
-
|
|
69
|
-
|
|
92
|
+
const property = new ByteProperty(value, ueType, guidInfo, index);
|
|
93
|
+
return property;
|
|
94
|
+
}
|
|
95
|
+
static ReadValue(reader) {
|
|
96
|
+
return reader.readByte();
|
|
97
|
+
}
|
|
98
|
+
static CalcOverhead(property) {
|
|
99
|
+
return property.value.type.length + 5 + 1;
|
|
100
|
+
}
|
|
101
|
+
static Serialize(writer, property) {
|
|
102
|
+
writer.writeString(property.value.type);
|
|
103
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
104
|
+
if (property.value.type === 'None') {
|
|
105
|
+
ByteProperty.SerializeValue(writer, property.value.value);
|
|
70
106
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
107
|
+
else {
|
|
108
|
+
writer.writeString(property.value.value);
|
|
74
109
|
}
|
|
75
|
-
|
|
76
|
-
|
|
110
|
+
}
|
|
111
|
+
static SerializeValue(writer, value) {
|
|
112
|
+
writer.writeByte(value);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
exports.ByteProperty = ByteProperty;
|
|
116
|
+
class Int8Property extends BasicProperty {
|
|
117
|
+
constructor(value, ueType = 'Int8Property', guidInfo = undefined, index = 0) {
|
|
118
|
+
super('Int8Property', ueType, guidInfo, index);
|
|
119
|
+
this.value = value;
|
|
120
|
+
}
|
|
121
|
+
static Parse(reader, ueType, index = 0) {
|
|
122
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
123
|
+
const value = Int8Property.ReadValue(reader);
|
|
124
|
+
return new Int8Property(value, ueType, guidInfo, index);
|
|
125
|
+
}
|
|
126
|
+
static ReadValue(reader) {
|
|
127
|
+
return reader.readInt8();
|
|
128
|
+
}
|
|
129
|
+
static CalcOverhead(property) {
|
|
130
|
+
return 1;
|
|
131
|
+
}
|
|
132
|
+
static Serialize(writer, property) {
|
|
133
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
134
|
+
Int8Property.SerializeValue(writer, property.value);
|
|
135
|
+
}
|
|
136
|
+
static SerializeValue(writer, value) {
|
|
137
|
+
writer.writeInt8(value);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.Int8Property = Int8Property;
|
|
141
|
+
class Uint8Property extends BasicProperty {
|
|
142
|
+
constructor(value, ueType = 'UInt8Property', guidInfo = undefined, index = 0) {
|
|
143
|
+
super('UInt8Property', ueType, guidInfo, index);
|
|
144
|
+
this.value = value;
|
|
145
|
+
}
|
|
146
|
+
static Parse(reader, ueType, index = 0) {
|
|
147
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
148
|
+
const value = Uint8Property.ReadValue(reader);
|
|
149
|
+
return new Uint8Property(value, ueType, guidInfo, index);
|
|
150
|
+
}
|
|
151
|
+
static ReadValue(reader) {
|
|
152
|
+
return reader.readUint8();
|
|
153
|
+
}
|
|
154
|
+
static CalcOverhead(property) {
|
|
155
|
+
throw new Error('Unimplemented.');
|
|
156
|
+
}
|
|
157
|
+
static Serialize(writer, property) {
|
|
158
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
159
|
+
Uint8Property.SerializeValue(writer, property.value);
|
|
160
|
+
}
|
|
161
|
+
static SerializeValue(writer, value) {
|
|
162
|
+
writer.writeUint8(value);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.Uint8Property = Uint8Property;
|
|
166
|
+
class Int32Property extends BasicProperty {
|
|
167
|
+
constructor(value, ueType = 'IntProperty', guidInfo = undefined, index = 0) {
|
|
168
|
+
super('Int32Property', ueType, guidInfo, index);
|
|
169
|
+
this.value = value;
|
|
170
|
+
}
|
|
171
|
+
static Parse(reader, ueType, index = 0) {
|
|
172
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
173
|
+
const value = Int32Property.ReadValue(reader);
|
|
174
|
+
return new Int32Property(value, ueType, guidInfo, index);
|
|
175
|
+
}
|
|
176
|
+
static ReadValue(reader) {
|
|
177
|
+
return reader.readInt32();
|
|
178
|
+
}
|
|
179
|
+
static CalcOverhead(property) {
|
|
180
|
+
return 1;
|
|
181
|
+
}
|
|
182
|
+
static Serialize(writer, property) {
|
|
183
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
184
|
+
Int32Property.SerializeValue(writer, property.value);
|
|
185
|
+
}
|
|
186
|
+
static SerializeValue(writer, value) {
|
|
187
|
+
writer.writeInt32(value);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
exports.Int32Property = Int32Property;
|
|
191
|
+
class Uint32Property extends BasicProperty {
|
|
192
|
+
constructor(value, ueType = 'UInt32Property', guidInfo = undefined, index = 0) {
|
|
193
|
+
super('UInt32Property', ueType, guidInfo, index);
|
|
194
|
+
this.value = value;
|
|
195
|
+
}
|
|
196
|
+
static Parse(reader, ueType, index = 0) {
|
|
197
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
198
|
+
const value = Uint32Property.ReadValue(reader);
|
|
199
|
+
return new Uint32Property(value, ueType, guidInfo, index);
|
|
200
|
+
}
|
|
201
|
+
static ReadValue(reader) {
|
|
202
|
+
return reader.readUint32();
|
|
203
|
+
}
|
|
204
|
+
static CalcOverhead(property) {
|
|
205
|
+
throw new Error('unimplemented');
|
|
206
|
+
}
|
|
207
|
+
static Serialize(writer, property) {
|
|
208
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
209
|
+
Uint32Property.SerializeValue(writer, property.value);
|
|
210
|
+
}
|
|
211
|
+
static SerializeValue(writer, value) {
|
|
212
|
+
writer.writeUint32(value);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.Uint32Property = Uint32Property;
|
|
216
|
+
class Int64Property extends BasicProperty {
|
|
217
|
+
constructor(value, ueType = 'Int64Property', guidInfo = undefined, index = 0) {
|
|
218
|
+
super('Int64Property', ueType, guidInfo, index);
|
|
219
|
+
this.value = value;
|
|
220
|
+
}
|
|
221
|
+
static Parse(reader, ueType, index = 0) {
|
|
222
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
223
|
+
const value = Int64Property.ReadValue(reader);
|
|
224
|
+
return new Int64Property(value, ueType, guidInfo, index);
|
|
225
|
+
}
|
|
226
|
+
static ReadValue(reader) {
|
|
227
|
+
return reader.readInt64().toString();
|
|
228
|
+
}
|
|
229
|
+
static CalcOverhead(property) {
|
|
230
|
+
return 1;
|
|
231
|
+
}
|
|
232
|
+
static Serialize(writer, property) {
|
|
233
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
234
|
+
Int64Property.SerializeValue(writer, property.value);
|
|
235
|
+
}
|
|
236
|
+
static SerializeValue(writer, value) {
|
|
237
|
+
writer.writeInt64(BigInt(value));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
exports.Int64Property = Int64Property;
|
|
241
|
+
class FloatProperty extends BasicProperty {
|
|
242
|
+
constructor(value, ueType = 'FloatProperty', guidInfo = undefined, index = 0) {
|
|
243
|
+
super('FloatProperty', ueType, guidInfo, index);
|
|
244
|
+
this.value = value;
|
|
245
|
+
}
|
|
246
|
+
static Parse(reader, ueType, index = 0) {
|
|
247
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
248
|
+
const value = FloatProperty.ReadValue(reader);
|
|
249
|
+
return new FloatProperty(value, ueType, guidInfo, index);
|
|
250
|
+
}
|
|
251
|
+
static CalcOverhead(property) {
|
|
252
|
+
return 1;
|
|
253
|
+
}
|
|
254
|
+
static ReadValue(reader) {
|
|
255
|
+
return reader.readFloat32();
|
|
256
|
+
}
|
|
257
|
+
static Serialize(writer, property) {
|
|
258
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
259
|
+
FloatProperty.SerializeValue(writer, property.value);
|
|
260
|
+
}
|
|
261
|
+
static SerializeValue(writer, value) {
|
|
262
|
+
writer.writeFloat(value);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
exports.FloatProperty = FloatProperty;
|
|
266
|
+
class DoubleProperty extends BasicProperty {
|
|
267
|
+
constructor(value, ueType = 'DoubleProperty', guidInfo = undefined, index = 0) {
|
|
268
|
+
super('DoubleProperty', ueType, guidInfo, index);
|
|
269
|
+
this.value = value;
|
|
270
|
+
}
|
|
271
|
+
static Parse(reader, ueType, index = 0) {
|
|
272
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
273
|
+
const value = DoubleProperty.ReadValue(reader);
|
|
274
|
+
return new DoubleProperty(value, ueType, guidInfo, index);
|
|
275
|
+
}
|
|
276
|
+
static ReadValue(reader) {
|
|
277
|
+
return reader.readDouble();
|
|
278
|
+
}
|
|
279
|
+
static CalcOverhead(property) {
|
|
280
|
+
return 1;
|
|
281
|
+
}
|
|
282
|
+
static Serialize(writer, property) {
|
|
283
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
284
|
+
DoubleProperty.SerializeValue(writer, property.value);
|
|
285
|
+
}
|
|
286
|
+
static SerializeValue(writer, value) {
|
|
287
|
+
writer.writeDouble(value);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.DoubleProperty = DoubleProperty;
|
|
291
|
+
class StrProperty extends BasicProperty {
|
|
292
|
+
constructor(value, ueType = 'StrProperty', guidInfo = undefined, index = 0) {
|
|
293
|
+
super('StrProperty', ueType, guidInfo, index);
|
|
294
|
+
this.value = value;
|
|
295
|
+
}
|
|
296
|
+
static Parse(reader, ueType, index = 0) {
|
|
297
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
298
|
+
const value = StrProperty.ReadValue(reader);
|
|
299
|
+
return new StrProperty(value, ueType, guidInfo, index);
|
|
300
|
+
}
|
|
301
|
+
static ReadValue(reader) {
|
|
302
|
+
return reader.readString();
|
|
303
|
+
}
|
|
304
|
+
static CalcOverhead(property) {
|
|
305
|
+
return 1;
|
|
306
|
+
}
|
|
307
|
+
static Serialize(writer, property) {
|
|
308
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
309
|
+
StrProperty.SerializeValue(writer, property.value);
|
|
310
|
+
}
|
|
311
|
+
static SerializeValue(writer, value) {
|
|
312
|
+
writer.writeString(value);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
exports.StrProperty = StrProperty;
|
|
316
|
+
class ObjectProperty extends BasicProperty {
|
|
317
|
+
constructor(value, ueType = 'ObjectProperty', guidInfo = undefined, index = 0) {
|
|
318
|
+
super('ObjectProperty', ueType, guidInfo, index);
|
|
319
|
+
this.value = value;
|
|
320
|
+
}
|
|
321
|
+
static Parse(reader, ueType, index = 0) {
|
|
322
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
323
|
+
const value = ObjectProperty.ReadValue(reader);
|
|
324
|
+
return new ObjectProperty(value, ueType, guidInfo, index);
|
|
325
|
+
}
|
|
326
|
+
static ReadValue(reader) {
|
|
327
|
+
const x = {
|
|
328
|
+
levelName: reader.readString(),
|
|
329
|
+
pathName: reader.readString()
|
|
330
|
+
};
|
|
331
|
+
return x;
|
|
332
|
+
}
|
|
333
|
+
static CalcOverhead(property) {
|
|
334
|
+
return 1;
|
|
335
|
+
}
|
|
336
|
+
static Serialize(writer, property) {
|
|
337
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
338
|
+
ObjectProperty.SerializeValue(writer, property.value);
|
|
339
|
+
}
|
|
340
|
+
static SerializeValue(writer, value) {
|
|
341
|
+
writer.writeString(value.levelName);
|
|
342
|
+
writer.writeString(value.pathName);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
exports.ObjectProperty = ObjectProperty;
|
|
346
|
+
class EnumProperty extends BasicProperty {
|
|
347
|
+
constructor(value, ueType = 'EnumProperty', guidInfo = undefined, index = 0) {
|
|
348
|
+
super('EnumProperty', ueType, guidInfo, index);
|
|
349
|
+
this.value = value;
|
|
350
|
+
}
|
|
351
|
+
static Parse(reader, ueType, index = 0) {
|
|
352
|
+
let name = reader.readString();
|
|
353
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
354
|
+
const value = EnumProperty.ReadValue(reader);
|
|
355
|
+
const property = new EnumProperty({ name, value }, ueType, guidInfo, index);
|
|
356
|
+
return property;
|
|
357
|
+
}
|
|
358
|
+
static ReadValue(reader) {
|
|
359
|
+
return reader.readString();
|
|
360
|
+
}
|
|
361
|
+
static CalcOverhead(property) {
|
|
362
|
+
return property.value.name.length + 6;
|
|
363
|
+
}
|
|
364
|
+
static Serialize(writer, property) {
|
|
365
|
+
writer.writeString(property.value.name);
|
|
366
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
367
|
+
EnumProperty.SerializeValue(writer, property.value.value);
|
|
368
|
+
}
|
|
369
|
+
static SerializeValue(writer, value) {
|
|
370
|
+
writer.writeString(value);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
exports.EnumProperty = EnumProperty;
|
|
374
|
+
class TextProperty extends BasicProperty {
|
|
375
|
+
constructor(value, ueType = 'TextProperty', guidInfo = undefined, index = 0) {
|
|
376
|
+
super('TextProperty', ueType, guidInfo, index);
|
|
377
|
+
this.value = value;
|
|
378
|
+
}
|
|
379
|
+
static Parse(reader, ueType, index = 0) {
|
|
380
|
+
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
381
|
+
const value = TextProperty.ParseValue(reader);
|
|
382
|
+
return new TextProperty(value, ueType, guidInfo, index);
|
|
383
|
+
}
|
|
384
|
+
static ParseValue(reader) {
|
|
385
|
+
const prop = {
|
|
386
|
+
flags: reader.readInt32(),
|
|
387
|
+
historyType: reader.readByte()
|
|
388
|
+
};
|
|
389
|
+
switch (prop.historyType) {
|
|
390
|
+
case 0:
|
|
391
|
+
prop.namespace = reader.readString();
|
|
392
|
+
prop.key = reader.readString();
|
|
393
|
+
prop.value = reader.readString();
|
|
394
|
+
break;
|
|
395
|
+
case 1:
|
|
396
|
+
case 3:
|
|
397
|
+
prop.sourceFmt = TextProperty.ParseValue(reader);
|
|
398
|
+
const argumentsCount = reader.readInt32();
|
|
399
|
+
prop.arguments = [];
|
|
400
|
+
for (let i = 0; i < argumentsCount; i++) {
|
|
401
|
+
let currentArgumentsData = {};
|
|
402
|
+
currentArgumentsData.name = reader.readString();
|
|
403
|
+
currentArgumentsData.valueType = reader.readByte();
|
|
404
|
+
switch (currentArgumentsData.valueType) {
|
|
405
|
+
case 4:
|
|
406
|
+
currentArgumentsData.argumentValue = TextProperty.ParseValue(reader);
|
|
407
|
+
break;
|
|
408
|
+
default:
|
|
409
|
+
throw new Error('Unimplemented FormatArgumentType `' + currentArgumentsData.valueType);
|
|
410
|
+
}
|
|
411
|
+
prop.arguments.push(currentArgumentsData);
|
|
412
|
+
}
|
|
413
|
+
break;
|
|
414
|
+
case 10:
|
|
415
|
+
prop.sourceText = TextProperty.ParseValue(reader);
|
|
416
|
+
prop.transformType = reader.readByte();
|
|
417
|
+
break;
|
|
418
|
+
case 255:
|
|
419
|
+
prop.hasCultureInvariantString = reader.readInt32() === 1;
|
|
420
|
+
if (prop.hasCultureInvariantString) {
|
|
421
|
+
prop.value = reader.readString();
|
|
422
|
+
}
|
|
423
|
+
break;
|
|
424
|
+
default:
|
|
425
|
+
throw new Error('Unimplemented historyType `' + prop.historyType);
|
|
77
426
|
}
|
|
427
|
+
return prop;
|
|
428
|
+
}
|
|
429
|
+
static CalcOverhead(property) {
|
|
430
|
+
return 1;
|
|
78
431
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
432
|
+
static Serialize(writer, property) {
|
|
433
|
+
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
434
|
+
TextProperty.SerializeValue(writer, property.value);
|
|
435
|
+
}
|
|
436
|
+
static SerializeValue(writer, value) {
|
|
437
|
+
writer.writeInt32(value.flags);
|
|
438
|
+
writer.writeByte(value.historyType);
|
|
439
|
+
switch (value.historyType) {
|
|
440
|
+
case 0:
|
|
441
|
+
writer.writeString(value.namespace);
|
|
442
|
+
writer.writeString(value.key);
|
|
443
|
+
writer.writeString(value.value);
|
|
444
|
+
break;
|
|
445
|
+
case 1:
|
|
446
|
+
case 3:
|
|
447
|
+
TextProperty.SerializeValue(writer, value.sourceFmt);
|
|
448
|
+
writer.writeInt32(value.arguments.length);
|
|
449
|
+
for (const arg of value.arguments) {
|
|
450
|
+
let currentArgumentsData = {};
|
|
451
|
+
writer.writeString(arg.name);
|
|
452
|
+
writer.writeByte(arg.valueType);
|
|
453
|
+
switch (arg.valueType) {
|
|
454
|
+
case 4:
|
|
455
|
+
TextProperty.SerializeValue(writer, arg.argumentValue);
|
|
456
|
+
break;
|
|
457
|
+
default:
|
|
458
|
+
throw new Error('Unimplemented FormatArgumentType `' + currentArgumentsData.valueType);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
break;
|
|
462
|
+
case 10:
|
|
463
|
+
TextProperty.SerializeValue(writer, value.sourceText);
|
|
464
|
+
writer.writeByte(value.transformType);
|
|
465
|
+
break;
|
|
466
|
+
case 255:
|
|
467
|
+
writer.writeInt32(value.hasCultureInvariantString ? 1 : 0);
|
|
468
|
+
if (value.hasCultureInvariantString) {
|
|
469
|
+
writer.writeString(value.value);
|
|
470
|
+
}
|
|
471
|
+
break;
|
|
472
|
+
default:
|
|
473
|
+
throw new Error('Unimplemented historyType `' + value.historyType);
|
|
84
474
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
exports.TextProperty = TextProperty;
|
|
478
|
+
class StructProperty extends AbstractBaseProperty {
|
|
479
|
+
constructor(subtype, ueType = 'StructProperty', index = 0, guid = 0) {
|
|
480
|
+
super('StructProperty', ueType, index);
|
|
481
|
+
this.subtype = subtype;
|
|
482
|
+
this.guid = guid;
|
|
483
|
+
this.value = { values: {} };
|
|
484
|
+
}
|
|
485
|
+
static Parse(reader, ueType, index, size) {
|
|
486
|
+
const struct = new StructProperty(reader.readString(), ueType, index, reader.readInt32());
|
|
487
|
+
const unk1 = reader.readInt32();
|
|
488
|
+
if (unk1 !== 0) {
|
|
489
|
+
struct.unk1 = unk1;
|
|
490
|
+
}
|
|
491
|
+
const unk2 = reader.readInt32();
|
|
492
|
+
if (unk2 !== 0) {
|
|
493
|
+
struct.unk2 = unk2;
|
|
494
|
+
}
|
|
495
|
+
const unk3 = reader.readInt32();
|
|
496
|
+
if (unk2 !== 0) {
|
|
497
|
+
struct.unk3 = unk3;
|
|
498
|
+
}
|
|
499
|
+
const unk4 = reader.readByte();
|
|
500
|
+
if (unk4 !== 0) {
|
|
501
|
+
struct.unk4 = unk4;
|
|
502
|
+
}
|
|
503
|
+
const before = reader.getBufferPosition();
|
|
504
|
+
struct.value = StructProperty.ParseValue(reader, struct.subtype, size);
|
|
505
|
+
const readBytes = reader.getBufferPosition() - before;
|
|
506
|
+
if (readBytes !== size) {
|
|
507
|
+
throw new Error(`possibly corrupt. Read ${readBytes} for StructProperty Content of ${struct.subtype}, but ${size} were indicated.`);
|
|
508
|
+
}
|
|
509
|
+
return struct;
|
|
510
|
+
}
|
|
511
|
+
static ParseValue(reader, subtype, size) {
|
|
512
|
+
let value;
|
|
513
|
+
switch (subtype) {
|
|
514
|
+
case 'Color':
|
|
515
|
+
value = (0, util_types_1.ParseCol4BGRA)(reader);
|
|
516
|
+
break;
|
|
517
|
+
case 'LinearColor':
|
|
518
|
+
value = (0, util_types_1.ParseCol4RGBA)(reader);
|
|
519
|
+
break;
|
|
520
|
+
case 'Vector':
|
|
521
|
+
case 'Rotator':
|
|
522
|
+
case 'Vector2D':
|
|
523
|
+
value = (0, util_types_1.ParseVec3)(reader);
|
|
524
|
+
break;
|
|
525
|
+
case 'Quat':
|
|
526
|
+
case 'Vector4':
|
|
527
|
+
case 'Vector4D':
|
|
528
|
+
value = (0, util_types_1.ParseVec4)(reader);
|
|
529
|
+
break;
|
|
530
|
+
case 'Box':
|
|
90
531
|
value = {
|
|
91
|
-
|
|
92
|
-
|
|
532
|
+
min: (0, util_types_1.ParseVec3)(reader),
|
|
533
|
+
max: (0, util_types_1.ParseVec3)(reader),
|
|
534
|
+
isValid: reader.readByte() >= 1
|
|
93
535
|
};
|
|
94
|
-
|
|
95
|
-
|
|
536
|
+
break;
|
|
537
|
+
case 'RailroadTrackPosition':
|
|
96
538
|
value = {
|
|
97
|
-
|
|
98
|
-
|
|
539
|
+
root: reader.readString(),
|
|
540
|
+
instanceName: reader.readString(),
|
|
541
|
+
offset: reader.readFloat32(),
|
|
542
|
+
forward: reader.readFloat32()
|
|
99
543
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
544
|
+
break;
|
|
545
|
+
case 'TimerHandle':
|
|
546
|
+
value = reader.readString();
|
|
547
|
+
break;
|
|
548
|
+
case 'Guid':
|
|
549
|
+
value = reader.readString();
|
|
550
|
+
break;
|
|
551
|
+
case 'InventoryItem':
|
|
552
|
+
value = {
|
|
553
|
+
unk1: reader.readInt32(),
|
|
554
|
+
itemName: reader.readString(),
|
|
555
|
+
unk2: reader.readString(),
|
|
556
|
+
unk3: reader.readString(),
|
|
557
|
+
properties: [],
|
|
558
|
+
};
|
|
559
|
+
break;
|
|
560
|
+
case 'FluidBox':
|
|
561
|
+
value = {
|
|
562
|
+
value: reader.readFloat32()
|
|
563
|
+
};
|
|
564
|
+
break;
|
|
565
|
+
case 'SlateBrush':
|
|
566
|
+
value = reader.readString();
|
|
567
|
+
break;
|
|
568
|
+
case 'DateTime':
|
|
569
|
+
value = reader.readInt64().toString();
|
|
570
|
+
break;
|
|
571
|
+
case 'FINNetworkTrace':
|
|
572
|
+
value = (0, exports.ReadFINNetworkTrace)(reader);
|
|
573
|
+
break;
|
|
574
|
+
case 'FINLuaProcessorStateStorage':
|
|
575
|
+
value = {
|
|
576
|
+
values: (0, exports.ReadFINLuaProcessorStateStorage)(reader, size)
|
|
577
|
+
};
|
|
578
|
+
break;
|
|
579
|
+
case 'FICFrameRange':
|
|
580
|
+
value = {
|
|
581
|
+
begin: reader.readInt64().toString(),
|
|
582
|
+
end: reader.readInt64().toString(),
|
|
583
|
+
};
|
|
584
|
+
break;
|
|
585
|
+
default:
|
|
586
|
+
value = (0, exports.ParseDynamicStructData)(reader, 0, subtype);
|
|
122
587
|
}
|
|
588
|
+
return value;
|
|
123
589
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
constructor(value, ueType = 'Int8Property', guidInfo = undefined, index = 0) {
|
|
127
|
-
super('Int8Property', ueType, guidInfo, index);
|
|
128
|
-
this.value = value;
|
|
129
|
-
}
|
|
130
|
-
static Parse(reader, ueType, index = 0) {
|
|
131
|
-
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
132
|
-
const value = Int8Property.ReadValue(reader);
|
|
133
|
-
return new Int8Property(value, ueType, guidInfo, index);
|
|
134
|
-
}
|
|
135
|
-
static ReadValue(reader) {
|
|
136
|
-
return reader.readInt8();
|
|
137
|
-
}
|
|
138
|
-
static CalcOverhead(property) {
|
|
139
|
-
return 1;
|
|
140
|
-
}
|
|
141
|
-
static Serialize(writer, property) {
|
|
142
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
143
|
-
Int8Property.SerializeValue(writer, property.value);
|
|
144
|
-
}
|
|
145
|
-
static SerializeValue(writer, value) {
|
|
146
|
-
writer.writeInt8(value);
|
|
147
|
-
}
|
|
590
|
+
static CalcOverhead(property) {
|
|
591
|
+
return property.subtype.length + 5 + 17;
|
|
148
592
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const value = Uint8Property.ReadValue(reader);
|
|
158
|
-
return new Uint8Property(value, ueType, guidInfo, index);
|
|
159
|
-
}
|
|
160
|
-
static ReadValue(reader) {
|
|
161
|
-
return reader.readUint8();
|
|
162
|
-
}
|
|
163
|
-
static CalcOverhead(property) {
|
|
164
|
-
throw new Error('Unimplemented.');
|
|
165
|
-
}
|
|
166
|
-
static Serialize(writer, property) {
|
|
167
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
168
|
-
Uint8Property.SerializeValue(writer, property.value);
|
|
169
|
-
}
|
|
170
|
-
static SerializeValue(writer, value) {
|
|
171
|
-
writer.writeUint8(value);
|
|
172
|
-
}
|
|
593
|
+
static Serialize(writer, property) {
|
|
594
|
+
writer.writeString(property.subtype);
|
|
595
|
+
writer.writeInt32(property.guid);
|
|
596
|
+
writer.writeInt32(property.unk1 ?? 0);
|
|
597
|
+
writer.writeInt32(property.unk2 ?? 0);
|
|
598
|
+
writer.writeInt32(property.unk3 ?? 0);
|
|
599
|
+
writer.writeByte(property.unk4 ?? 0);
|
|
600
|
+
StructProperty.SerializeValue(writer, property.subtype, property.value);
|
|
173
601
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
602
|
+
static SerializeValue(writer, subtype, value) {
|
|
603
|
+
switch (subtype) {
|
|
604
|
+
case 'Color':
|
|
605
|
+
value = value;
|
|
606
|
+
(0, util_types_1.SerializeCol4BGRA)(writer, value);
|
|
607
|
+
break;
|
|
608
|
+
case 'LinearColor':
|
|
609
|
+
value = value;
|
|
610
|
+
(0, util_types_1.SerializeCol4RGBA)(writer, value);
|
|
611
|
+
break;
|
|
612
|
+
case 'Vector':
|
|
613
|
+
case 'Rotator':
|
|
614
|
+
case 'Vector2D':
|
|
615
|
+
value = value;
|
|
616
|
+
(0, util_types_1.SerializeVec3)(writer, value);
|
|
617
|
+
break;
|
|
618
|
+
case 'Quat':
|
|
619
|
+
case 'Vector4':
|
|
620
|
+
case 'Vector4D':
|
|
621
|
+
value = value;
|
|
622
|
+
(0, util_types_1.SerializeVec4)(writer, value);
|
|
623
|
+
break;
|
|
624
|
+
case 'Box':
|
|
625
|
+
value = value;
|
|
626
|
+
(0, util_types_1.SerializeVec3)(writer, value.min);
|
|
627
|
+
(0, util_types_1.SerializeVec3)(writer, value.max);
|
|
628
|
+
writer.writeByte(value.isValid ? 1 : 0);
|
|
629
|
+
break;
|
|
630
|
+
case 'RailroadTrackPosition':
|
|
631
|
+
value = value;
|
|
632
|
+
writer.writeString(value.root);
|
|
633
|
+
writer.writeString(value.instanceName);
|
|
634
|
+
writer.writeFloat(value.offset);
|
|
635
|
+
writer.writeFloat(value.forward);
|
|
636
|
+
break;
|
|
637
|
+
case 'TimerHandle':
|
|
638
|
+
value = value;
|
|
639
|
+
writer.writeString(value);
|
|
640
|
+
break;
|
|
641
|
+
case 'Guid':
|
|
642
|
+
value = value;
|
|
643
|
+
writer.writeString(value);
|
|
644
|
+
break;
|
|
645
|
+
case 'InventoryItem':
|
|
646
|
+
value = value;
|
|
647
|
+
writer.writeInt32(value.unk1);
|
|
648
|
+
writer.writeString(value.itemName);
|
|
649
|
+
writer.writeString(value.unk2);
|
|
650
|
+
writer.writeString(value.unk3);
|
|
651
|
+
break;
|
|
652
|
+
case 'FluidBox':
|
|
653
|
+
value = value;
|
|
654
|
+
writer.writeFloat(value.value);
|
|
655
|
+
break;
|
|
656
|
+
case 'SlateBrush':
|
|
657
|
+
value = value;
|
|
658
|
+
writer.writeString(value);
|
|
659
|
+
break;
|
|
660
|
+
case 'DateTime':
|
|
661
|
+
value = value;
|
|
662
|
+
writer.writeInt64(BigInt(value));
|
|
663
|
+
break;
|
|
664
|
+
case 'FINNetworkTrace':
|
|
665
|
+
value = value;
|
|
666
|
+
(0, exports.SerializeFINNetworkTrace)(writer, value);
|
|
667
|
+
break;
|
|
668
|
+
case 'FINLuaProcessorStateStorage':
|
|
669
|
+
value = value;
|
|
670
|
+
(0, exports.SerializeFINLuaProcessorStateStorage)(writer, value.values);
|
|
671
|
+
break;
|
|
672
|
+
case 'FICFrameRange':
|
|
673
|
+
value = value;
|
|
674
|
+
writer.writeInt64(BigInt(value.begin));
|
|
675
|
+
writer.writeInt64(BigInt(value.end));
|
|
676
|
+
break;
|
|
677
|
+
default:
|
|
678
|
+
value = value;
|
|
679
|
+
(0, exports.SerializeDynamicStructData)(writer, 0, value);
|
|
197
680
|
}
|
|
198
681
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
const value = Uint32Property.ReadValue(reader);
|
|
208
|
-
return new Uint32Property(value, ueType, guidInfo, index);
|
|
209
|
-
}
|
|
210
|
-
static ReadValue(reader) {
|
|
211
|
-
return reader.readUint32();
|
|
212
|
-
}
|
|
213
|
-
static CalcOverhead(property) {
|
|
214
|
-
throw new Error('unimplemented');
|
|
215
|
-
}
|
|
216
|
-
static Serialize(writer, property) {
|
|
217
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
218
|
-
Uint32Property.SerializeValue(writer, property.value);
|
|
219
|
-
}
|
|
220
|
-
static SerializeValue(writer, value) {
|
|
221
|
-
writer.writeUint32(value);
|
|
222
|
-
}
|
|
682
|
+
}
|
|
683
|
+
exports.StructProperty = StructProperty;
|
|
684
|
+
class ArrayProperty extends BasicProperty {
|
|
685
|
+
constructor(subtype, values, ueType = 'ArrayProperty', index = 0, structValueFields) {
|
|
686
|
+
super('ArrayProperty', ueType, undefined, index);
|
|
687
|
+
this.subtype = subtype;
|
|
688
|
+
this.values = values;
|
|
689
|
+
this.structValueFields = structValueFields;
|
|
223
690
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
691
|
+
static Parse(reader, ueType, index, propertyName) {
|
|
692
|
+
const subtype = reader.readString();
|
|
693
|
+
reader.skipBytes();
|
|
694
|
+
let property;
|
|
695
|
+
const elementCount = reader.readInt32();
|
|
696
|
+
switch (subtype) {
|
|
697
|
+
case "FloatProperty":
|
|
698
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => FloatProperty.ReadValue(reader)), ueType, index);
|
|
699
|
+
break;
|
|
700
|
+
case "BoolProperty":
|
|
701
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => BoolProperty.ReadValue(reader)), ueType, index);
|
|
702
|
+
break;
|
|
703
|
+
case "IntProperty":
|
|
704
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index);
|
|
705
|
+
break;
|
|
706
|
+
case "Int64Property":
|
|
707
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int64Property.ReadValue(reader)), ueType, index);
|
|
708
|
+
break;
|
|
709
|
+
case "DoubleProperty":
|
|
710
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => DoubleProperty.ReadValue(reader)), ueType, index);
|
|
711
|
+
break;
|
|
712
|
+
case "ByteProperty":
|
|
713
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ByteProperty.ReadValue(reader)), ueType, index);
|
|
714
|
+
break;
|
|
715
|
+
case "StrProperty":
|
|
716
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index);
|
|
717
|
+
break;
|
|
718
|
+
case "EnumProperty":
|
|
719
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => EnumProperty.ReadValue(reader)), ueType, index);
|
|
720
|
+
break;
|
|
721
|
+
case "TextProperty":
|
|
722
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => TextProperty.ParseValue(reader)), ueType, index);
|
|
723
|
+
break;
|
|
724
|
+
case "InterfaceProperty":
|
|
725
|
+
case "ObjectProperty":
|
|
726
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index);
|
|
727
|
+
break;
|
|
728
|
+
case "StructProperty":
|
|
729
|
+
const name = reader.readString();
|
|
730
|
+
const type = reader.readString();
|
|
731
|
+
const binarySize = reader.readInt32();
|
|
732
|
+
const allIndex = reader.readInt32();
|
|
733
|
+
const allStructType = reader.readString();
|
|
734
|
+
const allGuid = reader.readInt32();
|
|
735
|
+
const allUnk1 = reader.readInt32();
|
|
736
|
+
const allUnk2 = reader.readInt32();
|
|
737
|
+
const allUnk3 = reader.readInt32();
|
|
738
|
+
const allUnk4 = reader.readByte();
|
|
739
|
+
const innerStructValueFields = { allStructType, allIndex, allGuid };
|
|
740
|
+
if (allUnk1 !== 0) {
|
|
741
|
+
innerStructValueFields.allUnk1 = allUnk1;
|
|
742
|
+
}
|
|
743
|
+
if (allUnk2 !== 0) {
|
|
744
|
+
innerStructValueFields.allUnk2 = allUnk2;
|
|
745
|
+
}
|
|
746
|
+
if (allUnk3 !== 0) {
|
|
747
|
+
innerStructValueFields.allUnk3 = allUnk3;
|
|
748
|
+
}
|
|
749
|
+
if (allUnk4 !== 0) {
|
|
750
|
+
innerStructValueFields.allUnk4 = allUnk4;
|
|
751
|
+
}
|
|
752
|
+
const before = reader.getBufferPosition();
|
|
753
|
+
const maArr = new Array(elementCount).fill(0).map(() => {
|
|
754
|
+
const struct = new StructProperty(allStructType, type, allIndex, allGuid);
|
|
755
|
+
struct.value = StructProperty.ParseValue(reader, allStructType, binarySize);
|
|
756
|
+
return struct;
|
|
757
|
+
});
|
|
758
|
+
const readBytees = reader.getBufferPosition() - before;
|
|
759
|
+
if (readBytees !== binarySize) {
|
|
760
|
+
throw new Error('possibly corrupt in array of struct.');
|
|
761
|
+
}
|
|
762
|
+
property = new ArrayProperty(subtype, maArr, ueType, index, innerStructValueFields);
|
|
763
|
+
break;
|
|
764
|
+
default:
|
|
765
|
+
console.log(subtype, ueType);
|
|
766
|
+
throw new Error();
|
|
767
|
+
}
|
|
768
|
+
return property;
|
|
248
769
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
constructor(value, ueType = 'FloatProperty', guidInfo = undefined, index = 0) {
|
|
252
|
-
super('FloatProperty', ueType, guidInfo, index);
|
|
253
|
-
this.value = value;
|
|
254
|
-
}
|
|
255
|
-
static Parse(reader, ueType, index = 0) {
|
|
256
|
-
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
257
|
-
const value = FloatProperty.ReadValue(reader);
|
|
258
|
-
return new FloatProperty(value, ueType, guidInfo, index);
|
|
259
|
-
}
|
|
260
|
-
static CalcOverhead(property) {
|
|
261
|
-
return 1;
|
|
262
|
-
}
|
|
263
|
-
static ReadValue(reader) {
|
|
264
|
-
return reader.readFloat32();
|
|
265
|
-
}
|
|
266
|
-
static Serialize(writer, property) {
|
|
267
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
268
|
-
FloatProperty.SerializeValue(writer, property.value);
|
|
269
|
-
}
|
|
270
|
-
static SerializeValue(writer, value) {
|
|
271
|
-
writer.writeFloat(value);
|
|
272
|
-
}
|
|
770
|
+
static CalcOverhead(property) {
|
|
771
|
+
return property.subtype.length + 5 + 1;
|
|
273
772
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
773
|
+
static Serialize(writer, property, propertyName) {
|
|
774
|
+
writer.writeString(property.subtype);
|
|
775
|
+
writer.writeByte(0);
|
|
776
|
+
writer.writeInt32(property.values.length);
|
|
777
|
+
switch (property.subtype) {
|
|
778
|
+
case "FloatProperty":
|
|
779
|
+
property.values.forEach(v => FloatProperty.SerializeValue(writer, v));
|
|
780
|
+
break;
|
|
781
|
+
case "BoolProperty":
|
|
782
|
+
property.values.forEach(v => BoolProperty.SerializeValue(writer, v));
|
|
783
|
+
break;
|
|
784
|
+
case "IntProperty":
|
|
785
|
+
property.values.forEach(v => Int32Property.SerializeValue(writer, v));
|
|
786
|
+
break;
|
|
787
|
+
case "Int64Property":
|
|
788
|
+
property.values.forEach(v => Int64Property.SerializeValue(writer, v));
|
|
789
|
+
break;
|
|
790
|
+
case "DoubleProperty":
|
|
791
|
+
property.values.forEach(v => DoubleProperty.SerializeValue(writer, v));
|
|
792
|
+
break;
|
|
793
|
+
case "ByteProperty":
|
|
794
|
+
property.values.forEach(v => ByteProperty.SerializeValue(writer, v));
|
|
795
|
+
break;
|
|
796
|
+
case "StrProperty":
|
|
797
|
+
property.values.forEach(v => StrProperty.SerializeValue(writer, v));
|
|
798
|
+
break;
|
|
799
|
+
case "EnumProperty":
|
|
800
|
+
property.values.forEach(v => EnumProperty.SerializeValue(writer, v));
|
|
801
|
+
break;
|
|
802
|
+
case "TextProperty":
|
|
803
|
+
property.values.forEach(v => TextProperty.SerializeValue(writer, v));
|
|
804
|
+
break;
|
|
805
|
+
case "InterfaceProperty":
|
|
806
|
+
case "ObjectProperty":
|
|
807
|
+
property.values.forEach(v => ObjectProperty.SerializeValue(writer, v));
|
|
808
|
+
break;
|
|
809
|
+
case "StructProperty":
|
|
810
|
+
writer.writeString(propertyName);
|
|
811
|
+
writer.writeString(property.subtype);
|
|
812
|
+
const lenIndicator = writer.getBufferPosition();
|
|
813
|
+
writer.writeInt32(0);
|
|
814
|
+
writer.writeInt32(property.structValueFields.allIndex);
|
|
815
|
+
writer.writeString(property.structValueFields.allStructType);
|
|
816
|
+
writer.writeInt32(property.structValueFields.allGuid);
|
|
817
|
+
writer.writeInt32(property.structValueFields.allUnk1 ?? 0);
|
|
818
|
+
writer.writeInt32(property.structValueFields.allUnk2 ?? 0);
|
|
819
|
+
writer.writeInt32(property.structValueFields.allUnk3 ?? 0);
|
|
820
|
+
writer.writeByte(property.structValueFields.allUnk4 ?? 0);
|
|
821
|
+
const before = writer.getBufferPosition();
|
|
822
|
+
property.values.forEach(v => StructProperty.SerializeValue(writer, property.structValueFields.allStructType, v.value));
|
|
823
|
+
writer.writeBinarySizeFromPosition(lenIndicator, before);
|
|
824
|
+
break;
|
|
825
|
+
default:
|
|
826
|
+
console.log(property.type, property.ueType);
|
|
827
|
+
throw new Error();
|
|
297
828
|
}
|
|
298
829
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
307
|
-
const value = StrProperty.ReadValue(reader);
|
|
308
|
-
return new StrProperty(value, ueType, guidInfo, index);
|
|
309
|
-
}
|
|
310
|
-
static ReadValue(reader) {
|
|
311
|
-
return reader.readString();
|
|
312
|
-
}
|
|
313
|
-
static CalcOverhead(property) {
|
|
314
|
-
return 1;
|
|
315
|
-
}
|
|
316
|
-
static Serialize(writer, property) {
|
|
317
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
318
|
-
StrProperty.SerializeValue(writer, property.value);
|
|
319
|
-
}
|
|
320
|
-
static SerializeValue(writer, value) {
|
|
321
|
-
writer.writeString(value);
|
|
322
|
-
}
|
|
830
|
+
}
|
|
831
|
+
exports.ArrayProperty = ArrayProperty;
|
|
832
|
+
class SetProperty extends BasicProperty {
|
|
833
|
+
constructor(subtype, values, ueType, index) {
|
|
834
|
+
super('SetProperty', ueType, undefined, index);
|
|
835
|
+
this.subtype = subtype;
|
|
836
|
+
this.values = values;
|
|
323
837
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
static SerializeValue(writer, value) {
|
|
350
|
-
writer.writeString(value.levelName);
|
|
351
|
-
writer.writeString(value.pathName);
|
|
352
|
-
}
|
|
838
|
+
static Parse(reader, ueType, index, propertyName) {
|
|
839
|
+
const subtype = reader.readString();
|
|
840
|
+
reader.skipBytes(1);
|
|
841
|
+
reader.skipBytes(4);
|
|
842
|
+
const elementCount = reader.readInt32();
|
|
843
|
+
let property;
|
|
844
|
+
switch (subtype) {
|
|
845
|
+
case "IntProperty":
|
|
846
|
+
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index);
|
|
847
|
+
break;
|
|
848
|
+
case "ObjectProperty":
|
|
849
|
+
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index);
|
|
850
|
+
break;
|
|
851
|
+
case "NameProperty":
|
|
852
|
+
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index);
|
|
853
|
+
break;
|
|
854
|
+
case "StructProperty":
|
|
855
|
+
if (propertyName === 'mRemovalLocations') {
|
|
856
|
+
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => (0, util_types_1.ParseVec3)(reader)), ueType, index);
|
|
857
|
+
}
|
|
858
|
+
break;
|
|
859
|
+
default:
|
|
860
|
+
throw new Error('Not Implemented.');
|
|
861
|
+
}
|
|
862
|
+
return property;
|
|
353
863
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
constructor(value, ueType = 'EnumProperty', guidInfo = undefined, index = 0) {
|
|
357
|
-
super('EnumProperty', ueType, guidInfo, index);
|
|
358
|
-
this.value = value;
|
|
359
|
-
}
|
|
360
|
-
static Parse(reader, ueType, index = 0) {
|
|
361
|
-
let name = reader.readString();
|
|
362
|
-
const guidInfo = (0, exports.ParseGUID)(reader);
|
|
363
|
-
const value = EnumProperty.ReadValue(reader);
|
|
364
|
-
const property = new EnumProperty({ name, value }, ueType, guidInfo, index);
|
|
365
|
-
return property;
|
|
366
|
-
}
|
|
367
|
-
static ReadValue(reader) {
|
|
368
|
-
return reader.readString();
|
|
369
|
-
}
|
|
370
|
-
static CalcOverhead(property) {
|
|
371
|
-
return property.value.name.length + 6;
|
|
372
|
-
}
|
|
373
|
-
static Serialize(writer, property) {
|
|
374
|
-
writer.writeString(property.value.name);
|
|
375
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
376
|
-
EnumProperty.SerializeValue(writer, property.value.value);
|
|
377
|
-
}
|
|
378
|
-
static SerializeValue(writer, value) {
|
|
379
|
-
writer.writeString(value);
|
|
380
|
-
}
|
|
864
|
+
static CalcOverhead(property) {
|
|
865
|
+
return property.subtype.length + 5 + 1;
|
|
381
866
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
prop.value = reader.readString();
|
|
403
|
-
break;
|
|
404
|
-
case 1:
|
|
405
|
-
case 3:
|
|
406
|
-
prop.sourceFmt = TextProperty.ParseValue(reader);
|
|
407
|
-
const argumentsCount = reader.readInt32();
|
|
408
|
-
prop.arguments = [];
|
|
409
|
-
for (let i = 0; i < argumentsCount; i++) {
|
|
410
|
-
let currentArgumentsData = {};
|
|
411
|
-
currentArgumentsData.name = reader.readString();
|
|
412
|
-
currentArgumentsData.valueType = reader.readByte();
|
|
413
|
-
switch (currentArgumentsData.valueType) {
|
|
414
|
-
case 4:
|
|
415
|
-
currentArgumentsData.argumentValue = TextProperty.ParseValue(reader);
|
|
416
|
-
break;
|
|
417
|
-
default:
|
|
418
|
-
throw new Error('Unimplemented FormatArgumentType `' + currentArgumentsData.valueType);
|
|
419
|
-
}
|
|
420
|
-
prop.arguments.push(currentArgumentsData);
|
|
421
|
-
}
|
|
422
|
-
break;
|
|
423
|
-
case 10:
|
|
424
|
-
prop.sourceText = TextProperty.ParseValue(reader);
|
|
425
|
-
prop.transformType = reader.readByte();
|
|
426
|
-
break;
|
|
427
|
-
case 255:
|
|
428
|
-
prop.hasCultureInvariantString = reader.readInt32() === 1;
|
|
429
|
-
if (prop.hasCultureInvariantString) {
|
|
430
|
-
prop.value = reader.readString();
|
|
431
|
-
}
|
|
432
|
-
break;
|
|
433
|
-
default:
|
|
434
|
-
throw new Error('Unimplemented historyType `' + prop.historyType);
|
|
435
|
-
}
|
|
436
|
-
return prop;
|
|
437
|
-
}
|
|
438
|
-
static CalcOverhead(property) {
|
|
439
|
-
return 1;
|
|
440
|
-
}
|
|
441
|
-
static Serialize(writer, property) {
|
|
442
|
-
(0, exports.SerializeGUID)(writer, property.guidInfo);
|
|
443
|
-
TextProperty.SerializeValue(writer, property.value);
|
|
444
|
-
}
|
|
445
|
-
static SerializeValue(writer, value) {
|
|
446
|
-
writer.writeInt32(value.flags);
|
|
447
|
-
writer.writeByte(value.historyType);
|
|
448
|
-
switch (value.historyType) {
|
|
449
|
-
case 0:
|
|
450
|
-
writer.writeString(value.namespace);
|
|
451
|
-
writer.writeString(value.key);
|
|
452
|
-
writer.writeString(value.value);
|
|
453
|
-
break;
|
|
454
|
-
case 1:
|
|
455
|
-
case 3:
|
|
456
|
-
TextProperty.SerializeValue(writer, value.sourceFmt);
|
|
457
|
-
writer.writeInt32(value.arguments.length);
|
|
458
|
-
for (const arg of value.arguments) {
|
|
459
|
-
let currentArgumentsData = {};
|
|
460
|
-
writer.writeString(arg.name);
|
|
461
|
-
writer.writeByte(arg.valueType);
|
|
462
|
-
switch (arg.valueType) {
|
|
463
|
-
case 4:
|
|
464
|
-
TextProperty.SerializeValue(writer, arg.argumentValue);
|
|
465
|
-
break;
|
|
466
|
-
default:
|
|
467
|
-
throw new Error('Unimplemented FormatArgumentType `' + currentArgumentsData.valueType);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
break;
|
|
471
|
-
case 10:
|
|
472
|
-
TextProperty.SerializeValue(writer, value.sourceText);
|
|
473
|
-
writer.writeByte(value.transformType);
|
|
474
|
-
break;
|
|
475
|
-
case 255:
|
|
476
|
-
writer.writeInt32(value.hasCultureInvariantString ? 1 : 0);
|
|
477
|
-
if (value.hasCultureInvariantString) {
|
|
478
|
-
writer.writeString(value.value);
|
|
479
|
-
}
|
|
480
|
-
break;
|
|
481
|
-
default:
|
|
482
|
-
throw new Error('Unimplemented historyType `' + value.historyType);
|
|
483
|
-
}
|
|
867
|
+
static Serialize(writer, property) {
|
|
868
|
+
writer.writeString(property.subtype);
|
|
869
|
+
writer.writeByte(0);
|
|
870
|
+
writer.writeInt32(0);
|
|
871
|
+
writer.writeInt32(property.values.length);
|
|
872
|
+
switch (property.subtype) {
|
|
873
|
+
case "IntProperty":
|
|
874
|
+
property.values.forEach(v => Int32Property.SerializeValue(writer, v));
|
|
875
|
+
break;
|
|
876
|
+
case "ObjectProperty":
|
|
877
|
+
property.values.forEach(v => ObjectProperty.SerializeValue(writer, v));
|
|
878
|
+
break;
|
|
879
|
+
case "NameProperty":
|
|
880
|
+
property.values.forEach(v => StrProperty.SerializeValue(writer, v));
|
|
881
|
+
break;
|
|
882
|
+
case "StructProperty":
|
|
883
|
+
property.values.forEach(v => (0, util_types_1.SerializeVec3)(writer, v));
|
|
884
|
+
break;
|
|
885
|
+
default:
|
|
886
|
+
throw new Error('Not Implemented.');
|
|
484
887
|
}
|
|
485
888
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
struct.unk1 = unk1;
|
|
499
|
-
}
|
|
500
|
-
const unk2 = reader.readInt32();
|
|
501
|
-
if (unk2 !== 0) {
|
|
502
|
-
struct.unk2 = unk2;
|
|
503
|
-
}
|
|
504
|
-
const unk3 = reader.readInt32();
|
|
505
|
-
if (unk2 !== 0) {
|
|
506
|
-
struct.unk3 = unk3;
|
|
507
|
-
}
|
|
508
|
-
const unk4 = reader.readByte();
|
|
509
|
-
if (unk4 !== 0) {
|
|
510
|
-
struct.unk4 = unk4;
|
|
511
|
-
}
|
|
512
|
-
const before = reader.getBufferPosition();
|
|
513
|
-
struct.value = StructProperty.ParseValue(reader, struct.subtype, size);
|
|
514
|
-
const readBytes = reader.getBufferPosition() - before;
|
|
515
|
-
if (readBytes !== size) {
|
|
516
|
-
throw new Error(`possibly corrupt. Read ${readBytes} for StructProperty Content of ${struct.subtype}, but ${size} were indicated.`);
|
|
517
|
-
}
|
|
518
|
-
return struct;
|
|
519
|
-
}
|
|
520
|
-
static ParseValue(reader, subtype, size) {
|
|
521
|
-
let value;
|
|
522
|
-
switch (subtype) {
|
|
523
|
-
case 'Color':
|
|
524
|
-
value = (0, util_types_1.ParseCol4BGRA)(reader);
|
|
525
|
-
break;
|
|
526
|
-
case 'LinearColor':
|
|
527
|
-
value = (0, util_types_1.ParseCol4RGBA)(reader);
|
|
528
|
-
break;
|
|
529
|
-
case 'Vector':
|
|
530
|
-
case 'Rotator':
|
|
531
|
-
case 'Vector2D':
|
|
532
|
-
value = (0, util_types_1.ParseVec3)(reader);
|
|
533
|
-
break;
|
|
534
|
-
case 'Quat':
|
|
535
|
-
case 'Vector4':
|
|
536
|
-
case 'Vector4D':
|
|
537
|
-
value = (0, util_types_1.ParseVec4)(reader);
|
|
538
|
-
break;
|
|
539
|
-
case 'Box':
|
|
540
|
-
value = {
|
|
541
|
-
min: (0, util_types_1.ParseVec3)(reader),
|
|
542
|
-
max: (0, util_types_1.ParseVec3)(reader),
|
|
543
|
-
isValid: reader.readByte() >= 1
|
|
544
|
-
};
|
|
545
|
-
break;
|
|
546
|
-
case 'RailroadTrackPosition':
|
|
547
|
-
value = {
|
|
548
|
-
root: reader.readString(),
|
|
549
|
-
instanceName: reader.readString(),
|
|
550
|
-
offset: reader.readFloat32(),
|
|
551
|
-
forward: reader.readFloat32()
|
|
552
|
-
};
|
|
553
|
-
break;
|
|
554
|
-
case 'TimerHandle':
|
|
555
|
-
value = reader.readString();
|
|
556
|
-
break;
|
|
557
|
-
case 'Guid':
|
|
558
|
-
value = reader.readString();
|
|
559
|
-
break;
|
|
560
|
-
case 'InventoryItem':
|
|
561
|
-
value = {
|
|
562
|
-
unk1: reader.readInt32(),
|
|
563
|
-
itemName: reader.readString(),
|
|
564
|
-
unk2: reader.readString(),
|
|
565
|
-
unk3: reader.readString(),
|
|
566
|
-
properties: [],
|
|
567
|
-
};
|
|
568
|
-
break;
|
|
569
|
-
case 'FluidBox':
|
|
570
|
-
value = {
|
|
571
|
-
value: reader.readFloat32()
|
|
572
|
-
};
|
|
573
|
-
break;
|
|
574
|
-
case 'SlateBrush':
|
|
575
|
-
value = reader.readString();
|
|
576
|
-
break;
|
|
577
|
-
case 'DateTime':
|
|
578
|
-
value = reader.readInt64().toString();
|
|
579
|
-
break;
|
|
580
|
-
case 'FINNetworkTrace':
|
|
581
|
-
value = (0, exports.ReadFINNetworkTrace)(reader);
|
|
582
|
-
break;
|
|
583
|
-
case 'FINLuaProcessorStateStorage':
|
|
584
|
-
value = {
|
|
585
|
-
values: (0, exports.ReadFINLuaProcessorStateStorage)(reader, size)
|
|
586
|
-
};
|
|
587
|
-
break;
|
|
588
|
-
case 'FICFrameRange':
|
|
589
|
-
value = {
|
|
590
|
-
begin: reader.readInt64().toString(),
|
|
591
|
-
end: reader.readInt64().toString(),
|
|
592
|
-
};
|
|
593
|
-
break;
|
|
594
|
-
default:
|
|
595
|
-
value = (0, exports.ParseDynamicStructData)(reader, 0, subtype);
|
|
596
|
-
}
|
|
597
|
-
return value;
|
|
598
|
-
}
|
|
599
|
-
static CalcOverhead(property) {
|
|
600
|
-
return property.subtype.length + 5 + 17;
|
|
601
|
-
}
|
|
602
|
-
static Serialize(writer, property) {
|
|
603
|
-
writer.writeString(property.subtype);
|
|
604
|
-
writer.writeInt32(property.guid);
|
|
605
|
-
writer.writeInt32(property.unk1 ?? 0);
|
|
606
|
-
writer.writeInt32(property.unk2 ?? 0);
|
|
607
|
-
writer.writeInt32(property.unk3 ?? 0);
|
|
608
|
-
writer.writeByte(property.unk4 ?? 0);
|
|
609
|
-
StructProperty.SerializeValue(writer, property.subtype, property.value);
|
|
610
|
-
}
|
|
611
|
-
static SerializeValue(writer, subtype, value) {
|
|
612
|
-
switch (subtype) {
|
|
613
|
-
case 'Color':
|
|
614
|
-
value = value;
|
|
615
|
-
(0, util_types_1.SerializeCol4BGRA)(writer, value);
|
|
616
|
-
break;
|
|
617
|
-
case 'LinearColor':
|
|
618
|
-
value = value;
|
|
619
|
-
(0, util_types_1.SerializeCol4RGBA)(writer, value);
|
|
620
|
-
break;
|
|
621
|
-
case 'Vector':
|
|
622
|
-
case 'Rotator':
|
|
623
|
-
case 'Vector2D':
|
|
624
|
-
value = value;
|
|
625
|
-
(0, util_types_1.SerializeVec3)(writer, value);
|
|
626
|
-
break;
|
|
627
|
-
case 'Quat':
|
|
628
|
-
case 'Vector4':
|
|
629
|
-
case 'Vector4D':
|
|
630
|
-
value = value;
|
|
631
|
-
(0, util_types_1.SerializeVec4)(writer, value);
|
|
632
|
-
break;
|
|
633
|
-
case 'Box':
|
|
634
|
-
value = value;
|
|
635
|
-
(0, util_types_1.SerializeVec3)(writer, value.min);
|
|
636
|
-
(0, util_types_1.SerializeVec3)(writer, value.max);
|
|
637
|
-
writer.writeByte(value.isValid ? 1 : 0);
|
|
638
|
-
break;
|
|
639
|
-
case 'RailroadTrackPosition':
|
|
640
|
-
value = value;
|
|
641
|
-
writer.writeString(value.root);
|
|
642
|
-
writer.writeString(value.instanceName);
|
|
643
|
-
writer.writeFloat(value.offset);
|
|
644
|
-
writer.writeFloat(value.forward);
|
|
645
|
-
break;
|
|
646
|
-
case 'TimerHandle':
|
|
647
|
-
value = value;
|
|
648
|
-
writer.writeString(value);
|
|
649
|
-
break;
|
|
650
|
-
case 'Guid':
|
|
651
|
-
value = value;
|
|
652
|
-
writer.writeString(value);
|
|
653
|
-
break;
|
|
654
|
-
case 'InventoryItem':
|
|
655
|
-
value = value;
|
|
656
|
-
writer.writeInt32(value.unk1);
|
|
657
|
-
writer.writeString(value.itemName);
|
|
658
|
-
writer.writeString(value.unk2);
|
|
659
|
-
writer.writeString(value.unk3);
|
|
660
|
-
break;
|
|
661
|
-
case 'FluidBox':
|
|
662
|
-
value = value;
|
|
663
|
-
writer.writeFloat(value.value);
|
|
664
|
-
break;
|
|
665
|
-
case 'SlateBrush':
|
|
666
|
-
value = value;
|
|
667
|
-
writer.writeString(value);
|
|
668
|
-
break;
|
|
669
|
-
case 'DateTime':
|
|
670
|
-
value = value;
|
|
671
|
-
writer.writeInt64(BigInt(value));
|
|
672
|
-
break;
|
|
673
|
-
case 'FINNetworkTrace':
|
|
674
|
-
value = value;
|
|
675
|
-
(0, exports.SerializeFINNetworkTrace)(writer, value);
|
|
676
|
-
break;
|
|
677
|
-
case 'FINLuaProcessorStateStorage':
|
|
678
|
-
value = value;
|
|
679
|
-
(0, exports.SerializeFINLuaProcessorStateStorage)(writer, value.values);
|
|
680
|
-
break;
|
|
681
|
-
case 'FICFrameRange':
|
|
682
|
-
value = value;
|
|
683
|
-
writer.writeInt64(BigInt(value.begin));
|
|
684
|
-
writer.writeInt64(BigInt(value.end));
|
|
685
|
-
break;
|
|
686
|
-
default:
|
|
687
|
-
value = value;
|
|
688
|
-
(0, exports.SerializeDynamicStructData)(writer, 0, value);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
889
|
+
}
|
|
890
|
+
exports.SetProperty = SetProperty;
|
|
891
|
+
class MapProperty extends BasicProperty {
|
|
892
|
+
constructor(keyType, valueType, ueType, index) {
|
|
893
|
+
super('MapProperty', ueType, undefined, index);
|
|
894
|
+
this.keyType = keyType;
|
|
895
|
+
this.valueType = valueType;
|
|
896
|
+
this.modeType = 2;
|
|
897
|
+
this.modeUnk2 = '';
|
|
898
|
+
this.modeUnk3 = '';
|
|
899
|
+
this.remainingData = [];
|
|
900
|
+
this.values = [];
|
|
691
901
|
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
}
|
|
700
|
-
static Parse(reader, ueType, index, propertyName) {
|
|
701
|
-
const subtype = reader.readString();
|
|
702
|
-
reader.skipBytes();
|
|
703
|
-
let property;
|
|
704
|
-
const elementCount = reader.readInt32();
|
|
705
|
-
switch (subtype) {
|
|
706
|
-
case "FloatProperty":
|
|
707
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => FloatProperty.ReadValue(reader)), ueType, index);
|
|
708
|
-
break;
|
|
709
|
-
case "BoolProperty":
|
|
710
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => BoolProperty.ReadValue(reader)), ueType, index);
|
|
711
|
-
break;
|
|
712
|
-
case "IntProperty":
|
|
713
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index);
|
|
714
|
-
break;
|
|
715
|
-
case "Int64Property":
|
|
716
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int64Property.ReadValue(reader)), ueType, index);
|
|
717
|
-
break;
|
|
718
|
-
case "DoubleProperty":
|
|
719
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => DoubleProperty.ReadValue(reader)), ueType, index);
|
|
720
|
-
break;
|
|
721
|
-
case "ByteProperty":
|
|
722
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ByteProperty.ReadValue(reader)), ueType, index);
|
|
723
|
-
break;
|
|
724
|
-
case "StrProperty":
|
|
725
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index);
|
|
726
|
-
break;
|
|
727
|
-
case "EnumProperty":
|
|
728
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => EnumProperty.ReadValue(reader)), ueType, index);
|
|
729
|
-
break;
|
|
730
|
-
case "TextProperty":
|
|
731
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => TextProperty.ParseValue(reader)), ueType, index);
|
|
732
|
-
break;
|
|
733
|
-
case "InterfaceProperty":
|
|
734
|
-
case "ObjectProperty":
|
|
735
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index);
|
|
736
|
-
break;
|
|
737
|
-
case "StructProperty":
|
|
738
|
-
const name = reader.readString();
|
|
739
|
-
const type = reader.readString();
|
|
740
|
-
const binarySize = reader.readInt32();
|
|
741
|
-
const allIndex = reader.readInt32();
|
|
742
|
-
const allStructType = reader.readString();
|
|
743
|
-
const allGuid = reader.readInt32();
|
|
744
|
-
const allUnk1 = reader.readInt32();
|
|
745
|
-
const allUnk2 = reader.readInt32();
|
|
746
|
-
const allUnk3 = reader.readInt32();
|
|
747
|
-
const allUnk4 = reader.readByte();
|
|
748
|
-
const innerStructValueFields = { allStructType, allIndex, allGuid };
|
|
749
|
-
if (allUnk1 !== 0) {
|
|
750
|
-
innerStructValueFields.allUnk1 = allUnk1;
|
|
751
|
-
}
|
|
752
|
-
if (allUnk2 !== 0) {
|
|
753
|
-
innerStructValueFields.allUnk2 = allUnk2;
|
|
754
|
-
}
|
|
755
|
-
if (allUnk3 !== 0) {
|
|
756
|
-
innerStructValueFields.allUnk3 = allUnk3;
|
|
757
|
-
}
|
|
758
|
-
if (allUnk4 !== 0) {
|
|
759
|
-
innerStructValueFields.allUnk4 = allUnk4;
|
|
760
|
-
}
|
|
761
|
-
const before = reader.getBufferPosition();
|
|
762
|
-
const maArr = new Array(elementCount).fill(0).map(() => {
|
|
763
|
-
const struct = new StructProperty(allStructType, type, allIndex, allGuid);
|
|
764
|
-
struct.value = StructProperty.ParseValue(reader, allStructType, binarySize);
|
|
765
|
-
return struct;
|
|
766
|
-
});
|
|
767
|
-
const readBytees = reader.getBufferPosition() - before;
|
|
768
|
-
if (readBytees !== binarySize) {
|
|
769
|
-
throw new Error('possibly corrupt in array of struct.');
|
|
770
|
-
}
|
|
771
|
-
property = new ArrayProperty(subtype, maArr, ueType, index, innerStructValueFields);
|
|
772
|
-
break;
|
|
773
|
-
default:
|
|
774
|
-
console.log(subtype, ueType);
|
|
775
|
-
throw new Error();
|
|
776
|
-
}
|
|
777
|
-
return property;
|
|
778
|
-
}
|
|
779
|
-
static CalcOverhead(property) {
|
|
780
|
-
return property.subtype.length + 5 + 1;
|
|
781
|
-
}
|
|
782
|
-
static Serialize(writer, property, propertyName) {
|
|
783
|
-
writer.writeString(property.subtype);
|
|
784
|
-
writer.writeByte(0);
|
|
785
|
-
writer.writeInt32(property.values.length);
|
|
786
|
-
switch (property.subtype) {
|
|
787
|
-
case "FloatProperty":
|
|
788
|
-
property.values.forEach(v => FloatProperty.SerializeValue(writer, v));
|
|
789
|
-
break;
|
|
790
|
-
case "BoolProperty":
|
|
791
|
-
property.values.forEach(v => BoolProperty.SerializeValue(writer, v));
|
|
792
|
-
break;
|
|
793
|
-
case "IntProperty":
|
|
794
|
-
property.values.forEach(v => Int32Property.SerializeValue(writer, v));
|
|
795
|
-
break;
|
|
796
|
-
case "Int64Property":
|
|
797
|
-
property.values.forEach(v => Int64Property.SerializeValue(writer, v));
|
|
798
|
-
break;
|
|
799
|
-
case "DoubleProperty":
|
|
800
|
-
property.values.forEach(v => DoubleProperty.SerializeValue(writer, v));
|
|
801
|
-
break;
|
|
802
|
-
case "ByteProperty":
|
|
803
|
-
property.values.forEach(v => ByteProperty.SerializeValue(writer, v));
|
|
804
|
-
break;
|
|
805
|
-
case "StrProperty":
|
|
806
|
-
property.values.forEach(v => StrProperty.SerializeValue(writer, v));
|
|
807
|
-
break;
|
|
808
|
-
case "EnumProperty":
|
|
809
|
-
property.values.forEach(v => EnumProperty.SerializeValue(writer, v));
|
|
810
|
-
break;
|
|
811
|
-
case "TextProperty":
|
|
812
|
-
property.values.forEach(v => TextProperty.SerializeValue(writer, v));
|
|
813
|
-
break;
|
|
814
|
-
case "InterfaceProperty":
|
|
815
|
-
case "ObjectProperty":
|
|
816
|
-
property.values.forEach(v => ObjectProperty.SerializeValue(writer, v));
|
|
817
|
-
break;
|
|
818
|
-
case "StructProperty":
|
|
819
|
-
writer.writeString(propertyName);
|
|
820
|
-
writer.writeString(property.subtype);
|
|
821
|
-
const lenIndicator = writer.getBufferPosition();
|
|
822
|
-
writer.writeInt32(0);
|
|
823
|
-
writer.writeInt32(property.structValueFields.allIndex);
|
|
824
|
-
writer.writeString(property.structValueFields.allStructType);
|
|
825
|
-
writer.writeInt32(property.structValueFields.allGuid);
|
|
826
|
-
writer.writeInt32(property.structValueFields.allUnk1 ?? 0);
|
|
827
|
-
writer.writeInt32(property.structValueFields.allUnk2 ?? 0);
|
|
828
|
-
writer.writeInt32(property.structValueFields.allUnk3 ?? 0);
|
|
829
|
-
writer.writeByte(property.structValueFields.allUnk4 ?? 0);
|
|
830
|
-
const before = writer.getBufferPosition();
|
|
831
|
-
property.values.forEach(v => StructProperty.SerializeValue(writer, property.structValueFields.allStructType, v.value));
|
|
832
|
-
writer.writeBinarySizeFromPosition(lenIndicator, before);
|
|
833
|
-
break;
|
|
834
|
-
default:
|
|
835
|
-
console.log(property.type, property.ueType);
|
|
836
|
-
throw new Error();
|
|
837
|
-
}
|
|
838
|
-
}
|
|
902
|
+
static Parse(reader, propertyName, buildVersion, size, ueType = 'MapProperty', index = 0) {
|
|
903
|
+
const start = reader.getBufferPosition();
|
|
904
|
+
const property = new MapProperty(reader.readString(), reader.readString(), ueType, index);
|
|
905
|
+
reader.skipBytes(1);
|
|
906
|
+
property.modeType = reader.readInt32();
|
|
907
|
+
property.remainingData = Array.from(reader.readBytes(size - 4));
|
|
908
|
+
return property;
|
|
839
909
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
constructor(subtype, values, ueType, index) {
|
|
843
|
-
super('SetProperty', ueType, undefined, index);
|
|
844
|
-
this.subtype = subtype;
|
|
845
|
-
this.values = values;
|
|
846
|
-
}
|
|
847
|
-
static Parse(reader, ueType, index, propertyName) {
|
|
848
|
-
const subtype = reader.readString();
|
|
849
|
-
reader.skipBytes(1);
|
|
850
|
-
reader.skipBytes(4);
|
|
851
|
-
const elementCount = reader.readInt32();
|
|
852
|
-
let property;
|
|
853
|
-
switch (subtype) {
|
|
854
|
-
case "IntProperty":
|
|
855
|
-
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index);
|
|
856
|
-
break;
|
|
857
|
-
case "ObjectProperty":
|
|
858
|
-
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index);
|
|
859
|
-
break;
|
|
860
|
-
case "NameProperty":
|
|
861
|
-
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index);
|
|
862
|
-
break;
|
|
863
|
-
case "StructProperty":
|
|
864
|
-
if (propertyName === 'mRemovalLocations') {
|
|
865
|
-
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => (0, util_types_1.ParseVec3)(reader)), ueType, index);
|
|
866
|
-
}
|
|
867
|
-
break;
|
|
868
|
-
default:
|
|
869
|
-
throw new Error('Not Implemented.');
|
|
870
|
-
}
|
|
871
|
-
return property;
|
|
872
|
-
}
|
|
873
|
-
static CalcOverhead(property) {
|
|
874
|
-
return property.subtype.length + 5 + 1;
|
|
875
|
-
}
|
|
876
|
-
static Serialize(writer, property) {
|
|
877
|
-
writer.writeString(property.subtype);
|
|
878
|
-
writer.writeByte(0);
|
|
879
|
-
writer.writeInt32(0);
|
|
880
|
-
writer.writeInt32(property.values.length);
|
|
881
|
-
switch (property.subtype) {
|
|
882
|
-
case "IntProperty":
|
|
883
|
-
property.values.forEach(v => Int32Property.SerializeValue(writer, v));
|
|
884
|
-
break;
|
|
885
|
-
case "ObjectProperty":
|
|
886
|
-
property.values.forEach(v => ObjectProperty.SerializeValue(writer, v));
|
|
887
|
-
break;
|
|
888
|
-
case "NameProperty":
|
|
889
|
-
property.values.forEach(v => StrProperty.SerializeValue(writer, v));
|
|
890
|
-
break;
|
|
891
|
-
case "StructProperty":
|
|
892
|
-
property.values.forEach(v => (0, util_types_1.SerializeVec3)(writer, v));
|
|
893
|
-
break;
|
|
894
|
-
default:
|
|
895
|
-
throw new Error('Not Implemented.');
|
|
896
|
-
}
|
|
897
|
-
}
|
|
910
|
+
static CalcOverhead(property) {
|
|
911
|
+
return property.keyType.length + 5 + property.valueType.length + 5 + 1;
|
|
898
912
|
}
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
this.modeType = 2;
|
|
906
|
-
this.modeUnk2 = '';
|
|
907
|
-
this.modeUnk3 = '';
|
|
908
|
-
this.remainingData = [];
|
|
909
|
-
this.values = [];
|
|
910
|
-
}
|
|
911
|
-
static Parse(reader, propertyName, buildVersion, size, ueType = 'MapProperty', index = 0) {
|
|
912
|
-
const start = reader.getBufferPosition();
|
|
913
|
-
const property = new MapProperty(reader.readString(), reader.readString(), ueType, index);
|
|
914
|
-
reader.skipBytes(1);
|
|
915
|
-
property.modeType = reader.readInt32();
|
|
916
|
-
property.remainingData = Array.from(reader.readBytes(size - 4));
|
|
917
|
-
return property;
|
|
918
|
-
}
|
|
919
|
-
static CalcOverhead(property) {
|
|
920
|
-
return property.keyType.length + 5 + property.valueType.length + 5 + 1;
|
|
921
|
-
}
|
|
922
|
-
static Serialize(writer, property) {
|
|
923
|
-
writer.writeString(property.keyType);
|
|
924
|
-
writer.writeString(property.valueType);
|
|
925
|
-
writer.writeByte(0);
|
|
926
|
-
writer.writeInt32(property.modeType);
|
|
927
|
-
writer.writeBytesArray(property.remainingData);
|
|
928
|
-
}
|
|
913
|
+
static Serialize(writer, property) {
|
|
914
|
+
writer.writeString(property.keyType);
|
|
915
|
+
writer.writeString(property.valueType);
|
|
916
|
+
writer.writeByte(0);
|
|
917
|
+
writer.writeInt32(property.modeType);
|
|
918
|
+
writer.writeBytesArray(property.remainingData);
|
|
929
919
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}
|
|
935
|
-
const pos = reader.getBufferPosition();
|
|
936
|
-
let propertyName = reader.readString();
|
|
937
|
-
while (propertyName !== 'None') {
|
|
938
|
-
const property = DataFields_1.DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
939
|
-
data.properties[propertyName] = property;
|
|
940
|
-
propertyName = reader.readString();
|
|
941
|
-
}
|
|
942
|
-
return data;
|
|
920
|
+
}
|
|
921
|
+
exports.MapProperty = MapProperty;
|
|
922
|
+
const ParseDynamicStructData = (reader, buildVersion, type) => {
|
|
923
|
+
const data = {
|
|
924
|
+
type, properties: {}
|
|
943
925
|
};
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
stateStorage.
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
926
|
+
const pos = reader.getBufferPosition();
|
|
927
|
+
let propertyName = reader.readString();
|
|
928
|
+
while (propertyName !== 'None') {
|
|
929
|
+
const property = DataFields_1.DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
930
|
+
data.properties[propertyName] = property;
|
|
931
|
+
propertyName = reader.readString();
|
|
932
|
+
}
|
|
933
|
+
return data;
|
|
934
|
+
};
|
|
935
|
+
exports.ParseDynamicStructData = ParseDynamicStructData;
|
|
936
|
+
const SerializeDynamicStructData = (writer, buildVersion, data) => {
|
|
937
|
+
for (const key in data.properties) {
|
|
938
|
+
writer.writeString(key);
|
|
939
|
+
DataFields_1.DataFields.SerializeProperty(writer, data.properties[key], key, buildVersion);
|
|
940
|
+
}
|
|
941
|
+
writer.writeString('None');
|
|
942
|
+
};
|
|
943
|
+
exports.SerializeDynamicStructData = SerializeDynamicStructData;
|
|
944
|
+
const ReadFINNetworkTrace = (reader) => {
|
|
945
|
+
const networkTrace = {};
|
|
946
|
+
networkTrace.ref = ObjectReference_1.ObjectReference.Parse(reader);
|
|
947
|
+
networkTrace.hasPrev = reader.readInt32();
|
|
948
|
+
if (networkTrace.hasPrev) {
|
|
949
|
+
networkTrace.prev = (0, exports.ReadFINNetworkTrace)(reader);
|
|
950
|
+
}
|
|
951
|
+
networkTrace.hasStep = reader.readInt32();
|
|
952
|
+
if (networkTrace.hasStep) {
|
|
953
|
+
networkTrace.step = reader.readString();
|
|
954
|
+
}
|
|
955
|
+
return networkTrace;
|
|
956
|
+
};
|
|
957
|
+
exports.ReadFINNetworkTrace = ReadFINNetworkTrace;
|
|
958
|
+
const SerializeFINNetworkTrace = (writer, obj) => {
|
|
959
|
+
const networkTrace = {};
|
|
960
|
+
ObjectReference_1.ObjectReference.Serialize(writer, obj.ref);
|
|
961
|
+
writer.writeInt32(obj.hasPrev);
|
|
962
|
+
if (obj.hasPrev) {
|
|
963
|
+
(0, exports.SerializeFINNetworkTrace)(writer, obj.prev);
|
|
964
|
+
}
|
|
965
|
+
writer.writeInt32(obj.hasStep);
|
|
966
|
+
if (obj.hasStep) {
|
|
967
|
+
writer.writeString(obj.step);
|
|
968
|
+
}
|
|
969
|
+
};
|
|
970
|
+
exports.SerializeFINNetworkTrace = SerializeFINNetworkTrace;
|
|
971
|
+
const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
972
|
+
const stateStorage = { traces: [], references: [], thread: '', globals: '', remainingStructData: {} };
|
|
973
|
+
const start = reader.getBufferPosition();
|
|
974
|
+
const traceCount = reader.readInt32();
|
|
975
|
+
for (let i = 0; i < traceCount; i++) {
|
|
976
|
+
stateStorage.traces.push((0, exports.ReadFINNetworkTrace)(reader));
|
|
977
|
+
}
|
|
978
|
+
const refCount = reader.readInt32();
|
|
979
|
+
for (let i = 0; i < refCount; i++) {
|
|
980
|
+
stateStorage.references.push(ObjectReference_1.ObjectReference.Parse(reader));
|
|
981
|
+
}
|
|
982
|
+
stateStorage.thread = reader.readString();
|
|
983
|
+
stateStorage.globals = reader.readString();
|
|
984
|
+
const remaining = size - (reader.getBufferPosition() - start);
|
|
985
|
+
stateStorage.remainingStructData = reader.readBytes(remaining);
|
|
986
|
+
return stateStorage;
|
|
987
|
+
};
|
|
988
|
+
exports.ReadFINLuaProcessorStateStorage = ReadFINLuaProcessorStateStorage;
|
|
989
|
+
const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
|
|
990
|
+
writer.writeInt32(stateStorage.traces.length);
|
|
991
|
+
for (const trace of stateStorage.traces) {
|
|
992
|
+
(0, exports.SerializeFINNetworkTrace)(writer, trace);
|
|
993
|
+
}
|
|
994
|
+
writer.writeInt32(stateStorage.references.length);
|
|
995
|
+
for (const ref of stateStorage.references) {
|
|
996
|
+
ObjectReference_1.ObjectReference.Serialize(writer, ref);
|
|
997
|
+
}
|
|
998
|
+
writer.writeString(stateStorage.thread);
|
|
999
|
+
writer.writeString(stateStorage.globals);
|
|
1000
|
+
writer.writeBytes(stateStorage.remainingStructData);
|
|
1001
|
+
};
|
|
1002
|
+
exports.SerializeFINLuaProcessorStateStorage = SerializeFINLuaProcessorStateStorage;
|