@etothepii/satisfactory-file-parser 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/build/parser/satisfactory/objects/GUIDInfo.d.ts +7 -0
- package/build/parser/satisfactory/objects/GUIDInfo.js +26 -0
- package/build/parser/satisfactory/objects/ObjectReference.d.ts +5 -4
- package/build/parser/satisfactory/objects/ObjectReference.js +12 -12
- package/build/parser/satisfactory/objects/Property.d.ts +16 -18
- package/build/parser/satisfactory/objects/Property.js +32 -48
- package/build/parser/satisfactory/objects/SaveEntity.js +1 -1
- package/build/parser/satisfactory/objects/ue/GUID.d.ts +6 -0
- package/build/parser/satisfactory/objects/ue/GUID.js +21 -0
- package/build/parser/satisfactory/objects/ue/MD5Hash.d.ts +9 -0
- package/build/parser/satisfactory/objects/ue/MD5Hash.js +21 -0
- package/build/parser/satisfactory/save/level.class.js +2 -2
- package/build/parser/satisfactory/save/save-reader.js +2 -25
- package/build/parser/satisfactory/save/save-writer.js +2 -2
- package/build/parser/satisfactory/save/save.types.d.ts +1 -1
- package/build/parser/stream/reworked/stream-parser.d.ts +6 -0
- package/build/parser/stream/reworked/stream-parser.js +31 -0
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export * from './parser/satisfactory/blueprint/blueprint.types';
|
|
2
2
|
export { DataFields } from './parser/satisfactory/objects/DataFields';
|
|
3
|
+
export * from './parser/satisfactory/objects/GUIDInfo';
|
|
3
4
|
export { ObjectReference } from './parser/satisfactory/objects/ObjectReference';
|
|
4
5
|
export * from './parser/satisfactory/objects/Property';
|
|
5
6
|
export { SaveComponent } from './parser/satisfactory/objects/SaveComponent';
|
|
6
7
|
export { SaveEntity } from './parser/satisfactory/objects/SaveEntity';
|
|
8
|
+
export * from './parser/satisfactory/objects/ue/GUID';
|
|
9
|
+
export * from './parser/satisfactory/objects/ue/MD5Hash';
|
|
7
10
|
export { Level } from './parser/satisfactory/save/level.class';
|
|
8
11
|
export { SatisfactorySave } from './parser/satisfactory/save/satisfactory-save';
|
|
9
12
|
export * from './parser/satisfactory/save/save.types';
|
package/build/index.js
CHANGED
|
@@ -18,6 +18,7 @@ exports.Parser = exports.SaveStreamWriter = exports.SaveStreamJsonStringifier =
|
|
|
18
18
|
__exportStar(require("./parser/satisfactory/blueprint/blueprint.types"), exports);
|
|
19
19
|
var DataFields_1 = require("./parser/satisfactory/objects/DataFields");
|
|
20
20
|
Object.defineProperty(exports, "DataFields", { enumerable: true, get: function () { return DataFields_1.DataFields; } });
|
|
21
|
+
__exportStar(require("./parser/satisfactory/objects/GUIDInfo"), exports);
|
|
21
22
|
var ObjectReference_1 = require("./parser/satisfactory/objects/ObjectReference");
|
|
22
23
|
Object.defineProperty(exports, "ObjectReference", { enumerable: true, get: function () { return ObjectReference_1.ObjectReference; } });
|
|
23
24
|
__exportStar(require("./parser/satisfactory/objects/Property"), exports);
|
|
@@ -25,6 +26,8 @@ var SaveComponent_1 = require("./parser/satisfactory/objects/SaveComponent");
|
|
|
25
26
|
Object.defineProperty(exports, "SaveComponent", { enumerable: true, get: function () { return SaveComponent_1.SaveComponent; } });
|
|
26
27
|
var SaveEntity_1 = require("./parser/satisfactory/objects/SaveEntity");
|
|
27
28
|
Object.defineProperty(exports, "SaveEntity", { enumerable: true, get: function () { return SaveEntity_1.SaveEntity; } });
|
|
29
|
+
__exportStar(require("./parser/satisfactory/objects/ue/GUID"), exports);
|
|
30
|
+
__exportStar(require("./parser/satisfactory/objects/ue/MD5Hash"), exports);
|
|
28
31
|
var level_class_1 = require("./parser/satisfactory/save/level.class");
|
|
29
32
|
Object.defineProperty(exports, "Level", { enumerable: true, get: function () { return level_class_1.Level; } });
|
|
30
33
|
var satisfactory_save_1 = require("./parser/satisfactory/save/satisfactory-save");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BinaryReadable, ByteWriter } from '../../../';
|
|
2
|
+
import { GUID } from './ue/GUID';
|
|
3
|
+
export type GUIDInfo = undefined | GUID;
|
|
4
|
+
export declare namespace GUIDInfo {
|
|
5
|
+
const read: (reader: BinaryReadable) => GUIDInfo;
|
|
6
|
+
const write: (writer: ByteWriter, guid: GUIDInfo) => void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GUIDInfo = void 0;
|
|
4
|
+
const GUID_1 = require("./ue/GUID");
|
|
5
|
+
var GUIDInfo;
|
|
6
|
+
(function (GUIDInfo) {
|
|
7
|
+
GUIDInfo.read = (reader) => {
|
|
8
|
+
if (reader.readByte() === 1) {
|
|
9
|
+
return GUID_1.GUID.read(reader);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
GUIDInfo.write = (writer, guid) => {
|
|
16
|
+
if (guid === undefined) {
|
|
17
|
+
writer.writeByte(0);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
writer.writeByte(1);
|
|
22
|
+
GUID_1.GUID.write(writer, guid);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
})(GUIDInfo = exports.GUIDInfo || (exports.GUIDInfo = {}));
|
|
26
|
+
;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
2
2
|
import { ByteWriter } from "../../byte/byte-writer.class";
|
|
3
|
-
export
|
|
3
|
+
export type ObjectReference = {
|
|
4
4
|
levelName: string;
|
|
5
5
|
pathName: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
};
|
|
7
|
+
export declare namespace ObjectReference {
|
|
8
|
+
const read: (reader: BinaryReadable) => ObjectReference;
|
|
9
|
+
const write: (writer: ByteWriter, ref: ObjectReference) => void;
|
|
9
10
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ObjectReference = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
4
|
+
var ObjectReference;
|
|
5
|
+
(function (ObjectReference) {
|
|
6
|
+
ObjectReference.read = (reader) => {
|
|
7
|
+
return {
|
|
8
|
+
levelName: reader.readString(),
|
|
9
|
+
pathName: reader.readString()
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
ObjectReference.write = (writer, ref) => {
|
|
13
13
|
writer.writeString(ref.levelName);
|
|
14
14
|
writer.writeString(ref.pathName);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
15
|
+
};
|
|
16
|
+
})(ObjectReference = exports.ObjectReference || (exports.ObjectReference = {}));
|
|
17
|
+
;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ByteWriter } from "../../..";
|
|
2
2
|
import { BinaryReadable } from "../../byte/binary-readable.interface";
|
|
3
3
|
import { col4, vec3, vec4 } from "../structs/util.types";
|
|
4
|
+
import { GUIDInfo } from './GUIDInfo';
|
|
4
5
|
import { ObjectReference } from "./ObjectReference";
|
|
5
6
|
export type PropertiesMap = {
|
|
6
7
|
[name: string]: AbstractBaseProperty | AbstractBaseProperty[];
|
|
@@ -16,18 +17,15 @@ export declare abstract class AbstractBaseProperty extends AbstractProperty {
|
|
|
16
17
|
constructor(type: string, ueType: string, index: number);
|
|
17
18
|
}
|
|
18
19
|
export declare abstract class BasicProperty extends AbstractBaseProperty {
|
|
19
|
-
guidInfo:
|
|
20
|
-
constructor(type: string, ueType: string, guidInfo:
|
|
20
|
+
guidInfo: GUIDInfo;
|
|
21
|
+
constructor(type: string, ueType: string, guidInfo: GUIDInfo, index?: number);
|
|
21
22
|
}
|
|
22
|
-
export type GUID = undefined | Uint8Array;
|
|
23
|
-
export declare const ParseGUID: (reader: BinaryReadable) => GUID;
|
|
24
|
-
export declare const SerializeGUID: (writer: ByteWriter, guid: GUID) => void;
|
|
25
23
|
export type OverheadResult = {
|
|
26
24
|
overhead: number;
|
|
27
25
|
};
|
|
28
26
|
export declare class BoolProperty extends BasicProperty {
|
|
29
27
|
value: boolean;
|
|
30
|
-
constructor(value: boolean, ueType?: string, guidInfo?:
|
|
28
|
+
constructor(value: boolean, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
31
29
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): BoolProperty;
|
|
32
30
|
static ReadValue(reader: BinaryReadable): boolean;
|
|
33
31
|
static CalcOverhead(property: BoolProperty): number;
|
|
@@ -40,7 +38,7 @@ export type BytePropertyValue = {
|
|
|
40
38
|
};
|
|
41
39
|
export declare class ByteProperty extends BasicProperty {
|
|
42
40
|
value: BytePropertyValue;
|
|
43
|
-
constructor(value: BytePropertyValue, ueType?: string, guidInfo?:
|
|
41
|
+
constructor(value: BytePropertyValue, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
44
42
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): ByteProperty;
|
|
45
43
|
static ReadValue(reader: BinaryReadable): number;
|
|
46
44
|
static CalcOverhead(property: ByteProperty): number;
|
|
@@ -49,7 +47,7 @@ export declare class ByteProperty extends BasicProperty {
|
|
|
49
47
|
}
|
|
50
48
|
export declare class Int8Property extends BasicProperty {
|
|
51
49
|
value: number;
|
|
52
|
-
constructor(value: number, ueType?: string, guidInfo?:
|
|
50
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
53
51
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int8Property;
|
|
54
52
|
static ReadValue(reader: BinaryReadable): number;
|
|
55
53
|
static CalcOverhead(property: Int8Property): number;
|
|
@@ -58,7 +56,7 @@ export declare class Int8Property extends BasicProperty {
|
|
|
58
56
|
}
|
|
59
57
|
export declare class Uint8Property extends BasicProperty {
|
|
60
58
|
value: number;
|
|
61
|
-
constructor(value: number, ueType?: string, guidInfo?:
|
|
59
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
62
60
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint8Property;
|
|
63
61
|
static ReadValue(reader: BinaryReadable): number;
|
|
64
62
|
static CalcOverhead(property: Uint8Property): number;
|
|
@@ -67,7 +65,7 @@ export declare class Uint8Property extends BasicProperty {
|
|
|
67
65
|
}
|
|
68
66
|
export declare class Int32Property extends BasicProperty {
|
|
69
67
|
value: number;
|
|
70
|
-
constructor(value: number, ueType?: string, guidInfo?:
|
|
68
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
71
69
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int32Property;
|
|
72
70
|
static ReadValue(reader: BinaryReadable): number;
|
|
73
71
|
static CalcOverhead(property: Int32Property): number;
|
|
@@ -76,7 +74,7 @@ export declare class Int32Property extends BasicProperty {
|
|
|
76
74
|
}
|
|
77
75
|
export declare class Uint32Property extends BasicProperty {
|
|
78
76
|
value: number;
|
|
79
|
-
constructor(value: number, ueType?: string, guidInfo?:
|
|
77
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
80
78
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint32Property;
|
|
81
79
|
static ReadValue(reader: BinaryReadable): number;
|
|
82
80
|
static CalcOverhead(property: Uint32Property): number;
|
|
@@ -85,7 +83,7 @@ export declare class Uint32Property extends BasicProperty {
|
|
|
85
83
|
}
|
|
86
84
|
export declare class Int64Property extends BasicProperty {
|
|
87
85
|
value: string;
|
|
88
|
-
constructor(value: string, ueType?: string, guidInfo?:
|
|
86
|
+
constructor(value: string, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
89
87
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int64Property;
|
|
90
88
|
static ReadValue(reader: BinaryReadable): string;
|
|
91
89
|
static CalcOverhead(property: Int64Property): number;
|
|
@@ -94,7 +92,7 @@ export declare class Int64Property extends BasicProperty {
|
|
|
94
92
|
}
|
|
95
93
|
export declare class FloatProperty extends BasicProperty {
|
|
96
94
|
value: number;
|
|
97
|
-
constructor(value: number, ueType?: string, guidInfo?:
|
|
95
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
98
96
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): FloatProperty;
|
|
99
97
|
static CalcOverhead(property: FloatProperty): number;
|
|
100
98
|
static ReadValue(reader: BinaryReadable): number;
|
|
@@ -103,7 +101,7 @@ export declare class FloatProperty extends BasicProperty {
|
|
|
103
101
|
}
|
|
104
102
|
export declare class DoubleProperty extends BasicProperty {
|
|
105
103
|
value: number;
|
|
106
|
-
constructor(value: number, ueType?: string, guidInfo?:
|
|
104
|
+
constructor(value: number, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
107
105
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): DoubleProperty;
|
|
108
106
|
static ReadValue(reader: BinaryReadable): number;
|
|
109
107
|
static CalcOverhead(property: DoubleProperty): number;
|
|
@@ -112,7 +110,7 @@ export declare class DoubleProperty extends BasicProperty {
|
|
|
112
110
|
}
|
|
113
111
|
export declare class StrProperty extends BasicProperty {
|
|
114
112
|
value: string;
|
|
115
|
-
constructor(value: string, ueType?: string, guidInfo?:
|
|
113
|
+
constructor(value: string, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
116
114
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): StrProperty;
|
|
117
115
|
static ReadValue(reader: BinaryReadable): string;
|
|
118
116
|
static CalcOverhead(property: StrProperty): number;
|
|
@@ -121,7 +119,7 @@ export declare class StrProperty extends BasicProperty {
|
|
|
121
119
|
}
|
|
122
120
|
export declare class ObjectProperty extends BasicProperty {
|
|
123
121
|
value: ObjectReference;
|
|
124
|
-
constructor(value: ObjectReference, ueType?: string, guidInfo?:
|
|
122
|
+
constructor(value: ObjectReference, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
125
123
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): ObjectProperty;
|
|
126
124
|
static ReadValue(reader: BinaryReadable): ObjectReference;
|
|
127
125
|
static CalcOverhead(property: ObjectProperty): number;
|
|
@@ -136,7 +134,7 @@ export declare class EnumProperty extends BasicProperty {
|
|
|
136
134
|
constructor(value: {
|
|
137
135
|
name: string;
|
|
138
136
|
value: string;
|
|
139
|
-
}, ueType?: string, guidInfo?:
|
|
137
|
+
}, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
140
138
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): EnumProperty;
|
|
141
139
|
static ReadValue(reader: BinaryReadable): string;
|
|
142
140
|
static CalcOverhead(property: EnumProperty): number;
|
|
@@ -161,7 +159,7 @@ export type TextPropertyValue = {
|
|
|
161
159
|
};
|
|
162
160
|
export declare class TextProperty extends BasicProperty {
|
|
163
161
|
value: TextPropertyValue;
|
|
164
|
-
constructor(value: TextPropertyValue, ueType?: string, guidInfo?:
|
|
162
|
+
constructor(value: TextPropertyValue, ueType?: string, guidInfo?: GUIDInfo, index?: number);
|
|
165
163
|
static Parse(reader: BinaryReadable, ueType: string, index?: number): TextProperty;
|
|
166
164
|
static ParseValue(reader: BinaryReadable): TextPropertyValue;
|
|
167
165
|
static CalcOverhead(property: TextProperty): number;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SerializeFINLuaProcessorStateStorage = exports.ReadFINLuaProcessorStateStorage = exports.SerializeFINNetworkTrace = exports.ReadFINNetworkTrace = exports.SerializeDynamicStructData = exports.ParseDynamicStructData = exports.MapProperty = exports.SetProperty = exports.ArrayProperty = exports.StructProperty = exports.TextProperty = exports.EnumProperty = exports.ObjectProperty = exports.StrProperty = exports.DoubleProperty = exports.FloatProperty = exports.Int64Property = exports.Uint32Property = exports.Int32Property = exports.Uint8Property = exports.Int8Property = exports.ByteProperty = exports.BoolProperty = exports.
|
|
3
|
+
exports.SerializeFINLuaProcessorStateStorage = exports.ReadFINLuaProcessorStateStorage = exports.SerializeFINNetworkTrace = exports.ReadFINNetworkTrace = exports.SerializeDynamicStructData = exports.ParseDynamicStructData = exports.MapProperty = exports.SetProperty = exports.ArrayProperty = exports.StructProperty = exports.TextProperty = exports.EnumProperty = exports.ObjectProperty = exports.StrProperty = exports.DoubleProperty = exports.FloatProperty = exports.Int64Property = exports.Uint32Property = exports.Int32Property = exports.Uint8Property = exports.Int8Property = exports.ByteProperty = exports.BoolProperty = exports.BasicProperty = exports.AbstractBaseProperty = exports.AbstractProperty = void 0;
|
|
4
4
|
const util_types_1 = require("../structs/util.types");
|
|
5
5
|
const DataFields_1 = require("./DataFields");
|
|
6
|
+
const GUIDInfo_1 = require("./GUIDInfo");
|
|
6
7
|
const ObjectReference_1 = require("./ObjectReference");
|
|
7
8
|
class AbstractProperty {
|
|
8
9
|
constructor(type, index) {
|
|
@@ -26,23 +27,6 @@ class BasicProperty extends AbstractBaseProperty {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
exports.BasicProperty = BasicProperty;
|
|
29
|
-
const ParseGUID = (reader) => {
|
|
30
|
-
const hasGuid = reader.readByte() === 1;
|
|
31
|
-
let guid;
|
|
32
|
-
if (hasGuid) {
|
|
33
|
-
throw new Error('Unexpected!');
|
|
34
|
-
guid = reader.readBytes(16);
|
|
35
|
-
}
|
|
36
|
-
return guid;
|
|
37
|
-
};
|
|
38
|
-
exports.ParseGUID = ParseGUID;
|
|
39
|
-
const SerializeGUID = (writer, guid) => {
|
|
40
|
-
writer.writeByte(guid ? 1 : 0);
|
|
41
|
-
if (guid) {
|
|
42
|
-
writer.writeBytes(guid);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
exports.SerializeGUID = SerializeGUID;
|
|
46
30
|
class BoolProperty extends BasicProperty {
|
|
47
31
|
constructor(value, ueType = 'BoolProperty', guidInfo = undefined, index = 0) {
|
|
48
32
|
super('BoolProperty', ueType, guidInfo, index);
|
|
@@ -50,7 +34,7 @@ class BoolProperty extends BasicProperty {
|
|
|
50
34
|
}
|
|
51
35
|
static Parse(reader, ueType, index = 0) {
|
|
52
36
|
const value = BoolProperty.ReadValue(reader);
|
|
53
|
-
const guidInfo =
|
|
37
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
54
38
|
return new BoolProperty(value, ueType, guidInfo, index);
|
|
55
39
|
}
|
|
56
40
|
static ReadValue(reader) {
|
|
@@ -61,7 +45,7 @@ class BoolProperty extends BasicProperty {
|
|
|
61
45
|
}
|
|
62
46
|
static Serialize(writer, property) {
|
|
63
47
|
BoolProperty.SerializeValue(writer, property.value);
|
|
64
|
-
|
|
48
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
65
49
|
}
|
|
66
50
|
static SerializeValue(writer, value) {
|
|
67
51
|
writer.writeByte(value ? 1 : 0);
|
|
@@ -75,7 +59,7 @@ class ByteProperty extends BasicProperty {
|
|
|
75
59
|
}
|
|
76
60
|
static Parse(reader, ueType, index = 0) {
|
|
77
61
|
const type = reader.readString();
|
|
78
|
-
const guidInfo =
|
|
62
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
79
63
|
let value;
|
|
80
64
|
if (type === 'None') {
|
|
81
65
|
value = {
|
|
@@ -100,7 +84,7 @@ class ByteProperty extends BasicProperty {
|
|
|
100
84
|
}
|
|
101
85
|
static Serialize(writer, property) {
|
|
102
86
|
writer.writeString(property.value.type);
|
|
103
|
-
|
|
87
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
104
88
|
if (property.value.type === 'None') {
|
|
105
89
|
ByteProperty.SerializeValue(writer, property.value.value);
|
|
106
90
|
}
|
|
@@ -119,7 +103,7 @@ class Int8Property extends BasicProperty {
|
|
|
119
103
|
this.value = value;
|
|
120
104
|
}
|
|
121
105
|
static Parse(reader, ueType, index = 0) {
|
|
122
|
-
const guidInfo =
|
|
106
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
123
107
|
const value = Int8Property.ReadValue(reader);
|
|
124
108
|
return new Int8Property(value, ueType, guidInfo, index);
|
|
125
109
|
}
|
|
@@ -130,7 +114,7 @@ class Int8Property extends BasicProperty {
|
|
|
130
114
|
return 1;
|
|
131
115
|
}
|
|
132
116
|
static Serialize(writer, property) {
|
|
133
|
-
|
|
117
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
134
118
|
Int8Property.SerializeValue(writer, property.value);
|
|
135
119
|
}
|
|
136
120
|
static SerializeValue(writer, value) {
|
|
@@ -144,7 +128,7 @@ class Uint8Property extends BasicProperty {
|
|
|
144
128
|
this.value = value;
|
|
145
129
|
}
|
|
146
130
|
static Parse(reader, ueType, index = 0) {
|
|
147
|
-
const guidInfo =
|
|
131
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
148
132
|
const value = Uint8Property.ReadValue(reader);
|
|
149
133
|
return new Uint8Property(value, ueType, guidInfo, index);
|
|
150
134
|
}
|
|
@@ -155,7 +139,7 @@ class Uint8Property extends BasicProperty {
|
|
|
155
139
|
throw new Error('Unimplemented.');
|
|
156
140
|
}
|
|
157
141
|
static Serialize(writer, property) {
|
|
158
|
-
|
|
142
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
159
143
|
Uint8Property.SerializeValue(writer, property.value);
|
|
160
144
|
}
|
|
161
145
|
static SerializeValue(writer, value) {
|
|
@@ -169,7 +153,7 @@ class Int32Property extends BasicProperty {
|
|
|
169
153
|
this.value = value;
|
|
170
154
|
}
|
|
171
155
|
static Parse(reader, ueType, index = 0) {
|
|
172
|
-
const guidInfo =
|
|
156
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
173
157
|
const value = Int32Property.ReadValue(reader);
|
|
174
158
|
return new Int32Property(value, ueType, guidInfo, index);
|
|
175
159
|
}
|
|
@@ -180,7 +164,7 @@ class Int32Property extends BasicProperty {
|
|
|
180
164
|
return 1;
|
|
181
165
|
}
|
|
182
166
|
static Serialize(writer, property) {
|
|
183
|
-
|
|
167
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
184
168
|
Int32Property.SerializeValue(writer, property.value);
|
|
185
169
|
}
|
|
186
170
|
static SerializeValue(writer, value) {
|
|
@@ -194,7 +178,7 @@ class Uint32Property extends BasicProperty {
|
|
|
194
178
|
this.value = value;
|
|
195
179
|
}
|
|
196
180
|
static Parse(reader, ueType, index = 0) {
|
|
197
|
-
const guidInfo =
|
|
181
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
198
182
|
const value = Uint32Property.ReadValue(reader);
|
|
199
183
|
return new Uint32Property(value, ueType, guidInfo, index);
|
|
200
184
|
}
|
|
@@ -205,7 +189,7 @@ class Uint32Property extends BasicProperty {
|
|
|
205
189
|
return 1;
|
|
206
190
|
}
|
|
207
191
|
static Serialize(writer, property) {
|
|
208
|
-
|
|
192
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
209
193
|
Uint32Property.SerializeValue(writer, property.value);
|
|
210
194
|
}
|
|
211
195
|
static SerializeValue(writer, value) {
|
|
@@ -219,7 +203,7 @@ class Int64Property extends BasicProperty {
|
|
|
219
203
|
this.value = value;
|
|
220
204
|
}
|
|
221
205
|
static Parse(reader, ueType, index = 0) {
|
|
222
|
-
const guidInfo =
|
|
206
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
223
207
|
const value = Int64Property.ReadValue(reader);
|
|
224
208
|
return new Int64Property(value, ueType, guidInfo, index);
|
|
225
209
|
}
|
|
@@ -230,7 +214,7 @@ class Int64Property extends BasicProperty {
|
|
|
230
214
|
return 1;
|
|
231
215
|
}
|
|
232
216
|
static Serialize(writer, property) {
|
|
233
|
-
|
|
217
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
234
218
|
Int64Property.SerializeValue(writer, property.value);
|
|
235
219
|
}
|
|
236
220
|
static SerializeValue(writer, value) {
|
|
@@ -244,7 +228,7 @@ class FloatProperty extends BasicProperty {
|
|
|
244
228
|
this.value = value;
|
|
245
229
|
}
|
|
246
230
|
static Parse(reader, ueType, index = 0) {
|
|
247
|
-
const guidInfo =
|
|
231
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
248
232
|
const value = FloatProperty.ReadValue(reader);
|
|
249
233
|
return new FloatProperty(value, ueType, guidInfo, index);
|
|
250
234
|
}
|
|
@@ -255,7 +239,7 @@ class FloatProperty extends BasicProperty {
|
|
|
255
239
|
return reader.readFloat32();
|
|
256
240
|
}
|
|
257
241
|
static Serialize(writer, property) {
|
|
258
|
-
|
|
242
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
259
243
|
FloatProperty.SerializeValue(writer, property.value);
|
|
260
244
|
}
|
|
261
245
|
static SerializeValue(writer, value) {
|
|
@@ -269,7 +253,7 @@ class DoubleProperty extends BasicProperty {
|
|
|
269
253
|
this.value = value;
|
|
270
254
|
}
|
|
271
255
|
static Parse(reader, ueType, index = 0) {
|
|
272
|
-
const guidInfo =
|
|
256
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
273
257
|
const value = DoubleProperty.ReadValue(reader);
|
|
274
258
|
return new DoubleProperty(value, ueType, guidInfo, index);
|
|
275
259
|
}
|
|
@@ -280,7 +264,7 @@ class DoubleProperty extends BasicProperty {
|
|
|
280
264
|
return 1;
|
|
281
265
|
}
|
|
282
266
|
static Serialize(writer, property) {
|
|
283
|
-
|
|
267
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
284
268
|
DoubleProperty.SerializeValue(writer, property.value);
|
|
285
269
|
}
|
|
286
270
|
static SerializeValue(writer, value) {
|
|
@@ -294,7 +278,7 @@ class StrProperty extends BasicProperty {
|
|
|
294
278
|
this.value = value;
|
|
295
279
|
}
|
|
296
280
|
static Parse(reader, ueType, index = 0) {
|
|
297
|
-
const guidInfo =
|
|
281
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
298
282
|
const value = StrProperty.ReadValue(reader);
|
|
299
283
|
return new StrProperty(value, ueType, guidInfo, index);
|
|
300
284
|
}
|
|
@@ -305,7 +289,7 @@ class StrProperty extends BasicProperty {
|
|
|
305
289
|
return 1;
|
|
306
290
|
}
|
|
307
291
|
static Serialize(writer, property) {
|
|
308
|
-
|
|
292
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
309
293
|
StrProperty.SerializeValue(writer, property.value);
|
|
310
294
|
}
|
|
311
295
|
static SerializeValue(writer, value) {
|
|
@@ -319,7 +303,7 @@ class ObjectProperty extends BasicProperty {
|
|
|
319
303
|
this.value = value;
|
|
320
304
|
}
|
|
321
305
|
static Parse(reader, ueType, index = 0) {
|
|
322
|
-
const guidInfo =
|
|
306
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
323
307
|
const value = ObjectProperty.ReadValue(reader);
|
|
324
308
|
return new ObjectProperty(value, ueType, guidInfo, index);
|
|
325
309
|
}
|
|
@@ -334,7 +318,7 @@ class ObjectProperty extends BasicProperty {
|
|
|
334
318
|
return 1;
|
|
335
319
|
}
|
|
336
320
|
static Serialize(writer, property) {
|
|
337
|
-
|
|
321
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
338
322
|
ObjectProperty.SerializeValue(writer, property.value);
|
|
339
323
|
}
|
|
340
324
|
static SerializeValue(writer, value) {
|
|
@@ -350,7 +334,7 @@ class EnumProperty extends BasicProperty {
|
|
|
350
334
|
}
|
|
351
335
|
static Parse(reader, ueType, index = 0) {
|
|
352
336
|
let name = reader.readString();
|
|
353
|
-
const guidInfo =
|
|
337
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
354
338
|
const value = EnumProperty.ReadValue(reader);
|
|
355
339
|
const property = new EnumProperty({ name, value }, ueType, guidInfo, index);
|
|
356
340
|
return property;
|
|
@@ -363,7 +347,7 @@ class EnumProperty extends BasicProperty {
|
|
|
363
347
|
}
|
|
364
348
|
static Serialize(writer, property) {
|
|
365
349
|
writer.writeString(property.value.name);
|
|
366
|
-
|
|
350
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
367
351
|
EnumProperty.SerializeValue(writer, property.value.value);
|
|
368
352
|
}
|
|
369
353
|
static SerializeValue(writer, value) {
|
|
@@ -377,7 +361,7 @@ class TextProperty extends BasicProperty {
|
|
|
377
361
|
this.value = value;
|
|
378
362
|
}
|
|
379
363
|
static Parse(reader, ueType, index = 0) {
|
|
380
|
-
const guidInfo =
|
|
364
|
+
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
|
|
381
365
|
const value = TextProperty.ParseValue(reader);
|
|
382
366
|
return new TextProperty(value, ueType, guidInfo, index);
|
|
383
367
|
}
|
|
@@ -430,7 +414,7 @@ class TextProperty extends BasicProperty {
|
|
|
430
414
|
return 1;
|
|
431
415
|
}
|
|
432
416
|
static Serialize(writer, property) {
|
|
433
|
-
|
|
417
|
+
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
|
|
434
418
|
TextProperty.SerializeValue(writer, property.value);
|
|
435
419
|
}
|
|
436
420
|
static SerializeValue(writer, value) {
|
|
@@ -1073,7 +1057,7 @@ const SerializeDynamicStructData = (writer, buildVersion, data) => {
|
|
|
1073
1057
|
exports.SerializeDynamicStructData = SerializeDynamicStructData;
|
|
1074
1058
|
const ReadFINNetworkTrace = (reader) => {
|
|
1075
1059
|
const networkTrace = {};
|
|
1076
|
-
networkTrace.ref = ObjectReference_1.ObjectReference.
|
|
1060
|
+
networkTrace.ref = ObjectReference_1.ObjectReference.read(reader);
|
|
1077
1061
|
networkTrace.hasPrev = reader.readInt32();
|
|
1078
1062
|
if (networkTrace.hasPrev) {
|
|
1079
1063
|
networkTrace.prev = (0, exports.ReadFINNetworkTrace)(reader);
|
|
@@ -1087,7 +1071,7 @@ const ReadFINNetworkTrace = (reader) => {
|
|
|
1087
1071
|
exports.ReadFINNetworkTrace = ReadFINNetworkTrace;
|
|
1088
1072
|
const SerializeFINNetworkTrace = (writer, obj) => {
|
|
1089
1073
|
const networkTrace = {};
|
|
1090
|
-
ObjectReference_1.ObjectReference.
|
|
1074
|
+
ObjectReference_1.ObjectReference.write(writer, obj.ref);
|
|
1091
1075
|
writer.writeInt32(obj.hasPrev);
|
|
1092
1076
|
if (obj.hasPrev) {
|
|
1093
1077
|
(0, exports.SerializeFINNetworkTrace)(writer, obj.prev);
|
|
@@ -1107,7 +1091,7 @@ const ReadFINLuaProcessorStateStorage = (reader, size) => {
|
|
|
1107
1091
|
}
|
|
1108
1092
|
const refCount = reader.readInt32();
|
|
1109
1093
|
for (let i = 0; i < refCount; i++) {
|
|
1110
|
-
stateStorage.references.push(ObjectReference_1.ObjectReference.
|
|
1094
|
+
stateStorage.references.push(ObjectReference_1.ObjectReference.read(reader));
|
|
1111
1095
|
}
|
|
1112
1096
|
stateStorage.thread = reader.readString();
|
|
1113
1097
|
stateStorage.globals = reader.readString();
|
|
@@ -1123,7 +1107,7 @@ const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
|
|
|
1123
1107
|
}
|
|
1124
1108
|
writer.writeInt32(stateStorage.references.length);
|
|
1125
1109
|
for (const ref of stateStorage.references) {
|
|
1126
|
-
ObjectReference_1.ObjectReference.
|
|
1110
|
+
ObjectReference_1.ObjectReference.write(writer, ref);
|
|
1127
1111
|
}
|
|
1128
1112
|
writer.writeString(stateStorage.thread);
|
|
1129
1113
|
writer.writeString(stateStorage.globals);
|
|
@@ -39,7 +39,7 @@ class SaveEntity extends SaveObject_1.SaveObject {
|
|
|
39
39
|
entity.parentObjectName = reader.readString();
|
|
40
40
|
var componentCount = reader.readInt32();
|
|
41
41
|
for (let i = 0; i < componentCount; i++) {
|
|
42
|
-
var componentRef = ObjectReference_1.ObjectReference.
|
|
42
|
+
var componentRef = ObjectReference_1.ObjectReference.read(reader);
|
|
43
43
|
entity.components.push(componentRef);
|
|
44
44
|
}
|
|
45
45
|
const remainingSize = length - (reader.getBufferPosition() - afterSizeIndicator);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GUID = void 0;
|
|
4
|
+
var GUID;
|
|
5
|
+
(function (GUID) {
|
|
6
|
+
GUID.read = (reader) => {
|
|
7
|
+
return [
|
|
8
|
+
reader.readUint32(),
|
|
9
|
+
reader.readUint32(),
|
|
10
|
+
reader.readUint32(),
|
|
11
|
+
reader.readUint32(),
|
|
12
|
+
];
|
|
13
|
+
};
|
|
14
|
+
GUID.write = (writer, guid) => {
|
|
15
|
+
writer.writeUint32(guid[0]);
|
|
16
|
+
writer.writeUint32(guid[1]);
|
|
17
|
+
writer.writeUint32(guid[2]);
|
|
18
|
+
writer.writeUint32(guid[3]);
|
|
19
|
+
};
|
|
20
|
+
})(GUID = exports.GUID || (exports.GUID = {}));
|
|
21
|
+
;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ByteReader, ByteWriter } from '../../../..';
|
|
2
|
+
export type MD5Hash = {
|
|
3
|
+
isValid: boolean;
|
|
4
|
+
hash?: number[];
|
|
5
|
+
};
|
|
6
|
+
export declare namespace MD5Hash {
|
|
7
|
+
const read: (reader: ByteReader) => MD5Hash;
|
|
8
|
+
const write: (writer: ByteWriter, md5Hash: MD5Hash) => void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MD5Hash = void 0;
|
|
4
|
+
var MD5Hash;
|
|
5
|
+
(function (MD5Hash) {
|
|
6
|
+
MD5Hash.read = (reader) => {
|
|
7
|
+
const md5Hash = { isValid: false };
|
|
8
|
+
md5Hash.isValid = reader.readInt32() === 1;
|
|
9
|
+
if (md5Hash.isValid) {
|
|
10
|
+
md5Hash.hash = Array.from(reader.readBytes(16));
|
|
11
|
+
}
|
|
12
|
+
return md5Hash;
|
|
13
|
+
};
|
|
14
|
+
MD5Hash.write = (writer, md5Hash) => {
|
|
15
|
+
writer.writeInt32(md5Hash.isValid ? 1 : 0);
|
|
16
|
+
if (md5Hash.isValid) {
|
|
17
|
+
writer.writeBytesArray(md5Hash.hash);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
})(MD5Hash = exports.MD5Hash || (exports.MD5Hash = {}));
|
|
21
|
+
;
|
|
@@ -141,7 +141,7 @@ class Level {
|
|
|
141
141
|
static SerializeCollectablesList(writer, collectables) {
|
|
142
142
|
writer.writeInt32(collectables.length);
|
|
143
143
|
for (const collectable of collectables) {
|
|
144
|
-
ObjectReference_1.ObjectReference.
|
|
144
|
+
ObjectReference_1.ObjectReference.write(writer, collectable);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
static ReadCollectablesList(reader, printSmthWhenItsCollectables) {
|
|
@@ -149,7 +149,7 @@ class Level {
|
|
|
149
149
|
let countSmthing = reader.readInt32();
|
|
150
150
|
if (countSmthing > 0) {
|
|
151
151
|
for (let i = 0; i < countSmthing; i++) {
|
|
152
|
-
const collectable = ObjectReference_1.ObjectReference.
|
|
152
|
+
const collectable = ObjectReference_1.ObjectReference.read(reader);
|
|
153
153
|
collected.push(collectable);
|
|
154
154
|
}
|
|
155
155
|
if (process.env.NODE_ENV === 'debug' && countSmthing > 0) {
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -31,7 +8,7 @@ const pako_1 = __importDefault(require("pako"));
|
|
|
31
8
|
const alignment_enum_1 = require("../../byte/alignment.enum");
|
|
32
9
|
const byte_reader_class_1 = require("../../byte/byte-reader.class");
|
|
33
10
|
const parser_error_1 = require("../../error/parser.error");
|
|
34
|
-
const
|
|
11
|
+
const MD5Hash_1 = require("../objects/ue/MD5Hash");
|
|
35
12
|
const asynchronous_level_class_1 = require("./asynchronous-level.class");
|
|
36
13
|
const level_class_1 = require("./level.class");
|
|
37
14
|
exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;
|
|
@@ -121,7 +98,7 @@ class SaveReader extends byte_reader_class_1.ByteReader {
|
|
|
121
98
|
this.header.partitionEnabledFlag = this.readInt32() === 1;
|
|
122
99
|
}
|
|
123
100
|
if (this.header.saveHeaderType >= 12) {
|
|
124
|
-
this.header.consistencyHashBytes =
|
|
101
|
+
this.header.consistencyHashBytes = MD5Hash_1.MD5Hash.read(this);
|
|
125
102
|
}
|
|
126
103
|
if (this.header.saveHeaderType >= 13) {
|
|
127
104
|
this.header.creativeModeEnabled = this.readInt32() == 1;
|
|
@@ -9,7 +9,7 @@ const alignment_enum_1 = require("../../byte/alignment.enum");
|
|
|
9
9
|
const byte_writer_class_1 = require("../../byte/byte-writer.class");
|
|
10
10
|
const parser_error_1 = require("../../error/parser.error");
|
|
11
11
|
const file_types_1 = require("../../file.types");
|
|
12
|
-
const
|
|
12
|
+
const MD5Hash_1 = require("../objects/ue/MD5Hash");
|
|
13
13
|
const level_class_1 = require("./level.class");
|
|
14
14
|
const save_reader_1 = require("./save-reader");
|
|
15
15
|
class SaveWriter extends byte_writer_class_1.ByteWriter {
|
|
@@ -45,7 +45,7 @@ class SaveWriter extends byte_writer_class_1.ByteWriter {
|
|
|
45
45
|
writer.writeInt32(header.partitionEnabledFlag ? 1 : 0);
|
|
46
46
|
}
|
|
47
47
|
if (header.saveHeaderType >= 12) {
|
|
48
|
-
|
|
48
|
+
MD5Hash_1.MD5Hash.write(writer, header.consistencyHashBytes);
|
|
49
49
|
}
|
|
50
50
|
if (header.saveHeaderType >= 13) {
|
|
51
51
|
writer.writeInt32(header.creativeModeEnabled ? 1 : 0);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { WritableStream } from 'stream/web';
|
|
3
|
+
export declare class StreamParser {
|
|
4
|
+
static ParseSaveFileAsynchronousToOutput(bytes: Uint8Array, outputJson: WritableStream<string>, onDecompressedSaveBody?: (buffer: ArrayBuffer) => void, onProgress?: (progress: number, message?: string) => void): Promise<void>;
|
|
5
|
+
private static readLevelsAsync;
|
|
6
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamParser = void 0;
|
|
4
|
+
const __1 = require("../../..");
|
|
5
|
+
class StreamParser {
|
|
6
|
+
static async ParseSaveFileAsynchronousToOutput(bytes, outputJson, onDecompressedSaveBody = () => { }, onProgress = () => { }) {
|
|
7
|
+
const reader = new __1.SaveReader(bytes.buffer, onProgress);
|
|
8
|
+
const writer = outputJson.getWriter();
|
|
9
|
+
const header = reader.readHeader();
|
|
10
|
+
const save = new __1.SatisfactorySave(header);
|
|
11
|
+
const inflateResult = reader.inflateChunks();
|
|
12
|
+
onDecompressedSaveBody(reader.getBuffer());
|
|
13
|
+
const gridHash = reader.readSaveBodyHash();
|
|
14
|
+
const grids = reader.readGrids();
|
|
15
|
+
await writer.write(`{"header:" ${JSON.stringify(header)}, "compressionInfo": {}, "gridHash": ${JSON.stringify(gridHash)}, "grids": ${JSON.stringify(grids)}, levels: [`);
|
|
16
|
+
await StreamParser.readLevelsAsync(reader, writer, save.header.mapName, save.header.buildVersion);
|
|
17
|
+
await writer.write(`]}`);
|
|
18
|
+
await writer.close();
|
|
19
|
+
}
|
|
20
|
+
static async readLevelsAsync(reader, writer, mapName, buildVersion) {
|
|
21
|
+
const levelCount = reader.readInt32();
|
|
22
|
+
reader.onProgressCallback(reader.getBufferProgress(), `reading pack of ${levelCount} levels.`);
|
|
23
|
+
for (let j = 0; j <= levelCount; j++) {
|
|
24
|
+
let levelName = (j === levelCount) ? '' + mapName : reader.readString();
|
|
25
|
+
if (j % 300 === 0) {
|
|
26
|
+
reader.onProgressCallback(reader.getBufferProgress(), `reading level [${(j + 1)}/${(levelCount + 1)}] ${levelName}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.StreamParser = StreamParser;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etothepii/satisfactory-file-parser",
|
|
3
3
|
"author": "etothepii",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.22",
|
|
5
5
|
"description": "A file parser for satisfactory files. Includes save files and blueprint files.",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
7
7
|
"main": "./build/index.js",
|