@etothepii/satisfactory-file-parser 0.0.30 → 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 +23 -0
- package/build/index.js +65 -0
- package/build/parser/byte/alignment.enum.d.ts +4 -0
- package/build/parser/byte/alignment.enum.js +18 -0
- 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 +36 -0
- package/build/parser/byte/byte-reader.class.js +139 -0
- package/build/parser/byte/byte-writer.class.d.ts +33 -0
- package/build/parser/byte/byte-writer.class.js +149 -0
- package/build/parser/error/parser.error.d.ts +18 -0
- package/build/parser/error/parser.error.js +50 -0
- package/build/parser/file.types.d.ts +9 -0
- package/build/parser/file.types.js +12 -0
- package/build/parser/parser.d.ts +25 -0
- package/build/parser/parser.js +196 -0
- package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts +19 -0
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +134 -0
- package/build/parser/satisfactory/blueprint/blueprint-writer.d.ts +15 -0
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +73 -0
- package/build/parser/satisfactory/blueprint/blueprint.types.d.ts +20 -0
- package/build/parser/satisfactory/blueprint/blueprint.types.js +12 -0
- package/build/parser/satisfactory/objects/DataFields.d.ts +41 -0
- package/build/parser/satisfactory/objects/DataFields.js +317 -0
- package/build/parser/satisfactory/objects/ObjectReference.d.ts +9 -0
- package/build/parser/satisfactory/objects/ObjectReference.js +27 -0
- package/build/parser/satisfactory/objects/Property.d.ts +270 -0
- package/build/parser/satisfactory/objects/Property.js +1012 -0
- package/build/parser/satisfactory/objects/SaveComponent.d.ts +19 -0
- package/build/parser/satisfactory/objects/SaveComponent.js +41 -0
- package/build/parser/satisfactory/objects/SaveEntity.d.ts +30 -0
- package/build/parser/satisfactory/objects/SaveEntity.js +80 -0
- package/build/parser/satisfactory/objects/SaveObject.d.ts +19 -0
- package/build/parser/satisfactory/objects/SaveObject.js +39 -0
- 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 +21 -0
- package/build/parser/satisfactory/save/level.class.js +149 -0
- package/build/parser/satisfactory/save/satisfactory-save.d.ts +11 -0
- package/build/parser/satisfactory/save/satisfactory-save.js +21 -0
- package/build/parser/satisfactory/save/save-reader.d.ts +35 -0
- package/build/parser/satisfactory/save/save-reader.js +188 -0
- package/build/parser/satisfactory/save/save-writer.d.ts +12 -0
- package/build/parser/satisfactory/save/save-writer.js +122 -0
- package/build/parser/satisfactory/save/save.types.d.ts +49 -0
- package/build/parser/satisfactory/save/save.types.js +12 -0
- package/build/parser/satisfactory/structs/util.types.d.ts +40 -0
- package/build/parser/satisfactory/structs/util.types.js +105 -0
- 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 +5 -3
- package/dist/index.d.ts +0 -610
- package/dist/index.js +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ByteWriter } from "../../byte/byte-writer.class";
|
|
2
|
+
import { ChunkCompressionInfo, ChunkSummary } from "../../file.types";
|
|
3
|
+
import { SaveComponent } from "../objects/SaveComponent";
|
|
4
|
+
import { SaveEntity } from "../objects/SaveEntity";
|
|
5
|
+
import { BlueprintConfig, BlueprintHeader } from "./blueprint.types";
|
|
6
|
+
export declare class BlueprintWriter extends ByteWriter {
|
|
7
|
+
constructor();
|
|
8
|
+
static SerializeHeader(writer: ByteWriter, header: BlueprintHeader): void;
|
|
9
|
+
generateChunks(compressionInfo: ChunkCompressionInfo, posAfterHeader: number, onBinaryBeforeCompressing: (binary: ArrayBuffer) => void, onHeader: (header: Uint8Array) => void, onChunk: (chunk: Uint8Array) => void): ChunkSummary[];
|
|
10
|
+
static SerializeObjects(writer: ByteWriter, objects: (SaveEntity | SaveComponent)[]): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class BlueprintConfigWriter extends ByteWriter {
|
|
13
|
+
constructor();
|
|
14
|
+
static SerializeConfig(writer: ByteWriter, config: BlueprintConfig): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "../../byte/alignment.enum", "../../byte/byte-writer.class", "../../error/parser.error", "../save/level.class", "../save/save-writer", "../structs/util.types"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BlueprintConfigWriter = exports.BlueprintWriter = void 0;
|
|
13
|
+
const alignment_enum_1 = require("../../byte/alignment.enum");
|
|
14
|
+
const byte_writer_class_1 = require("../../byte/byte-writer.class");
|
|
15
|
+
const parser_error_1 = require("../../error/parser.error");
|
|
16
|
+
const level_class_1 = require("../save/level.class");
|
|
17
|
+
const save_writer_1 = require("../save/save-writer");
|
|
18
|
+
const util_types_1 = require("../structs/util.types");
|
|
19
|
+
class BlueprintWriter extends byte_writer_class_1.ByteWriter {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
22
|
+
}
|
|
23
|
+
static SerializeHeader(writer, header) {
|
|
24
|
+
writer.writeInt32(2);
|
|
25
|
+
writer.writeInt32(36);
|
|
26
|
+
writer.writeInt32(211839);
|
|
27
|
+
writer.writeInt32(4);
|
|
28
|
+
writer.writeInt32(4);
|
|
29
|
+
writer.writeInt32(4);
|
|
30
|
+
writer.writeInt32(header.itemCosts.length);
|
|
31
|
+
for (const itemCost of header.itemCosts) {
|
|
32
|
+
writer.writeInt32(0);
|
|
33
|
+
writer.writeString(itemCost[0]);
|
|
34
|
+
writer.writeInt32(itemCost[1]);
|
|
35
|
+
}
|
|
36
|
+
writer.writeInt32(header.recipeReferences.length);
|
|
37
|
+
for (const recipeReference of header.recipeReferences) {
|
|
38
|
+
writer.writeInt32(0);
|
|
39
|
+
writer.writeString(recipeReference);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
generateChunks(compressionInfo, posAfterHeader, onBinaryBeforeCompressing, onHeader, onChunk) {
|
|
43
|
+
if (posAfterHeader <= 0) {
|
|
44
|
+
throw new parser_error_1.ParserError('ParserError', 'seems like this buffer has no header. Please write the header first before you can generate chunks.');
|
|
45
|
+
}
|
|
46
|
+
const header = new Uint8Array(this.bufferArray.slice(0, posAfterHeader));
|
|
47
|
+
onHeader(header);
|
|
48
|
+
this.bufferArray = this.bufferArray.slice(posAfterHeader);
|
|
49
|
+
const chunkSummary = save_writer_1.SaveWriter.GenerateCompressedChunksFromData(this.bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, this.alignment);
|
|
50
|
+
return chunkSummary;
|
|
51
|
+
}
|
|
52
|
+
static SerializeObjects(writer, objects) {
|
|
53
|
+
const headersLenIndicator = writer.getBufferPosition();
|
|
54
|
+
writer.writeInt32(0);
|
|
55
|
+
level_class_1.Level.SerializeObjectHeaders(writer, objects);
|
|
56
|
+
writer.writeBinarySizeFromPosition(headersLenIndicator, headersLenIndicator + 4);
|
|
57
|
+
level_class_1.Level.SerializeObjectContents(writer, objects, 0, '');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.BlueprintWriter = BlueprintWriter;
|
|
61
|
+
class BlueprintConfigWriter extends byte_writer_class_1.ByteWriter {
|
|
62
|
+
constructor() {
|
|
63
|
+
super(alignment_enum_1.Alignment.LITTLE_ENDIAN);
|
|
64
|
+
}
|
|
65
|
+
static SerializeConfig(writer, config) {
|
|
66
|
+
writer.writeInt32(2);
|
|
67
|
+
writer.writeString(config.description);
|
|
68
|
+
writer.writeInt32(config.iconID);
|
|
69
|
+
(0, util_types_1.SerializeCol4RGBA)(writer, config.color);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.BlueprintConfigWriter = BlueprintConfigWriter;
|
|
73
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChunkCompressionInfo } from "../../file.types";
|
|
2
|
+
import { SaveComponent } from "../objects/SaveComponent";
|
|
3
|
+
import { SaveEntity } from "../objects/SaveEntity";
|
|
4
|
+
import { col4 } from "../structs/util.types";
|
|
5
|
+
export interface BlueprintConfig {
|
|
6
|
+
description: string;
|
|
7
|
+
color: col4;
|
|
8
|
+
iconID: number;
|
|
9
|
+
}
|
|
10
|
+
export type BlueprintHeader = {
|
|
11
|
+
itemCosts: [string, number][];
|
|
12
|
+
recipeReferences: string[];
|
|
13
|
+
};
|
|
14
|
+
export interface Blueprint {
|
|
15
|
+
name: string;
|
|
16
|
+
compressionInfo: ChunkCompressionInfo;
|
|
17
|
+
header: BlueprintHeader;
|
|
18
|
+
config: BlueprintConfig;
|
|
19
|
+
objects: (SaveEntity | SaveComponent)[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ByteWriter } from "../../..";
|
|
2
|
+
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
3
|
+
import { SaveWriter } from "../save/save-writer";
|
|
4
|
+
import { vec3 } from "../structs/util.types";
|
|
5
|
+
import { ObjectReference } from "./ObjectReference";
|
|
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
|
+
};
|
|
29
|
+
export declare class DataFields {
|
|
30
|
+
properties: AbstractBaseProperty[];
|
|
31
|
+
specialProperties: SpecialAnyProperty;
|
|
32
|
+
trailingData: number[];
|
|
33
|
+
shouldBeNulled: boolean;
|
|
34
|
+
constructor();
|
|
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;
|
|
41
|
+
}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "../structs/util.types", "./Property"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.DataFields = void 0;
|
|
13
|
+
const util_types_1 = require("../structs/util.types");
|
|
14
|
+
const Property_1 = require("./Property");
|
|
15
|
+
class DataFields {
|
|
16
|
+
constructor() {
|
|
17
|
+
this.properties = [];
|
|
18
|
+
this.specialProperties = {};
|
|
19
|
+
this.trailingData = [];
|
|
20
|
+
this.shouldBeNulled = false;
|
|
21
|
+
}
|
|
22
|
+
static Parse(length, reader, buildVersion, typePath) {
|
|
23
|
+
const start = reader.getBufferPosition();
|
|
24
|
+
const fields = new DataFields();
|
|
25
|
+
if (length === 0) {
|
|
26
|
+
fields.shouldBeNulled = true;
|
|
27
|
+
return fields;
|
|
28
|
+
}
|
|
29
|
+
let propertyName = reader.readString();
|
|
30
|
+
while (propertyName !== 'None') {
|
|
31
|
+
const property = DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
32
|
+
fields.properties.push(property);
|
|
33
|
+
propertyName = reader.readString();
|
|
34
|
+
}
|
|
35
|
+
let int1 = reader.readInt32();
|
|
36
|
+
if (int1 !== 0) {
|
|
37
|
+
}
|
|
38
|
+
fields.specialProperties = DataFields.ParseAdditionalSpecialProperties(reader, typePath, start + length - reader.getBufferPosition() - 4);
|
|
39
|
+
const end = reader.getBufferPosition();
|
|
40
|
+
let remainingBytes = start + length - end;
|
|
41
|
+
fields.trailingData = Array.from(reader.readBytes(remainingBytes));
|
|
42
|
+
return fields;
|
|
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
|
+
}
|
|
90
|
+
static ParseProperty(reader, buildVersion, propertyName) {
|
|
91
|
+
let currentProperty = {};
|
|
92
|
+
if (currentProperty.name === 'None') {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
const propertyType = reader.readString();
|
|
96
|
+
const binarySize = reader.readInt32();
|
|
97
|
+
const index = reader.readInt32();
|
|
98
|
+
const before = reader.getBufferPosition();
|
|
99
|
+
let overhead = 0;
|
|
100
|
+
switch (propertyType) {
|
|
101
|
+
case 'BoolProperty':
|
|
102
|
+
currentProperty = Property_1.BoolProperty.Parse(reader, propertyType, index);
|
|
103
|
+
overhead = Property_1.BoolProperty.CalcOverhead(currentProperty);
|
|
104
|
+
break;
|
|
105
|
+
case 'ByteProperty':
|
|
106
|
+
currentProperty = Property_1.ByteProperty.Parse(reader, propertyType, index);
|
|
107
|
+
overhead = Property_1.ByteProperty.CalcOverhead(currentProperty);
|
|
108
|
+
break;
|
|
109
|
+
case 'Int8Property':
|
|
110
|
+
currentProperty = Property_1.Int8Property.Parse(reader, propertyType, index);
|
|
111
|
+
overhead = Property_1.Int8Property.CalcOverhead(currentProperty);
|
|
112
|
+
break;
|
|
113
|
+
case 'UInt8Property':
|
|
114
|
+
currentProperty = Property_1.Uint8Property.Parse(reader, propertyType, index);
|
|
115
|
+
overhead = Property_1.Uint8Property.CalcOverhead(currentProperty);
|
|
116
|
+
break;
|
|
117
|
+
case 'IntProperty':
|
|
118
|
+
case 'Int32Property':
|
|
119
|
+
currentProperty = Property_1.Int32Property.Parse(reader, propertyType, index);
|
|
120
|
+
overhead = Property_1.Int32Property.CalcOverhead(currentProperty);
|
|
121
|
+
break;
|
|
122
|
+
case 'UInt32Property':
|
|
123
|
+
currentProperty = Property_1.Uint32Property.Parse(reader, propertyType, index);
|
|
124
|
+
overhead = Property_1.Uint32Property.CalcOverhead(currentProperty);
|
|
125
|
+
break;
|
|
126
|
+
case 'Int64Property':
|
|
127
|
+
currentProperty = Property_1.Int64Property.Parse(reader, propertyType, index);
|
|
128
|
+
overhead = Property_1.Int64Property.CalcOverhead(currentProperty);
|
|
129
|
+
break;
|
|
130
|
+
case 'SingleProperty':
|
|
131
|
+
case 'FloatProperty':
|
|
132
|
+
currentProperty = Property_1.FloatProperty.Parse(reader, propertyType, index);
|
|
133
|
+
overhead = Property_1.FloatProperty.CalcOverhead(currentProperty);
|
|
134
|
+
break;
|
|
135
|
+
case 'DoubleProperty':
|
|
136
|
+
currentProperty = Property_1.DoubleProperty.Parse(reader, propertyType, index);
|
|
137
|
+
overhead = Property_1.DoubleProperty.CalcOverhead(currentProperty);
|
|
138
|
+
break;
|
|
139
|
+
case 'StrProperty':
|
|
140
|
+
case 'NameProperty':
|
|
141
|
+
currentProperty = Property_1.StrProperty.Parse(reader, propertyType, index);
|
|
142
|
+
overhead = Property_1.StrProperty.CalcOverhead(currentProperty);
|
|
143
|
+
break;
|
|
144
|
+
case 'ObjectProperty':
|
|
145
|
+
case 'InterfaceProperty':
|
|
146
|
+
currentProperty = Property_1.ObjectProperty.Parse(reader, propertyType, index);
|
|
147
|
+
overhead = Property_1.ObjectProperty.CalcOverhead(currentProperty);
|
|
148
|
+
break;
|
|
149
|
+
case 'EnumProperty':
|
|
150
|
+
currentProperty = Property_1.EnumProperty.Parse(reader, propertyType, index);
|
|
151
|
+
overhead = Property_1.EnumProperty.CalcOverhead(currentProperty);
|
|
152
|
+
break;
|
|
153
|
+
case 'StructProperty':
|
|
154
|
+
currentProperty = Property_1.StructProperty.Parse(reader, propertyType, index, binarySize);
|
|
155
|
+
overhead = Property_1.StructProperty.CalcOverhead(currentProperty);
|
|
156
|
+
break;
|
|
157
|
+
case 'ArrayProperty':
|
|
158
|
+
currentProperty = Property_1.ArrayProperty.Parse(reader, propertyType, index, propertyName);
|
|
159
|
+
overhead = Property_1.ArrayProperty.CalcOverhead(currentProperty);
|
|
160
|
+
break;
|
|
161
|
+
case 'MapProperty':
|
|
162
|
+
currentProperty = Property_1.MapProperty.Parse(reader, propertyName, buildVersion, binarySize);
|
|
163
|
+
overhead = Property_1.MapProperty.CalcOverhead(currentProperty);
|
|
164
|
+
break;
|
|
165
|
+
case 'TextProperty':
|
|
166
|
+
currentProperty = Property_1.TextProperty.Parse(reader, propertyType, index);
|
|
167
|
+
overhead = Property_1.TextProperty.CalcOverhead(currentProperty);
|
|
168
|
+
break;
|
|
169
|
+
case 'SetProperty':
|
|
170
|
+
currentProperty = Property_1.SetProperty.Parse(reader, propertyType, index, propertyName);
|
|
171
|
+
overhead = Property_1.SetProperty.CalcOverhead(currentProperty);
|
|
172
|
+
break;
|
|
173
|
+
default:
|
|
174
|
+
throw new Error(`Unimplemented type ${propertyType}`);
|
|
175
|
+
}
|
|
176
|
+
currentProperty.name = propertyName;
|
|
177
|
+
const readBytes = reader.getBufferPosition() - before - overhead;
|
|
178
|
+
if (readBytes !== binarySize) {
|
|
179
|
+
throw new Error(`possibly corrupt. Read ${readBytes} for ${propertyType} ${propertyName}, but ${binarySize} were indicated.`);
|
|
180
|
+
}
|
|
181
|
+
return currentProperty;
|
|
182
|
+
}
|
|
183
|
+
static Serialize(writer, fields, buildVersion, typePath) {
|
|
184
|
+
for (const property of fields.properties) {
|
|
185
|
+
writer.writeString(property.name);
|
|
186
|
+
DataFields.SerializeProperty(writer, property, property.name, buildVersion);
|
|
187
|
+
}
|
|
188
|
+
writer.writeString('None');
|
|
189
|
+
writer.writeInt32(0);
|
|
190
|
+
DataFields.SerializeAdditionalSpecialProperties(writer, typePath, fields.specialProperties);
|
|
191
|
+
writer.writeBytesArray(fields.trailingData);
|
|
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
|
+
}
|
|
226
|
+
static SerializeProperty(writer, property, propertyName, buildVersion) {
|
|
227
|
+
writer.writeString(property.ueType);
|
|
228
|
+
const lenIndicator = writer.getBufferPosition();
|
|
229
|
+
writer.writeInt32(0);
|
|
230
|
+
writer.writeInt32(property.index ?? 0);
|
|
231
|
+
const start = writer.getBufferPosition();
|
|
232
|
+
let overhead = 0;
|
|
233
|
+
switch (property.ueType) {
|
|
234
|
+
case 'BoolProperty':
|
|
235
|
+
overhead = Property_1.BoolProperty.CalcOverhead(property);
|
|
236
|
+
Property_1.BoolProperty.Serialize(writer, property);
|
|
237
|
+
break;
|
|
238
|
+
case 'ByteProperty':
|
|
239
|
+
overhead = Property_1.ByteProperty.CalcOverhead(property);
|
|
240
|
+
Property_1.ByteProperty.Serialize(writer, property);
|
|
241
|
+
break;
|
|
242
|
+
case 'Int8Property':
|
|
243
|
+
overhead = Property_1.Int8Property.CalcOverhead(property);
|
|
244
|
+
Property_1.Int8Property.Serialize(writer, property);
|
|
245
|
+
break;
|
|
246
|
+
case 'UInt8Property':
|
|
247
|
+
overhead = Property_1.Uint8Property.CalcOverhead(property);
|
|
248
|
+
Property_1.Uint8Property.Serialize(writer, property);
|
|
249
|
+
break;
|
|
250
|
+
case 'IntProperty':
|
|
251
|
+
case 'Int32Property':
|
|
252
|
+
overhead = Property_1.Int32Property.CalcOverhead(property);
|
|
253
|
+
Property_1.Int32Property.Serialize(writer, property);
|
|
254
|
+
break;
|
|
255
|
+
case 'UInt32Property':
|
|
256
|
+
overhead = Property_1.Uint32Property.CalcOverhead(property);
|
|
257
|
+
Property_1.Uint32Property.Serialize(writer, property);
|
|
258
|
+
break;
|
|
259
|
+
case 'Int64Property':
|
|
260
|
+
overhead = Property_1.Int64Property.CalcOverhead(property);
|
|
261
|
+
Property_1.Int64Property.Serialize(writer, property);
|
|
262
|
+
break;
|
|
263
|
+
case 'SingleProperty':
|
|
264
|
+
case 'FloatProperty':
|
|
265
|
+
overhead = Property_1.FloatProperty.CalcOverhead(property);
|
|
266
|
+
Property_1.FloatProperty.Serialize(writer, property);
|
|
267
|
+
break;
|
|
268
|
+
case 'DoubleProperty':
|
|
269
|
+
overhead = Property_1.DoubleProperty.CalcOverhead(property);
|
|
270
|
+
Property_1.DoubleProperty.Serialize(writer, property);
|
|
271
|
+
break;
|
|
272
|
+
case 'StrProperty':
|
|
273
|
+
case 'NameProperty':
|
|
274
|
+
overhead = Property_1.StrProperty.CalcOverhead(property);
|
|
275
|
+
Property_1.StrProperty.Serialize(writer, property);
|
|
276
|
+
break;
|
|
277
|
+
case 'ObjectProperty':
|
|
278
|
+
case 'InterfaceProperty':
|
|
279
|
+
overhead = Property_1.ObjectProperty.CalcOverhead(property);
|
|
280
|
+
Property_1.ObjectProperty.Serialize(writer, property);
|
|
281
|
+
break;
|
|
282
|
+
case 'EnumProperty':
|
|
283
|
+
overhead = Property_1.EnumProperty.CalcOverhead(property);
|
|
284
|
+
Property_1.EnumProperty.Serialize(writer, property);
|
|
285
|
+
break;
|
|
286
|
+
case 'ByteProperty':
|
|
287
|
+
overhead = Property_1.ByteProperty.CalcOverhead(property);
|
|
288
|
+
Property_1.ByteProperty.Serialize(writer, property);
|
|
289
|
+
break;
|
|
290
|
+
case 'StructProperty':
|
|
291
|
+
overhead = Property_1.StructProperty.CalcOverhead(property);
|
|
292
|
+
Property_1.StructProperty.Serialize(writer, property);
|
|
293
|
+
break;
|
|
294
|
+
case 'ArrayProperty':
|
|
295
|
+
overhead = Property_1.ArrayProperty.CalcOverhead(property);
|
|
296
|
+
Property_1.ArrayProperty.Serialize(writer, property, propertyName);
|
|
297
|
+
break;
|
|
298
|
+
case 'MapProperty':
|
|
299
|
+
overhead = Property_1.MapProperty.CalcOverhead(property);
|
|
300
|
+
Property_1.MapProperty.Serialize(writer, property);
|
|
301
|
+
break;
|
|
302
|
+
case 'TextProperty':
|
|
303
|
+
overhead = Property_1.TextProperty.CalcOverhead(property);
|
|
304
|
+
Property_1.TextProperty.Serialize(writer, property);
|
|
305
|
+
break;
|
|
306
|
+
case 'SetProperty':
|
|
307
|
+
overhead = Property_1.SetProperty.CalcOverhead(property);
|
|
308
|
+
Property_1.SetProperty.Serialize(writer, property);
|
|
309
|
+
break;
|
|
310
|
+
default:
|
|
311
|
+
throw new Error(`Unimplemented type ${property.type}`);
|
|
312
|
+
}
|
|
313
|
+
writer.writeBinarySizeFromPosition(lenIndicator, start + overhead);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
exports.DataFields = DataFields;
|
|
317
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
2
|
+
import { ByteWriter } from "../../byte/byte-writer.class";
|
|
3
|
+
export declare class ObjectReference {
|
|
4
|
+
levelName: string;
|
|
5
|
+
pathName: string;
|
|
6
|
+
constructor(levelName: string, pathName: string);
|
|
7
|
+
static Parse(reader: BinaryReadable): ObjectReference;
|
|
8
|
+
static Serialize(writer: ByteWriter, ref: ObjectReference): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ObjectReference = void 0;
|
|
13
|
+
class ObjectReference {
|
|
14
|
+
constructor(levelName, pathName) {
|
|
15
|
+
this.levelName = levelName;
|
|
16
|
+
this.pathName = pathName;
|
|
17
|
+
}
|
|
18
|
+
static Parse(reader) {
|
|
19
|
+
return new ObjectReference(reader.readString(), reader.readString());
|
|
20
|
+
}
|
|
21
|
+
static Serialize(writer, ref) {
|
|
22
|
+
writer.writeString(ref.levelName);
|
|
23
|
+
writer.writeString(ref.pathName);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.ObjectReference = ObjectReference;
|
|
27
|
+
});
|