@etothepii/satisfactory-file-parser 0.1.4 → 0.1.7
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 +1 -1
- package/build/parser/parser.js +1 -1
- package/build/parser/satisfactory/objects/DataFields.js +2 -2
- package/build/parser/satisfactory/objects/Property.js +1 -1
- package/build/parser/satisfactory/objects/SaveObject.d.ts +1 -3
- package/build/parser/satisfactory/objects/SaveObject.js +1 -1
- package/build/parser/satisfactory/save/save-reader.d.ts +4 -1
- package/build/parser/satisfactory/save/save-reader.js +5 -2
- package/build/parser/satisfactory/save/save-writer.d.ts +2 -0
- package/build/parser/satisfactory/save/save-writer.js +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ U8 has only read support so far and only for save files, not for blueprint files
|
|
|
19
19
|
|:--------------:|:-----------------------------|
|
|
20
20
|
| <= U5 | ❌ |
|
|
21
21
|
| U6 + U7 | ✅ 0.0.1 - 0.0.34 |
|
|
22
|
-
| U8 | ⚠️ >= 0.1.
|
|
22
|
+
| U8 | ⚠️ >= 0.1.5 (Reading only) |
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
## Installation via npm
|
package/build/parser/parser.js
CHANGED
|
@@ -22,7 +22,7 @@ class Parser {
|
|
|
22
22
|
const save = new satisfactory_save_1.SatisfactorySave(header);
|
|
23
23
|
const inflateResult = reader.inflateChunks();
|
|
24
24
|
onDecompressedSaveBody(reader.getBuffer());
|
|
25
|
-
reader.readGrids();
|
|
25
|
+
const grids = reader.readGrids();
|
|
26
26
|
save.levels = reader.readLevels();
|
|
27
27
|
save.compressionInfo = reader.compressionInfo;
|
|
28
28
|
save.trailingCollectedObjects = reader.trailingCollectedObjects;
|
|
@@ -8,14 +8,14 @@ class DataFields {
|
|
|
8
8
|
}
|
|
9
9
|
static ParseProperties(obj, length, reader, buildVersion, typePath) {
|
|
10
10
|
const start = reader.getBufferPosition();
|
|
11
|
-
obj.properties =
|
|
11
|
+
obj.properties = [];
|
|
12
12
|
if (length === 0) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
let propertyName = reader.readString();
|
|
16
16
|
while (propertyName !== 'None') {
|
|
17
17
|
const property = DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
18
|
-
obj.properties
|
|
18
|
+
obj.properties.push(property);
|
|
19
19
|
propertyName = reader.readString();
|
|
20
20
|
}
|
|
21
21
|
let padding = reader.readInt32();
|
|
@@ -934,7 +934,7 @@ const ParseDynamicStructData = (reader, buildVersion, type) => {
|
|
|
934
934
|
let propertyName = reader.readString();
|
|
935
935
|
while (propertyName !== 'None') {
|
|
936
936
|
const property = DataFields_1.DataFields.ParseProperty(reader, buildVersion, propertyName);
|
|
937
|
-
data.properties
|
|
937
|
+
data.properties.push(property);
|
|
938
938
|
propertyName = reader.readString();
|
|
939
939
|
}
|
|
940
940
|
return data;
|
|
@@ -11,9 +11,7 @@ export declare abstract class SaveObject implements SaveObjectHeader {
|
|
|
11
11
|
typePath: string;
|
|
12
12
|
rootObject: string;
|
|
13
13
|
instanceName: string;
|
|
14
|
-
properties:
|
|
15
|
-
[name: string]: AbstractBaseProperty;
|
|
16
|
-
};
|
|
14
|
+
properties: AbstractBaseProperty[];
|
|
17
15
|
specialProperties: SpecialAnyProperty;
|
|
18
16
|
trailingData: number[];
|
|
19
17
|
unknownType1: number;
|
|
@@ -8,7 +8,10 @@ export type ReadMode = 'stream' | 'whole';
|
|
|
8
8
|
export declare const DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;
|
|
9
9
|
export type Grids = {
|
|
10
10
|
[parentName: string]: {
|
|
11
|
-
[level: number]:
|
|
11
|
+
[level: number]: {
|
|
12
|
+
name: string;
|
|
13
|
+
size: number;
|
|
14
|
+
}[];
|
|
12
15
|
};
|
|
13
16
|
};
|
|
14
17
|
export declare class SaveReader extends ByteReader {
|
|
@@ -38,14 +38,17 @@ class SaveReader extends byte_reader_class_1.ByteReader {
|
|
|
38
38
|
const whatever2 = this.readInt32();
|
|
39
39
|
grids[parentName] = {};
|
|
40
40
|
for (let i = 0; i < childrenCount; i++) {
|
|
41
|
-
const binaryLenIGuess = this.
|
|
41
|
+
const binaryLenIGuess = this.readUint32();
|
|
42
42
|
const levelInstanceName = this.readString();
|
|
43
43
|
const lod = /\_L([0-9]+)\_/.exec(levelInstanceName)[1];
|
|
44
44
|
const arr = grids[parentName][Number(lod)];
|
|
45
45
|
if (!arr) {
|
|
46
46
|
grids[parentName][Number(lod)] = [];
|
|
47
47
|
}
|
|
48
|
-
grids[parentName][Number(lod)].push(
|
|
48
|
+
grids[parentName][Number(lod)].push({
|
|
49
|
+
name: levelInstanceName,
|
|
50
|
+
size: binaryLenIGuess
|
|
51
|
+
});
|
|
49
52
|
}
|
|
50
53
|
};
|
|
51
54
|
readLevelsList(1379);
|
|
@@ -2,10 +2,12 @@ import { Alignment } from "../../byte/alignment.enum";
|
|
|
2
2
|
import { ByteWriter } from "../../byte/byte-writer.class";
|
|
3
3
|
import { ChunkCompressionInfo, ChunkSummary } from "../../file.types";
|
|
4
4
|
import { SatisfactorySave } from "./satisfactory-save";
|
|
5
|
+
import { Grids } from "./save-reader";
|
|
5
6
|
import { SatisfactorySaveHeader } from "./save.types";
|
|
6
7
|
export declare class SaveWriter extends ByteWriter {
|
|
7
8
|
constructor();
|
|
8
9
|
static WriteHeader(writer: ByteWriter, header: SatisfactorySaveHeader): void;
|
|
10
|
+
static WriteGrids: (writer: ByteWriter, grids: Grids) => void;
|
|
9
11
|
static WriteLevels(writer: ByteWriter, save: SatisfactorySave, buildVersion: number): void;
|
|
10
12
|
static GenerateCompressedChunksFromData(bufferArray: ArrayBuffer, compressionInfo: ChunkCompressionInfo, onBinaryBeforeCompressing: (binary: ArrayBuffer) => void, onChunk: (chunk: Uint8Array) => void, alignment?: Alignment): ChunkSummary[];
|
|
11
13
|
generateChunks(compressionInfo: ChunkCompressionInfo, posAfterHeader: number, onBinaryBeforeCompressing: (binary: ArrayBuffer) => void, onHeader: (header: Uint8Array) => void, onChunk: (chunk: Uint8Array) => void): ChunkSummary[];
|
|
@@ -112,4 +112,23 @@ class SaveWriter extends byte_writer_class_1.ByteWriter {
|
|
|
112
112
|
return chunkSummary;
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
+
SaveWriter.WriteGrids = (writer, grids) => {
|
|
116
|
+
writer.writeInt32(0);
|
|
117
|
+
writer.writeInt32(0);
|
|
118
|
+
writer.writeString('None');
|
|
119
|
+
writer.writeInt32(0);
|
|
120
|
+
writer.writeInt32(0);
|
|
121
|
+
writer.writeInt32(0);
|
|
122
|
+
writer.writeString('None');
|
|
123
|
+
for (const parentEntry of Object.entries(grids)) {
|
|
124
|
+
writer.writeInt32(0);
|
|
125
|
+
writer.writeString(parentEntry[0]);
|
|
126
|
+
writer.writeInt32(0);
|
|
127
|
+
writer.writeInt32(0);
|
|
128
|
+
for (const child of Object.entries(parentEntry[1]).flatMap(entry => entry[1])) {
|
|
129
|
+
writer.writeUint32(child.size);
|
|
130
|
+
writer.writeString(child.name);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
115
134
|
exports.SaveWriter = SaveWriter;
|
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.7",
|
|
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",
|