@etothepii/satisfactory-file-parser 0.4.20 → 0.4.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -4
- package/build/index.d.ts +35 -36
- package/build/index.js +36 -40
- package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts +2 -2
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +12 -10
- package/build/parser/satisfactory/blueprint/blueprint-writer.d.ts +2 -2
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +6 -6
- package/build/parser/satisfactory/blueprint/blueprint.types.d.ts +6 -5
- package/build/parser/satisfactory/save/level.class.d.ts +6 -6
- package/build/parser/satisfactory/save/level.class.js +22 -22
- package/build/parser/satisfactory/save/save-reader.js +1 -1
- package/build/parser/satisfactory/save/save-writer.js +2 -2
- package/build/parser/satisfactory/save/save.types.d.ts +1 -1
- package/build/parser/satisfactory/types/objects/SaveComponent.d.ts +19 -0
- package/build/parser/satisfactory/types/objects/SaveComponent.js +31 -0
- package/build/parser/satisfactory/types/objects/SaveEntity.d.ts +30 -0
- package/build/parser/satisfactory/types/objects/SaveEntity.js +66 -0
- package/build/parser/satisfactory/types/objects/SaveObject.d.ts +24 -0
- package/build/parser/satisfactory/types/objects/SaveObject.js +33 -0
- package/build/parser/satisfactory/types/property/DataFields.d.ts +15 -0
- package/build/parser/satisfactory/types/property/DataFields.js +493 -0
- package/build/parser/satisfactory/types/property/generic/ArrayProperty.d.ts +22 -0
- package/build/parser/satisfactory/types/property/generic/ArrayProperty.js +171 -0
- package/build/parser/satisfactory/types/property/generic/BasicProperty.d.ts +25 -0
- package/build/parser/satisfactory/types/property/generic/BasicProperty.js +28 -0
- package/build/parser/satisfactory/types/property/generic/BoolProperty.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/BoolProperty.js +32 -0
- package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts +18 -0
- package/build/parser/satisfactory/types/property/generic/ByteProperty.js +52 -0
- package/build/parser/satisfactory/types/property/generic/DoubleProperty.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/DoubleProperty.js +32 -0
- package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts +20 -0
- package/build/parser/satisfactory/types/property/generic/EnumProperty.js +35 -0
- package/build/parser/satisfactory/types/property/generic/FloatProperty.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/FloatProperty.js +32 -0
- package/build/parser/satisfactory/types/property/generic/Int32Property.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/Int32Property.js +32 -0
- package/build/parser/satisfactory/types/property/generic/Int64Property.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/Int64Property.js +32 -0
- package/build/parser/satisfactory/types/property/generic/Int8Property.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/Int8Property.js +32 -0
- package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts +22 -0
- package/build/parser/satisfactory/types/property/generic/MapProperty.js +162 -0
- package/build/parser/satisfactory/types/property/generic/ObjectProperty.d.ts +15 -0
- package/build/parser/satisfactory/types/property/generic/ObjectProperty.js +37 -0
- package/build/parser/satisfactory/types/property/generic/SetProperty.d.ts +12 -0
- package/build/parser/satisfactory/types/property/generic/SetProperty.js +94 -0
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.d.ts +13 -0
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.js +27 -0
- package/build/parser/satisfactory/types/property/generic/StrProperty.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/StrProperty.js +32 -0
- package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts +69 -0
- package/build/parser/satisfactory/types/property/generic/StructProperty.js +365 -0
- package/build/parser/satisfactory/types/property/generic/TextProperty.d.ts +30 -0
- package/build/parser/satisfactory/types/property/generic/TextProperty.js +111 -0
- package/build/parser/satisfactory/types/property/generic/Uint32Property.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/Uint32Property.js +32 -0
- package/build/parser/satisfactory/types/property/generic/Uint64Property.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/Uint64Property.js +32 -0
- package/build/parser/satisfactory/types/property/generic/Uint8Property.d.ts +14 -0
- package/build/parser/satisfactory/types/property/generic/Uint8Property.js +32 -0
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperty.d.ts +54 -0
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperty.js +2 -0
- package/build/parser/satisfactory/types/structs/GUID.d.ts +7 -0
- package/build/parser/satisfactory/types/structs/GUID.js +21 -0
- package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts +8 -0
- package/build/parser/satisfactory/types/structs/GUIDInfo.js +26 -0
- package/build/parser/satisfactory/types/structs/MD5Hash.d.ts +10 -0
- package/build/parser/satisfactory/types/structs/MD5Hash.js +21 -0
- package/build/parser/satisfactory/types/structs/ObjectReference.d.ts +10 -0
- package/build/parser/satisfactory/types/structs/ObjectReference.js +17 -0
- package/build/parser/satisfactory/types/structs/SoftObjectReference.d.ts +11 -0
- package/build/parser/satisfactory/types/structs/SoftObjectReference.js +19 -0
- package/build/parser/satisfactory/types/structs/Transform.d.ts +15 -0
- package/build/parser/satisfactory/types/structs/Transform.js +32 -0
- package/build/parser/satisfactory/types/structs/col4.d.ts +14 -0
- package/build/parser/satisfactory/types/structs/col4.js +34 -0
- package/build/parser/satisfactory/types/structs/vec2.d.ts +12 -0
- package/build/parser/satisfactory/types/structs/vec2.js +26 -0
- package/build/parser/satisfactory/types/structs/vec3.d.ts +19 -0
- package/build/parser/satisfactory/types/structs/vec3.js +44 -0
- package/build/parser/satisfactory/types/structs/vec4.d.ts +12 -0
- package/build/parser/satisfactory/types/structs/vec4.js +27 -0
- package/build/parser/stream/reworked/readable-stream-parser.js +3 -3
- package/build/parser/stream/reworked/save-stream-writer.class.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SerializeFINLuaProcessorStateStorage = exports.ReadFINLuaProcessorStateStorage = exports.SerializeFINNetworkTrace = exports.ReadFINNetworkTrace = exports.SerializeDynamicStructData = exports.ParseDynamicStructData = exports.StructProperty = exports.isStructProperty = void 0;
|
|
4
|
+
const parser_error_1 = require("../../../../error/parser.error");
|
|
5
|
+
const col4_1 = require("../../structs/col4");
|
|
6
|
+
const ObjectReference_1 = require("../../structs/ObjectReference");
|
|
7
|
+
const vec3_1 = require("../../structs/vec3");
|
|
8
|
+
const vec4_1 = require("../../structs/vec4");
|
|
9
|
+
const DataFields_1 = require("../DataFields");
|
|
10
|
+
const BasicProperty_1 = require("./BasicProperty");
|
|
11
|
+
const isStructProperty = (property) => property.type === 'StructProperty';
|
|
12
|
+
exports.isStructProperty = isStructProperty;
|
|
13
|
+
class StructProperty extends BasicProperty_1.AbstractBaseProperty {
|
|
14
|
+
constructor(subtype, ueType = 'StructProperty', index = 0, guid = 0) {
|
|
15
|
+
super('StructProperty', ueType, index);
|
|
16
|
+
this.subtype = subtype;
|
|
17
|
+
this.guid = guid;
|
|
18
|
+
this.value = { values: {} };
|
|
19
|
+
}
|
|
20
|
+
static Parse(reader, ueType, index, size) {
|
|
21
|
+
const struct = new StructProperty(reader.readString(), ueType, index, reader.readInt32());
|
|
22
|
+
const unk1 = reader.readInt32();
|
|
23
|
+
if (unk1 !== 0) {
|
|
24
|
+
struct.unk1 = unk1;
|
|
25
|
+
}
|
|
26
|
+
const unk2 = reader.readInt32();
|
|
27
|
+
if (unk2 !== 0) {
|
|
28
|
+
struct.unk2 = unk2;
|
|
29
|
+
}
|
|
30
|
+
const unk3 = reader.readInt32();
|
|
31
|
+
if (unk3 !== 0) {
|
|
32
|
+
struct.unk3 = unk3;
|
|
33
|
+
}
|
|
34
|
+
const unk4 = reader.readByte();
|
|
35
|
+
if (unk4 !== 0) {
|
|
36
|
+
struct.unk4 = unk4;
|
|
37
|
+
}
|
|
38
|
+
const before = reader.getBufferPosition();
|
|
39
|
+
struct.value = StructProperty.ParseValue(reader, struct.subtype, size);
|
|
40
|
+
const readBytes = reader.getBufferPosition() - before;
|
|
41
|
+
if (readBytes !== size) {
|
|
42
|
+
if (size - readBytes === 4) {
|
|
43
|
+
reader.skipBytes(size - readBytes);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new Error(`possibly corrupt. Read ${readBytes} for StructProperty Content of ${struct.subtype}, but ${size} were indicated.`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return struct;
|
|
50
|
+
}
|
|
51
|
+
static ParseValue(reader, subtype, size) {
|
|
52
|
+
let value;
|
|
53
|
+
switch (subtype) {
|
|
54
|
+
case 'Color':
|
|
55
|
+
value = col4_1.col4.ParseBGRA(reader);
|
|
56
|
+
break;
|
|
57
|
+
case 'LinearColor':
|
|
58
|
+
value = col4_1.col4.ParseRGBA(reader);
|
|
59
|
+
break;
|
|
60
|
+
case 'Vector':
|
|
61
|
+
case 'Rotator':
|
|
62
|
+
case 'Vector2D':
|
|
63
|
+
value = (size === 12) ? vec3_1.vec3.ParseF(reader) : vec3_1.vec3.Parse(reader);
|
|
64
|
+
break;
|
|
65
|
+
case 'Quat':
|
|
66
|
+
case 'Vector4':
|
|
67
|
+
case 'Vector4D':
|
|
68
|
+
value = (size === 16) ? vec4_1.vec4.ParseF(reader) : vec4_1.vec4.Parse(reader);
|
|
69
|
+
break;
|
|
70
|
+
case 'Box':
|
|
71
|
+
value = ((size === 25) ? {
|
|
72
|
+
min: vec3_1.vec3.ParseF(reader),
|
|
73
|
+
max: vec3_1.vec3.ParseF(reader),
|
|
74
|
+
isValid: reader.readByte() >= 1
|
|
75
|
+
} : {
|
|
76
|
+
min: vec3_1.vec3.Parse(reader),
|
|
77
|
+
max: vec3_1.vec3.Parse(reader),
|
|
78
|
+
isValid: reader.readByte() >= 1
|
|
79
|
+
});
|
|
80
|
+
break;
|
|
81
|
+
case 'RailroadTrackPosition':
|
|
82
|
+
value = {
|
|
83
|
+
root: reader.readString(),
|
|
84
|
+
instanceName: reader.readString(),
|
|
85
|
+
offset: reader.readFloat32(),
|
|
86
|
+
forward: reader.readFloat32()
|
|
87
|
+
};
|
|
88
|
+
break;
|
|
89
|
+
case 'TimerHandle':
|
|
90
|
+
value = reader.readString();
|
|
91
|
+
break;
|
|
92
|
+
case 'Guid':
|
|
93
|
+
value = reader.readString();
|
|
94
|
+
break;
|
|
95
|
+
case 'ClientIdentityInfo':
|
|
96
|
+
const offlineId = reader.readString();
|
|
97
|
+
const numAccountIds = reader.readInt32();
|
|
98
|
+
const accountIds = {};
|
|
99
|
+
for (let i = 0; i < numAccountIds; i++) {
|
|
100
|
+
const platformFlagMaybe = reader.readByte();
|
|
101
|
+
const idSize = reader.readInt32();
|
|
102
|
+
const accountId = Array.from(reader.readBytes(idSize));
|
|
103
|
+
accountIds[platformFlagMaybe] = accountId;
|
|
104
|
+
}
|
|
105
|
+
value = {
|
|
106
|
+
offlineId,
|
|
107
|
+
accountIds
|
|
108
|
+
};
|
|
109
|
+
break;
|
|
110
|
+
case 'InventoryItem':
|
|
111
|
+
const before = reader.getBufferPosition();
|
|
112
|
+
value = {
|
|
113
|
+
unk1: reader.readInt32(),
|
|
114
|
+
itemName: reader.readString(),
|
|
115
|
+
hasItemState: reader.readInt32(),
|
|
116
|
+
};
|
|
117
|
+
if (value.hasItemState >= 1) {
|
|
118
|
+
const stateUnk = reader.readInt32();
|
|
119
|
+
const statePathName = reader.readString();
|
|
120
|
+
const stateBinarySize = reader.readInt32();
|
|
121
|
+
const itemStateRaw = Array.from(reader.readBytes(stateBinarySize));
|
|
122
|
+
value.itemState = {
|
|
123
|
+
unk: stateUnk,
|
|
124
|
+
pathName: statePathName,
|
|
125
|
+
binarySize: stateBinarySize,
|
|
126
|
+
itemStateRaw: itemStateRaw
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const bytesLeft = size - (reader.getBufferPosition() - before);
|
|
130
|
+
if (bytesLeft === 0 || (bytesLeft === 4 && reader.readInt32() === 0)) {
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
throw new parser_error_1.CorruptSaveError(`save may be corrupt. InventoryItem has weird format that was not seen so far and therefore not implemented. Could be that the save is ported from way before U8.`);
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
case 'FluidBox':
|
|
137
|
+
value = {
|
|
138
|
+
value: reader.readFloat32()
|
|
139
|
+
};
|
|
140
|
+
break;
|
|
141
|
+
case 'SlateBrush':
|
|
142
|
+
value = reader.readString();
|
|
143
|
+
break;
|
|
144
|
+
case 'DateTime':
|
|
145
|
+
value = reader.readInt64().toString();
|
|
146
|
+
break;
|
|
147
|
+
case 'FINNetworkTrace':
|
|
148
|
+
value = (0, exports.ReadFINNetworkTrace)(reader);
|
|
149
|
+
break;
|
|
150
|
+
case 'FINLuaProcessorStateStorage':
|
|
151
|
+
value = {
|
|
152
|
+
values: (0, exports.ReadFINLuaProcessorStateStorage)(reader, size)
|
|
153
|
+
};
|
|
154
|
+
break;
|
|
155
|
+
case 'FICFrameRange':
|
|
156
|
+
value = {
|
|
157
|
+
begin: reader.readInt64().toString(),
|
|
158
|
+
end: reader.readInt64().toString(),
|
|
159
|
+
};
|
|
160
|
+
break;
|
|
161
|
+
default:
|
|
162
|
+
value = (0, exports.ParseDynamicStructData)(reader, 0, subtype);
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
static CalcOverhead(property) {
|
|
167
|
+
return property.subtype.length + 5 + 17;
|
|
168
|
+
}
|
|
169
|
+
static Serialize(writer, property) {
|
|
170
|
+
writer.writeString(property.subtype);
|
|
171
|
+
writer.writeInt32(property.guid);
|
|
172
|
+
writer.writeInt32(property.unk1 ?? 0);
|
|
173
|
+
writer.writeInt32(property.unk2 ?? 0);
|
|
174
|
+
writer.writeInt32(property.unk3 ?? 0);
|
|
175
|
+
writer.writeByte(property.unk4 ?? 0);
|
|
176
|
+
StructProperty.SerializeValue(writer, property.subtype, property.value);
|
|
177
|
+
}
|
|
178
|
+
static SerializeValue(writer, subtype, value) {
|
|
179
|
+
switch (subtype) {
|
|
180
|
+
case 'Color':
|
|
181
|
+
value = value;
|
|
182
|
+
col4_1.col4.SerializeBGRA(writer, value);
|
|
183
|
+
break;
|
|
184
|
+
case 'LinearColor':
|
|
185
|
+
value = value;
|
|
186
|
+
col4_1.col4.SerializeRGBA(writer, value);
|
|
187
|
+
break;
|
|
188
|
+
case 'Vector':
|
|
189
|
+
case 'Rotator':
|
|
190
|
+
case 'Vector2D':
|
|
191
|
+
value = value;
|
|
192
|
+
vec3_1.vec3.Serialize(writer, value);
|
|
193
|
+
break;
|
|
194
|
+
case 'Quat':
|
|
195
|
+
case 'Vector4':
|
|
196
|
+
case 'Vector4D':
|
|
197
|
+
value = value;
|
|
198
|
+
vec4_1.vec4.Serialize(writer, value);
|
|
199
|
+
break;
|
|
200
|
+
case 'Box':
|
|
201
|
+
value = value;
|
|
202
|
+
vec3_1.vec3.Serialize(writer, value.min);
|
|
203
|
+
vec3_1.vec3.Serialize(writer, value.max);
|
|
204
|
+
writer.writeByte(value.isValid ? 1 : 0);
|
|
205
|
+
break;
|
|
206
|
+
case 'RailroadTrackPosition':
|
|
207
|
+
value = value;
|
|
208
|
+
writer.writeString(value.root);
|
|
209
|
+
writer.writeString(value.instanceName);
|
|
210
|
+
writer.writeFloat32(value.offset);
|
|
211
|
+
writer.writeFloat32(value.forward);
|
|
212
|
+
break;
|
|
213
|
+
case 'TimerHandle':
|
|
214
|
+
value = value;
|
|
215
|
+
writer.writeString(value);
|
|
216
|
+
break;
|
|
217
|
+
case 'Guid':
|
|
218
|
+
value = value;
|
|
219
|
+
writer.writeString(value);
|
|
220
|
+
break;
|
|
221
|
+
case 'ClientIdentityInfo':
|
|
222
|
+
value = value;
|
|
223
|
+
writer.writeString(value.offlineId);
|
|
224
|
+
writer.writeInt32(Object.values(value.accountIds).length);
|
|
225
|
+
for (const [platformFlagMaybe, accountId] of Object.entries(value.accountIds)) {
|
|
226
|
+
writer.writeByte(Number(platformFlagMaybe));
|
|
227
|
+
writer.writeInt32(accountId.length);
|
|
228
|
+
writer.writeBytesArray(accountId);
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
case 'InventoryItem':
|
|
232
|
+
value = value;
|
|
233
|
+
writer.writeInt32(value.unk1);
|
|
234
|
+
writer.writeString(value.itemName);
|
|
235
|
+
writer.writeInt32(value.hasItemState);
|
|
236
|
+
if (value.hasItemState >= 1) {
|
|
237
|
+
writer.writeInt32(value.itemState.unk);
|
|
238
|
+
writer.writeString(value.itemState.pathName);
|
|
239
|
+
writer.writeInt32(value.itemState.binarySize);
|
|
240
|
+
writer.writeBytesArray(value.itemState.itemStateRaw);
|
|
241
|
+
}
|
|
242
|
+
break;
|
|
243
|
+
case 'FluidBox':
|
|
244
|
+
value = value;
|
|
245
|
+
writer.writeFloat32(value.value);
|
|
246
|
+
break;
|
|
247
|
+
case 'SlateBrush':
|
|
248
|
+
value = value;
|
|
249
|
+
writer.writeString(value);
|
|
250
|
+
break;
|
|
251
|
+
case 'DateTime':
|
|
252
|
+
value = value;
|
|
253
|
+
writer.writeInt64(BigInt(value));
|
|
254
|
+
break;
|
|
255
|
+
case 'FINNetworkTrace':
|
|
256
|
+
value = value;
|
|
257
|
+
(0, exports.SerializeFINNetworkTrace)(writer, value);
|
|
258
|
+
break;
|
|
259
|
+
case 'FINLuaProcessorStateStorage':
|
|
260
|
+
value = value;
|
|
261
|
+
(0, exports.SerializeFINLuaProcessorStateStorage)(writer, value.values);
|
|
262
|
+
break;
|
|
263
|
+
case 'FICFrameRange':
|
|
264
|
+
value = value;
|
|
265
|
+
writer.writeInt64(BigInt(value.begin));
|
|
266
|
+
writer.writeInt64(BigInt(value.end));
|
|
267
|
+
break;
|
|
268
|
+
default:
|
|
269
|
+
value = value;
|
|
270
|
+
(0, exports.SerializeDynamicStructData)(writer, 0, value);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
exports.StructProperty = StructProperty;
|
|
275
|
+
const ParseDynamicStructData = (reader, buildVersion, type) => {
|
|
276
|
+
const data = {
|
|
277
|
+
type, properties: {}
|
|
278
|
+
};
|
|
279
|
+
const pos = reader.getBufferPosition();
|
|
280
|
+
let propertyName = reader.readString();
|
|
281
|
+
while (propertyName !== 'None') {
|
|
282
|
+
const parsedProperty = DataFields_1.DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
283
|
+
if (data.properties[propertyName]) {
|
|
284
|
+
if (!Array.isArray(data.properties[propertyName])) {
|
|
285
|
+
data.properties[propertyName] = [data.properties[propertyName]];
|
|
286
|
+
}
|
|
287
|
+
data.properties[propertyName].push(parsedProperty);
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
data.properties[propertyName] = parsedProperty;
|
|
291
|
+
}
|
|
292
|
+
propertyName = reader.readString();
|
|
293
|
+
}
|
|
294
|
+
return data;
|
|
295
|
+
};
|
|
296
|
+
exports.ParseDynamicStructData = ParseDynamicStructData;
|
|
297
|
+
const SerializeDynamicStructData = (writer, buildVersion, data) => {
|
|
298
|
+
for (const key in data.properties) {
|
|
299
|
+
for (const prop of (Array.isArray(data.properties[key]) ? data.properties[key] : [data.properties[key]])) {
|
|
300
|
+
writer.writeString(key);
|
|
301
|
+
DataFields_1.DataFields.SerializeProperty(writer, prop, key, buildVersion);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
writer.writeString('None');
|
|
305
|
+
};
|
|
306
|
+
exports.SerializeDynamicStructData = SerializeDynamicStructData;
|
|
307
|
+
const ReadFINNetworkTrace = (reader) => {
|
|
308
|
+
const networkTrace = {};
|
|
309
|
+
networkTrace.ref = ObjectReference_1.ObjectReference.read(reader);
|
|
310
|
+
networkTrace.hasPrev = reader.readInt32();
|
|
311
|
+
if (networkTrace.hasPrev) {
|
|
312
|
+
networkTrace.prev = (0, exports.ReadFINNetworkTrace)(reader);
|
|
313
|
+
}
|
|
314
|
+
networkTrace.hasStep = reader.readInt32();
|
|
315
|
+
if (networkTrace.hasStep) {
|
|
316
|
+
networkTrace.step = reader.readString();
|
|
317
|
+
}
|
|
318
|
+
return networkTrace;
|
|
319
|
+
};
|
|
320
|
+
exports.ReadFINNetworkTrace = ReadFINNetworkTrace;
|
|
321
|
+
const SerializeFINNetworkTrace = (writer, obj) => {
|
|
322
|
+
const networkTrace = {};
|
|
323
|
+
ObjectReference_1.ObjectReference.write(writer, obj.ref);
|
|
324
|
+
writer.writeInt32(obj.hasPrev);
|
|
325
|
+
if (obj.hasPrev) {
|
|
326
|
+
(0, exports.SerializeFINNetworkTrace)(writer, obj.prev);
|
|
327
|
+
}
|
|
328
|
+
writer.writeInt32(obj.hasStep);
|
|
329
|
+
if (obj.hasStep) {
|
|
330
|
+
writer.writeString(obj.step);
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
exports.SerializeFINNetworkTrace = SerializeFINNetworkTrace;
|
|
334
|
+
const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
335
|
+
const stateStorage = { traces: [], references: [], thread: '', globals: '', remainingStructData: {} };
|
|
336
|
+
const start = reader.getBufferPosition();
|
|
337
|
+
const traceCount = reader.readInt32();
|
|
338
|
+
for (let i = 0; i < traceCount; i++) {
|
|
339
|
+
stateStorage.traces.push((0, exports.ReadFINNetworkTrace)(reader));
|
|
340
|
+
}
|
|
341
|
+
const refCount = reader.readInt32();
|
|
342
|
+
for (let i = 0; i < refCount; i++) {
|
|
343
|
+
stateStorage.references.push(ObjectReference_1.ObjectReference.read(reader));
|
|
344
|
+
}
|
|
345
|
+
stateStorage.thread = reader.readString();
|
|
346
|
+
stateStorage.globals = reader.readString();
|
|
347
|
+
const remaining = size - (reader.getBufferPosition() - start);
|
|
348
|
+
stateStorage.remainingStructData = reader.readBytes(remaining);
|
|
349
|
+
return stateStorage;
|
|
350
|
+
};
|
|
351
|
+
exports.ReadFINLuaProcessorStateStorage = ReadFINLuaProcessorStateStorage;
|
|
352
|
+
const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
|
|
353
|
+
writer.writeInt32(stateStorage.traces.length);
|
|
354
|
+
for (const trace of stateStorage.traces) {
|
|
355
|
+
(0, exports.SerializeFINNetworkTrace)(writer, trace);
|
|
356
|
+
}
|
|
357
|
+
writer.writeInt32(stateStorage.references.length);
|
|
358
|
+
for (const ref of stateStorage.references) {
|
|
359
|
+
ObjectReference_1.ObjectReference.write(writer, ref);
|
|
360
|
+
}
|
|
361
|
+
writer.writeString(stateStorage.thread);
|
|
362
|
+
writer.writeString(stateStorage.globals);
|
|
363
|
+
writer.writeBytes(stateStorage.remainingStructData);
|
|
364
|
+
};
|
|
365
|
+
exports.SerializeFINLuaProcessorStateStorage = SerializeFINLuaProcessorStateStorage;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BinaryReadable } from '../../../../byte/binary-readable.interface';
|
|
2
|
+
import { ByteWriter } from '../../../../byte/byte-writer.class';
|
|
3
|
+
import { GUIDInfo } from '../../structs/GUIDInfo';
|
|
4
|
+
import { BasicProperty } from './BasicProperty';
|
|
5
|
+
export declare const isTextProperty: (property: BasicProperty) => property is TextProperty;
|
|
6
|
+
export declare class TextProperty extends BasicProperty {
|
|
7
|
+
value: TextPropertyValue;
|
|
8
|
+
constructor(value: TextPropertyValue, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
9
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): TextProperty;
|
|
10
|
+
static ParseValue(reader: BinaryReadable): TextPropertyValue;
|
|
11
|
+
static CalcOverhead(property: TextProperty): number;
|
|
12
|
+
static Serialize(writer: ByteWriter, property: TextProperty): void;
|
|
13
|
+
static SerializeValue(writer: ByteWriter, value: TextPropertyValue): void;
|
|
14
|
+
}
|
|
15
|
+
export type TextPropertyValue = {
|
|
16
|
+
flags: number;
|
|
17
|
+
historyType: number;
|
|
18
|
+
namespace?: string;
|
|
19
|
+
key?: string;
|
|
20
|
+
value?: string;
|
|
21
|
+
sourceFmt?: TextPropertyValue;
|
|
22
|
+
arguments?: {
|
|
23
|
+
name: string;
|
|
24
|
+
valueType: number;
|
|
25
|
+
argumentValue: TextPropertyValue;
|
|
26
|
+
}[];
|
|
27
|
+
sourceText?: TextPropertyValue;
|
|
28
|
+
transformType?: number;
|
|
29
|
+
hasCultureInvariantString?: boolean;
|
|
30
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextProperty = exports.isTextProperty = void 0;
|
|
4
|
+
const GUIDInfo_1 = require("../../structs/GUIDInfo");
|
|
5
|
+
const BasicProperty_1 = require("./BasicProperty");
|
|
6
|
+
const isTextProperty = (property) => property.type === 'TextProperty';
|
|
7
|
+
exports.isTextProperty = isTextProperty;
|
|
8
|
+
class TextProperty extends BasicProperty_1.BasicProperty {
|
|
9
|
+
constructor(value, ueType = 'TextProperty', guidInfo = undefined, index = 0) {
|
|
10
|
+
super({ type: 'TextProperty', ueType, guidInfo, index });
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
static Parse(reader, ueType, index = 0) {
|
|
14
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
15
|
+
const value = TextProperty.ParseValue(reader);
|
|
16
|
+
return new TextProperty(value, ueType, guidInfo, index);
|
|
17
|
+
}
|
|
18
|
+
static ParseValue(reader) {
|
|
19
|
+
const prop = {
|
|
20
|
+
flags: reader.readInt32(),
|
|
21
|
+
historyType: reader.readByte()
|
|
22
|
+
};
|
|
23
|
+
switch (prop.historyType) {
|
|
24
|
+
case 0:
|
|
25
|
+
prop.namespace = reader.readString();
|
|
26
|
+
prop.key = reader.readString();
|
|
27
|
+
prop.value = reader.readString();
|
|
28
|
+
break;
|
|
29
|
+
case 1:
|
|
30
|
+
case 3:
|
|
31
|
+
prop.sourceFmt = TextProperty.ParseValue(reader);
|
|
32
|
+
const argumentsCount = reader.readInt32();
|
|
33
|
+
prop.arguments = [];
|
|
34
|
+
for (let i = 0; i < argumentsCount; i++) {
|
|
35
|
+
let currentArgumentsData = {};
|
|
36
|
+
currentArgumentsData.name = reader.readString();
|
|
37
|
+
currentArgumentsData.valueType = reader.readByte();
|
|
38
|
+
switch (currentArgumentsData.valueType) {
|
|
39
|
+
case 4:
|
|
40
|
+
currentArgumentsData.argumentValue = TextProperty.ParseValue(reader);
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
throw new Error('Unimplemented FormatArgumentType `' + currentArgumentsData.valueType);
|
|
44
|
+
}
|
|
45
|
+
prop.arguments.push(currentArgumentsData);
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
case 10:
|
|
49
|
+
prop.sourceText = TextProperty.ParseValue(reader);
|
|
50
|
+
prop.transformType = reader.readByte();
|
|
51
|
+
break;
|
|
52
|
+
case 255:
|
|
53
|
+
prop.hasCultureInvariantString = reader.readInt32() === 1;
|
|
54
|
+
if (prop.hasCultureInvariantString) {
|
|
55
|
+
prop.value = reader.readString();
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
throw new Error('Unimplemented historyType `' + prop.historyType);
|
|
60
|
+
}
|
|
61
|
+
return prop;
|
|
62
|
+
}
|
|
63
|
+
static CalcOverhead(property) {
|
|
64
|
+
return 1;
|
|
65
|
+
}
|
|
66
|
+
static Serialize(writer, property) {
|
|
67
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
68
|
+
TextProperty.SerializeValue(writer, property.value);
|
|
69
|
+
}
|
|
70
|
+
static SerializeValue(writer, value) {
|
|
71
|
+
writer.writeInt32(value.flags);
|
|
72
|
+
writer.writeByte(value.historyType);
|
|
73
|
+
switch (value.historyType) {
|
|
74
|
+
case 0:
|
|
75
|
+
writer.writeString(value.namespace);
|
|
76
|
+
writer.writeString(value.key);
|
|
77
|
+
writer.writeString(value.value);
|
|
78
|
+
break;
|
|
79
|
+
case 1:
|
|
80
|
+
case 3:
|
|
81
|
+
TextProperty.SerializeValue(writer, value.sourceFmt);
|
|
82
|
+
writer.writeInt32(value.arguments.length);
|
|
83
|
+
for (const arg of value.arguments) {
|
|
84
|
+
let currentArgumentsData = {};
|
|
85
|
+
writer.writeString(arg.name);
|
|
86
|
+
writer.writeByte(arg.valueType);
|
|
87
|
+
switch (arg.valueType) {
|
|
88
|
+
case 4:
|
|
89
|
+
TextProperty.SerializeValue(writer, arg.argumentValue);
|
|
90
|
+
break;
|
|
91
|
+
default:
|
|
92
|
+
throw new Error('Unimplemented FormatArgumentType `' + currentArgumentsData.valueType);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case 10:
|
|
97
|
+
TextProperty.SerializeValue(writer, value.sourceText);
|
|
98
|
+
writer.writeByte(value.transformType);
|
|
99
|
+
break;
|
|
100
|
+
case 255:
|
|
101
|
+
writer.writeInt32(value.hasCultureInvariantString ? 1 : 0);
|
|
102
|
+
if (value.hasCultureInvariantString) {
|
|
103
|
+
writer.writeString(value.value);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
default:
|
|
107
|
+
throw new Error('Unimplemented historyType `' + value.historyType);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.TextProperty = TextProperty;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BinaryReadable } from '../../../../byte/binary-readable.interface';
|
|
2
|
+
import { ByteWriter } from '../../../../byte/byte-writer.class';
|
|
3
|
+
import { GUIDInfo } from '../../structs/GUIDInfo';
|
|
4
|
+
import { BasicProperty } from './BasicProperty';
|
|
5
|
+
export declare const isUint32Property: (property: BasicProperty) => property is Uint32Property;
|
|
6
|
+
export declare class Uint32Property extends BasicProperty {
|
|
7
|
+
value: number;
|
|
8
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
9
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint32Property;
|
|
10
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
11
|
+
static CalcOverhead(property: Uint32Property): number;
|
|
12
|
+
static Serialize(writer: ByteWriter, property: Uint32Property): void;
|
|
13
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Uint32Property = exports.isUint32Property = void 0;
|
|
4
|
+
const GUIDInfo_1 = require("../../structs/GUIDInfo");
|
|
5
|
+
const BasicProperty_1 = require("./BasicProperty");
|
|
6
|
+
const isUint32Property = (property) => property.type === 'UInt32Property';
|
|
7
|
+
exports.isUint32Property = isUint32Property;
|
|
8
|
+
class Uint32Property extends BasicProperty_1.BasicProperty {
|
|
9
|
+
constructor(value, ueType = 'UInt32Property', guidInfo = undefined, index = 0) {
|
|
10
|
+
super({ type: 'UInt32Property', ueType, guidInfo, index });
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
static Parse(reader, ueType, index = 0) {
|
|
14
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
15
|
+
const value = Uint32Property.ReadValue(reader);
|
|
16
|
+
return new Uint32Property(value, ueType, guidInfo, index);
|
|
17
|
+
}
|
|
18
|
+
static ReadValue(reader) {
|
|
19
|
+
return reader.readUint32();
|
|
20
|
+
}
|
|
21
|
+
static CalcOverhead(property) {
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
static Serialize(writer, property) {
|
|
25
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
26
|
+
Uint32Property.SerializeValue(writer, property.value);
|
|
27
|
+
}
|
|
28
|
+
static SerializeValue(writer, value) {
|
|
29
|
+
writer.writeUint32(value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Uint32Property = Uint32Property;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BinaryReadable } from '../../../../byte/binary-readable.interface';
|
|
2
|
+
import { ByteWriter } from '../../../../byte/byte-writer.class';
|
|
3
|
+
import { GUIDInfo } from '../../structs/GUIDInfo';
|
|
4
|
+
import { BasicProperty } from './BasicProperty';
|
|
5
|
+
export declare const isUInt64Property: (property: BasicProperty) => property is Uint64Property;
|
|
6
|
+
export declare class Uint64Property extends BasicProperty {
|
|
7
|
+
value: string;
|
|
8
|
+
constructor(value: string, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
9
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint64Property;
|
|
10
|
+
static ReadValue(reader: BinaryReadable): string;
|
|
11
|
+
static CalcOverhead(property: Uint64Property): number;
|
|
12
|
+
static Serialize(writer: ByteWriter, property: Uint64Property): void;
|
|
13
|
+
static SerializeValue(writer: ByteWriter, value: string): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Uint64Property = exports.isUInt64Property = void 0;
|
|
4
|
+
const GUIDInfo_1 = require("../../structs/GUIDInfo");
|
|
5
|
+
const BasicProperty_1 = require("./BasicProperty");
|
|
6
|
+
const isUInt64Property = (property) => property.type === 'UInt64Property';
|
|
7
|
+
exports.isUInt64Property = isUInt64Property;
|
|
8
|
+
class Uint64Property extends BasicProperty_1.BasicProperty {
|
|
9
|
+
constructor(value, ueType = 'UInt64Property', guidInfo = undefined, index = 0) {
|
|
10
|
+
super({ type: 'UInt64Property', ueType, guidInfo, index });
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
static Parse(reader, ueType, index = 0) {
|
|
14
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
15
|
+
const value = Uint64Property.ReadValue(reader);
|
|
16
|
+
return new Uint64Property(value, ueType, guidInfo, index);
|
|
17
|
+
}
|
|
18
|
+
static ReadValue(reader) {
|
|
19
|
+
return reader.readUint64().toString();
|
|
20
|
+
}
|
|
21
|
+
static CalcOverhead(property) {
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
static Serialize(writer, property) {
|
|
25
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
26
|
+
Uint64Property.SerializeValue(writer, property.value);
|
|
27
|
+
}
|
|
28
|
+
static SerializeValue(writer, value) {
|
|
29
|
+
writer.writeUint64(BigInt(value));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Uint64Property = Uint64Property;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BinaryReadable } from '../../../../byte/binary-readable.interface';
|
|
2
|
+
import { ByteWriter } from '../../../../byte/byte-writer.class';
|
|
3
|
+
import { GUIDInfo } from '../../structs/GUIDInfo';
|
|
4
|
+
import { BasicProperty } from './BasicProperty';
|
|
5
|
+
export declare const isUint8Property: (property: BasicProperty) => property is Uint8Property;
|
|
6
|
+
export declare class Uint8Property extends BasicProperty {
|
|
7
|
+
value: number;
|
|
8
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
9
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint8Property;
|
|
10
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
11
|
+
static CalcOverhead(property: Uint8Property): number;
|
|
12
|
+
static Serialize(writer: ByteWriter, property: Uint8Property): void;
|
|
13
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Uint8Property = exports.isUint8Property = void 0;
|
|
4
|
+
const GUIDInfo_1 = require("../../structs/GUIDInfo");
|
|
5
|
+
const BasicProperty_1 = require("./BasicProperty");
|
|
6
|
+
const isUint8Property = (property) => property.type === 'UInt8Property';
|
|
7
|
+
exports.isUint8Property = isUint8Property;
|
|
8
|
+
class Uint8Property extends BasicProperty_1.BasicProperty {
|
|
9
|
+
constructor(value, ueType = 'UInt8Property', guidInfo = undefined, index = 0) {
|
|
10
|
+
super({ type: 'UInt8Property', ueType, guidInfo, index });
|
|
11
|
+
this.value = value;
|
|
12
|
+
}
|
|
13
|
+
static Parse(reader, ueType, index = 0) {
|
|
14
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
15
|
+
const value = Uint8Property.ReadValue(reader);
|
|
16
|
+
return new Uint8Property(value, ueType, guidInfo, index);
|
|
17
|
+
}
|
|
18
|
+
static ReadValue(reader) {
|
|
19
|
+
return reader.readUint8();
|
|
20
|
+
}
|
|
21
|
+
static CalcOverhead(property) {
|
|
22
|
+
throw new Error('Unimplemented.');
|
|
23
|
+
}
|
|
24
|
+
static Serialize(writer, property) {
|
|
25
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
26
|
+
Uint8Property.SerializeValue(writer, property.value);
|
|
27
|
+
}
|
|
28
|
+
static SerializeValue(writer, value) {
|
|
29
|
+
writer.writeUint8(value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Uint8Property = Uint8Property;
|