@etothepii/satisfactory-file-parser 0.0.31 → 0.0.32
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/LICENCE.md +20 -20
- package/README.md +112 -112
- package/build/index.d.ts +5 -1
- package/build/index.js +7 -7
- package/build/parser/byte/binary-operable.interface.d.ts +6 -0
- package/build/parser/byte/binary-operable.interface.js +12 -0
- package/build/parser/byte/binary-readable.interface.d.ts +22 -0
- package/build/parser/byte/binary-readable.interface.js +12 -0
- package/build/parser/byte/byte-reader.class.d.ts +11 -9
- package/build/parser/byte/byte-reader.class.js +23 -15
- package/build/parser/error/parser.error.d.ts +6 -0
- package/build/parser/error/parser.error.js +13 -1
- package/build/parser/parser.d.ts +9 -0
- package/build/parser/parser.js +100 -2
- package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts +3 -2
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +1 -1
- package/build/parser/satisfactory/objects/DataFields.d.ts +34 -6
- package/build/parser/satisfactory/objects/DataFields.js +86 -3
- package/build/parser/satisfactory/objects/ObjectReference.d.ts +2 -2
- package/build/parser/satisfactory/objects/Property.d.ts +72 -72
- package/build/parser/satisfactory/objects/Property.js +24 -23
- package/build/parser/satisfactory/objects/SaveComponent.d.ts +8 -5
- package/build/parser/satisfactory/objects/SaveComponent.js +2 -2
- package/build/parser/satisfactory/objects/SaveEntity.d.ts +9 -4
- package/build/parser/satisfactory/objects/SaveEntity.js +2 -2
- package/build/parser/satisfactory/objects/SaveObject.d.ts +9 -4
- package/build/parser/satisfactory/objects/SaveObject.js +3 -3
- package/build/parser/satisfactory/save/asynchronous-level.class.d.ts +9 -0
- package/build/parser/satisfactory/save/asynchronous-level.class.js +76 -0
- package/build/parser/satisfactory/save/level.class.d.ts +5 -5
- package/build/parser/satisfactory/save/level.class.js +7 -6
- package/build/parser/satisfactory/save/save-reader.d.ts +4 -13
- package/build/parser/satisfactory/save/save-reader.js +17 -72
- package/build/parser/satisfactory/structs/util.types.d.ts +7 -7
- package/build/parser/satisfactory/structs/util.types.js +10 -10
- package/build/parser/stream/byte-stream-reader.class.d.ts +57 -0
- package/build/parser/stream/byte-stream-reader.class.js +251 -0
- package/build/parser/stream/json-stream-state-writer.d.ts +12 -0
- package/build/parser/stream/json-stream-state-writer.js +28 -0
- package/build/parser/stream/json-stream-writable.d.ts +20 -0
- package/build/parser/stream/json-stream-writable.js +93 -0
- package/build/parser/stream/json-stream-writer.d.ts +22 -0
- package/build/parser/stream/json-stream-writer.js +137 -0
- package/build/parser/stream/save-stream-json-stringifier.d.ts +6 -0
- package/build/parser/stream/save-stream-json-stringifier.js +43 -0
- package/build/parser/stream/save-stream-reader.class.d.ts +15 -0
- package/build/parser/stream/save-stream-reader.class.js +131 -0
- package/build/parser/stream/save-stream-writer.class.d.ts +22 -0
- package/build/parser/stream/save-stream-writer.class.js +115 -0
- package/build/parser/stream/stream-level.class.d.ts +12 -0
- package/build/parser/stream/stream-level.class.js +113 -0
- package/package.json +3 -1
package/build/parser/parser.js
CHANGED
|
@@ -4,18 +4,37 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./satisfactory/blueprint/blueprint-reader", "./satisfactory/blueprint/blueprint-writer", "./satisfactory/save/level.class", "./satisfactory/save/satisfactory-save", "./satisfactory/save/save-reader", "./satisfactory/save/save-writer"], factory);
|
|
7
|
+
define(["require", "exports", "stream/web", "./satisfactory/blueprint/blueprint-reader", "./satisfactory/blueprint/blueprint-writer", "./satisfactory/save/level.class", "./satisfactory/save/satisfactory-save", "./satisfactory/save/save-reader", "./satisfactory/save/save-writer", "./stream/save-stream-reader.class", "./stream/save-stream-writer.class"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Parser = void 0;
|
|
12
|
+
exports.Parser = exports.PassthroughWebTransform = void 0;
|
|
13
|
+
const web_1 = require("stream/web");
|
|
13
14
|
const blueprint_reader_1 = require("./satisfactory/blueprint/blueprint-reader");
|
|
14
15
|
const blueprint_writer_1 = require("./satisfactory/blueprint/blueprint-writer");
|
|
15
16
|
const level_class_1 = require("./satisfactory/save/level.class");
|
|
16
17
|
const satisfactory_save_1 = require("./satisfactory/save/satisfactory-save");
|
|
17
18
|
const save_reader_1 = require("./satisfactory/save/save-reader");
|
|
18
19
|
const save_writer_1 = require("./satisfactory/save/save-writer");
|
|
20
|
+
const save_stream_reader_class_1 = require("./stream/save-stream-reader.class");
|
|
21
|
+
const save_stream_writer_class_1 = require("./stream/save-stream-writer.class");
|
|
22
|
+
class PassthroughWebTransform extends web_1.TransformStream {
|
|
23
|
+
constructor() {
|
|
24
|
+
super({
|
|
25
|
+
start: (controller) => {
|
|
26
|
+
},
|
|
27
|
+
transform: async (chunk, controller) => {
|
|
28
|
+
chunk = await chunk;
|
|
29
|
+
controller.enqueue(chunk);
|
|
30
|
+
},
|
|
31
|
+
flush: (controller) => {
|
|
32
|
+
console.log('on passthrough dispose.');
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.PassthroughWebTransform = PassthroughWebTransform;
|
|
19
38
|
class Parser {
|
|
20
39
|
static WriteSave(save, onBinaryBeforeCompressing, onHeader, onChunk) {
|
|
21
40
|
const writer = new save_writer_1.SaveWriter();
|
|
@@ -26,6 +45,68 @@
|
|
|
26
45
|
const chunkSummary = writer.generateChunks(save.compressionInfo, posAfterHeader, onBinaryBeforeCompressing, onHeader, onChunk);
|
|
27
46
|
return chunkSummary;
|
|
28
47
|
}
|
|
48
|
+
static async ParseSaveFileStream(input, output, binaryOutput) {
|
|
49
|
+
return new Promise(async (resolve, reject) => {
|
|
50
|
+
if (input.locked || output.locked || (binaryOutput !== undefined ? binaryOutput.locked : false)) {
|
|
51
|
+
throw new Error('One of the input/output streams is locked. Aborting save parsing.');
|
|
52
|
+
}
|
|
53
|
+
const binaryOutWriter = binaryOutput ? binaryOutput.getWriter() : undefined;
|
|
54
|
+
const writer = new save_stream_writer_class_1.SaveStreamWriter(output.getWriter());
|
|
55
|
+
const reader = new save_stream_reader_class_1.SaveStreamReader(input.getReader(), 500 * 1000 * 1000);
|
|
56
|
+
const passthrough = new PassthroughWebTransform();
|
|
57
|
+
const passthroughWriter = passthrough.writable.getWriter();
|
|
58
|
+
const passthroughReader = new save_stream_reader_class_1.SaveStreamReader(passthrough.readable.getReader(), 3000 * 1000 * 1000);
|
|
59
|
+
await writer.beginSave();
|
|
60
|
+
const header = await reader.readHeader();
|
|
61
|
+
await writer.writeHeader(header);
|
|
62
|
+
let contentParsingPromise;
|
|
63
|
+
const decompressionPromise = Parser.DecompressStreamSave(reader, writer, passthroughWriter, async () => {
|
|
64
|
+
console.log('start streaming content');
|
|
65
|
+
passthroughReader.debug = true;
|
|
66
|
+
contentParsingPromise = await Parser.ParseStreamSave(passthroughReader, writer, header);
|
|
67
|
+
await writer.close();
|
|
68
|
+
return resolve();
|
|
69
|
+
}, binaryOutWriter);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
static async ParseStreamSave(reader, jsonWriter, header) {
|
|
73
|
+
return new Promise(async (resolve, reject) => {
|
|
74
|
+
reader.onCloseCallback = async () => {
|
|
75
|
+
console.log('content reader closes.');
|
|
76
|
+
await jsonWriter.endLevels();
|
|
77
|
+
await jsonWriter.endSave();
|
|
78
|
+
return resolve();
|
|
79
|
+
};
|
|
80
|
+
console.log('before open levels');
|
|
81
|
+
await jsonWriter.openLevels();
|
|
82
|
+
const dataLength = await reader.readInt32();
|
|
83
|
+
await reader.allocate(Math.min(1000, dataLength));
|
|
84
|
+
console.log(`incoming body size should be ${dataLength} bytes big.`);
|
|
85
|
+
await reader.streamLevelsToOutput(jsonWriter, header);
|
|
86
|
+
await reader.close();
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
static async DecompressStreamSave(reader, jsonWriter, outputWriter, onDecompressionInfoWritten, debugAdditionalBinaryOutputWriter) {
|
|
90
|
+
return new Promise(async (resolve, reject) => {
|
|
91
|
+
reader.onCloseCallback = async () => {
|
|
92
|
+
console.log('decompress reader closes.');
|
|
93
|
+
return resolve();
|
|
94
|
+
};
|
|
95
|
+
let first = true;
|
|
96
|
+
while (reader.hasInput()) {
|
|
97
|
+
const decompressedChunk = await reader.readBodyChunk();
|
|
98
|
+
if (first && reader.compressionInfo) {
|
|
99
|
+
await jsonWriter.writeCompressionInfo(reader.compressionInfo);
|
|
100
|
+
onDecompressionInfoWritten();
|
|
101
|
+
first = false;
|
|
102
|
+
}
|
|
103
|
+
if (debugAdditionalBinaryOutputWriter) {
|
|
104
|
+
debugAdditionalBinaryOutputWriter.write(decompressedChunk);
|
|
105
|
+
}
|
|
106
|
+
outputWriter.write(decompressedChunk);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
29
110
|
static ParseSaveFile(file, onDecompressedSaveBody = () => { }, onProgress = () => { }) {
|
|
30
111
|
const reader = new save_reader_1.SaveReader(new Uint8Array(file).buffer, onProgress);
|
|
31
112
|
const header = reader.readHeader();
|
|
@@ -38,6 +119,23 @@
|
|
|
38
119
|
save.trailingCollectedObjects = reader.trailingCollectedObjects;
|
|
39
120
|
return save;
|
|
40
121
|
}
|
|
122
|
+
static async ParseSaveFileAsynchronousToOutput(file, outputJson, onDecompressedSaveBody = () => { }, onProgress = () => { }) {
|
|
123
|
+
const reader = new save_reader_1.SaveReader(new Uint8Array(file).buffer, onProgress);
|
|
124
|
+
const writer = new save_stream_writer_class_1.SaveStreamWriter(outputJson.getWriter());
|
|
125
|
+
await writer.beginSave();
|
|
126
|
+
const header = reader.readHeader();
|
|
127
|
+
const save = new satisfactory_save_1.SatisfactorySave(header);
|
|
128
|
+
await writer.writeHeader(save.header);
|
|
129
|
+
await writer.writeCompressionInfo({});
|
|
130
|
+
const inflateResult = reader.inflateChunks();
|
|
131
|
+
onDecompressedSaveBody(reader.getBuffer());
|
|
132
|
+
const levelParseResult = await reader.readLevelsAsynchronously(writer);
|
|
133
|
+
save.levels = reader.levels;
|
|
134
|
+
save.compressionInfo = reader.compressionInfo;
|
|
135
|
+
save.trailingCollectedObjects = reader.trailingCollectedObjects;
|
|
136
|
+
await writer.endSave();
|
|
137
|
+
return save;
|
|
138
|
+
}
|
|
41
139
|
static WriteBlueprintFiles(blueprint, onMainFileBinaryBeforeCompressing = () => { }, onMainFileHeader = () => { }, onMainFileChunk = () => { }) {
|
|
42
140
|
const blueprintWriter = new blueprint_writer_1.BlueprintWriter();
|
|
43
141
|
blueprint_writer_1.BlueprintWriter.SerializeHeader(blueprintWriter, blueprint.header);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
1
2
|
import { ByteReader } from "../../byte/byte-reader.class";
|
|
2
3
|
import { ChunkCompressionInfo } from "../../file.types";
|
|
3
4
|
import { SaveComponent } from "../objects/SaveComponent";
|
|
@@ -6,7 +7,7 @@ import { BlueprintConfig, BlueprintHeader } from "./blueprint.types";
|
|
|
6
7
|
export declare class BlueprintReader extends ByteReader {
|
|
7
8
|
compressionInfo: ChunkCompressionInfo;
|
|
8
9
|
constructor(bluePrintBuffer: ArrayBuffer);
|
|
9
|
-
static ReadHeader(reader:
|
|
10
|
+
static ReadHeader(reader: BinaryReadable): BlueprintHeader;
|
|
10
11
|
inflateChunks(): any;
|
|
11
12
|
static ParseObjects(reader: ByteReader): (SaveEntity | SaveComponent)[];
|
|
12
13
|
}
|
|
@@ -14,5 +15,5 @@ export declare class BlueprintConfigReader extends ByteReader {
|
|
|
14
15
|
bluePrintConfigBuffer: ArrayBuffer;
|
|
15
16
|
constructor(bluePrintConfigBuffer: ArrayBuffer);
|
|
16
17
|
parse: () => BlueprintConfig;
|
|
17
|
-
static ParseConfig(reader:
|
|
18
|
+
static ParseConfig(reader: BinaryReadable): BlueprintConfig;
|
|
18
19
|
}
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
writer.writeInt32(0);
|
|
55
55
|
level_class_1.Level.SerializeObjectHeaders(writer, objects);
|
|
56
56
|
writer.writeBinarySizeFromPosition(headersLenIndicator, headersLenIndicator + 4);
|
|
57
|
-
level_class_1.Level.SerializeObjectContents(writer, objects, 0);
|
|
57
|
+
level_class_1.Level.SerializeObjectContents(writer, objects, 0, '');
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
exports.BlueprintWriter = BlueprintWriter;
|
|
@@ -1,13 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ByteWriter } from "../../..";
|
|
2
|
+
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
2
3
|
import { SaveWriter } from "../save/save-writer";
|
|
4
|
+
import { vec3 } from "../structs/util.types";
|
|
5
|
+
import { ObjectReference } from "./ObjectReference";
|
|
3
6
|
import { AbstractBaseProperty } from "./Property";
|
|
7
|
+
export type SpecialAnyProperty = {} | PowerLineSpecialProperty;
|
|
8
|
+
export type PowerLineSpecialProperty = {
|
|
9
|
+
num: number;
|
|
10
|
+
source: ObjectReference;
|
|
11
|
+
target: ObjectReference;
|
|
12
|
+
sourceTranslation?: vec3;
|
|
13
|
+
targetTranslation?: vec3;
|
|
14
|
+
};
|
|
15
|
+
export type PlayerSpecialProperty = {
|
|
16
|
+
flag: number;
|
|
17
|
+
eosData?: string;
|
|
18
|
+
steamPlayerData?: string;
|
|
19
|
+
};
|
|
20
|
+
export type ItemSpecialProperty = {
|
|
21
|
+
length: number;
|
|
22
|
+
name: string;
|
|
23
|
+
position: number;
|
|
24
|
+
pathName: string;
|
|
25
|
+
};
|
|
26
|
+
export type ConveyorSpecialProperty = {
|
|
27
|
+
items: ItemSpecialProperty[];
|
|
28
|
+
};
|
|
4
29
|
export declare class DataFields {
|
|
5
|
-
properties:
|
|
30
|
+
properties: AbstractBaseProperty[];
|
|
31
|
+
specialProperties: SpecialAnyProperty;
|
|
6
32
|
trailingData: number[];
|
|
7
33
|
shouldBeNulled: boolean;
|
|
8
34
|
constructor();
|
|
9
|
-
static Parse(length: number, reader:
|
|
10
|
-
static
|
|
11
|
-
static
|
|
12
|
-
static
|
|
35
|
+
static Parse(length: number, reader: BinaryReadable, buildVersion: number, typePath: string): DataFields;
|
|
36
|
+
static ParseAdditionalSpecialProperties(reader: BinaryReadable, typePath: string, remainingLen: number): SpecialAnyProperty;
|
|
37
|
+
static ParseProperty(reader: BinaryReadable, buildVersion: number, propertyName: string): AbstractBaseProperty | null;
|
|
38
|
+
static Serialize(writer: SaveWriter, fields: DataFields, buildVersion: number, typePath: string): void;
|
|
39
|
+
static SerializeAdditionalSpecialProperties(writer: ByteWriter, typePath: string, property: SpecialAnyProperty): void;
|
|
40
|
+
static SerializeProperty(writer: ByteWriter, property: AbstractBaseProperty, propertyName: string, buildVersion: number): void;
|
|
13
41
|
}
|
|
@@ -4,20 +4,22 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./Property"], factory);
|
|
7
|
+
define(["require", "exports", "../structs/util.types", "./Property"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DataFields = void 0;
|
|
13
|
+
const util_types_1 = require("../structs/util.types");
|
|
13
14
|
const Property_1 = require("./Property");
|
|
14
15
|
class DataFields {
|
|
15
16
|
constructor() {
|
|
16
17
|
this.properties = [];
|
|
18
|
+
this.specialProperties = {};
|
|
17
19
|
this.trailingData = [];
|
|
18
20
|
this.shouldBeNulled = false;
|
|
19
21
|
}
|
|
20
|
-
static Parse(length, reader, buildVersion) {
|
|
22
|
+
static Parse(length, reader, buildVersion, typePath) {
|
|
21
23
|
const start = reader.getBufferPosition();
|
|
22
24
|
const fields = new DataFields();
|
|
23
25
|
if (length === 0) {
|
|
@@ -33,11 +35,58 @@
|
|
|
33
35
|
let int1 = reader.readInt32();
|
|
34
36
|
if (int1 !== 0) {
|
|
35
37
|
}
|
|
38
|
+
fields.specialProperties = DataFields.ParseAdditionalSpecialProperties(reader, typePath, start + length - reader.getBufferPosition() - 4);
|
|
36
39
|
const end = reader.getBufferPosition();
|
|
37
40
|
let remainingBytes = start + length - end;
|
|
38
41
|
fields.trailingData = Array.from(reader.readBytes(remainingBytes));
|
|
39
42
|
return fields;
|
|
40
43
|
}
|
|
44
|
+
static ParseAdditionalSpecialProperties(reader, typePath, remainingLen) {
|
|
45
|
+
let property;
|
|
46
|
+
switch (typePath) {
|
|
47
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':
|
|
48
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':
|
|
49
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C':
|
|
50
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C':
|
|
51
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C':
|
|
52
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C':
|
|
53
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C':
|
|
54
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C':
|
|
55
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
|
|
56
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C':
|
|
57
|
+
property = {};
|
|
58
|
+
break;
|
|
59
|
+
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
|
|
60
|
+
case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C':
|
|
61
|
+
property = {
|
|
62
|
+
source: Property_1.ObjectProperty.ReadValue(reader),
|
|
63
|
+
target: Property_1.ObjectProperty.ReadValue(reader)
|
|
64
|
+
};
|
|
65
|
+
if (remainingLen >= 24) {
|
|
66
|
+
property.sourceTranslation = (0, util_types_1.ParseVec3)(reader);
|
|
67
|
+
property.targetTranslation = (0, util_types_1.ParseVec3)(reader);
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C':
|
|
71
|
+
property = {};
|
|
72
|
+
property.flag = reader.readByte();
|
|
73
|
+
switch (property.flag) {
|
|
74
|
+
case 248:
|
|
75
|
+
const eos = reader.readString();
|
|
76
|
+
property.eosData = reader.readString();
|
|
77
|
+
break;
|
|
78
|
+
case 25:
|
|
79
|
+
break;
|
|
80
|
+
default:
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
property = {};
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
return property;
|
|
89
|
+
}
|
|
41
90
|
static ParseProperty(reader, buildVersion, propertyName) {
|
|
42
91
|
let currentProperty = {};
|
|
43
92
|
if (currentProperty.name === 'None') {
|
|
@@ -131,15 +180,49 @@
|
|
|
131
180
|
}
|
|
132
181
|
return currentProperty;
|
|
133
182
|
}
|
|
134
|
-
static Serialize(writer, fields, buildVersion) {
|
|
183
|
+
static Serialize(writer, fields, buildVersion, typePath) {
|
|
135
184
|
for (const property of fields.properties) {
|
|
136
185
|
writer.writeString(property.name);
|
|
137
186
|
DataFields.SerializeProperty(writer, property, property.name, buildVersion);
|
|
138
187
|
}
|
|
139
188
|
writer.writeString('None');
|
|
140
189
|
writer.writeInt32(0);
|
|
190
|
+
DataFields.SerializeAdditionalSpecialProperties(writer, typePath, fields.specialProperties);
|
|
141
191
|
writer.writeBytesArray(fields.trailingData);
|
|
142
192
|
}
|
|
193
|
+
static SerializeAdditionalSpecialProperties(writer, typePath, property) {
|
|
194
|
+
switch (typePath) {
|
|
195
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':
|
|
196
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':
|
|
197
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C':
|
|
198
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C':
|
|
199
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C':
|
|
200
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C':
|
|
201
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C':
|
|
202
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C':
|
|
203
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
|
|
204
|
+
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C':
|
|
205
|
+
break;
|
|
206
|
+
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':
|
|
207
|
+
case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C':
|
|
208
|
+
Property_1.ObjectProperty.SerializeValue(writer, property.source);
|
|
209
|
+
Property_1.ObjectProperty.SerializeValue(writer, property.target);
|
|
210
|
+
break;
|
|
211
|
+
case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C':
|
|
212
|
+
writer.writeByte(property.flag);
|
|
213
|
+
switch (property.flag) {
|
|
214
|
+
case 248:
|
|
215
|
+
writer.writeString('EOS');
|
|
216
|
+
writer.writeString(property.eosData);
|
|
217
|
+
break;
|
|
218
|
+
case 25:
|
|
219
|
+
break;
|
|
220
|
+
default:
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
143
226
|
static SerializeProperty(writer, property, propertyName, buildVersion) {
|
|
144
227
|
writer.writeString(property.ueType);
|
|
145
228
|
const lenIndicator = writer.getBufferPosition();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
2
2
|
import { ByteWriter } from "../../byte/byte-writer.class";
|
|
3
3
|
export declare class ObjectReference {
|
|
4
4
|
levelName: string;
|
|
5
5
|
pathName: string;
|
|
6
6
|
constructor(levelName: string, pathName: string);
|
|
7
|
-
static Parse(reader:
|
|
7
|
+
static Parse(reader: BinaryReadable): ObjectReference;
|
|
8
8
|
static Serialize(writer: ByteWriter, ref: ObjectReference): void;
|
|
9
9
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ByteWriter } from "../../..";
|
|
2
|
+
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
3
3
|
import { col4, vec3, vec4 } from "../structs/util.types";
|
|
4
4
|
import { ObjectReference } from "./ObjectReference";
|
|
5
5
|
export type Properties = {
|
|
@@ -20,19 +20,19 @@ export declare abstract class BasicProperty extends AbstractBaseProperty {
|
|
|
20
20
|
constructor(type: string, ueType: string, guidInfo: GUID, index?: number);
|
|
21
21
|
}
|
|
22
22
|
export type GUID = undefined | Uint8Array;
|
|
23
|
-
export declare const ParseGUID: (reader:
|
|
24
|
-
export declare const SerializeGUID: (writer:
|
|
23
|
+
export declare const ParseGUID: (reader: BinaryReadable) => GUID;
|
|
24
|
+
export declare const SerializeGUID: (writer: ByteWriter, guid: GUID) => void;
|
|
25
25
|
export type OverheadResult = {
|
|
26
26
|
overhead: number;
|
|
27
27
|
};
|
|
28
28
|
export declare class BoolProperty extends BasicProperty {
|
|
29
29
|
value: boolean;
|
|
30
30
|
constructor(value: boolean, ueType?: string, guidInfo?: GUID, index?: number);
|
|
31
|
-
static Parse(reader:
|
|
32
|
-
static ReadValue(reader:
|
|
31
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): BoolProperty;
|
|
32
|
+
static ReadValue(reader: BinaryReadable): boolean;
|
|
33
33
|
static CalcOverhead(property: BoolProperty): number;
|
|
34
|
-
static Serialize(writer:
|
|
35
|
-
static SerializeValue(writer:
|
|
34
|
+
static Serialize(writer: ByteWriter, property: BoolProperty): void;
|
|
35
|
+
static SerializeValue(writer: ByteWriter, value: boolean): void;
|
|
36
36
|
}
|
|
37
37
|
export type BytePropertyValue = {
|
|
38
38
|
type: string;
|
|
@@ -41,92 +41,92 @@ export type BytePropertyValue = {
|
|
|
41
41
|
export declare class ByteProperty extends BasicProperty {
|
|
42
42
|
value: BytePropertyValue;
|
|
43
43
|
constructor(value: BytePropertyValue, ueType?: string, guidInfo?: GUID, index?: number);
|
|
44
|
-
static Parse(reader:
|
|
45
|
-
static ReadValue(reader:
|
|
44
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): ByteProperty;
|
|
45
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
46
46
|
static CalcOverhead(property: ByteProperty): number;
|
|
47
|
-
static Serialize(writer:
|
|
48
|
-
static SerializeValue(writer:
|
|
47
|
+
static Serialize(writer: ByteWriter, property: ByteProperty): void;
|
|
48
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
49
49
|
}
|
|
50
50
|
export declare class Int8Property extends BasicProperty {
|
|
51
51
|
value: number;
|
|
52
52
|
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
|
|
53
|
-
static Parse(reader:
|
|
54
|
-
static ReadValue(reader:
|
|
53
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int8Property;
|
|
54
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
55
55
|
static CalcOverhead(property: Int8Property): number;
|
|
56
|
-
static Serialize(writer:
|
|
57
|
-
static SerializeValue(writer:
|
|
56
|
+
static Serialize(writer: ByteWriter, property: Int8Property): void;
|
|
57
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
58
58
|
}
|
|
59
59
|
export declare class Uint8Property extends BasicProperty {
|
|
60
60
|
value: number;
|
|
61
61
|
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
|
|
62
|
-
static Parse(reader:
|
|
63
|
-
static ReadValue(reader:
|
|
62
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint8Property;
|
|
63
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
64
64
|
static CalcOverhead(property: Uint8Property): number;
|
|
65
|
-
static Serialize(writer:
|
|
66
|
-
static SerializeValue(writer:
|
|
65
|
+
static Serialize(writer: ByteWriter, property: Uint8Property): void;
|
|
66
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
67
67
|
}
|
|
68
68
|
export declare class Int32Property extends BasicProperty {
|
|
69
69
|
value: number;
|
|
70
70
|
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
|
|
71
|
-
static Parse(reader:
|
|
72
|
-
static ReadValue(reader:
|
|
71
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int32Property;
|
|
72
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
73
73
|
static CalcOverhead(property: Int32Property): number;
|
|
74
|
-
static Serialize(writer:
|
|
75
|
-
static SerializeValue(writer:
|
|
74
|
+
static Serialize(writer: ByteWriter, property: Int32Property): void;
|
|
75
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
76
76
|
}
|
|
77
77
|
export declare class Uint32Property extends BasicProperty {
|
|
78
78
|
value: number;
|
|
79
79
|
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
|
|
80
|
-
static Parse(reader:
|
|
81
|
-
static ReadValue(reader:
|
|
80
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint32Property;
|
|
81
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
82
82
|
static CalcOverhead(property: Uint32Property): number;
|
|
83
|
-
static Serialize(writer:
|
|
84
|
-
static SerializeValue(writer:
|
|
83
|
+
static Serialize(writer: ByteWriter, property: Uint32Property): void;
|
|
84
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
85
85
|
}
|
|
86
86
|
export declare class Int64Property extends BasicProperty {
|
|
87
87
|
value: string;
|
|
88
88
|
constructor(value: string, ueType?: string, guidInfo?: GUID, index?: number);
|
|
89
|
-
static Parse(reader:
|
|
90
|
-
static ReadValue(reader:
|
|
89
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int64Property;
|
|
90
|
+
static ReadValue(reader: BinaryReadable): string;
|
|
91
91
|
static CalcOverhead(property: Int64Property): number;
|
|
92
|
-
static Serialize(writer:
|
|
93
|
-
static SerializeValue(writer:
|
|
92
|
+
static Serialize(writer: ByteWriter, property: Int64Property): void;
|
|
93
|
+
static SerializeValue(writer: ByteWriter, value: string): void;
|
|
94
94
|
}
|
|
95
95
|
export declare class FloatProperty extends BasicProperty {
|
|
96
96
|
value: number;
|
|
97
97
|
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
|
|
98
|
-
static Parse(reader:
|
|
98
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): FloatProperty;
|
|
99
99
|
static CalcOverhead(property: FloatProperty): number;
|
|
100
|
-
static ReadValue(reader:
|
|
101
|
-
static Serialize(writer:
|
|
102
|
-
static SerializeValue(writer:
|
|
100
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
101
|
+
static Serialize(writer: ByteWriter, property: FloatProperty): void;
|
|
102
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
103
103
|
}
|
|
104
104
|
export declare class DoubleProperty extends BasicProperty {
|
|
105
105
|
value: number;
|
|
106
106
|
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number);
|
|
107
|
-
static Parse(reader:
|
|
108
|
-
static ReadValue(reader:
|
|
107
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): DoubleProperty;
|
|
108
|
+
static ReadValue(reader: BinaryReadable): number;
|
|
109
109
|
static CalcOverhead(property: DoubleProperty): number;
|
|
110
|
-
static Serialize(writer:
|
|
111
|
-
static SerializeValue(writer:
|
|
110
|
+
static Serialize(writer: ByteWriter, property: DoubleProperty): void;
|
|
111
|
+
static SerializeValue(writer: ByteWriter, value: number): void;
|
|
112
112
|
}
|
|
113
113
|
export declare class StrProperty extends BasicProperty {
|
|
114
114
|
value: string;
|
|
115
115
|
constructor(value: string, ueType?: string, guidInfo?: GUID, index?: number);
|
|
116
|
-
static Parse(reader:
|
|
117
|
-
static ReadValue(reader:
|
|
116
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): StrProperty;
|
|
117
|
+
static ReadValue(reader: BinaryReadable): string;
|
|
118
118
|
static CalcOverhead(property: StrProperty): number;
|
|
119
|
-
static Serialize(writer:
|
|
120
|
-
static SerializeValue(writer:
|
|
119
|
+
static Serialize(writer: ByteWriter, property: StrProperty): void;
|
|
120
|
+
static SerializeValue(writer: ByteWriter, value: string): void;
|
|
121
121
|
}
|
|
122
122
|
export declare class ObjectProperty extends BasicProperty {
|
|
123
123
|
value: ObjectReference;
|
|
124
124
|
constructor(value: ObjectReference, ueType?: string, guidInfo?: GUID, index?: number);
|
|
125
|
-
static Parse(reader:
|
|
126
|
-
static ReadValue(reader:
|
|
125
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): ObjectProperty;
|
|
126
|
+
static ReadValue(reader: BinaryReadable): ObjectReference;
|
|
127
127
|
static CalcOverhead(property: ObjectProperty): number;
|
|
128
|
-
static Serialize(writer:
|
|
129
|
-
static SerializeValue(writer:
|
|
128
|
+
static Serialize(writer: ByteWriter, property: ObjectProperty): void;
|
|
129
|
+
static SerializeValue(writer: ByteWriter, value: {
|
|
130
130
|
levelName: string;
|
|
131
131
|
pathName: string;
|
|
132
132
|
}): void;
|
|
@@ -140,11 +140,11 @@ export declare class EnumProperty extends BasicProperty {
|
|
|
140
140
|
name: string;
|
|
141
141
|
value: string;
|
|
142
142
|
}, ueType?: string, guidInfo?: GUID, index?: number);
|
|
143
|
-
static Parse(reader:
|
|
144
|
-
static ReadValue(reader:
|
|
143
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): EnumProperty;
|
|
144
|
+
static ReadValue(reader: BinaryReadable): string;
|
|
145
145
|
static CalcOverhead(property: EnumProperty): number;
|
|
146
|
-
static Serialize(writer:
|
|
147
|
-
static SerializeValue(writer:
|
|
146
|
+
static Serialize(writer: ByteWriter, property: EnumProperty): void;
|
|
147
|
+
static SerializeValue(writer: ByteWriter, value: string): void;
|
|
148
148
|
}
|
|
149
149
|
export type TextPropertyValue = {
|
|
150
150
|
flags: number;
|
|
@@ -165,11 +165,11 @@ export type TextPropertyValue = {
|
|
|
165
165
|
export declare class TextProperty extends BasicProperty {
|
|
166
166
|
value: TextPropertyValue;
|
|
167
167
|
constructor(value: TextPropertyValue, ueType?: string, guidInfo?: GUID, index?: number);
|
|
168
|
-
static Parse(reader:
|
|
169
|
-
static ParseValue(reader:
|
|
168
|
+
static Parse(reader: BinaryReadable, ueType: string, index?: number): TextProperty;
|
|
169
|
+
static ParseValue(reader: BinaryReadable): TextPropertyValue;
|
|
170
170
|
static CalcOverhead(property: TextProperty): number;
|
|
171
|
-
static Serialize(writer:
|
|
172
|
-
static SerializeValue(writer:
|
|
171
|
+
static Serialize(writer: ByteWriter, property: TextProperty): void;
|
|
172
|
+
static SerializeValue(writer: ByteWriter, value: TextPropertyValue): void;
|
|
173
173
|
}
|
|
174
174
|
export type BasicMultipleStructPropertyValue = {
|
|
175
175
|
values: any;
|
|
@@ -213,11 +213,11 @@ export declare class StructProperty extends AbstractBaseProperty {
|
|
|
213
213
|
unk3?: number;
|
|
214
214
|
unk4?: number;
|
|
215
215
|
constructor(subtype: string, ueType?: string, index?: number, guid?: number);
|
|
216
|
-
static Parse(reader:
|
|
217
|
-
static ParseValue(reader:
|
|
216
|
+
static Parse(reader: BinaryReadable, ueType: string, index: number, size: number): StructProperty;
|
|
217
|
+
static ParseValue(reader: BinaryReadable, subtype: string, size: number): GENERIC_STRUCT_PROPERTY_VALUE;
|
|
218
218
|
static CalcOverhead(property: StructProperty): number;
|
|
219
|
-
static Serialize(writer:
|
|
220
|
-
static SerializeValue(writer:
|
|
219
|
+
static Serialize(writer: ByteWriter, property: StructProperty): void;
|
|
220
|
+
static SerializeValue(writer: ByteWriter, subtype: string, value: GENERIC_STRUCT_PROPERTY_VALUE): void;
|
|
221
221
|
}
|
|
222
222
|
export type ArrayPropertyStructValueFields = {
|
|
223
223
|
allStructType: string;
|
|
@@ -233,17 +233,17 @@ export declare class ArrayProperty<T> extends BasicProperty {
|
|
|
233
233
|
values: T[];
|
|
234
234
|
structValueFields?: ArrayPropertyStructValueFields | undefined;
|
|
235
235
|
constructor(subtype: string, values: T[], ueType?: string, index?: number, structValueFields?: ArrayPropertyStructValueFields | undefined);
|
|
236
|
-
static Parse(reader:
|
|
236
|
+
static Parse(reader: BinaryReadable, ueType: string, index: number, propertyName: string): ArrayProperty<any>;
|
|
237
237
|
static CalcOverhead(property: ArrayProperty<any>): number;
|
|
238
|
-
static Serialize(writer:
|
|
238
|
+
static Serialize(writer: ByteWriter, property: ArrayProperty<any>, propertyName: string): void;
|
|
239
239
|
}
|
|
240
240
|
export declare class SetProperty<T> extends BasicProperty {
|
|
241
241
|
subtype: string;
|
|
242
242
|
values: T[];
|
|
243
243
|
constructor(subtype: string, values: T[], ueType: string, index: number);
|
|
244
|
-
static Parse(reader:
|
|
244
|
+
static Parse(reader: BinaryReadable, ueType: string, index: number, propertyName: string): SetProperty<any>;
|
|
245
245
|
static CalcOverhead(property: SetProperty<any>): number;
|
|
246
|
-
static Serialize(writer:
|
|
246
|
+
static Serialize(writer: ByteWriter, property: SetProperty<any>): void;
|
|
247
247
|
}
|
|
248
248
|
export declare class MapProperty extends BasicProperty {
|
|
249
249
|
keyType: string;
|
|
@@ -258,13 +258,13 @@ export declare class MapProperty extends BasicProperty {
|
|
|
258
258
|
value: any;
|
|
259
259
|
}[];
|
|
260
260
|
constructor(keyType: string, valueType: string, ueType: string, index: number);
|
|
261
|
-
static Parse(reader:
|
|
261
|
+
static Parse(reader: BinaryReadable, propertyName: string, buildVersion: number, size: number, ueType?: string, index?: number): MapProperty;
|
|
262
262
|
static CalcOverhead(property: MapProperty): number;
|
|
263
|
-
static Serialize(writer:
|
|
263
|
+
static Serialize(writer: ByteWriter, property: MapProperty): void;
|
|
264
264
|
}
|
|
265
|
-
export declare const ParseDynamicStructData: (reader:
|
|
266
|
-
export declare const SerializeDynamicStructData: (writer:
|
|
267
|
-
export declare const ReadFINNetworkTrace: (reader:
|
|
268
|
-
export declare const SerializeFINNetworkTrace: (writer:
|
|
269
|
-
export declare const ReadFINLuaProcessorStateStorage: (reader:
|
|
270
|
-
export declare const SerializeFINLuaProcessorStateStorage: (writer:
|
|
265
|
+
export declare const ParseDynamicStructData: (reader: BinaryReadable, buildVersion: number, type: string) => DynamicStructPropertyValue;
|
|
266
|
+
export declare const SerializeDynamicStructData: (writer: ByteWriter, buildVersion: number, data: DynamicStructPropertyValue) => void;
|
|
267
|
+
export declare const ReadFINNetworkTrace: (reader: BinaryReadable) => any;
|
|
268
|
+
export declare const SerializeFINNetworkTrace: (writer: ByteWriter, obj: any) => void;
|
|
269
|
+
export declare const ReadFINLuaProcessorStateStorage: (reader: BinaryReadable, size: number) => any;
|
|
270
|
+
export declare const SerializeFINLuaProcessorStateStorage: (writer: ByteWriter, stateStorage: any) => void;
|