@etothepii/satisfactory-file-parser 0.1.24 → 0.1.26
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 +1 -0
- package/build/index.js +25 -58
- package/build/parser/byte/alignment.enum.js +2 -5
- package/build/parser/byte/binary-operable.interface.js +1 -2
- package/build/parser/byte/binary-readable.interface.js +1 -2
- package/build/parser/byte/byte-reader.class.js +10 -14
- package/build/parser/byte/byte-writer.class.js +10 -13
- package/build/parser/error/parser.error.js +6 -15
- package/build/parser/file.types.js +2 -5
- package/build/parser/parser.d.ts +1 -1
- package/build/parser/parser.js +24 -27
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +28 -36
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +20 -25
- package/build/parser/satisfactory/blueprint/blueprint.types.js +1 -2
- package/build/parser/satisfactory/objects/DataFields.js +79 -83
- package/build/parser/satisfactory/objects/GUIDInfo.js +5 -8
- package/build/parser/satisfactory/objects/ObjectReference.js +2 -5
- package/build/parser/satisfactory/objects/Property.js +91 -120
- package/build/parser/satisfactory/objects/SaveComponent.js +7 -11
- package/build/parser/satisfactory/objects/SaveEntity.js +13 -17
- package/build/parser/satisfactory/objects/SaveObject.js +4 -8
- package/build/parser/satisfactory/objects/ue/GUID.js +2 -5
- package/build/parser/satisfactory/objects/ue/MD5Hash.js +2 -5
- package/build/parser/satisfactory/save/asynchronous-level.class.js +12 -16
- package/build/parser/satisfactory/save/level.class.js +26 -30
- package/build/parser/satisfactory/save/satisfactory-save.d.ts +2 -1
- package/build/parser/satisfactory/save/satisfactory-save.js +3 -6
- package/build/parser/satisfactory/save/save-reader.js +31 -34
- package/build/parser/satisfactory/save/save-writer.js +34 -40
- package/build/parser/satisfactory/save/save.types.js +1 -2
- package/build/parser/satisfactory/structs/util.types.js +37 -63
- package/build/parser/stream/byte-stream-reader.class.js +17 -21
- package/build/parser/stream/json-stream-state-writer.js +2 -6
- package/build/parser/stream/json-stream-writable.js +1 -5
- package/build/parser/stream/json-stream-writer.js +2 -6
- package/build/parser/stream/reworked/readable-stream-parser.d.ts +12 -0
- package/build/parser/stream/reworked/readable-stream-parser.js +201 -0
- package/build/parser/stream/reworked/stream-parser.d.ts +3 -1
- package/build/parser/stream/reworked/stream-parser.js +86 -11
- package/build/parser/stream/save-stream-json-stringifier.js +3 -7
- package/build/parser/stream/save-stream-reader.class.js +18 -24
- package/build/parser/stream/save-stream-writer.class.d.ts +15 -13
- package/build/parser/stream/save-stream-writer.class.js +71 -108
- package/build/parser/stream/stream-level.class.js +11 -15
- package/build/parser/stream/stream-parser.js +11 -15
- package/package.json +4 -2
- package/build/parser/satisfactory/objects/ue/FMD5Hash.d.ts +0 -7
- package/build/parser/satisfactory/objects/ue/FMD5Hash.js +0 -19
|
@@ -1,119 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
class ModeStateTracker {
|
|
2
|
+
constructor(mode) {
|
|
3
|
+
this.mode = mode;
|
|
4
|
+
}
|
|
5
|
+
checkIsComingFrom(...allowedPredecessors) {
|
|
6
|
+
if (!allowedPredecessors.includes(this.mode)) {
|
|
7
|
+
throw new Error(`Wrong order of commands. mode is ${this.mode}. but only ${allowedPredecessors.join(', ')} is/are allowed.`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
advance(newMode) {
|
|
11
|
+
this.mode = newMode;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class SaveStreamWriter {
|
|
5
15
|
constructor(writer) {
|
|
6
16
|
this.writer = writer;
|
|
17
|
+
this.createExecutionFunction = async (allowedInputModes, fn, targetMode) => {
|
|
18
|
+
this.tracker.checkIsComingFrom(...allowedInputModes);
|
|
19
|
+
await fn();
|
|
20
|
+
this.tracker.advance(targetMode);
|
|
21
|
+
};
|
|
22
|
+
this.beginSave = () => this.createExecutionFunction(['BEFORE_START'], async () => {
|
|
23
|
+
await this.writer.write('{');
|
|
24
|
+
}, 'OPENED_SAVE');
|
|
25
|
+
this.writeHeader = (header) => this.createExecutionFunction(['OPENED_SAVE'], async () => {
|
|
26
|
+
await this.writer.write(`"header": ${JSON.stringify(header)}`);
|
|
27
|
+
}, 'FINISHED_HEADER');
|
|
28
|
+
this.writeCompressionInfo = (compressionInfo) => this.createExecutionFunction(['FINISHED_HEADER'], async () => {
|
|
29
|
+
await this.writer.write(`, "compressionInfo": ${JSON.stringify(compressionInfo)}`);
|
|
30
|
+
}, 'WROTE_COMPRESSION_INFO');
|
|
31
|
+
this.writeGridHash = (gridHash) => this.createExecutionFunction(['WROTE_COMPRESSION_INFO'], async () => {
|
|
32
|
+
await this.writer.write(`, "gridHash": ${JSON.stringify(gridHash)}`);
|
|
33
|
+
}, 'WROTE_GRID_HASH');
|
|
34
|
+
this.writeGrids = (grids) => this.createExecutionFunction(['WROTE_GRID_HASH'], async () => {
|
|
35
|
+
await this.writer.write(`, "grids": ${JSON.stringify(grids)}`);
|
|
36
|
+
}, 'WROTE_GRIDS');
|
|
37
|
+
this.openLevels = () => this.createExecutionFunction(['WROTE_GRIDS'], async () => {
|
|
38
|
+
await this.writer.write(`, "levels": [`);
|
|
39
|
+
}, 'OPENED_LEVELS');
|
|
40
|
+
this.openLevel = (levelName) => this.createExecutionFunction(['OPENED_LEVELS', 'FINISHED_LEVEL'], async () => {
|
|
41
|
+
this.formatTracker.levels.push({
|
|
42
|
+
objectCount: 0, collectablesCount: 0
|
|
43
|
+
});
|
|
44
|
+
const prefix = this.formatTracker.levels.length > 1 ? ', ' : '';
|
|
45
|
+
await this.writer.write(`${prefix}{"name": "${levelName}", "objects": [`);
|
|
46
|
+
}, 'OPENED_LEVEL');
|
|
47
|
+
this.writeObjects = (...objects) => this.createExecutionFunction(['OPENED_LEVEL', 'WROTE_OBJECT'], async () => {
|
|
48
|
+
const stringified = objects.map(saveObj => JSON.stringify(saveObj));
|
|
49
|
+
for (const obj of stringified) {
|
|
50
|
+
await this.writer.write(`${this.formatTracker.levels.at(-1).objectCount >= 1 ? ', ' : ''}${obj}`);
|
|
51
|
+
this.formatTracker.levels.at(-1).objectCount++;
|
|
52
|
+
}
|
|
53
|
+
}, 'WROTE_OBJECT');
|
|
54
|
+
this.switchInLevelToCollectables = (...objects) => this.createExecutionFunction(['OPENED_LEVEL', 'WROTE_OBJECT'], async () => {
|
|
55
|
+
await this.writer.write(`], "collectables": [`);
|
|
56
|
+
}, 'SWITCH_TO_COLLECTABLES');
|
|
57
|
+
this.writeCollectables = (...collectables) => this.createExecutionFunction(['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'], async () => {
|
|
58
|
+
const stringified = collectables.map(coll => JSON.stringify(coll));
|
|
59
|
+
for (const obj of stringified) {
|
|
60
|
+
await this.writer.write(`${this.formatTracker.levels.at(-1).collectablesCount >= 1 ? ', ' : ''}${obj}`);
|
|
61
|
+
this.formatTracker.levels.at(-1).collectablesCount++;
|
|
62
|
+
}
|
|
63
|
+
}, 'WROTE_COLLECTABLE');
|
|
64
|
+
this.endLevel = () => this.createExecutionFunction(['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'], async () => {
|
|
65
|
+
await this.writer.write(`]}`);
|
|
66
|
+
}, 'FINISHED_LEVEL');
|
|
67
|
+
this.endLevels = () => this.createExecutionFunction(['OPENED_LEVELS', 'FINISHED_LEVEL'], async () => {
|
|
68
|
+
await this.writer.write(`]`);
|
|
69
|
+
}, 'FINISHED_LEVELS');
|
|
70
|
+
this.endSave = () => this.createExecutionFunction(['FINISHED_LEVELS'], async () => {
|
|
71
|
+
await this.writer.write('}');
|
|
72
|
+
}, 'FINISHED_SAVE');
|
|
7
73
|
this.mode = 'BEFORE_START';
|
|
74
|
+
this.tracker = new ModeStateTracker(this.mode);
|
|
8
75
|
this.formatTracker = {
|
|
9
76
|
levels: []
|
|
10
77
|
};
|
|
11
78
|
}
|
|
12
|
-
async beginSave() {
|
|
13
|
-
if (this.mode !== 'BEFORE_START') {
|
|
14
|
-
throw new Error(`Wrong order of commands. Already opened save. mode is ${this.mode}.`);
|
|
15
|
-
}
|
|
16
|
-
await this.writer.write('{');
|
|
17
|
-
this.mode = 'OPENED_SAVE';
|
|
18
|
-
}
|
|
19
|
-
async writeHeader(header) {
|
|
20
|
-
if (this.mode !== 'OPENED_SAVE') {
|
|
21
|
-
throw new Error(`Wrong order of commands. Header has to come after save open. mode is ${this.mode}.`);
|
|
22
|
-
}
|
|
23
|
-
await this.writer.write(`"header": ${JSON.stringify(header)}`);
|
|
24
|
-
this.mode = 'FINISHED_HEADER';
|
|
25
|
-
}
|
|
26
|
-
async writeCompressionInfo(compressionInfo) {
|
|
27
|
-
if (this.mode !== 'FINISHED_HEADER') {
|
|
28
|
-
throw new Error(`Wrong order of commands. Compression info has to come after header. mode is ${this.mode}.`);
|
|
29
|
-
}
|
|
30
|
-
await this.writer.write(`, "compressionInfo": ${JSON.stringify(compressionInfo)}`);
|
|
31
|
-
this.mode = 'WROTE_COMPRESSION_INFO';
|
|
32
|
-
}
|
|
33
|
-
async writeGridHash(gridHash) {
|
|
34
|
-
if (this.mode !== 'WROTE_COMPRESSION_INFO') {
|
|
35
|
-
throw new Error(`Wrong order of commands. Save hbody hash has to come after compression info. mode is ${this.mode}.`);
|
|
36
|
-
}
|
|
37
|
-
await this.writer.write(`, "gridHash": ${JSON.stringify(gridHash)}`);
|
|
38
|
-
this.mode = 'WROTE_GRID_HASH';
|
|
39
|
-
}
|
|
40
|
-
async writeGrids(grids) {
|
|
41
|
-
if (this.mode !== 'WROTE_GRID_HASH') {
|
|
42
|
-
throw new Error(`Wrong order of commands. Grids have to come after save body hash info. mode is ${this.mode}.`);
|
|
43
|
-
}
|
|
44
|
-
await this.writer.write(`, "grids": ${JSON.stringify(grids)}`);
|
|
45
|
-
this.mode = 'WROTE_GRIDS';
|
|
46
|
-
}
|
|
47
|
-
async openLevels() {
|
|
48
|
-
if (this.mode !== 'WROTE_GRIDS') {
|
|
49
|
-
throw new Error(`Wrong order of commands. Levels have to come after grids info. mode is ${this.mode}.`);
|
|
50
|
-
}
|
|
51
|
-
await this.writer.write(`, "levels": [`);
|
|
52
|
-
this.mode = 'OPENED_LEVELS';
|
|
53
|
-
}
|
|
54
|
-
async openLevel(levelName) {
|
|
55
|
-
if (this.mode !== 'OPENED_LEVELS' && this.mode !== 'FINISHED_LEVEL') {
|
|
56
|
-
throw new Error(`Wrong order of commands. Single level can only come after opening levels array or after finishing single level. mode is ${this.mode}.`);
|
|
57
|
-
}
|
|
58
|
-
this.formatTracker.levels.push({
|
|
59
|
-
objectCount: 0, collectablesCount: 0
|
|
60
|
-
});
|
|
61
|
-
const prefix = this.formatTracker.levels.length > 1 ? ', ' : '';
|
|
62
|
-
await this.writer.write(`${prefix}{"name": "${levelName}", "objects": [`);
|
|
63
|
-
this.mode = 'OPENED_LEVEL';
|
|
64
|
-
}
|
|
65
|
-
async writeObjects(...objects) {
|
|
66
|
-
if (this.mode !== 'OPENED_LEVEL' && this.mode !== 'WROTE_OBJECT') {
|
|
67
|
-
throw new Error(`Wrong order of commands. An object can not be written into the level if it was not opened or other objects were not written. mode is ${this.mode}.`);
|
|
68
|
-
}
|
|
69
|
-
const stringified = objects.map(saveObj => JSON.stringify(saveObj));
|
|
70
|
-
for (const obj of stringified) {
|
|
71
|
-
await this.writer.write(`${this.formatTracker.levels.at(-1).objectCount >= 1 ? ', ' : ''}${obj}`);
|
|
72
|
-
this.formatTracker.levels.at(-1).objectCount++;
|
|
73
|
-
}
|
|
74
|
-
this.mode = 'WROTE_OBJECT';
|
|
75
|
-
}
|
|
76
|
-
async switchInLevelToCollectables() {
|
|
77
|
-
if (this.mode !== 'OPENED_LEVEL' && this.mode !== 'WROTE_OBJECT') {
|
|
78
|
-
throw new Error(`Wrong order of commands. The level structure can not be switched to collectables if the level was not opened recently or has not written objects. mode is ${this.mode}.`);
|
|
79
|
-
}
|
|
80
|
-
await this.writer.write(`], "collectables": [`);
|
|
81
|
-
this.mode = 'SWITCH_TO_COLLECTABLES';
|
|
82
|
-
}
|
|
83
|
-
async writeCollectables(...collectables) {
|
|
84
|
-
if (this.mode !== 'SWITCH_TO_COLLECTABLES' && this.mode !== 'WROTE_COLLECTABLE') {
|
|
85
|
-
throw new Error(`Wrong order of commands. A collectable can not be written into the level if we did not switch to collectables or other collectables were not written. mode is ${this.mode}.`);
|
|
86
|
-
}
|
|
87
|
-
const stringified = collectables.map(coll => JSON.stringify(coll));
|
|
88
|
-
for (const obj of stringified) {
|
|
89
|
-
await this.writer.write(`${this.formatTracker.levels.at(-1).collectablesCount >= 1 ? ', ' : ''}${obj}`);
|
|
90
|
-
this.formatTracker.levels.at(-1).collectablesCount++;
|
|
91
|
-
}
|
|
92
|
-
this.mode = 'WROTE_COLLECTABLE';
|
|
93
|
-
}
|
|
94
|
-
async endLevel() {
|
|
95
|
-
if (this.mode !== 'SWITCH_TO_COLLECTABLES' && this.mode !== 'WROTE_COLLECTABLE') {
|
|
96
|
-
throw new Error(`Wrong order of commands. Single level can not be closed if a switch to collectibles or writing of collectible did not happen. mode is ${this.mode}.`);
|
|
97
|
-
}
|
|
98
|
-
await this.writer.write(`]}`);
|
|
99
|
-
this.mode = 'FINISHED_LEVEL';
|
|
100
|
-
}
|
|
101
|
-
async endLevels() {
|
|
102
|
-
if (this.mode !== 'OPENED_LEVELS' && this.mode !== 'FINISHED_LEVEL') {
|
|
103
|
-
throw new Error(`Wrong order of commands. Levels can only be closed after opening levels array or after finishing single level. mode is ${this.mode}.`);
|
|
104
|
-
}
|
|
105
|
-
await this.writer.write(`]`);
|
|
106
|
-
this.mode = 'FINISHED_LEVELS';
|
|
107
|
-
}
|
|
108
|
-
async endSave() {
|
|
109
|
-
if (this.mode !== 'FINISHED_LEVELS') {
|
|
110
|
-
throw new Error(`Wrong order of commands. Save has to end after levels. mode is ${this.mode}.`);
|
|
111
|
-
}
|
|
112
|
-
await this.writer.write('}');
|
|
113
|
-
this.mode = 'FINISHED_SAVE';
|
|
114
|
-
}
|
|
115
79
|
async close() {
|
|
116
80
|
return this.writer.close();
|
|
117
81
|
}
|
|
118
82
|
}
|
|
119
|
-
exports.SaveStreamWriter = SaveStreamWriter;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const SaveComponent_1 = require("../satisfactory/objects/SaveComponent");
|
|
6
|
-
const SaveEntity_1 = require("../satisfactory/objects/SaveEntity");
|
|
7
|
-
class StreamLevel {
|
|
1
|
+
import { Level, ParseTransform } from "../..";
|
|
2
|
+
import { SaveComponent } from "../satisfactory/objects/SaveComponent";
|
|
3
|
+
import { SaveEntity } from "../satisfactory/objects/SaveEntity";
|
|
4
|
+
export class StreamLevel {
|
|
8
5
|
constructor(name) {
|
|
9
6
|
this.name = name;
|
|
10
7
|
}
|
|
@@ -12,13 +9,13 @@ class StreamLevel {
|
|
|
12
9
|
const binaryLength = reader.readInt32();
|
|
13
10
|
await reader.allocate(binaryLength);
|
|
14
11
|
const objectHeaders = StreamLevel.ReadObjectHeaders(reader);
|
|
15
|
-
const collectables =
|
|
12
|
+
const collectables = Level.ReadCollectablesList(reader);
|
|
16
13
|
await writer.openLevel(levelName);
|
|
17
14
|
await StreamLevel.StreamObjectContentsAsync(reader, writer, objectHeaders, buildVersion);
|
|
18
15
|
await writer.switchInLevelToCollectables();
|
|
19
16
|
await writer.writeCollectables(...collectables);
|
|
20
17
|
await writer.endLevel();
|
|
21
|
-
|
|
18
|
+
Level.ReadCollectablesList(reader);
|
|
22
19
|
return;
|
|
23
20
|
}
|
|
24
21
|
static ReadObjectHeaders(reader) {
|
|
@@ -33,7 +30,7 @@ class StreamLevel {
|
|
|
33
30
|
rootObject: reader.readString(),
|
|
34
31
|
instanceName: reader.readString(),
|
|
35
32
|
needTransform: reader.readInt32() == 1,
|
|
36
|
-
transform:
|
|
33
|
+
transform: ParseTransform(reader),
|
|
37
34
|
wasPlacedInLevel: reader.readInt32() == 1
|
|
38
35
|
});
|
|
39
36
|
break;
|
|
@@ -78,13 +75,13 @@ class StreamLevel {
|
|
|
78
75
|
}
|
|
79
76
|
const isComponent = obj.parentEntityName !== undefined;
|
|
80
77
|
if (!isComponent) {
|
|
81
|
-
const entity = new
|
|
82
|
-
|
|
78
|
+
const entity = new SaveEntity(obj.typePath, obj.rootObject, obj.instanceName, '', obj.needTransform);
|
|
79
|
+
SaveEntity.ParseData(entity, len, reader, buildVersion, obj.typePath);
|
|
83
80
|
bufferedObjects.push(entity);
|
|
84
81
|
}
|
|
85
82
|
else if (isComponent) {
|
|
86
|
-
const component = new
|
|
87
|
-
|
|
83
|
+
const component = new SaveComponent(obj.typePath, obj.rootObject, obj.instanceName, obj.parentEntityName);
|
|
84
|
+
SaveComponent.ParseData(component, len, reader, buildVersion, obj.typePath);
|
|
88
85
|
bufferedObjects.push(component);
|
|
89
86
|
}
|
|
90
87
|
const after = reader.getBufferPosition();
|
|
@@ -100,4 +97,3 @@ class StreamLevel {
|
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
|
-
exports.StreamLevel = StreamLevel;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.StreamParserReader = void 0;
|
|
4
|
-
const alignment_enum_1 = require("../byte/alignment.enum");
|
|
5
|
-
class StreamParserReader {
|
|
1
|
+
import { Alignment } from "../byte/alignment.enum";
|
|
2
|
+
export class StreamParserReader {
|
|
6
3
|
constructor(minBufferSize) {
|
|
7
4
|
this.minBufferSize = minBufferSize;
|
|
8
|
-
this.alignment =
|
|
5
|
+
this.alignment = Alignment.LITTLE_ENDIAN;
|
|
9
6
|
this.getAmountLeftToRead = () => {
|
|
10
7
|
return this.view.byteLength - this.currentByte;
|
|
11
8
|
};
|
|
@@ -154,27 +151,27 @@ class StreamParserReader {
|
|
|
154
151
|
return data;
|
|
155
152
|
}
|
|
156
153
|
readInt16() {
|
|
157
|
-
let data = this.view.getInt16(this.currentByte, this.alignment ===
|
|
154
|
+
let data = this.view.getInt16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
158
155
|
this.currentByte += 2;
|
|
159
156
|
return data;
|
|
160
157
|
}
|
|
161
158
|
readUint16() {
|
|
162
|
-
let data = this.view.getUint16(this.currentByte, this.alignment ===
|
|
159
|
+
let data = this.view.getUint16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
163
160
|
this.currentByte += 2;
|
|
164
161
|
return data;
|
|
165
162
|
}
|
|
166
163
|
readInt32() {
|
|
167
|
-
let data = this.view.getInt32(this.currentByte, this.alignment ===
|
|
164
|
+
let data = this.view.getInt32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
168
165
|
this.currentByte += 4;
|
|
169
166
|
return data;
|
|
170
167
|
}
|
|
171
168
|
readUint32() {
|
|
172
|
-
let data = this.view.getUint32(this.currentByte, this.alignment ===
|
|
169
|
+
let data = this.view.getUint32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
173
170
|
this.currentByte += 4;
|
|
174
171
|
return data;
|
|
175
172
|
}
|
|
176
173
|
readLong() {
|
|
177
|
-
let data = this.view.getBigInt64(this.currentByte, this.alignment ===
|
|
174
|
+
let data = this.view.getBigInt64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
178
175
|
this.currentByte += 8;
|
|
179
176
|
return data;
|
|
180
177
|
}
|
|
@@ -182,17 +179,17 @@ class StreamParserReader {
|
|
|
182
179
|
return this.readLong();
|
|
183
180
|
}
|
|
184
181
|
readUint64() {
|
|
185
|
-
let data = this.view.getBigUint64(this.currentByte, this.alignment ===
|
|
182
|
+
let data = this.view.getBigUint64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
186
183
|
this.currentByte += 8;
|
|
187
184
|
return data;
|
|
188
185
|
}
|
|
189
186
|
readFloat32() {
|
|
190
|
-
let data = this.view.getFloat32(this.currentByte, this.alignment ===
|
|
187
|
+
let data = this.view.getFloat32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
191
188
|
this.currentByte += 4;
|
|
192
189
|
return data;
|
|
193
190
|
}
|
|
194
191
|
readDouble() {
|
|
195
|
-
let data = this.view.getFloat64(this.currentByte, this.alignment ===
|
|
192
|
+
let data = this.view.getFloat64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
|
|
196
193
|
this.currentByte += 8;
|
|
197
194
|
return data;
|
|
198
195
|
}
|
|
@@ -222,4 +219,3 @@ class StreamParserReader {
|
|
|
222
219
|
}
|
|
223
220
|
}
|
|
224
221
|
}
|
|
225
|
-
exports.StreamParserReader = StreamParserReader;
|
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.26",
|
|
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",
|
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
"webpack-cli": "^5.0.1"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"pako": "^2.1.0"
|
|
48
|
+
"pako": "^2.1.0",
|
|
49
|
+
"stream-browserify": "^3.0.0",
|
|
50
|
+
"web-streams-polyfill": "^4.0.0"
|
|
49
51
|
}
|
|
50
52
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ByteReader, ByteWriter } from '../../../..';
|
|
2
|
-
export type MD5Hash = {
|
|
3
|
-
isValid: boolean;
|
|
4
|
-
hash?: number[];
|
|
5
|
-
};
|
|
6
|
-
export declare const readMD5Hash: (reader: ByteReader) => MD5Hash;
|
|
7
|
-
export declare const writeMD5Hash: (writer: ByteWriter, md5Hash: MD5Hash) => void;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeMD5Hash = exports.readMD5Hash = void 0;
|
|
4
|
-
const readMD5Hash = (reader) => {
|
|
5
|
-
const md5Hash = { isValid: false };
|
|
6
|
-
md5Hash.isValid = reader.readInt32() === 1;
|
|
7
|
-
if (md5Hash.isValid) {
|
|
8
|
-
md5Hash.hash = Array.from(reader.readBytes(16));
|
|
9
|
-
}
|
|
10
|
-
return md5Hash;
|
|
11
|
-
};
|
|
12
|
-
exports.readMD5Hash = readMD5Hash;
|
|
13
|
-
const writeMD5Hash = (writer, md5Hash) => {
|
|
14
|
-
writer.writeInt32(md5Hash.isValid ? 1 : 0);
|
|
15
|
-
if (md5Hash.isValid) {
|
|
16
|
-
writer.writeBytesArray(md5Hash.hash);
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.writeMD5Hash = writeMD5Hash;
|