@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,24 @@
|
|
|
1
|
+
import { BinaryReadable } from "../../../byte/binary-readable.interface";
|
|
2
|
+
import { ByteWriter } from "../../../byte/byte-writer.class";
|
|
3
|
+
import { PropertiesMap } from "../property/generic/BasicProperty";
|
|
4
|
+
import { SpecialAnyProperty } from '../property/special/SpecialAnyProperty';
|
|
5
|
+
export interface SaveObjectHeader {
|
|
6
|
+
typePath: string;
|
|
7
|
+
rootObject: string;
|
|
8
|
+
instanceName: string;
|
|
9
|
+
}
|
|
10
|
+
export declare abstract class SaveObject implements SaveObjectHeader {
|
|
11
|
+
typePath: string;
|
|
12
|
+
rootObject: string;
|
|
13
|
+
instanceName: string;
|
|
14
|
+
properties: PropertiesMap;
|
|
15
|
+
specialProperties: SpecialAnyProperty;
|
|
16
|
+
trailingData: number[];
|
|
17
|
+
objectVersion: number;
|
|
18
|
+
unknownType2: number;
|
|
19
|
+
constructor(typePath: string, rootObject: string, instanceName: string);
|
|
20
|
+
protected static ParseHeader(reader: BinaryReadable, obj: SaveObject): void;
|
|
21
|
+
protected static SerializeHeader(writer: ByteWriter, obj: SaveObject): void;
|
|
22
|
+
static ParseData(obj: SaveObject, length: number, reader: BinaryReadable, buildVersion: number, typePath: string): void;
|
|
23
|
+
static SerializeData(writer: any, obj: SaveObject, buildVersion: number): void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SaveObject = void 0;
|
|
4
|
+
const DataFields_1 = require("../property/DataFields");
|
|
5
|
+
class SaveObject {
|
|
6
|
+
constructor(typePath, rootObject, instanceName) {
|
|
7
|
+
this.typePath = typePath;
|
|
8
|
+
this.rootObject = rootObject;
|
|
9
|
+
this.instanceName = instanceName;
|
|
10
|
+
this.properties = {};
|
|
11
|
+
this.specialProperties = {};
|
|
12
|
+
this.trailingData = [];
|
|
13
|
+
this.objectVersion = 0;
|
|
14
|
+
this.unknownType2 = 0;
|
|
15
|
+
}
|
|
16
|
+
static ParseHeader(reader, obj) {
|
|
17
|
+
obj.typePath = reader.readString();
|
|
18
|
+
obj.rootObject = reader.readString();
|
|
19
|
+
obj.instanceName = reader.readString();
|
|
20
|
+
}
|
|
21
|
+
static SerializeHeader(writer, obj) {
|
|
22
|
+
writer.writeString(obj.typePath);
|
|
23
|
+
writer.writeString(obj.rootObject);
|
|
24
|
+
writer.writeString(obj.instanceName);
|
|
25
|
+
}
|
|
26
|
+
static ParseData(obj, length, reader, buildVersion, typePath) {
|
|
27
|
+
DataFields_1.DataFields.ParseProperties(obj, length, reader, buildVersion, typePath);
|
|
28
|
+
}
|
|
29
|
+
static SerializeData(writer, obj, buildVersion) {
|
|
30
|
+
DataFields_1.DataFields.Serialize(obj, writer, buildVersion, obj.typePath);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.SaveObject = SaveObject;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BinaryReadable } from "../../../byte/binary-readable.interface";
|
|
2
|
+
import { ByteWriter } from '../../../byte/byte-writer.class';
|
|
3
|
+
import { SaveWriter } from "../../save/save-writer";
|
|
4
|
+
import { SaveObject } from "../objects/SaveObject";
|
|
5
|
+
import { AbstractBaseProperty } from "./generic/BasicProperty";
|
|
6
|
+
import { SpecialAnyProperty } from './special/SpecialAnyProperty';
|
|
7
|
+
export declare class DataFields {
|
|
8
|
+
constructor();
|
|
9
|
+
static ParseProperties(obj: SaveObject, length: number, reader: BinaryReadable, buildVersion: number, typePath: string): void;
|
|
10
|
+
static ParseAdditionalSpecialProperties(reader: BinaryReadable, typePath: string, remainingLen: number): SpecialAnyProperty;
|
|
11
|
+
static ParseProperty(reader: BinaryReadable, buildVersion: number, propertyName: string): AbstractBaseProperty;
|
|
12
|
+
static Serialize(obj: SaveObject, writer: SaveWriter, buildVersion: number, typePath: string): void;
|
|
13
|
+
static SerializeAdditionalSpecialProperties(writer: ByteWriter, typePath: string, property: SpecialAnyProperty): void;
|
|
14
|
+
static SerializeProperty(writer: ByteWriter, property: AbstractBaseProperty, propertyName: string, buildVersion: number): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataFields = void 0;
|
|
4
|
+
const parser_error_1 = require("../../../error/parser.error");
|
|
5
|
+
const ObjectReference_1 = require("../structs/ObjectReference");
|
|
6
|
+
const Transform_1 = require("../structs/Transform");
|
|
7
|
+
const vec2_1 = require("../structs/vec2");
|
|
8
|
+
const vec3_1 = require("../structs/vec3");
|
|
9
|
+
const ArrayProperty_1 = require("./generic/ArrayProperty");
|
|
10
|
+
const BoolProperty_1 = require("./generic/BoolProperty");
|
|
11
|
+
const ByteProperty_1 = require("./generic/ByteProperty");
|
|
12
|
+
const DoubleProperty_1 = require("./generic/DoubleProperty");
|
|
13
|
+
const EnumProperty_1 = require("./generic/EnumProperty");
|
|
14
|
+
const FloatProperty_1 = require("./generic/FloatProperty");
|
|
15
|
+
const Int32Property_1 = require("./generic/Int32Property");
|
|
16
|
+
const Int64Property_1 = require("./generic/Int64Property");
|
|
17
|
+
const Int8Property_1 = require("./generic/Int8Property");
|
|
18
|
+
const MapProperty_1 = require("./generic/MapProperty");
|
|
19
|
+
const ObjectProperty_1 = require("./generic/ObjectProperty");
|
|
20
|
+
const SetProperty_1 = require("./generic/SetProperty");
|
|
21
|
+
const SoftObjectProperty_1 = require("./generic/SoftObjectProperty");
|
|
22
|
+
const StrProperty_1 = require("./generic/StrProperty");
|
|
23
|
+
const StructProperty_1 = require("./generic/StructProperty");
|
|
24
|
+
const TextProperty_1 = require("./generic/TextProperty");
|
|
25
|
+
const Uint32Property_1 = require("./generic/Uint32Property");
|
|
26
|
+
const Uint64Property_1 = require("./generic/Uint64Property");
|
|
27
|
+
const Uint8Property_1 = require("./generic/Uint8Property");
|
|
28
|
+
class DataFields {
|
|
29
|
+
constructor() {
|
|
30
|
+
}
|
|
31
|
+
static ParseProperties(obj, length, reader, buildVersion, typePath) {
|
|
32
|
+
const start = reader.getBufferPosition();
|
|
33
|
+
obj.properties = {};
|
|
34
|
+
if (length === 0) {
|
|
35
|
+
console.warn(`properties length for object ${obj.instanceName} was indicated as 0. Which is suspicious. Skipping object properties.`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
let propertyName = reader.readString();
|
|
39
|
+
while (propertyName !== 'None') {
|
|
40
|
+
const parsedProperty = DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
41
|
+
if (obj.properties[propertyName]) {
|
|
42
|
+
if (!Array.isArray(obj.properties[propertyName])) {
|
|
43
|
+
obj.properties[propertyName] = [obj.properties[propertyName]];
|
|
44
|
+
}
|
|
45
|
+
obj.properties[propertyName].push(parsedProperty);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
obj.properties[propertyName] = parsedProperty;
|
|
49
|
+
}
|
|
50
|
+
propertyName = reader.readString();
|
|
51
|
+
}
|
|
52
|
+
reader.readInt32();
|
|
53
|
+
const remainingLen = length - (reader.getBufferPosition() - start);
|
|
54
|
+
obj.specialProperties = DataFields.ParseAdditionalSpecialProperties(reader, typePath, remainingLen);
|
|
55
|
+
const remainingSize = length - (reader.getBufferPosition() - start);
|
|
56
|
+
if (remainingSize > 0) {
|
|
57
|
+
obj.trailingData = Array.from(reader.readBytes(remainingSize));
|
|
58
|
+
}
|
|
59
|
+
else if (remainingSize < 0) {
|
|
60
|
+
throw new parser_error_1.ParserError('ParserError', `Unexpected. Read more bytes than are indicated for entity ${obj.instanceName}. bytes left to read is ${remainingSize}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
static ParseAdditionalSpecialProperties(reader, typePath, remainingLen) {
|
|
64
|
+
let property;
|
|
65
|
+
const start = reader.getBufferPosition();
|
|
66
|
+
switch (typePath) {
|
|
67
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':
|
|
68
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':
|
|
69
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C':
|
|
70
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C':
|
|
71
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C':
|
|
72
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk6/Build_ConveyorBeltMk6.Build_ConveyorBeltMk6_C':
|
|
73
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C':
|
|
74
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C':
|
|
75
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C':
|
|
76
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
|
|
77
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C':
|
|
78
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk6/Build_ConveyorLiftMk6.Build_ConveyorLiftMk6_C':
|
|
79
|
+
reader.readInt32();
|
|
80
|
+
property = {};
|
|
81
|
+
break;
|
|
82
|
+
case '/Script/FactoryGame.FGConveyorChainActor':
|
|
83
|
+
const lastBelt = ObjectReference_1.ObjectReference.read(reader);
|
|
84
|
+
const firstBelt = ObjectReference_1.ObjectReference.read(reader);
|
|
85
|
+
const countBeltsInChain = reader.readInt32();
|
|
86
|
+
const beltsInChain = [];
|
|
87
|
+
for (let i = 0; i < countBeltsInChain; i++) {
|
|
88
|
+
const chainActorRef = ObjectReference_1.ObjectReference.read(reader);
|
|
89
|
+
const beltRef = ObjectReference_1.ObjectReference.read(reader);
|
|
90
|
+
const someCount = reader.readInt32();
|
|
91
|
+
const unknownUseBytes = Array.from(reader.readBytes(someCount * 3 * 24 + 12));
|
|
92
|
+
const firstItemIndex = reader.readInt32();
|
|
93
|
+
const lastItemIndex = reader.readInt32();
|
|
94
|
+
const beltIndexInChain = reader.readInt32();
|
|
95
|
+
beltsInChain.push({
|
|
96
|
+
chainActorRef,
|
|
97
|
+
beltRef,
|
|
98
|
+
someCount,
|
|
99
|
+
unknownUseBytes,
|
|
100
|
+
firstItemIndex,
|
|
101
|
+
lastItemIndex,
|
|
102
|
+
beltIndexInChain
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const unknownInts = [reader.readInt32(), reader.readInt32()];
|
|
106
|
+
const firstChainItemIndex = reader.readInt32();
|
|
107
|
+
const lastChainItemIndex = reader.readInt32();
|
|
108
|
+
const countItemsInChain = reader.readInt32();
|
|
109
|
+
const items = [];
|
|
110
|
+
for (let n = 0; n < countItemsInChain; n++) {
|
|
111
|
+
reader.readInt32();
|
|
112
|
+
const itemName = reader.readString();
|
|
113
|
+
reader.readInt32();
|
|
114
|
+
const position = reader.readInt32();
|
|
115
|
+
items.push({ itemName, position });
|
|
116
|
+
}
|
|
117
|
+
property = {
|
|
118
|
+
firstBelt: firstBelt,
|
|
119
|
+
lastBelt: lastBelt,
|
|
120
|
+
beltsInChain,
|
|
121
|
+
unknownInts,
|
|
122
|
+
firstChainItemIndex,
|
|
123
|
+
lastChainItemIndex,
|
|
124
|
+
items
|
|
125
|
+
};
|
|
126
|
+
break;
|
|
127
|
+
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
|
|
128
|
+
case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C':
|
|
129
|
+
property = {
|
|
130
|
+
source: ObjectProperty_1.ObjectProperty.ReadValue(reader),
|
|
131
|
+
target: ObjectProperty_1.ObjectProperty.ReadValue(reader)
|
|
132
|
+
};
|
|
133
|
+
if (remainingLen - (reader.getBufferPosition() - start) >= 24) {
|
|
134
|
+
property.sourceTranslation = vec3_1.vec3.ParseF(reader);
|
|
135
|
+
property.targetTranslation = vec3_1.vec3.ParseF(reader);
|
|
136
|
+
}
|
|
137
|
+
break;
|
|
138
|
+
case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C':
|
|
139
|
+
property = {};
|
|
140
|
+
property.flag = reader.readByte();
|
|
141
|
+
switch (property.flag) {
|
|
142
|
+
case 248:
|
|
143
|
+
const eos = reader.readString();
|
|
144
|
+
property.eosData = reader.readString();
|
|
145
|
+
break;
|
|
146
|
+
case 25:
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
case '/Script/FactoryGame.FGLightweightBuildableSubsystem':
|
|
153
|
+
property = { buildables: [] };
|
|
154
|
+
const entriesCount = reader.readInt32();
|
|
155
|
+
if (entriesCount > 0) {
|
|
156
|
+
for (let i = 0; i < entriesCount; i++) {
|
|
157
|
+
reader.readInt32();
|
|
158
|
+
const typePath = reader.readString();
|
|
159
|
+
const count = reader.readInt32();
|
|
160
|
+
const instances = [];
|
|
161
|
+
for (let j = 0; j < count; j++) {
|
|
162
|
+
const transform = Transform_1.Transform.Parse(reader);
|
|
163
|
+
reader.readInt32();
|
|
164
|
+
const swatchSlotTypePath = reader.readString();
|
|
165
|
+
reader.readInt32();
|
|
166
|
+
reader.readInt64();
|
|
167
|
+
const patternPath = reader.readString();
|
|
168
|
+
const zeroes = vec2_1.vec2.Parse(reader);
|
|
169
|
+
const oneZeroOne = vec3_1.vec3.Parse(reader);
|
|
170
|
+
const unknownUseNumbers = [zeroes, oneZeroOne];
|
|
171
|
+
reader.readInt32();
|
|
172
|
+
const paintFinishPath = reader.readString();
|
|
173
|
+
reader.readInt32();
|
|
174
|
+
reader.readBytes(1);
|
|
175
|
+
const recipeTypePath = reader.readString();
|
|
176
|
+
const blueprintProxy = ObjectReference_1.ObjectReference.read(reader);
|
|
177
|
+
instances.push({
|
|
178
|
+
transform,
|
|
179
|
+
unknownUseNumbers,
|
|
180
|
+
swatchSlotTypePath,
|
|
181
|
+
paintFinishPath,
|
|
182
|
+
recipeTypePath,
|
|
183
|
+
patternPath,
|
|
184
|
+
blueprintProxy
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
property.buildables.push({
|
|
188
|
+
typePath,
|
|
189
|
+
instances
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
default:
|
|
195
|
+
property = {};
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
return property;
|
|
199
|
+
}
|
|
200
|
+
static ParseProperty(reader, buildVersion, propertyName) {
|
|
201
|
+
let currentProperty = {};
|
|
202
|
+
const propertyType = reader.readString();
|
|
203
|
+
const binarySize = reader.readInt32();
|
|
204
|
+
const index = reader.readInt32();
|
|
205
|
+
const before = reader.getBufferPosition();
|
|
206
|
+
let overhead = 0;
|
|
207
|
+
switch (propertyType) {
|
|
208
|
+
case 'BoolProperty':
|
|
209
|
+
currentProperty = BoolProperty_1.BoolProperty.Parse(reader, propertyType, index);
|
|
210
|
+
overhead = BoolProperty_1.BoolProperty.CalcOverhead(currentProperty);
|
|
211
|
+
break;
|
|
212
|
+
case 'ByteProperty':
|
|
213
|
+
currentProperty = ByteProperty_1.ByteProperty.Parse(reader, propertyType, index);
|
|
214
|
+
overhead = ByteProperty_1.ByteProperty.CalcOverhead(currentProperty);
|
|
215
|
+
break;
|
|
216
|
+
case 'Int8Property':
|
|
217
|
+
currentProperty = Int8Property_1.Int8Property.Parse(reader, propertyType, index);
|
|
218
|
+
overhead = Int8Property_1.Int8Property.CalcOverhead(currentProperty);
|
|
219
|
+
break;
|
|
220
|
+
case 'UInt8Property':
|
|
221
|
+
currentProperty = Uint8Property_1.Uint8Property.Parse(reader, propertyType, index);
|
|
222
|
+
overhead = Uint8Property_1.Uint8Property.CalcOverhead(currentProperty);
|
|
223
|
+
break;
|
|
224
|
+
case 'IntProperty':
|
|
225
|
+
case 'Int32Property':
|
|
226
|
+
currentProperty = Int32Property_1.Int32Property.Parse(reader, propertyType, index);
|
|
227
|
+
overhead = Int32Property_1.Int32Property.CalcOverhead(currentProperty);
|
|
228
|
+
break;
|
|
229
|
+
case 'UInt32Property':
|
|
230
|
+
currentProperty = Uint32Property_1.Uint32Property.Parse(reader, propertyType, index);
|
|
231
|
+
overhead = Uint32Property_1.Uint32Property.CalcOverhead(currentProperty);
|
|
232
|
+
break;
|
|
233
|
+
case 'Int64Property':
|
|
234
|
+
currentProperty = Int64Property_1.Int64Property.Parse(reader, propertyType, index);
|
|
235
|
+
overhead = Int64Property_1.Int64Property.CalcOverhead(currentProperty);
|
|
236
|
+
break;
|
|
237
|
+
case 'UInt64Property':
|
|
238
|
+
currentProperty = Uint64Property_1.Uint64Property.Parse(reader, propertyType, index);
|
|
239
|
+
break;
|
|
240
|
+
case 'SingleProperty':
|
|
241
|
+
case 'FloatProperty':
|
|
242
|
+
currentProperty = FloatProperty_1.FloatProperty.Parse(reader, propertyType, index);
|
|
243
|
+
overhead = FloatProperty_1.FloatProperty.CalcOverhead(currentProperty);
|
|
244
|
+
break;
|
|
245
|
+
case 'DoubleProperty':
|
|
246
|
+
currentProperty = DoubleProperty_1.DoubleProperty.Parse(reader, propertyType, index);
|
|
247
|
+
overhead = DoubleProperty_1.DoubleProperty.CalcOverhead(currentProperty);
|
|
248
|
+
break;
|
|
249
|
+
case 'StrProperty':
|
|
250
|
+
case 'NameProperty':
|
|
251
|
+
currentProperty = StrProperty_1.StrProperty.Parse(reader, propertyType, index);
|
|
252
|
+
overhead = StrProperty_1.StrProperty.CalcOverhead(currentProperty);
|
|
253
|
+
break;
|
|
254
|
+
case 'ObjectProperty':
|
|
255
|
+
case 'InterfaceProperty':
|
|
256
|
+
currentProperty = ObjectProperty_1.ObjectProperty.Parse(reader, propertyType, index);
|
|
257
|
+
overhead = ObjectProperty_1.ObjectProperty.CalcOverhead(currentProperty);
|
|
258
|
+
break;
|
|
259
|
+
case 'SoftObjectProperty':
|
|
260
|
+
currentProperty = SoftObjectProperty_1.SoftObjectProperty.Parse(reader, propertyType, index);
|
|
261
|
+
overhead = SoftObjectProperty_1.SoftObjectProperty.CalcOverhead(currentProperty);
|
|
262
|
+
break;
|
|
263
|
+
case 'EnumProperty':
|
|
264
|
+
currentProperty = EnumProperty_1.EnumProperty.Parse(reader, propertyType, index);
|
|
265
|
+
overhead = EnumProperty_1.EnumProperty.CalcOverhead(currentProperty);
|
|
266
|
+
break;
|
|
267
|
+
case 'StructProperty':
|
|
268
|
+
currentProperty = StructProperty_1.StructProperty.Parse(reader, propertyType, index, binarySize);
|
|
269
|
+
overhead = StructProperty_1.StructProperty.CalcOverhead(currentProperty);
|
|
270
|
+
break;
|
|
271
|
+
case 'ArrayProperty':
|
|
272
|
+
currentProperty = ArrayProperty_1.ArrayProperty.Parse(reader, propertyType, index, propertyName);
|
|
273
|
+
overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(currentProperty);
|
|
274
|
+
break;
|
|
275
|
+
case 'MapProperty':
|
|
276
|
+
currentProperty = MapProperty_1.MapProperty.Parse(reader, propertyName, buildVersion, binarySize);
|
|
277
|
+
overhead = MapProperty_1.MapProperty.CalcOverhead(currentProperty);
|
|
278
|
+
break;
|
|
279
|
+
case 'TextProperty':
|
|
280
|
+
currentProperty = TextProperty_1.TextProperty.Parse(reader, propertyType, index);
|
|
281
|
+
overhead = TextProperty_1.TextProperty.CalcOverhead(currentProperty);
|
|
282
|
+
break;
|
|
283
|
+
case 'SetProperty':
|
|
284
|
+
currentProperty = SetProperty_1.SetProperty.Parse(reader, propertyType, index, propertyName);
|
|
285
|
+
overhead = SetProperty_1.SetProperty.CalcOverhead(currentProperty);
|
|
286
|
+
break;
|
|
287
|
+
default:
|
|
288
|
+
throw new Error(`Unimplemented type ${propertyType}`);
|
|
289
|
+
}
|
|
290
|
+
currentProperty.name = propertyName;
|
|
291
|
+
const readBytes = reader.getBufferPosition() - before - overhead;
|
|
292
|
+
if (readBytes !== binarySize) {
|
|
293
|
+
console.warn(`possibly corrupt. Read ${readBytes} for ${propertyType} ${propertyName}, but ${binarySize} were indicated.`);
|
|
294
|
+
throw new parser_error_1.ParserError('ParserError', `possibly corrupt. Read ${readBytes} bytes for ${propertyType} ${propertyName}, but ${binarySize} bytes were indicated.`);
|
|
295
|
+
}
|
|
296
|
+
return currentProperty;
|
|
297
|
+
}
|
|
298
|
+
static Serialize(obj, writer, buildVersion, typePath) {
|
|
299
|
+
for (const property of Object.values(obj.properties).flatMap(val => Array.isArray(val) ? val : [val])) {
|
|
300
|
+
writer.writeString(property.name);
|
|
301
|
+
DataFields.SerializeProperty(writer, property, property.name, buildVersion);
|
|
302
|
+
}
|
|
303
|
+
writer.writeString('None');
|
|
304
|
+
writer.writeInt32(0);
|
|
305
|
+
DataFields.SerializeAdditionalSpecialProperties(writer, typePath, obj.specialProperties);
|
|
306
|
+
writer.writeBytesArray(obj.trailingData);
|
|
307
|
+
}
|
|
308
|
+
static SerializeAdditionalSpecialProperties(writer, typePath, property) {
|
|
309
|
+
switch (typePath) {
|
|
310
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':
|
|
311
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':
|
|
312
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C':
|
|
313
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C':
|
|
314
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C':
|
|
315
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk6/Build_ConveyorBeltMk6.Build_ConveyorBeltMk6_C':
|
|
316
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C':
|
|
317
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C':
|
|
318
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C':
|
|
319
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
|
|
320
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C':
|
|
321
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk6/Build_ConveyorLiftMk6.Build_ConveyorLiftMk6_C':
|
|
322
|
+
writer.writeInt32(0);
|
|
323
|
+
break;
|
|
324
|
+
case '/Script/FactoryGame.FGConveyorChainActor':
|
|
325
|
+
ObjectReference_1.ObjectReference.write(writer, property.lastBelt);
|
|
326
|
+
ObjectReference_1.ObjectReference.write(writer, property.firstBelt);
|
|
327
|
+
writer.writeInt32(property.beltsInChain.length);
|
|
328
|
+
for (const belt of property.beltsInChain) {
|
|
329
|
+
ObjectReference_1.ObjectReference.write(writer, belt.chainActorRef);
|
|
330
|
+
ObjectReference_1.ObjectReference.write(writer, belt.beltRef);
|
|
331
|
+
writer.writeInt32(belt.someCount);
|
|
332
|
+
writer.writeBytesArray(belt.unknownUseBytes);
|
|
333
|
+
writer.writeInt32(belt.firstItemIndex);
|
|
334
|
+
writer.writeInt32(belt.lastItemIndex);
|
|
335
|
+
writer.writeInt32(belt.beltIndexInChain);
|
|
336
|
+
}
|
|
337
|
+
writer.writeInt32(property.unknownInts[0]);
|
|
338
|
+
writer.writeInt32(property.unknownInts[1]);
|
|
339
|
+
writer.writeInt32(property.firstChainItemIndex);
|
|
340
|
+
writer.writeInt32(property.lastChainItemIndex);
|
|
341
|
+
writer.writeInt32(property.items.length);
|
|
342
|
+
for (const item of property.items) {
|
|
343
|
+
writer.writeInt32(0);
|
|
344
|
+
writer.writeString(item.itemName);
|
|
345
|
+
writer.writeInt32(0);
|
|
346
|
+
writer.writeInt32(item.position);
|
|
347
|
+
}
|
|
348
|
+
break;
|
|
349
|
+
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
|
|
350
|
+
case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C':
|
|
351
|
+
ObjectProperty_1.ObjectProperty.SerializeValue(writer, property.source);
|
|
352
|
+
ObjectProperty_1.ObjectProperty.SerializeValue(writer, property.target);
|
|
353
|
+
break;
|
|
354
|
+
case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C':
|
|
355
|
+
writer.writeByte(property.flag);
|
|
356
|
+
switch (property.flag) {
|
|
357
|
+
case 248:
|
|
358
|
+
writer.writeString('EOS');
|
|
359
|
+
writer.writeString(property.eosData);
|
|
360
|
+
break;
|
|
361
|
+
case 25:
|
|
362
|
+
break;
|
|
363
|
+
default:
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
break;
|
|
367
|
+
case '/Script/FactoryGame.FGLightweightBuildableSubsystem':
|
|
368
|
+
writer.writeInt32(property.buildables.length);
|
|
369
|
+
if (property.buildables.length > 0) {
|
|
370
|
+
for (const buildable of property.buildables) {
|
|
371
|
+
writer.writeInt32(0);
|
|
372
|
+
writer.writeString(buildable.typePath);
|
|
373
|
+
writer.writeInt32(buildable.instances.length);
|
|
374
|
+
for (const instance of buildable.instances) {
|
|
375
|
+
Transform_1.Transform.Serialize(writer, instance.transform);
|
|
376
|
+
writer.writeInt32(0);
|
|
377
|
+
writer.writeString(instance.swatchSlotTypePath);
|
|
378
|
+
writer.writeInt32(0);
|
|
379
|
+
writer.writeInt64(0n);
|
|
380
|
+
writer.writeString(instance.patternPath);
|
|
381
|
+
vec2_1.vec2.Serialize(writer, instance.unknownUseNumbers[0]);
|
|
382
|
+
vec3_1.vec3.Serialize(writer, instance.unknownUseNumbers[1]);
|
|
383
|
+
writer.writeInt32(0);
|
|
384
|
+
writer.writeString(instance.paintFinishPath);
|
|
385
|
+
writer.writeInt32(0);
|
|
386
|
+
writer.writeByte(0);
|
|
387
|
+
writer.writeString(instance.recipeTypePath);
|
|
388
|
+
ObjectReference_1.ObjectReference.write(writer, instance.blueprintProxy);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
static SerializeProperty(writer, property, propertyName, buildVersion) {
|
|
396
|
+
writer.writeString(property.ueType);
|
|
397
|
+
const lenIndicator = writer.getBufferPosition();
|
|
398
|
+
writer.writeInt32(0);
|
|
399
|
+
writer.writeInt32(property.index ?? 0);
|
|
400
|
+
const start = writer.getBufferPosition();
|
|
401
|
+
let overhead = 0;
|
|
402
|
+
switch (property.ueType) {
|
|
403
|
+
case 'BoolProperty':
|
|
404
|
+
overhead = BoolProperty_1.BoolProperty.CalcOverhead(property);
|
|
405
|
+
BoolProperty_1.BoolProperty.Serialize(writer, property);
|
|
406
|
+
break;
|
|
407
|
+
case 'ByteProperty':
|
|
408
|
+
overhead = ByteProperty_1.ByteProperty.CalcOverhead(property);
|
|
409
|
+
ByteProperty_1.ByteProperty.Serialize(writer, property);
|
|
410
|
+
break;
|
|
411
|
+
case 'Int8Property':
|
|
412
|
+
overhead = Int8Property_1.Int8Property.CalcOverhead(property);
|
|
413
|
+
Int8Property_1.Int8Property.Serialize(writer, property);
|
|
414
|
+
break;
|
|
415
|
+
case 'UInt8Property':
|
|
416
|
+
overhead = Uint8Property_1.Uint8Property.CalcOverhead(property);
|
|
417
|
+
Uint8Property_1.Uint8Property.Serialize(writer, property);
|
|
418
|
+
break;
|
|
419
|
+
case 'IntProperty':
|
|
420
|
+
case 'Int32Property':
|
|
421
|
+
overhead = Int32Property_1.Int32Property.CalcOverhead(property);
|
|
422
|
+
Int32Property_1.Int32Property.Serialize(writer, property);
|
|
423
|
+
break;
|
|
424
|
+
case 'UInt32Property':
|
|
425
|
+
overhead = Uint32Property_1.Uint32Property.CalcOverhead(property);
|
|
426
|
+
Uint32Property_1.Uint32Property.Serialize(writer, property);
|
|
427
|
+
break;
|
|
428
|
+
case 'Int64Property':
|
|
429
|
+
overhead = Int64Property_1.Int64Property.CalcOverhead(property);
|
|
430
|
+
Int64Property_1.Int64Property.Serialize(writer, property);
|
|
431
|
+
break;
|
|
432
|
+
case 'UInt64PRoperty':
|
|
433
|
+
overhead = Uint64Property_1.Uint64Property.CalcOverhead(property);
|
|
434
|
+
Uint64Property_1.Uint64Property.Serialize(writer, property);
|
|
435
|
+
break;
|
|
436
|
+
case 'SingleProperty':
|
|
437
|
+
case 'FloatProperty':
|
|
438
|
+
overhead = FloatProperty_1.FloatProperty.CalcOverhead(property);
|
|
439
|
+
FloatProperty_1.FloatProperty.Serialize(writer, property);
|
|
440
|
+
break;
|
|
441
|
+
case 'DoubleProperty':
|
|
442
|
+
overhead = DoubleProperty_1.DoubleProperty.CalcOverhead(property);
|
|
443
|
+
DoubleProperty_1.DoubleProperty.Serialize(writer, property);
|
|
444
|
+
break;
|
|
445
|
+
case 'StrProperty':
|
|
446
|
+
case 'NameProperty':
|
|
447
|
+
overhead = StrProperty_1.StrProperty.CalcOverhead(property);
|
|
448
|
+
StrProperty_1.StrProperty.Serialize(writer, property);
|
|
449
|
+
break;
|
|
450
|
+
case 'ObjectProperty':
|
|
451
|
+
case 'InterfaceProperty':
|
|
452
|
+
overhead = ObjectProperty_1.ObjectProperty.CalcOverhead(property);
|
|
453
|
+
ObjectProperty_1.ObjectProperty.Serialize(writer, property);
|
|
454
|
+
break;
|
|
455
|
+
case 'SoftObjectProperty':
|
|
456
|
+
overhead = SoftObjectProperty_1.SoftObjectProperty.CalcOverhead(property);
|
|
457
|
+
SoftObjectProperty_1.SoftObjectProperty.Serialize(writer, property);
|
|
458
|
+
break;
|
|
459
|
+
case 'EnumProperty':
|
|
460
|
+
overhead = EnumProperty_1.EnumProperty.CalcOverhead(property);
|
|
461
|
+
EnumProperty_1.EnumProperty.Serialize(writer, property);
|
|
462
|
+
break;
|
|
463
|
+
case 'ByteProperty':
|
|
464
|
+
overhead = ByteProperty_1.ByteProperty.CalcOverhead(property);
|
|
465
|
+
ByteProperty_1.ByteProperty.Serialize(writer, property);
|
|
466
|
+
break;
|
|
467
|
+
case 'StructProperty':
|
|
468
|
+
overhead = StructProperty_1.StructProperty.CalcOverhead(property);
|
|
469
|
+
StructProperty_1.StructProperty.Serialize(writer, property);
|
|
470
|
+
break;
|
|
471
|
+
case 'ArrayProperty':
|
|
472
|
+
overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(property);
|
|
473
|
+
ArrayProperty_1.ArrayProperty.Serialize(writer, property, propertyName);
|
|
474
|
+
break;
|
|
475
|
+
case 'MapProperty':
|
|
476
|
+
overhead = MapProperty_1.MapProperty.CalcOverhead(property);
|
|
477
|
+
MapProperty_1.MapProperty.Serialize(writer, property);
|
|
478
|
+
break;
|
|
479
|
+
case 'TextProperty':
|
|
480
|
+
overhead = TextProperty_1.TextProperty.CalcOverhead(property);
|
|
481
|
+
TextProperty_1.TextProperty.Serialize(writer, property);
|
|
482
|
+
break;
|
|
483
|
+
case 'SetProperty':
|
|
484
|
+
overhead = SetProperty_1.SetProperty.CalcOverhead(property);
|
|
485
|
+
SetProperty_1.SetProperty.Serialize(writer, property);
|
|
486
|
+
break;
|
|
487
|
+
default:
|
|
488
|
+
throw new Error(`Unimplemented type ${property.type}`);
|
|
489
|
+
}
|
|
490
|
+
writer.writeBinarySizeFromPosition(lenIndicator, start + overhead);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
exports.DataFields = DataFields;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BinaryReadable } from '../../../../byte/binary-readable.interface';
|
|
2
|
+
import { ByteWriter } from '../../../../byte/byte-writer.class';
|
|
3
|
+
import { BasicProperty } from './BasicProperty';
|
|
4
|
+
export type ArrayPropertyStructValueFields = {
|
|
5
|
+
allStructType: string;
|
|
6
|
+
allIndex: number;
|
|
7
|
+
allGuid: number;
|
|
8
|
+
allUnk1?: number;
|
|
9
|
+
allUnk2?: number;
|
|
10
|
+
allUnk3?: number;
|
|
11
|
+
allUnk4?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const isArrayProperty: (property: BasicProperty) => property is ArrayProperty<any>;
|
|
14
|
+
export declare class ArrayProperty<T> extends BasicProperty {
|
|
15
|
+
subtype: string;
|
|
16
|
+
values: T[];
|
|
17
|
+
structValueFields?: ArrayPropertyStructValueFields | undefined;
|
|
18
|
+
constructor(subtype: string, values: T[], ueType?: string, index?: number, structValueFields?: ArrayPropertyStructValueFields | undefined);
|
|
19
|
+
static Parse(reader: BinaryReadable, ueType: string, index: number, propertyName: string): ArrayProperty<any>;
|
|
20
|
+
static CalcOverhead(property: ArrayProperty<any>): number;
|
|
21
|
+
static Serialize(writer: ByteWriter, property: ArrayProperty<any>, propertyName: string): void;
|
|
22
|
+
}
|