@etothepii/satisfactory-file-parser 0.4.21 → 0.5.1
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 +23 -1
- package/build/index.d.ts +5 -2
- package/build/index.js +5 -2
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +6 -5
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +2 -2
- package/build/parser/satisfactory/blueprint/blueprint.types.d.ts +2 -2
- package/build/parser/satisfactory/types/objects/SaveEntity.js +5 -5
- package/build/parser/satisfactory/types/objects/SaveObject.d.ts +2 -2
- package/build/parser/satisfactory/types/objects/SaveObject.js +19 -3
- package/build/parser/satisfactory/types/property/PropertiesList.d.ts +11 -0
- package/build/parser/satisfactory/types/property/PropertiesList.js +249 -0
- package/build/parser/satisfactory/types/property/generic/ArrayProperty.js +4 -4
- package/build/parser/satisfactory/types/property/generic/BoolProperty.js +1 -1
- package/build/parser/satisfactory/types/property/generic/EnumProperty.js +1 -1
- package/build/parser/satisfactory/types/property/generic/MapProperty.js +11 -5
- package/build/parser/satisfactory/types/property/generic/ObjectProperty.js +3 -7
- package/build/parser/satisfactory/types/property/generic/SetProperty.js +2 -2
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.d.ts +2 -0
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.js +6 -0
- package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts +2 -11
- package/build/parser/satisfactory/types/property/generic/StructProperty.js +14 -119
- package/build/parser/satisfactory/types/property/generic/TextProperty.d.ts +1 -1
- package/build/parser/satisfactory/types/property/generic/TextProperty.js +5 -5
- package/build/parser/satisfactory/types/property/generic/Uint8Property.js +1 -1
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperties.d.ts +54 -0
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperties.js +2 -0
- package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts +7 -0
- package/build/parser/satisfactory/types/property/special/SpecialProperties.js +234 -0
- package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.d.ts +11 -0
- package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.js +37 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts +10 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -140,7 +140,29 @@ fs.writeFileSync('./MyModifiedBlueprint.sbpcfg', Buffer.from(summary.configFileB
|
|
|
140
140
|
So far this was just a private hobby project. But i figure some people actually use it.
|
|
141
141
|
If you find a bug or have feedback about the parser, you can just open an issue on the github repo or hit me up on the satisfactory discord `etothepii`.
|
|
142
142
|
|
|
143
|
+
# Explicitly Supported/Tested Mods (No guarantee for other mods)
|
|
144
|
+
### Ficsit-Cam (`FicsItCam`)
|
|
145
|
+
### Structural Solutions (`SS_Mod`)
|
|
146
|
+
### Linear Motion (`LinearMotion`)
|
|
147
|
+
### Container Screens (`ContainerScreen`)
|
|
148
|
+
### Conveyor Wall Hole (`WallHoleConveyor`)
|
|
149
|
+
### X3-Signs (`x3_signs`)
|
|
150
|
+
### X3-Roads (`x3_roads`)
|
|
151
|
+
|
|
143
152
|
# Changelog
|
|
153
|
+
### [0.5.1] (2024-10-15)
|
|
154
|
+
#### Added Mod Support
|
|
155
|
+
#### Internal Renamings
|
|
156
|
+
* `DynamicStructPropertyValue` extracted to own file.
|
|
157
|
+
* Parsing of object data partially moved to `SaveObject`.
|
|
158
|
+
* Renamed `DataFields` class to `PropertiesList`.
|
|
159
|
+
* Moved parsing of class-specific properties into own namespace.
|
|
160
|
+
* `ObjectProperty` and `SoftObjectProperty` now reuse the correct method for parsing/serializing the reference value.
|
|
161
|
+
|
|
162
|
+
### [0.4.22] (2024-10-07)
|
|
163
|
+
#### compatibility fix
|
|
164
|
+
* referenced icon libraries in blueprints are now optional when being parsed.
|
|
165
|
+
|
|
144
166
|
### [0.4.21] (2024-10-07)
|
|
145
167
|
#### internal package restructuring
|
|
146
168
|
* restructured some internal packages.
|
|
@@ -185,7 +207,7 @@ If you find a bug or have feedback about the parser, you can just open an issue
|
|
|
185
207
|
# License
|
|
186
208
|
MIT License
|
|
187
209
|
|
|
188
|
-
Copyright (c) 2024 etothepii
|
|
210
|
+
Copyright (c) 2021-2024 etothepii
|
|
189
211
|
|
|
190
212
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
191
213
|
of this software and associated documentation files (the "Software"), to deal
|
package/build/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export * from './parser/satisfactory/save/satisfactory-save';
|
|
|
4
4
|
export * from './parser/satisfactory/save/save.types';
|
|
5
5
|
export * from './parser/satisfactory/types/objects/SaveComponent';
|
|
6
6
|
export * from './parser/satisfactory/types/objects/SaveEntity';
|
|
7
|
-
export * from './parser/satisfactory/types/property/DataFields';
|
|
8
7
|
export * from './parser/satisfactory/types/property/generic/ArrayProperty';
|
|
9
8
|
export * from './parser/satisfactory/types/property/generic/BasicProperty';
|
|
10
9
|
export * from './parser/satisfactory/types/property/generic/BoolProperty';
|
|
@@ -24,11 +23,15 @@ export * from './parser/satisfactory/types/property/generic/TextProperty';
|
|
|
24
23
|
export * from './parser/satisfactory/types/property/generic/Uint32Property';
|
|
25
24
|
export * from './parser/satisfactory/types/property/generic/Uint64Property';
|
|
26
25
|
export * from './parser/satisfactory/types/property/generic/Uint8Property';
|
|
27
|
-
export * from './parser/satisfactory/types/property/
|
|
26
|
+
export * from './parser/satisfactory/types/property/PropertiesList';
|
|
27
|
+
export * from './parser/satisfactory/types/property/special/SpecialAnyProperties';
|
|
28
|
+
export * from './parser/satisfactory/types/property/special/SpecialProperties';
|
|
28
29
|
export * from './parser/satisfactory/types/structs/col4';
|
|
30
|
+
export * from './parser/satisfactory/types/structs/DynamicStructPropertyValue';
|
|
29
31
|
export * from './parser/satisfactory/types/structs/GUID';
|
|
30
32
|
export * from './parser/satisfactory/types/structs/GUIDInfo';
|
|
31
33
|
export * from './parser/satisfactory/types/structs/MD5Hash';
|
|
34
|
+
export * from './parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange';
|
|
32
35
|
export * from './parser/satisfactory/types/structs/ObjectReference';
|
|
33
36
|
export * from './parser/satisfactory/types/structs/SoftObjectReference';
|
|
34
37
|
export * from './parser/satisfactory/types/structs/Transform';
|
package/build/index.js
CHANGED
|
@@ -21,7 +21,6 @@ __exportStar(require("./parser/satisfactory/save/satisfactory-save"), exports);
|
|
|
21
21
|
__exportStar(require("./parser/satisfactory/save/save.types"), exports);
|
|
22
22
|
__exportStar(require("./parser/satisfactory/types/objects/SaveComponent"), exports);
|
|
23
23
|
__exportStar(require("./parser/satisfactory/types/objects/SaveEntity"), exports);
|
|
24
|
-
__exportStar(require("./parser/satisfactory/types/property/DataFields"), exports);
|
|
25
24
|
__exportStar(require("./parser/satisfactory/types/property/generic/ArrayProperty"), exports);
|
|
26
25
|
__exportStar(require("./parser/satisfactory/types/property/generic/BasicProperty"), exports);
|
|
27
26
|
__exportStar(require("./parser/satisfactory/types/property/generic/BoolProperty"), exports);
|
|
@@ -41,11 +40,15 @@ __exportStar(require("./parser/satisfactory/types/property/generic/TextProperty"
|
|
|
41
40
|
__exportStar(require("./parser/satisfactory/types/property/generic/Uint32Property"), exports);
|
|
42
41
|
__exportStar(require("./parser/satisfactory/types/property/generic/Uint64Property"), exports);
|
|
43
42
|
__exportStar(require("./parser/satisfactory/types/property/generic/Uint8Property"), exports);
|
|
44
|
-
__exportStar(require("./parser/satisfactory/types/property/
|
|
43
|
+
__exportStar(require("./parser/satisfactory/types/property/PropertiesList"), exports);
|
|
44
|
+
__exportStar(require("./parser/satisfactory/types/property/special/SpecialAnyProperties"), exports);
|
|
45
|
+
__exportStar(require("./parser/satisfactory/types/property/special/SpecialProperties"), exports);
|
|
45
46
|
__exportStar(require("./parser/satisfactory/types/structs/col4"), exports);
|
|
47
|
+
__exportStar(require("./parser/satisfactory/types/structs/DynamicStructPropertyValue"), exports);
|
|
46
48
|
__exportStar(require("./parser/satisfactory/types/structs/GUID"), exports);
|
|
47
49
|
__exportStar(require("./parser/satisfactory/types/structs/GUIDInfo"), exports);
|
|
48
50
|
__exportStar(require("./parser/satisfactory/types/structs/MD5Hash"), exports);
|
|
51
|
+
__exportStar(require("./parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange"), exports);
|
|
49
52
|
__exportStar(require("./parser/satisfactory/types/structs/ObjectReference"), exports);
|
|
50
53
|
__exportStar(require("./parser/satisfactory/types/structs/SoftObjectReference"), exports);
|
|
51
54
|
__exportStar(require("./parser/satisfactory/types/structs/Transform"), exports);
|
|
@@ -138,15 +138,16 @@ class BlueprintConfigReader extends byte_reader_class_1.ByteReader {
|
|
|
138
138
|
const description = reader.readString();
|
|
139
139
|
const iconID = reader.readInt32();
|
|
140
140
|
const color = col4_1.col4.ParseRGBA(reader);
|
|
141
|
-
const
|
|
142
|
-
const iconLibraryType = reader.readString();
|
|
143
|
-
return {
|
|
141
|
+
const config = {
|
|
144
142
|
description,
|
|
145
143
|
color,
|
|
146
144
|
iconID,
|
|
147
|
-
referencedIconLibrary,
|
|
148
|
-
iconLibraryType
|
|
149
145
|
};
|
|
146
|
+
if (reader.getBufferPosition() < reader.getBufferLength()) {
|
|
147
|
+
config.referencedIconLibrary = reader.readString();
|
|
148
|
+
config.iconLibraryType = reader.readString();
|
|
149
|
+
}
|
|
150
|
+
return config;
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
exports.BlueprintConfigReader = BlueprintConfigReader;
|
|
@@ -82,8 +82,8 @@ class BlueprintConfigWriter extends byte_writer_class_1.ByteWriter {
|
|
|
82
82
|
writer.writeString(config.description);
|
|
83
83
|
writer.writeInt32(config.iconID);
|
|
84
84
|
col4_1.col4.SerializeRGBA(writer, config.color);
|
|
85
|
-
writer.writeString(config.referencedIconLibrary);
|
|
86
|
-
writer.writeString(config.iconLibraryType);
|
|
85
|
+
writer.writeString(config.referencedIconLibrary ?? '');
|
|
86
|
+
writer.writeString(config.iconLibraryType ?? '');
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
exports.BlueprintConfigWriter = BlueprintConfigWriter;
|
|
@@ -7,8 +7,8 @@ export interface BlueprintConfig {
|
|
|
7
7
|
description: string;
|
|
8
8
|
color: col4;
|
|
9
9
|
iconID: number;
|
|
10
|
-
referencedIconLibrary
|
|
11
|
-
iconLibraryType
|
|
10
|
+
referencedIconLibrary?: string;
|
|
11
|
+
iconLibraryType?: string;
|
|
12
12
|
}
|
|
13
13
|
export type BlueprintHeader = {
|
|
14
14
|
designerDimension?: vec3;
|
|
@@ -34,7 +34,7 @@ class SaveEntity extends SaveObject_1.SaveObject {
|
|
|
34
34
|
obj.wasPlacedInLevel = reader.readInt32() == 1;
|
|
35
35
|
}
|
|
36
36
|
static ParseData(entity, length, reader, buildVersion, typePath) {
|
|
37
|
-
const
|
|
37
|
+
const start = reader.getBufferPosition();
|
|
38
38
|
entity.parentObjectRoot = reader.readString();
|
|
39
39
|
entity.parentObjectName = reader.readString();
|
|
40
40
|
var componentCount = reader.readInt32();
|
|
@@ -42,7 +42,7 @@ class SaveEntity extends SaveObject_1.SaveObject {
|
|
|
42
42
|
var componentRef = ObjectReference_1.ObjectReference.read(reader);
|
|
43
43
|
entity.components.push(componentRef);
|
|
44
44
|
}
|
|
45
|
-
const remainingSize = length - (reader.getBufferPosition() -
|
|
45
|
+
const remainingSize = length - (reader.getBufferPosition() - start);
|
|
46
46
|
return SaveObject_1.SaveObject.ParseData(entity, remainingSize, reader, buildVersion, typePath);
|
|
47
47
|
}
|
|
48
48
|
static SerializeHeader(writer, entity) {
|
|
@@ -55,9 +55,9 @@ class SaveEntity extends SaveObject_1.SaveObject {
|
|
|
55
55
|
writer.writeString(entity.parentObjectRoot);
|
|
56
56
|
writer.writeString(entity.parentObjectName);
|
|
57
57
|
writer.writeInt32(entity.components.length);
|
|
58
|
-
for (const
|
|
59
|
-
writer.writeString(
|
|
60
|
-
writer.writeString(
|
|
58
|
+
for (const component of entity.components) {
|
|
59
|
+
writer.writeString(component.levelName);
|
|
60
|
+
writer.writeString(component.pathName);
|
|
61
61
|
}
|
|
62
62
|
SaveObject_1.SaveObject.SerializeData(writer, entity, buildVersion);
|
|
63
63
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BinaryReadable } from "../../../byte/binary-readable.interface";
|
|
2
2
|
import { ByteWriter } from "../../../byte/byte-writer.class";
|
|
3
3
|
import { PropertiesMap } from "../property/generic/BasicProperty";
|
|
4
|
-
import {
|
|
4
|
+
import { SpecialAnyProperties } from '../property/special/SpecialAnyProperties';
|
|
5
5
|
export interface SaveObjectHeader {
|
|
6
6
|
typePath: string;
|
|
7
7
|
rootObject: string;
|
|
@@ -12,7 +12,7 @@ export declare abstract class SaveObject implements SaveObjectHeader {
|
|
|
12
12
|
rootObject: string;
|
|
13
13
|
instanceName: string;
|
|
14
14
|
properties: PropertiesMap;
|
|
15
|
-
specialProperties:
|
|
15
|
+
specialProperties: SpecialAnyProperties;
|
|
16
16
|
trailingData: number[];
|
|
17
17
|
objectVersion: number;
|
|
18
18
|
unknownType2: number;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SaveObject = void 0;
|
|
4
|
-
const
|
|
4
|
+
const parser_error_1 = require("../../../error/parser.error");
|
|
5
|
+
const PropertiesList_1 = require("../property/PropertiesList");
|
|
6
|
+
const SpecialProperties_1 = require("../property/special/SpecialProperties");
|
|
5
7
|
class SaveObject {
|
|
6
8
|
constructor(typePath, rootObject, instanceName) {
|
|
7
9
|
this.typePath = typePath;
|
|
@@ -24,10 +26,24 @@ class SaveObject {
|
|
|
24
26
|
writer.writeString(obj.instanceName);
|
|
25
27
|
}
|
|
26
28
|
static ParseData(obj, length, reader, buildVersion, typePath) {
|
|
27
|
-
|
|
29
|
+
const start = reader.getBufferPosition();
|
|
30
|
+
PropertiesList_1.PropertiesList.ParseList(obj, length, reader, buildVersion, typePath);
|
|
31
|
+
reader.readInt32();
|
|
32
|
+
let remainingSize = length - (reader.getBufferPosition() - start);
|
|
33
|
+
obj.specialProperties = SpecialProperties_1.SpecialProperties.ParseClassSpecificSpecialProperties(reader, typePath, remainingSize);
|
|
34
|
+
remainingSize = length - (reader.getBufferPosition() - start);
|
|
35
|
+
if (remainingSize > 0) {
|
|
36
|
+
obj.trailingData = Array.from(reader.readBytes(remainingSize));
|
|
37
|
+
}
|
|
38
|
+
else if (remainingSize < 0) {
|
|
39
|
+
throw new parser_error_1.ParserError('ParserError', `Unexpected. Read more bytes than are indicated for entity ${obj.instanceName}. bytes left to read is ${remainingSize}`);
|
|
40
|
+
}
|
|
28
41
|
}
|
|
29
42
|
static SerializeData(writer, obj, buildVersion) {
|
|
30
|
-
|
|
43
|
+
PropertiesList_1.PropertiesList.SerializeList(obj, writer, buildVersion, obj.typePath);
|
|
44
|
+
writer.writeInt32(0);
|
|
45
|
+
SpecialProperties_1.SpecialProperties.SerializeClassSpecificSpecialProperties(writer, obj.typePath, obj.specialProperties);
|
|
46
|
+
writer.writeBytesArray(obj.trailingData);
|
|
31
47
|
}
|
|
32
48
|
}
|
|
33
49
|
exports.SaveObject = SaveObject;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
export declare namespace PropertiesList {
|
|
7
|
+
const ParseList: (obj: SaveObject, length: number, reader: BinaryReadable, buildVersion: number, typePath: string) => void;
|
|
8
|
+
const SerializeList: (obj: SaveObject, writer: SaveWriter, buildVersion: number, typePath: string) => void;
|
|
9
|
+
const ParseSingleProperty: (reader: BinaryReadable, buildVersion: number, propertyName: string) => AbstractBaseProperty;
|
|
10
|
+
const SerializeSingleProperty: (writer: ByteWriter, property: AbstractBaseProperty, propertyName: string, buildVersion: number) => void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PropertiesList = void 0;
|
|
4
|
+
const parser_error_1 = require("../../../error/parser.error");
|
|
5
|
+
const ArrayProperty_1 = require("./generic/ArrayProperty");
|
|
6
|
+
const BoolProperty_1 = require("./generic/BoolProperty");
|
|
7
|
+
const ByteProperty_1 = require("./generic/ByteProperty");
|
|
8
|
+
const DoubleProperty_1 = require("./generic/DoubleProperty");
|
|
9
|
+
const EnumProperty_1 = require("./generic/EnumProperty");
|
|
10
|
+
const FloatProperty_1 = require("./generic/FloatProperty");
|
|
11
|
+
const Int32Property_1 = require("./generic/Int32Property");
|
|
12
|
+
const Int64Property_1 = require("./generic/Int64Property");
|
|
13
|
+
const Int8Property_1 = require("./generic/Int8Property");
|
|
14
|
+
const MapProperty_1 = require("./generic/MapProperty");
|
|
15
|
+
const ObjectProperty_1 = require("./generic/ObjectProperty");
|
|
16
|
+
const SetProperty_1 = require("./generic/SetProperty");
|
|
17
|
+
const SoftObjectProperty_1 = require("./generic/SoftObjectProperty");
|
|
18
|
+
const StrProperty_1 = require("./generic/StrProperty");
|
|
19
|
+
const StructProperty_1 = require("./generic/StructProperty");
|
|
20
|
+
const TextProperty_1 = require("./generic/TextProperty");
|
|
21
|
+
const Uint32Property_1 = require("./generic/Uint32Property");
|
|
22
|
+
const Uint64Property_1 = require("./generic/Uint64Property");
|
|
23
|
+
const Uint8Property_1 = require("./generic/Uint8Property");
|
|
24
|
+
var PropertiesList;
|
|
25
|
+
(function (PropertiesList) {
|
|
26
|
+
PropertiesList.ParseList = (obj, length, reader, buildVersion, typePath) => {
|
|
27
|
+
obj.properties = {};
|
|
28
|
+
if (length === 0) {
|
|
29
|
+
console.warn(`properties length for object ${obj.instanceName} was indicated as 0. Which is suspicious. Skipping object properties.`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
let propertyName = reader.readString();
|
|
33
|
+
while (propertyName !== 'None') {
|
|
34
|
+
const parsedProperty = PropertiesList.ParseSingleProperty(reader, buildVersion, propertyName);
|
|
35
|
+
if (obj.properties[propertyName]) {
|
|
36
|
+
if (!Array.isArray(obj.properties[propertyName])) {
|
|
37
|
+
obj.properties[propertyName] = [obj.properties[propertyName]];
|
|
38
|
+
}
|
|
39
|
+
obj.properties[propertyName].push(parsedProperty);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
obj.properties[propertyName] = parsedProperty;
|
|
43
|
+
}
|
|
44
|
+
propertyName = reader.readString();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
PropertiesList.SerializeList = (obj, writer, buildVersion, typePath) => {
|
|
48
|
+
for (const property of Object.values(obj.properties).flatMap(val => Array.isArray(val) ? val : [val])) {
|
|
49
|
+
writer.writeString(property.name);
|
|
50
|
+
PropertiesList.SerializeSingleProperty(writer, property, property.name, buildVersion);
|
|
51
|
+
}
|
|
52
|
+
writer.writeString('None');
|
|
53
|
+
};
|
|
54
|
+
PropertiesList.ParseSingleProperty = (reader, buildVersion, propertyName) => {
|
|
55
|
+
let currentProperty = {};
|
|
56
|
+
const propertyType = reader.readString();
|
|
57
|
+
const binarySize = reader.readInt32();
|
|
58
|
+
const index = reader.readInt32();
|
|
59
|
+
const before = reader.getBufferPosition();
|
|
60
|
+
let overhead = 0;
|
|
61
|
+
switch (propertyType) {
|
|
62
|
+
case 'BoolProperty':
|
|
63
|
+
currentProperty = BoolProperty_1.BoolProperty.Parse(reader, propertyType, index);
|
|
64
|
+
overhead = BoolProperty_1.BoolProperty.CalcOverhead(currentProperty);
|
|
65
|
+
break;
|
|
66
|
+
case 'ByteProperty':
|
|
67
|
+
currentProperty = ByteProperty_1.ByteProperty.Parse(reader, propertyType, index);
|
|
68
|
+
overhead = ByteProperty_1.ByteProperty.CalcOverhead(currentProperty);
|
|
69
|
+
break;
|
|
70
|
+
case 'Int8Property':
|
|
71
|
+
currentProperty = Int8Property_1.Int8Property.Parse(reader, propertyType, index);
|
|
72
|
+
overhead = Int8Property_1.Int8Property.CalcOverhead(currentProperty);
|
|
73
|
+
break;
|
|
74
|
+
case 'UInt8Property':
|
|
75
|
+
currentProperty = Uint8Property_1.Uint8Property.Parse(reader, propertyType, index);
|
|
76
|
+
overhead = Uint8Property_1.Uint8Property.CalcOverhead(currentProperty);
|
|
77
|
+
break;
|
|
78
|
+
case 'IntProperty':
|
|
79
|
+
case 'Int32Property':
|
|
80
|
+
currentProperty = Int32Property_1.Int32Property.Parse(reader, propertyType, index);
|
|
81
|
+
overhead = Int32Property_1.Int32Property.CalcOverhead(currentProperty);
|
|
82
|
+
break;
|
|
83
|
+
case 'UInt32Property':
|
|
84
|
+
currentProperty = Uint32Property_1.Uint32Property.Parse(reader, propertyType, index);
|
|
85
|
+
overhead = Uint32Property_1.Uint32Property.CalcOverhead(currentProperty);
|
|
86
|
+
break;
|
|
87
|
+
case 'Int64Property':
|
|
88
|
+
currentProperty = Int64Property_1.Int64Property.Parse(reader, propertyType, index);
|
|
89
|
+
overhead = Int64Property_1.Int64Property.CalcOverhead(currentProperty);
|
|
90
|
+
break;
|
|
91
|
+
case 'UInt64Property':
|
|
92
|
+
currentProperty = Uint64Property_1.Uint64Property.Parse(reader, propertyType, index);
|
|
93
|
+
break;
|
|
94
|
+
case 'SingleProperty':
|
|
95
|
+
case 'FloatProperty':
|
|
96
|
+
currentProperty = FloatProperty_1.FloatProperty.Parse(reader, propertyType, index);
|
|
97
|
+
overhead = FloatProperty_1.FloatProperty.CalcOverhead(currentProperty);
|
|
98
|
+
break;
|
|
99
|
+
case 'DoubleProperty':
|
|
100
|
+
currentProperty = DoubleProperty_1.DoubleProperty.Parse(reader, propertyType, index);
|
|
101
|
+
overhead = DoubleProperty_1.DoubleProperty.CalcOverhead(currentProperty);
|
|
102
|
+
break;
|
|
103
|
+
case 'StrProperty':
|
|
104
|
+
case 'NameProperty':
|
|
105
|
+
currentProperty = StrProperty_1.StrProperty.Parse(reader, propertyType, index);
|
|
106
|
+
overhead = StrProperty_1.StrProperty.CalcOverhead(currentProperty);
|
|
107
|
+
break;
|
|
108
|
+
case 'ObjectProperty':
|
|
109
|
+
case 'InterfaceProperty':
|
|
110
|
+
currentProperty = ObjectProperty_1.ObjectProperty.Parse(reader, propertyType, index);
|
|
111
|
+
overhead = ObjectProperty_1.ObjectProperty.CalcOverhead(currentProperty);
|
|
112
|
+
break;
|
|
113
|
+
case 'SoftObjectProperty':
|
|
114
|
+
currentProperty = SoftObjectProperty_1.SoftObjectProperty.Parse(reader, propertyType, index);
|
|
115
|
+
overhead = SoftObjectProperty_1.SoftObjectProperty.CalcOverhead(currentProperty);
|
|
116
|
+
break;
|
|
117
|
+
case 'EnumProperty':
|
|
118
|
+
currentProperty = EnumProperty_1.EnumProperty.Parse(reader, propertyType, index);
|
|
119
|
+
overhead = EnumProperty_1.EnumProperty.CalcOverhead(currentProperty);
|
|
120
|
+
break;
|
|
121
|
+
case 'StructProperty':
|
|
122
|
+
currentProperty = StructProperty_1.StructProperty.Parse(reader, propertyType, index, binarySize);
|
|
123
|
+
overhead = StructProperty_1.StructProperty.CalcOverhead(currentProperty);
|
|
124
|
+
break;
|
|
125
|
+
case 'ArrayProperty':
|
|
126
|
+
currentProperty = ArrayProperty_1.ArrayProperty.Parse(reader, propertyType, index, propertyName);
|
|
127
|
+
overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(currentProperty);
|
|
128
|
+
break;
|
|
129
|
+
case 'MapProperty':
|
|
130
|
+
currentProperty = MapProperty_1.MapProperty.Parse(reader, propertyName, buildVersion, binarySize);
|
|
131
|
+
overhead = MapProperty_1.MapProperty.CalcOverhead(currentProperty);
|
|
132
|
+
break;
|
|
133
|
+
case 'TextProperty':
|
|
134
|
+
currentProperty = TextProperty_1.TextProperty.Parse(reader, propertyType, index);
|
|
135
|
+
overhead = TextProperty_1.TextProperty.CalcOverhead(currentProperty);
|
|
136
|
+
break;
|
|
137
|
+
case 'SetProperty':
|
|
138
|
+
currentProperty = SetProperty_1.SetProperty.Parse(reader, propertyType, index, propertyName);
|
|
139
|
+
overhead = SetProperty_1.SetProperty.CalcOverhead(currentProperty);
|
|
140
|
+
break;
|
|
141
|
+
default:
|
|
142
|
+
throw new Error(`Unimplemented type ${propertyType}`);
|
|
143
|
+
}
|
|
144
|
+
currentProperty.name = propertyName;
|
|
145
|
+
const readBytes = reader.getBufferPosition() - before - overhead;
|
|
146
|
+
if (readBytes !== binarySize) {
|
|
147
|
+
console.warn(`possibly corrupt. Read ${readBytes} for ${propertyType} ${propertyName}, but ${binarySize} were indicated.`);
|
|
148
|
+
throw new parser_error_1.ParserError('ParserError', `possibly corrupt. Read ${readBytes} bytes for ${propertyType} ${propertyName}, but ${binarySize} bytes were indicated.`);
|
|
149
|
+
}
|
|
150
|
+
return currentProperty;
|
|
151
|
+
};
|
|
152
|
+
PropertiesList.SerializeSingleProperty = (writer, property, propertyName, buildVersion) => {
|
|
153
|
+
writer.writeString(property.ueType);
|
|
154
|
+
const lenIndicator = writer.getBufferPosition();
|
|
155
|
+
writer.writeInt32(0);
|
|
156
|
+
writer.writeInt32(property.index ?? 0);
|
|
157
|
+
const start = writer.getBufferPosition();
|
|
158
|
+
let overhead = 0;
|
|
159
|
+
switch (property.ueType) {
|
|
160
|
+
case 'BoolProperty':
|
|
161
|
+
overhead = BoolProperty_1.BoolProperty.CalcOverhead(property);
|
|
162
|
+
BoolProperty_1.BoolProperty.Serialize(writer, property);
|
|
163
|
+
break;
|
|
164
|
+
case 'ByteProperty':
|
|
165
|
+
overhead = ByteProperty_1.ByteProperty.CalcOverhead(property);
|
|
166
|
+
ByteProperty_1.ByteProperty.Serialize(writer, property);
|
|
167
|
+
break;
|
|
168
|
+
case 'Int8Property':
|
|
169
|
+
overhead = Int8Property_1.Int8Property.CalcOverhead(property);
|
|
170
|
+
Int8Property_1.Int8Property.Serialize(writer, property);
|
|
171
|
+
break;
|
|
172
|
+
case 'UInt8Property':
|
|
173
|
+
overhead = Uint8Property_1.Uint8Property.CalcOverhead(property);
|
|
174
|
+
Uint8Property_1.Uint8Property.Serialize(writer, property);
|
|
175
|
+
break;
|
|
176
|
+
case 'IntProperty':
|
|
177
|
+
case 'Int32Property':
|
|
178
|
+
overhead = Int32Property_1.Int32Property.CalcOverhead(property);
|
|
179
|
+
Int32Property_1.Int32Property.Serialize(writer, property);
|
|
180
|
+
break;
|
|
181
|
+
case 'UInt32Property':
|
|
182
|
+
overhead = Uint32Property_1.Uint32Property.CalcOverhead(property);
|
|
183
|
+
Uint32Property_1.Uint32Property.Serialize(writer, property);
|
|
184
|
+
break;
|
|
185
|
+
case 'Int64Property':
|
|
186
|
+
overhead = Int64Property_1.Int64Property.CalcOverhead(property);
|
|
187
|
+
Int64Property_1.Int64Property.Serialize(writer, property);
|
|
188
|
+
break;
|
|
189
|
+
case 'UInt64PRoperty':
|
|
190
|
+
overhead = Uint64Property_1.Uint64Property.CalcOverhead(property);
|
|
191
|
+
Uint64Property_1.Uint64Property.Serialize(writer, property);
|
|
192
|
+
break;
|
|
193
|
+
case 'SingleProperty':
|
|
194
|
+
case 'FloatProperty':
|
|
195
|
+
overhead = FloatProperty_1.FloatProperty.CalcOverhead(property);
|
|
196
|
+
FloatProperty_1.FloatProperty.Serialize(writer, property);
|
|
197
|
+
break;
|
|
198
|
+
case 'DoubleProperty':
|
|
199
|
+
overhead = DoubleProperty_1.DoubleProperty.CalcOverhead(property);
|
|
200
|
+
DoubleProperty_1.DoubleProperty.Serialize(writer, property);
|
|
201
|
+
break;
|
|
202
|
+
case 'StrProperty':
|
|
203
|
+
case 'NameProperty':
|
|
204
|
+
overhead = StrProperty_1.StrProperty.CalcOverhead(property);
|
|
205
|
+
StrProperty_1.StrProperty.Serialize(writer, property);
|
|
206
|
+
break;
|
|
207
|
+
case 'ObjectProperty':
|
|
208
|
+
case 'InterfaceProperty':
|
|
209
|
+
overhead = ObjectProperty_1.ObjectProperty.CalcOverhead(property);
|
|
210
|
+
ObjectProperty_1.ObjectProperty.Serialize(writer, property);
|
|
211
|
+
break;
|
|
212
|
+
case 'SoftObjectProperty':
|
|
213
|
+
overhead = SoftObjectProperty_1.SoftObjectProperty.CalcOverhead(property);
|
|
214
|
+
SoftObjectProperty_1.SoftObjectProperty.Serialize(writer, property);
|
|
215
|
+
break;
|
|
216
|
+
case 'EnumProperty':
|
|
217
|
+
overhead = EnumProperty_1.EnumProperty.CalcOverhead(property);
|
|
218
|
+
EnumProperty_1.EnumProperty.Serialize(writer, property);
|
|
219
|
+
break;
|
|
220
|
+
case 'ByteProperty':
|
|
221
|
+
overhead = ByteProperty_1.ByteProperty.CalcOverhead(property);
|
|
222
|
+
ByteProperty_1.ByteProperty.Serialize(writer, property);
|
|
223
|
+
break;
|
|
224
|
+
case 'StructProperty':
|
|
225
|
+
overhead = StructProperty_1.StructProperty.CalcOverhead(property);
|
|
226
|
+
StructProperty_1.StructProperty.Serialize(writer, property);
|
|
227
|
+
break;
|
|
228
|
+
case 'ArrayProperty':
|
|
229
|
+
overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(property);
|
|
230
|
+
ArrayProperty_1.ArrayProperty.Serialize(writer, property, propertyName);
|
|
231
|
+
break;
|
|
232
|
+
case 'MapProperty':
|
|
233
|
+
overhead = MapProperty_1.MapProperty.CalcOverhead(property);
|
|
234
|
+
MapProperty_1.MapProperty.Serialize(writer, property);
|
|
235
|
+
break;
|
|
236
|
+
case 'TextProperty':
|
|
237
|
+
overhead = TextProperty_1.TextProperty.CalcOverhead(property);
|
|
238
|
+
TextProperty_1.TextProperty.Serialize(writer, property);
|
|
239
|
+
break;
|
|
240
|
+
case 'SetProperty':
|
|
241
|
+
overhead = SetProperty_1.SetProperty.CalcOverhead(property);
|
|
242
|
+
SetProperty_1.SetProperty.Serialize(writer, property);
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
throw new Error(`Unimplemented type ${property.type}`);
|
|
246
|
+
}
|
|
247
|
+
writer.writeBinarySizeFromPosition(lenIndicator, start + overhead);
|
|
248
|
+
};
|
|
249
|
+
})(PropertiesList || (exports.PropertiesList = PropertiesList = {}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArrayProperty = exports.isArrayProperty = void 0;
|
|
4
|
-
const SoftObjectReference_1 = require("../../structs/SoftObjectReference");
|
|
5
4
|
const BasicProperty_1 = require("./BasicProperty");
|
|
6
5
|
const BoolProperty_1 = require("./BoolProperty");
|
|
7
6
|
const ByteProperty_1 = require("./ByteProperty");
|
|
@@ -11,6 +10,7 @@ const FloatProperty_1 = require("./FloatProperty");
|
|
|
11
10
|
const Int32Property_1 = require("./Int32Property");
|
|
12
11
|
const Int64Property_1 = require("./Int64Property");
|
|
13
12
|
const ObjectProperty_1 = require("./ObjectProperty");
|
|
13
|
+
const SoftObjectProperty_1 = require("./SoftObjectProperty");
|
|
14
14
|
const StrProperty_1 = require("./StrProperty");
|
|
15
15
|
const StructProperty_1 = require("./StructProperty");
|
|
16
16
|
const TextProperty_1 = require("./TextProperty");
|
|
@@ -54,14 +54,14 @@ class ArrayProperty extends BasicProperty_1.BasicProperty {
|
|
|
54
54
|
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => EnumProperty_1.EnumProperty.ReadValue(reader)), ueType, index);
|
|
55
55
|
break;
|
|
56
56
|
case "TextProperty":
|
|
57
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => TextProperty_1.TextProperty.
|
|
57
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => TextProperty_1.TextProperty.ReadValue(reader)), ueType, index);
|
|
58
58
|
break;
|
|
59
59
|
case "InterfaceProperty":
|
|
60
60
|
case "ObjectProperty":
|
|
61
61
|
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty_1.ObjectProperty.ReadValue(reader)), ueType, index);
|
|
62
62
|
break;
|
|
63
63
|
case "SoftObjectProperty":
|
|
64
|
-
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() =>
|
|
64
|
+
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => SoftObjectProperty_1.SoftObjectProperty.ReadValue(reader)), ueType, index);
|
|
65
65
|
break;
|
|
66
66
|
case "StructProperty":
|
|
67
67
|
const name = reader.readString();
|
|
@@ -145,7 +145,7 @@ class ArrayProperty extends BasicProperty_1.BasicProperty {
|
|
|
145
145
|
property.values.forEach(v => ObjectProperty_1.ObjectProperty.SerializeValue(writer, v));
|
|
146
146
|
break;
|
|
147
147
|
case "SoftObjectProperty":
|
|
148
|
-
property.values.forEach(v =>
|
|
148
|
+
property.values.forEach(v => SoftObjectProperty_1.SoftObjectProperty.SerializeValue(writer, v));
|
|
149
149
|
break;
|
|
150
150
|
case "StructProperty":
|
|
151
151
|
writer.writeString(propertyName);
|
|
@@ -19,7 +19,7 @@ class BoolProperty extends BasicProperty_1.BasicProperty {
|
|
|
19
19
|
return reader.readByte() > 0;
|
|
20
20
|
}
|
|
21
21
|
static CalcOverhead(property) {
|
|
22
|
-
return
|
|
22
|
+
return 1 + 1;
|
|
23
23
|
}
|
|
24
24
|
static Serialize(writer, property) {
|
|
25
25
|
BoolProperty.SerializeValue(writer, property.value);
|
|
@@ -21,7 +21,7 @@ class EnumProperty extends BasicProperty_1.BasicProperty {
|
|
|
21
21
|
return reader.readString();
|
|
22
22
|
}
|
|
23
23
|
static CalcOverhead(property) {
|
|
24
|
-
return property.value.name.length +
|
|
24
|
+
return property.value.name.length + 5 + 1;
|
|
25
25
|
}
|
|
26
26
|
static Serialize(writer, property) {
|
|
27
27
|
writer.writeString(property.value.name);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MapProperty = exports.isMapProperty = void 0;
|
|
4
|
+
const DynamicStructPropertyValue_1 = require("../../structs/DynamicStructPropertyValue");
|
|
4
5
|
const BasicProperty_1 = require("./BasicProperty");
|
|
5
6
|
const ByteProperty_1 = require("./ByteProperty");
|
|
6
7
|
const EnumProperty_1 = require("./EnumProperty");
|
|
@@ -8,7 +9,6 @@ const Int32Property_1 = require("./Int32Property");
|
|
|
8
9
|
const Int64Property_1 = require("./Int64Property");
|
|
9
10
|
const ObjectProperty_1 = require("./ObjectProperty");
|
|
10
11
|
const StrProperty_1 = require("./StrProperty");
|
|
11
|
-
const StructProperty_1 = require("./StructProperty");
|
|
12
12
|
const isMapProperty = (property) => property.type === 'MapProperty';
|
|
13
13
|
exports.isMapProperty = isMapProperty;
|
|
14
14
|
class MapProperty extends BasicProperty_1.BasicProperty {
|
|
@@ -36,7 +36,7 @@ class MapProperty extends BasicProperty_1.BasicProperty {
|
|
|
36
36
|
key = Array.from(reader.readBytes(12));
|
|
37
37
|
}
|
|
38
38
|
else {
|
|
39
|
-
key =
|
|
39
|
+
key = DynamicStructPropertyValue_1.DynamicStructPropertyValue.read(reader, 0, property.keyType);
|
|
40
40
|
}
|
|
41
41
|
break;
|
|
42
42
|
case 'ObjectProperty':
|
|
@@ -53,6 +53,9 @@ class MapProperty extends BasicProperty_1.BasicProperty {
|
|
|
53
53
|
case 'Int32Property':
|
|
54
54
|
key = Int32Property_1.Int32Property.ReadValue(reader);
|
|
55
55
|
break;
|
|
56
|
+
case 'Int64Property':
|
|
57
|
+
key = Int64Property_1.Int64Property.ReadValue(reader);
|
|
58
|
+
break;
|
|
56
59
|
case 'ByteProperty':
|
|
57
60
|
key = ByteProperty_1.ByteProperty.ReadValue(reader);
|
|
58
61
|
break;
|
|
@@ -61,7 +64,7 @@ class MapProperty extends BasicProperty_1.BasicProperty {
|
|
|
61
64
|
}
|
|
62
65
|
switch (property.valueType) {
|
|
63
66
|
case 'StructProperty':
|
|
64
|
-
value =
|
|
67
|
+
value = DynamicStructPropertyValue_1.DynamicStructPropertyValue.read(reader, 0, property.valueType);
|
|
65
68
|
break;
|
|
66
69
|
case 'ObjectProperty':
|
|
67
70
|
value = ObjectProperty_1.ObjectProperty.ReadValue(reader);
|
|
@@ -106,7 +109,7 @@ class MapProperty extends BasicProperty_1.BasicProperty {
|
|
|
106
109
|
writer.writeBytesArray(entry[0]);
|
|
107
110
|
}
|
|
108
111
|
else {
|
|
109
|
-
|
|
112
|
+
DynamicStructPropertyValue_1.DynamicStructPropertyValue.write(writer, 0, entry[0]);
|
|
110
113
|
}
|
|
111
114
|
break;
|
|
112
115
|
case 'ObjectProperty':
|
|
@@ -123,6 +126,9 @@ class MapProperty extends BasicProperty_1.BasicProperty {
|
|
|
123
126
|
case 'Int32Property':
|
|
124
127
|
Int32Property_1.Int32Property.SerializeValue(writer, entry[0]);
|
|
125
128
|
break;
|
|
129
|
+
case 'Int64Property':
|
|
130
|
+
Int64Property_1.Int64Property.SerializeValue(writer, entry[0]);
|
|
131
|
+
break;
|
|
126
132
|
case 'ByteProperty':
|
|
127
133
|
ByteProperty_1.ByteProperty.SerializeValue(writer, entry[0]);
|
|
128
134
|
break;
|
|
@@ -131,7 +137,7 @@ class MapProperty extends BasicProperty_1.BasicProperty {
|
|
|
131
137
|
}
|
|
132
138
|
switch (property.valueType) {
|
|
133
139
|
case 'StructProperty':
|
|
134
|
-
|
|
140
|
+
DynamicStructPropertyValue_1.DynamicStructPropertyValue.write(writer, 0, entry[1]);
|
|
135
141
|
break;
|
|
136
142
|
case 'ObjectProperty':
|
|
137
143
|
ObjectProperty_1.ObjectProperty.SerializeValue(writer, entry[1]);
|