Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@etothepii/satisfactory-file-parser

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@etothepii/satisfactory-file-parser - npm Package Compare versions

Comparing version 0.1.26 to 0.1.27

85

build/index.js

@@ -1,25 +0,60 @@

export * from './parser/satisfactory/blueprint/blueprint.types';
export { DataFields } from './parser/satisfactory/objects/DataFields';
export * from './parser/satisfactory/objects/GUIDInfo';
export { ObjectReference } from './parser/satisfactory/objects/ObjectReference';
export * from './parser/satisfactory/objects/Property';
export { SaveComponent } from './parser/satisfactory/objects/SaveComponent';
export { SaveEntity } from './parser/satisfactory/objects/SaveEntity';
export * from './parser/satisfactory/objects/ue/GUID';
export * from './parser/satisfactory/objects/ue/MD5Hash';
export { Level } from './parser/satisfactory/save/level.class';
export { SatisfactorySave } from './parser/satisfactory/save/satisfactory-save';
export * from './parser/satisfactory/save/save.types';
export { ByteReader } from './parser/byte/byte-reader.class';
export { ByteWriter } from './parser/byte/byte-writer.class';
export { BlueprintConfigReader, BlueprintReader } from './parser/satisfactory/blueprint/blueprint-reader';
export { BlueprintConfigWriter, BlueprintWriter } from './parser/satisfactory/blueprint/blueprint-writer';
export { SaveReader } from './parser/satisfactory/save/save-reader';
export { SaveWriter } from './parser/satisfactory/save/save-writer';
export * from './parser/satisfactory/structs/util.types';
export { SaveStreamJsonStringifier } from './parser/stream/save-stream-json-stringifier';
export { SaveStreamWriter } from './parser/stream/save-stream-writer.class';
export * from './parser/error/parser.error';
export * from './parser/file.types';
export { Parser } from './parser/parser';
export { ReadableStreamParser } from './parser/stream/reworked/readable-stream-parser';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReadableStreamParser = exports.Parser = exports.SaveStreamWriter = exports.SaveStreamJsonStringifier = exports.SaveWriter = exports.SaveReader = exports.BlueprintWriter = exports.BlueprintConfigWriter = exports.BlueprintReader = exports.BlueprintConfigReader = exports.ByteWriter = exports.ByteReader = exports.SatisfactorySave = exports.Level = exports.SaveEntity = exports.SaveComponent = exports.ObjectReference = exports.DataFields = void 0;
__exportStar(require("./parser/satisfactory/blueprint/blueprint.types"), exports);
var DataFields_1 = require("./parser/satisfactory/objects/DataFields");
Object.defineProperty(exports, "DataFields", { enumerable: true, get: function () { return DataFields_1.DataFields; } });
__exportStar(require("./parser/satisfactory/objects/GUIDInfo"), exports);
var ObjectReference_1 = require("./parser/satisfactory/objects/ObjectReference");
Object.defineProperty(exports, "ObjectReference", { enumerable: true, get: function () { return ObjectReference_1.ObjectReference; } });
__exportStar(require("./parser/satisfactory/objects/Property"), exports);
var SaveComponent_1 = require("./parser/satisfactory/objects/SaveComponent");
Object.defineProperty(exports, "SaveComponent", { enumerable: true, get: function () { return SaveComponent_1.SaveComponent; } });
var SaveEntity_1 = require("./parser/satisfactory/objects/SaveEntity");
Object.defineProperty(exports, "SaveEntity", { enumerable: true, get: function () { return SaveEntity_1.SaveEntity; } });
__exportStar(require("./parser/satisfactory/objects/ue/GUID"), exports);
__exportStar(require("./parser/satisfactory/objects/ue/MD5Hash"), exports);
var level_class_1 = require("./parser/satisfactory/save/level.class");
Object.defineProperty(exports, "Level", { enumerable: true, get: function () { return level_class_1.Level; } });
var satisfactory_save_1 = require("./parser/satisfactory/save/satisfactory-save");
Object.defineProperty(exports, "SatisfactorySave", { enumerable: true, get: function () { return satisfactory_save_1.SatisfactorySave; } });
__exportStar(require("./parser/satisfactory/save/save.types"), exports);
var byte_reader_class_1 = require("./parser/byte/byte-reader.class");
Object.defineProperty(exports, "ByteReader", { enumerable: true, get: function () { return byte_reader_class_1.ByteReader; } });
var byte_writer_class_1 = require("./parser/byte/byte-writer.class");
Object.defineProperty(exports, "ByteWriter", { enumerable: true, get: function () { return byte_writer_class_1.ByteWriter; } });
var blueprint_reader_1 = require("./parser/satisfactory/blueprint/blueprint-reader");
Object.defineProperty(exports, "BlueprintConfigReader", { enumerable: true, get: function () { return blueprint_reader_1.BlueprintConfigReader; } });
Object.defineProperty(exports, "BlueprintReader", { enumerable: true, get: function () { return blueprint_reader_1.BlueprintReader; } });
var blueprint_writer_1 = require("./parser/satisfactory/blueprint/blueprint-writer");
Object.defineProperty(exports, "BlueprintConfigWriter", { enumerable: true, get: function () { return blueprint_writer_1.BlueprintConfigWriter; } });
Object.defineProperty(exports, "BlueprintWriter", { enumerable: true, get: function () { return blueprint_writer_1.BlueprintWriter; } });
var save_reader_1 = require("./parser/satisfactory/save/save-reader");
Object.defineProperty(exports, "SaveReader", { enumerable: true, get: function () { return save_reader_1.SaveReader; } });
var save_writer_1 = require("./parser/satisfactory/save/save-writer");
Object.defineProperty(exports, "SaveWriter", { enumerable: true, get: function () { return save_writer_1.SaveWriter; } });
__exportStar(require("./parser/satisfactory/structs/util.types"), exports);
var save_stream_json_stringifier_1 = require("./parser/stream/save-stream-json-stringifier");
Object.defineProperty(exports, "SaveStreamJsonStringifier", { enumerable: true, get: function () { return save_stream_json_stringifier_1.SaveStreamJsonStringifier; } });
var save_stream_writer_class_1 = require("./parser/stream/save-stream-writer.class");
Object.defineProperty(exports, "SaveStreamWriter", { enumerable: true, get: function () { return save_stream_writer_class_1.SaveStreamWriter; } });
__exportStar(require("./parser/error/parser.error"), exports);
__exportStar(require("./parser/file.types"), exports);
var parser_1 = require("./parser/parser");
Object.defineProperty(exports, "Parser", { enumerable: true, get: function () { return parser_1.Parser; } });
var readable_stream_parser_1 = require("./parser/stream/reworked/readable-stream-parser");
Object.defineProperty(exports, "ReadableStreamParser", { enumerable: true, get: function () { return readable_stream_parser_1.ReadableStreamParser; } });

@@ -1,5 +0,8 @@

export var Alignment;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Alignment = void 0;
var Alignment;
(function (Alignment) {
Alignment[Alignment["BIG_ENDIAN"] = 0] = "BIG_ENDIAN";
Alignment[Alignment["LITTLE_ENDIAN"] = 1] = "LITTLE_ENDIAN";
})(Alignment || (Alignment = {}));
})(Alignment = exports.Alignment || (exports.Alignment = {}));

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,3 +0,6 @@

import { Alignment } from "./alignment.enum";
export class ByteReader {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ByteReader = void 0;
const alignment_enum_1 = require("./alignment.enum");
class ByteReader {
constructor(fileBuffer, alignment) {

@@ -49,3 +52,3 @@ this.debug = false;

readInt16() {
let data = this.bufferView.getInt16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getInt16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -55,3 +58,3 @@ return data;

readUint16() {
let data = this.bufferView.getUint16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getUint16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -61,3 +64,3 @@ return data;

readInt32() {
let data = this.bufferView.getInt32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getInt32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -67,3 +70,3 @@ return data;

readUint32() {
let data = this.bufferView.getUint32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getUint32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -73,3 +76,3 @@ return data;

readLong() {
let data = this.bufferView.getBigInt64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getBigInt64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -82,3 +85,3 @@ return data;

readUint64() {
let data = this.bufferView.getBigUint64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getBigUint64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -88,3 +91,3 @@ return data;

readFloat32() {
let data = this.bufferView.getFloat32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getFloat32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -94,3 +97,3 @@ return data;

readDouble() {
let data = this.bufferView.getFloat64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.bufferView.getFloat64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -132,1 +135,2 @@ return data;

}
exports.ByteReader = ByteReader;

@@ -1,2 +0,5 @@

import { Alignment } from "./alignment.enum";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ByteWriter = void 0;
const alignment_enum_1 = require("./alignment.enum");
class ByteWriter {

@@ -41,3 +44,3 @@ constructor(alignment, bufferSize = 500) {

this.extendBufferIfNeeded(2);
this.bufferView.setInt16(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setInt16(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -47,3 +50,3 @@ }

this.extendBufferIfNeeded(2);
this.bufferView.setUint16(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setUint16(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -53,3 +56,3 @@ }

this.extendBufferIfNeeded(4);
this.bufferView.setInt32(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setInt32(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -59,3 +62,3 @@ }

this.extendBufferIfNeeded(4);
this.bufferView.setUint32(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setUint32(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -65,3 +68,3 @@ }

this.extendBufferIfNeeded(8);
this.bufferView.setBigInt64(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setBigInt64(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -71,3 +74,3 @@ }

this.extendBufferIfNeeded(8);
this.bufferView.setBigUint64(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setBigUint64(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -77,3 +80,3 @@ }

this.extendBufferIfNeeded(4);
this.bufferView.setFloat32(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setFloat32(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -83,3 +86,3 @@ }

this.extendBufferIfNeeded(8);
this.bufferView.setFloat64(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);
this.bufferView.setFloat64(this.currentByte, value, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -144,2 +147,2 @@ }

ByteWriter.IsASCIICompatible = (value) => /^[\x00-\x7F]*$/.test(value);
export { ByteWriter };
exports.ByteWriter = ByteWriter;

@@ -1,2 +0,5 @@

export class ParserError extends Error {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnimplementedError = exports.TimeoutError = exports.CompressionLibraryError = exports.CorruptSaveError = exports.UnsupportedVersionError = exports.ParserError = void 0;
class ParserError extends Error {
constructor(name, message) {

@@ -7,3 +10,4 @@ super(message);

}
export class UnsupportedVersionError extends ParserError {
exports.ParserError = ParserError;
class UnsupportedVersionError extends ParserError {
constructor(message) {

@@ -13,3 +17,4 @@ super('UnsupportedVersionError', message ?? 'This save version is not supported.');

}
export class CorruptSaveError extends ParserError {
exports.UnsupportedVersionError = UnsupportedVersionError;
class CorruptSaveError extends ParserError {
constructor(message) {

@@ -19,3 +24,4 @@ super('CorruptSaveError', message ?? 'This save data is most likely corrupt.');

}
export class CompressionLibraryError extends ParserError {
exports.CorruptSaveError = CorruptSaveError;
class CompressionLibraryError extends ParserError {
constructor(message) {

@@ -25,3 +31,4 @@ super('CompressionLibraryError', message ?? 'Failed to compress/decompress save data.');

}
export class TimeoutError extends ParserError {
exports.CompressionLibraryError = CompressionLibraryError;
class TimeoutError extends ParserError {
constructor(message) {

@@ -31,3 +38,4 @@ super('TimeoutError', message ?? 'Operation timed out.');

}
export class UnimplementedError extends ParserError {
exports.TimeoutError = TimeoutError;
class UnimplementedError extends ParserError {
constructor(message) {

@@ -37,1 +45,2 @@ super('UnimplementedError', message ?? 'Unimplemented Operation.');

}
exports.UnimplementedError = UnimplementedError;

@@ -1,4 +0,7 @@

export var CompressionAlgorithmCode;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CompressionAlgorithmCode = void 0;
var CompressionAlgorithmCode;
(function (CompressionAlgorithmCode) {
CompressionAlgorithmCode[CompressionAlgorithmCode["ZLIB"] = 3] = "ZLIB";
})(CompressionAlgorithmCode || (CompressionAlgorithmCode = {}));
})(CompressionAlgorithmCode = exports.CompressionAlgorithmCode || (exports.CompressionAlgorithmCode = {}));

@@ -1,14 +0,17 @@

import { BlueprintConfigReader, BlueprintReader } from "./satisfactory/blueprint/blueprint-reader";
import { BlueprintConfigWriter, BlueprintWriter } from "./satisfactory/blueprint/blueprint-writer";
import { SatisfactorySave } from "./satisfactory/save/satisfactory-save";
import { SaveReader } from "./satisfactory/save/save-reader";
import { SaveWriter } from "./satisfactory/save/save-writer";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Parser = void 0;
const blueprint_reader_1 = require("./satisfactory/blueprint/blueprint-reader");
const blueprint_writer_1 = require("./satisfactory/blueprint/blueprint-writer");
const satisfactory_save_1 = require("./satisfactory/save/satisfactory-save");
const save_reader_1 = require("./satisfactory/save/save-reader");
const save_writer_1 = require("./satisfactory/save/save-writer");
class Parser {
static WriteSave(save, onBinaryBeforeCompressing, onHeader, onChunk) {
const writer = new SaveWriter();
SaveWriter.WriteHeader(writer, save.header);
const writer = new save_writer_1.SaveWriter();
save_writer_1.SaveWriter.WriteHeader(writer, save.header);
const posAfterHeader = writer.getBufferPosition();
SaveWriter.WriteSaveBodyHash(writer, save.gridHash);
SaveWriter.WriteGrids(writer, save.grids);
SaveWriter.WriteLevels(writer, save, save.header.buildVersion);
save_writer_1.SaveWriter.WriteSaveBodyHash(writer, save.gridHash);
save_writer_1.SaveWriter.WriteGrids(writer, save.grids);
save_writer_1.SaveWriter.WriteLevels(writer, save, save.header.buildVersion);
writer.endWriting();

@@ -19,5 +22,5 @@ const chunkSummary = writer.generateChunks(save.compressionInfo, posAfterHeader, onBinaryBeforeCompressing, onHeader, onChunk);

static ParseSaveFile(name, file, onDecompressedSaveBody = () => { }, onProgress = () => { }) {
const reader = new SaveReader(new Uint8Array(file).buffer, onProgress);
const reader = new save_reader_1.SaveReader(new Uint8Array(file).buffer, onProgress);
const header = reader.readHeader();
const save = new SatisfactorySave(name, header);
const save = new satisfactory_save_1.SatisfactorySave(name, header);
const inflateResult = reader.inflateChunks();

@@ -35,6 +38,6 @@ onDecompressedSaveBody(reader.getBuffer());

static WriteBlueprintFiles(blueprint, onMainFileBinaryBeforeCompressing = () => { }, onMainFileHeader = () => { }, onMainFileChunk = () => { }) {
const blueprintWriter = new BlueprintWriter();
BlueprintWriter.SerializeHeader(blueprintWriter, blueprint.header);
const blueprintWriter = new blueprint_writer_1.BlueprintWriter();
blueprint_writer_1.BlueprintWriter.SerializeHeader(blueprintWriter, blueprint.header);
const saveBodyPos = blueprintWriter.getBufferPosition();
BlueprintWriter.SerializeObjects(blueprintWriter, blueprint.objects);
blueprint_writer_1.BlueprintWriter.SerializeObjects(blueprintWriter, blueprint.objects);
blueprintWriter.endWriting();

@@ -44,4 +47,4 @@ let binaryChunks = [];

const mainFileChunkSummary = blueprintWriter.generateChunks(blueprint.compressionInfo, saveBodyPos, onMainFileBinaryBeforeCompressing, onMainFileHeader, onMainFileChunk);
const configWriter = new BlueprintConfigWriter();
BlueprintConfigWriter.SerializeConfig(configWriter, blueprint.config);
const configWriter = new blueprint_writer_1.BlueprintConfigWriter();
blueprint_writer_1.BlueprintConfigWriter.SerializeConfig(configWriter, blueprint.config);
const configFileBinary = configWriter.endWriting();

@@ -54,9 +57,9 @@ return {

static ParseBlueprintFiles(name, blueprintFile, blueprintConfigFile, onDecompressedBlueprintBody = () => { }) {
const blueprintConfigReader = new BlueprintConfigReader(new Uint8Array(blueprintConfigFile).buffer);
const config = BlueprintConfigReader.ParseConfig(blueprintConfigReader);
const blueprintReader = new BlueprintReader(new Uint8Array(blueprintFile).buffer);
const header = BlueprintReader.ReadHeader(blueprintReader);
const blueprintConfigReader = new blueprint_reader_1.BlueprintConfigReader(new Uint8Array(blueprintConfigFile).buffer);
const config = blueprint_reader_1.BlueprintConfigReader.ParseConfig(blueprintConfigReader);
const blueprintReader = new blueprint_reader_1.BlueprintReader(new Uint8Array(blueprintFile).buffer);
const header = blueprint_reader_1.BlueprintReader.ReadHeader(blueprintReader);
const inflateResult = blueprintReader.inflateChunks();
onDecompressedBlueprintBody(inflateResult.inflatedData);
const blueprintObjects = BlueprintReader.ParseObjects(blueprintReader);
const blueprintObjects = blueprint_reader_1.BlueprintReader.ParseObjects(blueprintReader);
const blueprint = {

@@ -81,2 +84,2 @@ name,

}, indent);
export { Parser };
exports.Parser = Parser;

@@ -1,17 +0,23 @@

import Pako from "pako";
import { Alignment } from "../../byte/alignment.enum";
import { ByteReader } from "../../byte/byte-reader.class";
import { CorruptSaveError, ParserError } from "../../error/parser.error";
import { SaveComponent, isSaveComponent } from "../objects/SaveComponent";
import { SaveEntity, isSaveEntity } from "../objects/SaveEntity";
import { Level } from "../save/level.class";
import { DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE } from "../save/save-reader";
import { ParseCol4RGBA, ParseVec3f } from "../structs/util.types";
export class BlueprintReader extends ByteReader {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlueprintConfigReader = exports.BlueprintReader = void 0;
const pako_1 = __importDefault(require("pako"));
const alignment_enum_1 = require("../../byte/alignment.enum");
const byte_reader_class_1 = require("../../byte/byte-reader.class");
const parser_error_1 = require("../../error/parser.error");
const SaveComponent_1 = require("../objects/SaveComponent");
const SaveEntity_1 = require("../objects/SaveEntity");
const level_class_1 = require("../save/level.class");
const save_reader_1 = require("../save/save-reader");
const util_types_1 = require("../structs/util.types");
class BlueprintReader extends byte_reader_class_1.ByteReader {
constructor(bluePrintBuffer) {
super(bluePrintBuffer, Alignment.LITTLE_ENDIAN);
super(bluePrintBuffer, alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.compressionInfo = {
packageFileTag: 0,
maxUncompressedChunkContentSize: 0,
chunkHeaderSize: DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE
chunkHeaderSize: save_reader_1.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE
};

@@ -22,3 +28,3 @@ }

const versionThing = reader.readBytes(2 * 4);
const dimensions = ParseVec3f(reader);
const dimensions = (0, util_types_1.ParseVec3f)(reader);
let itemTypeCount = reader.readInt32();

@@ -57,9 +63,9 @@ const itemCosts = new Array(itemTypeCount).fill(['', 0]);

if (this.compressionInfo.packageFileTag <= 0) {
this.compressionInfo.packageFileTag = chunkHeader.getUint32(0, this.alignment === Alignment.LITTLE_ENDIAN);
this.compressionInfo.packageFileTag = chunkHeader.getUint32(0, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
}
if (this.compressionInfo.maxUncompressedChunkContentSize <= 0) {
this.compressionInfo.maxUncompressedChunkContentSize = chunkHeader.getInt32(8, this.alignment === Alignment.LITTLE_ENDIAN);
this.compressionInfo.maxUncompressedChunkContentSize = chunkHeader.getInt32(8, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
}
const chunkCompressedLength = chunkHeader.getInt32(33, this.alignment === Alignment.LITTLE_ENDIAN);
const chunkUncompressedLength = chunkHeader.getInt32(25, this.alignment === Alignment.LITTLE_ENDIAN);
const chunkCompressedLength = chunkHeader.getInt32(33, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
const chunkUncompressedLength = chunkHeader.getInt32(25, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
totalUncompressedBodySize += chunkUncompressedLength;

@@ -74,7 +80,7 @@ const currentChunkSize = chunkCompressedLength;

let currentInflatedChunk = null;
currentInflatedChunk = Pako.inflate(currentChunk);
currentInflatedChunk = pako_1.default.inflate(currentChunk);
currentChunks.push(currentInflatedChunk);
}
catch (err) {
throw new ParserError('ParserError', 'An error occurred while calling pako inflate.' + err);
throw new parser_error_1.ParserError('ParserError', 'An error occurred while calling pako inflate.' + err);
}

@@ -102,3 +108,3 @@ }

let objects = [];
Level.ReadObjectHeaders(reader, objects, () => { });
level_class_1.Level.ReadObjectHeaders(reader, objects, () => { });
const someChecksumThing = reader.readInt32();

@@ -114,10 +120,10 @@ BlueprintReader.ReadBlueprintObjectContents(reader, objects, 0);

if (len === 0) {
throw new CorruptSaveError(`check number is a wrong value (${len}). This normally indicates a corrupt entity or blueprint.`);
throw new parser_error_1.CorruptSaveError(`check number is a wrong value (${len}). This normally indicates a corrupt entity or blueprint.`);
}
const obj = objectsList[i];
if (isSaveEntity(obj)) {
SaveEntity.ParseData(obj, len, reader, buildVersion, obj.typePath);
if ((0, SaveEntity_1.isSaveEntity)(obj)) {
SaveEntity_1.SaveEntity.ParseData(obj, len, reader, buildVersion, obj.typePath);
}
else if (isSaveComponent(obj)) {
SaveComponent.ParseData(obj, len, reader, buildVersion, obj.typePath);
else if ((0, SaveComponent_1.isSaveComponent)(obj)) {
SaveComponent_1.SaveComponent.ParseData(obj, len, reader, buildVersion, obj.typePath);
}

@@ -127,5 +133,6 @@ }

}
export class BlueprintConfigReader extends ByteReader {
exports.BlueprintReader = BlueprintReader;
class BlueprintConfigReader extends byte_reader_class_1.ByteReader {
constructor(bluePrintConfigBuffer) {
super(bluePrintConfigBuffer, Alignment.LITTLE_ENDIAN);
super(bluePrintConfigBuffer, alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.bluePrintConfigBuffer = bluePrintConfigBuffer;

@@ -138,3 +145,3 @@ this.parse = () => BlueprintConfigReader.ParseConfig(this);

const unk3 = reader.readInt32();
const colorMaybe = ParseCol4RGBA(reader);
const colorMaybe = (0, util_types_1.ParseCol4RGBA)(reader);
return {

@@ -147,1 +154,2 @@ description,

}
exports.BlueprintConfigReader = BlueprintConfigReader;

@@ -1,12 +0,15 @@

import { Alignment } from "../../byte/alignment.enum";
import { ByteWriter } from "../../byte/byte-writer.class";
import { ParserError } from "../../error/parser.error";
import { SaveComponent, isSaveComponent } from "../objects/SaveComponent";
import { SaveEntity, isSaveEntity } from "../objects/SaveEntity";
import { Level } from "../save/level.class";
import { SaveWriter } from "../save/save-writer";
import { SerializeCol4RGBA } from "../structs/util.types";
export class BlueprintWriter extends ByteWriter {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlueprintConfigWriter = exports.BlueprintWriter = void 0;
const alignment_enum_1 = require("../../byte/alignment.enum");
const byte_writer_class_1 = require("../../byte/byte-writer.class");
const parser_error_1 = require("../../error/parser.error");
const SaveComponent_1 = require("../objects/SaveComponent");
const SaveEntity_1 = require("../objects/SaveEntity");
const level_class_1 = require("../save/level.class");
const save_writer_1 = require("../save/save-writer");
const util_types_1 = require("../structs/util.types");
class BlueprintWriter extends byte_writer_class_1.ByteWriter {
constructor() {
super(Alignment.LITTLE_ENDIAN);
super(alignment_enum_1.Alignment.LITTLE_ENDIAN);
}

@@ -39,3 +42,3 @@ static SerializeHeader(writer, header) {

if (posAfterHeader <= 0) {
throw new ParserError('ParserError', 'seems like this buffer has no header. Please write the header first before you can generate chunks.');
throw new parser_error_1.ParserError('ParserError', 'seems like this buffer has no header. Please write the header first before you can generate chunks.');
}

@@ -45,3 +48,3 @@ const header = new Uint8Array(this.bufferArray.slice(0, posAfterHeader));

this.bufferArray = this.bufferArray.slice(posAfterHeader);
const chunkSummary = SaveWriter.GenerateCompressedChunksFromData(this.bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, this.alignment);
const chunkSummary = save_writer_1.SaveWriter.GenerateCompressedChunksFromData(this.bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, this.alignment);
return chunkSummary;

@@ -52,3 +55,3 @@ }

writer.writeInt32(0);
Level.SerializeObjectHeaders(writer, objects);
level_class_1.Level.SerializeObjectHeaders(writer, objects);
writer.writeBinarySizeFromPosition(headersLenIndicator, headersLenIndicator + 4);

@@ -64,7 +67,7 @@ BlueprintWriter.SerializeObjectContents(writer, objects, 0, '');

writer.writeInt32(0);
if (isSaveEntity(obj)) {
SaveEntity.SerializeData(writer, obj, buildVersion);
if ((0, SaveEntity_1.isSaveEntity)(obj)) {
SaveEntity_1.SaveEntity.SerializeData(writer, obj, buildVersion);
}
else if (isSaveComponent(obj)) {
SaveComponent.SerializeData(writer, obj, buildVersion);
else if ((0, SaveComponent_1.isSaveComponent)(obj)) {
SaveComponent_1.SaveComponent.SerializeData(writer, obj, buildVersion);
}

@@ -76,5 +79,6 @@ writer.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);

}
export class BlueprintConfigWriter extends ByteWriter {
exports.BlueprintWriter = BlueprintWriter;
class BlueprintConfigWriter extends byte_writer_class_1.ByteWriter {
constructor() {
super(Alignment.LITTLE_ENDIAN);
super(alignment_enum_1.Alignment.LITTLE_ENDIAN);
}

@@ -85,4 +89,5 @@ static SerializeConfig(writer, config) {

writer.writeInt32(config.iconID);
SerializeCol4RGBA(writer, config.color);
(0, util_types_1.SerializeCol4RGBA)(writer, config.color);
}
}
exports.BlueprintConfigWriter = BlueprintConfigWriter;

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,4 +0,7 @@

import { ParseVec3f } from "../structs/util.types";
import { ArrayProperty, BoolProperty, ByteProperty, DoubleProperty, EnumProperty, FloatProperty, Int32Property, Int64Property, Int8Property, MapProperty, ObjectProperty, SetProperty, StrProperty, StructProperty, TextProperty, Uint32Property, Uint8Property } from "./Property";
export class DataFields {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataFields = void 0;
const util_types_1 = require("../structs/util.types");
const Property_1 = require("./Property");
class DataFields {
constructor() {

@@ -59,8 +62,8 @@ }

property = {
source: ObjectProperty.ReadValue(reader),
target: ObjectProperty.ReadValue(reader)
source: Property_1.ObjectProperty.ReadValue(reader),
target: Property_1.ObjectProperty.ReadValue(reader)
};
if (remainingLen - (reader.getBufferPosition() - start) >= 24) {
property.sourceTranslation = ParseVec3f(reader);
property.targetTranslation = ParseVec3f(reader);
property.sourceTranslation = (0, util_types_1.ParseVec3f)(reader);
property.targetTranslation = (0, util_types_1.ParseVec3f)(reader);
}

@@ -97,72 +100,72 @@ break;

case 'BoolProperty':
currentProperty = BoolProperty.Parse(reader, propertyType, index);
overhead = BoolProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.BoolProperty.Parse(reader, propertyType, index);
overhead = Property_1.BoolProperty.CalcOverhead(currentProperty);
break;
case 'ByteProperty':
currentProperty = ByteProperty.Parse(reader, propertyType, index);
overhead = ByteProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.ByteProperty.Parse(reader, propertyType, index);
overhead = Property_1.ByteProperty.CalcOverhead(currentProperty);
break;
case 'Int8Property':
currentProperty = Int8Property.Parse(reader, propertyType, index);
overhead = Int8Property.CalcOverhead(currentProperty);
currentProperty = Property_1.Int8Property.Parse(reader, propertyType, index);
overhead = Property_1.Int8Property.CalcOverhead(currentProperty);
break;
case 'UInt8Property':
currentProperty = Uint8Property.Parse(reader, propertyType, index);
overhead = Uint8Property.CalcOverhead(currentProperty);
currentProperty = Property_1.Uint8Property.Parse(reader, propertyType, index);
overhead = Property_1.Uint8Property.CalcOverhead(currentProperty);
break;
case 'IntProperty':
case 'Int32Property':
currentProperty = Int32Property.Parse(reader, propertyType, index);
overhead = Int32Property.CalcOverhead(currentProperty);
currentProperty = Property_1.Int32Property.Parse(reader, propertyType, index);
overhead = Property_1.Int32Property.CalcOverhead(currentProperty);
break;
case 'UInt32Property':
currentProperty = Uint32Property.Parse(reader, propertyType, index);
overhead = Uint32Property.CalcOverhead(currentProperty);
currentProperty = Property_1.Uint32Property.Parse(reader, propertyType, index);
overhead = Property_1.Uint32Property.CalcOverhead(currentProperty);
break;
case 'Int64Property':
currentProperty = Int64Property.Parse(reader, propertyType, index);
overhead = Int64Property.CalcOverhead(currentProperty);
currentProperty = Property_1.Int64Property.Parse(reader, propertyType, index);
overhead = Property_1.Int64Property.CalcOverhead(currentProperty);
break;
case 'SingleProperty':
case 'FloatProperty':
currentProperty = FloatProperty.Parse(reader, propertyType, index);
overhead = FloatProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.FloatProperty.Parse(reader, propertyType, index);
overhead = Property_1.FloatProperty.CalcOverhead(currentProperty);
break;
case 'DoubleProperty':
currentProperty = DoubleProperty.Parse(reader, propertyType, index);
overhead = DoubleProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.DoubleProperty.Parse(reader, propertyType, index);
overhead = Property_1.DoubleProperty.CalcOverhead(currentProperty);
break;
case 'StrProperty':
case 'NameProperty':
currentProperty = StrProperty.Parse(reader, propertyType, index);
overhead = StrProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.StrProperty.Parse(reader, propertyType, index);
overhead = Property_1.StrProperty.CalcOverhead(currentProperty);
break;
case 'ObjectProperty':
case 'InterfaceProperty':
currentProperty = ObjectProperty.Parse(reader, propertyType, index);
overhead = ObjectProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.ObjectProperty.Parse(reader, propertyType, index);
overhead = Property_1.ObjectProperty.CalcOverhead(currentProperty);
break;
case 'EnumProperty':
currentProperty = EnumProperty.Parse(reader, propertyType, index);
overhead = EnumProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.EnumProperty.Parse(reader, propertyType, index);
overhead = Property_1.EnumProperty.CalcOverhead(currentProperty);
break;
case 'StructProperty':
currentProperty = StructProperty.Parse(reader, propertyType, index, binarySize);
overhead = StructProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.StructProperty.Parse(reader, propertyType, index, binarySize);
overhead = Property_1.StructProperty.CalcOverhead(currentProperty);
break;
case 'ArrayProperty':
currentProperty = ArrayProperty.Parse(reader, propertyType, index, propertyName);
overhead = ArrayProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.ArrayProperty.Parse(reader, propertyType, index, propertyName);
overhead = Property_1.ArrayProperty.CalcOverhead(currentProperty);
break;
case 'MapProperty':
currentProperty = MapProperty.Parse(reader, propertyName, buildVersion, binarySize);
overhead = MapProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.MapProperty.Parse(reader, propertyName, buildVersion, binarySize);
overhead = Property_1.MapProperty.CalcOverhead(currentProperty);
break;
case 'TextProperty':
currentProperty = TextProperty.Parse(reader, propertyType, index);
overhead = TextProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.TextProperty.Parse(reader, propertyType, index);
overhead = Property_1.TextProperty.CalcOverhead(currentProperty);
break;
case 'SetProperty':
currentProperty = SetProperty.Parse(reader, propertyType, index, propertyName);
overhead = SetProperty.CalcOverhead(currentProperty);
currentProperty = Property_1.SetProperty.Parse(reader, propertyType, index, propertyName);
overhead = Property_1.SetProperty.CalcOverhead(currentProperty);
break;

@@ -205,4 +208,4 @@ default:

case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C':
ObjectProperty.SerializeValue(writer, property.source);
ObjectProperty.SerializeValue(writer, property.target);
Property_1.ObjectProperty.SerializeValue(writer, property.source);
Property_1.ObjectProperty.SerializeValue(writer, property.target);
break;

@@ -233,76 +236,76 @@ case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C':

case 'BoolProperty':
overhead = BoolProperty.CalcOverhead(property);
BoolProperty.Serialize(writer, property);
overhead = Property_1.BoolProperty.CalcOverhead(property);
Property_1.BoolProperty.Serialize(writer, property);
break;
case 'ByteProperty':
overhead = ByteProperty.CalcOverhead(property);
ByteProperty.Serialize(writer, property);
overhead = Property_1.ByteProperty.CalcOverhead(property);
Property_1.ByteProperty.Serialize(writer, property);
break;
case 'Int8Property':
overhead = Int8Property.CalcOverhead(property);
Int8Property.Serialize(writer, property);
overhead = Property_1.Int8Property.CalcOverhead(property);
Property_1.Int8Property.Serialize(writer, property);
break;
case 'UInt8Property':
overhead = Uint8Property.CalcOverhead(property);
Uint8Property.Serialize(writer, property);
overhead = Property_1.Uint8Property.CalcOverhead(property);
Property_1.Uint8Property.Serialize(writer, property);
break;
case 'IntProperty':
case 'Int32Property':
overhead = Int32Property.CalcOverhead(property);
Int32Property.Serialize(writer, property);
overhead = Property_1.Int32Property.CalcOverhead(property);
Property_1.Int32Property.Serialize(writer, property);
break;
case 'UInt32Property':
overhead = Uint32Property.CalcOverhead(property);
Uint32Property.Serialize(writer, property);
overhead = Property_1.Uint32Property.CalcOverhead(property);
Property_1.Uint32Property.Serialize(writer, property);
break;
case 'Int64Property':
overhead = Int64Property.CalcOverhead(property);
Int64Property.Serialize(writer, property);
overhead = Property_1.Int64Property.CalcOverhead(property);
Property_1.Int64Property.Serialize(writer, property);
break;
case 'SingleProperty':
case 'FloatProperty':
overhead = FloatProperty.CalcOverhead(property);
FloatProperty.Serialize(writer, property);
overhead = Property_1.FloatProperty.CalcOverhead(property);
Property_1.FloatProperty.Serialize(writer, property);
break;
case 'DoubleProperty':
overhead = DoubleProperty.CalcOverhead(property);
DoubleProperty.Serialize(writer, property);
overhead = Property_1.DoubleProperty.CalcOverhead(property);
Property_1.DoubleProperty.Serialize(writer, property);
break;
case 'StrProperty':
case 'NameProperty':
overhead = StrProperty.CalcOverhead(property);
StrProperty.Serialize(writer, property);
overhead = Property_1.StrProperty.CalcOverhead(property);
Property_1.StrProperty.Serialize(writer, property);
break;
case 'ObjectProperty':
case 'InterfaceProperty':
overhead = ObjectProperty.CalcOverhead(property);
ObjectProperty.Serialize(writer, property);
overhead = Property_1.ObjectProperty.CalcOverhead(property);
Property_1.ObjectProperty.Serialize(writer, property);
break;
case 'EnumProperty':
overhead = EnumProperty.CalcOverhead(property);
EnumProperty.Serialize(writer, property);
overhead = Property_1.EnumProperty.CalcOverhead(property);
Property_1.EnumProperty.Serialize(writer, property);
break;
case 'ByteProperty':
overhead = ByteProperty.CalcOverhead(property);
ByteProperty.Serialize(writer, property);
overhead = Property_1.ByteProperty.CalcOverhead(property);
Property_1.ByteProperty.Serialize(writer, property);
break;
case 'StructProperty':
overhead = StructProperty.CalcOverhead(property);
StructProperty.Serialize(writer, property);
overhead = Property_1.StructProperty.CalcOverhead(property);
Property_1.StructProperty.Serialize(writer, property);
break;
case 'ArrayProperty':
overhead = ArrayProperty.CalcOverhead(property);
ArrayProperty.Serialize(writer, property, propertyName);
overhead = Property_1.ArrayProperty.CalcOverhead(property);
Property_1.ArrayProperty.Serialize(writer, property, propertyName);
break;
case 'MapProperty':
overhead = MapProperty.CalcOverhead(property);
MapProperty.Serialize(writer, property);
overhead = Property_1.MapProperty.CalcOverhead(property);
Property_1.MapProperty.Serialize(writer, property);
break;
case 'TextProperty':
overhead = TextProperty.CalcOverhead(property);
TextProperty.Serialize(writer, property);
overhead = Property_1.TextProperty.CalcOverhead(property);
Property_1.TextProperty.Serialize(writer, property);
break;
case 'SetProperty':
overhead = SetProperty.CalcOverhead(property);
SetProperty.Serialize(writer, property);
overhead = Property_1.SetProperty.CalcOverhead(property);
Property_1.SetProperty.Serialize(writer, property);
break;

@@ -315,1 +318,2 @@ default:

}
exports.DataFields = DataFields;

@@ -1,7 +0,10 @@

import { GUID } from './ue/GUID';
export var GUIDInfo;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GUIDInfo = void 0;
const GUID_1 = require("./ue/GUID");
var GUIDInfo;
(function (GUIDInfo) {
GUIDInfo.read = (reader) => {
if (reader.readByte() === 1) {
return GUID.read(reader);
return GUID_1.GUID.read(reader);
}

@@ -19,6 +22,6 @@ else {

writer.writeByte(1);
GUID.write(writer, guid);
GUID_1.GUID.write(writer, guid);
}
};
})(GUIDInfo || (GUIDInfo = {}));
})(GUIDInfo = exports.GUIDInfo || (exports.GUIDInfo = {}));
;

@@ -1,2 +0,5 @@

export var ObjectReference;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObjectReference = void 0;
var ObjectReference;
(function (ObjectReference) {

@@ -13,3 +16,3 @@ ObjectReference.read = (reader) => {

};
})(ObjectReference || (ObjectReference = {}));
})(ObjectReference = exports.ObjectReference || (exports.ObjectReference = {}));
;

@@ -1,6 +0,9 @@

import { ParseCol4BGRA, ParseCol4RGBA, ParseVec3, ParseVec3f, ParseVec4, ParseVec4f, SerializeCol4BGRA, SerializeCol4RGBA, SerializeVec3, SerializeVec3f, SerializeVec4 } from "../structs/util.types";
import { DataFields } from "./DataFields";
import { GUIDInfo } from './GUIDInfo';
import { ObjectReference } from "./ObjectReference";
export class AbstractProperty {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
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;
const util_types_1 = require("../structs/util.types");
const DataFields_1 = require("./DataFields");
const GUIDInfo_1 = require("./GUIDInfo");
const ObjectReference_1 = require("./ObjectReference");
class AbstractProperty {
constructor(type, index) {

@@ -11,3 +14,4 @@ this.type = type;

}
export class AbstractBaseProperty extends AbstractProperty {
exports.AbstractProperty = AbstractProperty;
class AbstractBaseProperty extends AbstractProperty {
constructor(type, ueType, index) {

@@ -19,3 +23,4 @@ super(type, index && index !== 0 ? index : undefined);

}
export class BasicProperty extends AbstractBaseProperty {
exports.AbstractBaseProperty = AbstractBaseProperty;
class BasicProperty extends AbstractBaseProperty {
constructor(type, ueType, guidInfo, index = 0) {

@@ -26,3 +31,4 @@ super(type, ueType, index);

}
export class BoolProperty extends BasicProperty {
exports.BasicProperty = BasicProperty;
class BoolProperty extends BasicProperty {
constructor(value, ueType = 'BoolProperty', guidInfo = undefined, index = 0) {

@@ -34,3 +40,3 @@ super('BoolProperty', ueType, guidInfo, index);

const value = BoolProperty.ReadValue(reader);
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
return new BoolProperty(value, ueType, guidInfo, index);

@@ -46,3 +52,3 @@ }

BoolProperty.SerializeValue(writer, property.value);
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
}

@@ -53,3 +59,4 @@ static SerializeValue(writer, value) {

}
export class ByteProperty extends BasicProperty {
exports.BoolProperty = BoolProperty;
class ByteProperty extends BasicProperty {
constructor(value, ueType = 'ByteProperty', guidInfo = undefined, index = 0) {

@@ -61,3 +68,3 @@ super('ByteProperty', ueType, guidInfo, index);

const type = reader.readString();
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
let value;

@@ -87,3 +94,3 @@ if (type === 'None') {

writer.writeString(property.value.type);
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
if (property.value.type === 'None') {

@@ -100,3 +107,4 @@ ByteProperty.SerializeValue(writer, property.value.value);

}
export class Int8Property extends BasicProperty {
exports.ByteProperty = ByteProperty;
class Int8Property extends BasicProperty {
constructor(value, ueType = 'Int8Property', guidInfo = undefined, index = 0) {

@@ -107,3 +115,3 @@ super('Int8Property', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = Int8Property.ReadValue(reader);

@@ -119,3 +127,3 @@ return new Int8Property(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
Int8Property.SerializeValue(writer, property.value);

@@ -127,3 +135,4 @@ }

}
export class Uint8Property extends BasicProperty {
exports.Int8Property = Int8Property;
class Uint8Property extends BasicProperty {
constructor(value, ueType = 'UInt8Property', guidInfo = undefined, index = 0) {

@@ -134,3 +143,3 @@ super('UInt8Property', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = Uint8Property.ReadValue(reader);

@@ -146,3 +155,3 @@ return new Uint8Property(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
Uint8Property.SerializeValue(writer, property.value);

@@ -154,3 +163,4 @@ }

}
export class Int32Property extends BasicProperty {
exports.Uint8Property = Uint8Property;
class Int32Property extends BasicProperty {
constructor(value, ueType = 'IntProperty', guidInfo = undefined, index = 0) {

@@ -161,3 +171,3 @@ super('Int32Property', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = Int32Property.ReadValue(reader);

@@ -173,3 +183,3 @@ return new Int32Property(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
Int32Property.SerializeValue(writer, property.value);

@@ -181,3 +191,4 @@ }

}
export class Uint32Property extends BasicProperty {
exports.Int32Property = Int32Property;
class Uint32Property extends BasicProperty {
constructor(value, ueType = 'UInt32Property', guidInfo = undefined, index = 0) {

@@ -188,3 +199,3 @@ super('UInt32Property', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = Uint32Property.ReadValue(reader);

@@ -200,3 +211,3 @@ return new Uint32Property(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
Uint32Property.SerializeValue(writer, property.value);

@@ -208,3 +219,4 @@ }

}
export class Int64Property extends BasicProperty {
exports.Uint32Property = Uint32Property;
class Int64Property extends BasicProperty {
constructor(value, ueType = 'Int64Property', guidInfo = undefined, index = 0) {

@@ -215,3 +227,3 @@ super('Int64Property', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = Int64Property.ReadValue(reader);

@@ -227,3 +239,3 @@ return new Int64Property(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
Int64Property.SerializeValue(writer, property.value);

@@ -235,3 +247,4 @@ }

}
export class FloatProperty extends BasicProperty {
exports.Int64Property = Int64Property;
class FloatProperty extends BasicProperty {
constructor(value, ueType = 'FloatProperty', guidInfo = undefined, index = 0) {

@@ -242,3 +255,3 @@ super('FloatProperty', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = FloatProperty.ReadValue(reader);

@@ -254,3 +267,3 @@ return new FloatProperty(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
FloatProperty.SerializeValue(writer, property.value);

@@ -262,3 +275,4 @@ }

}
export class DoubleProperty extends BasicProperty {
exports.FloatProperty = FloatProperty;
class DoubleProperty extends BasicProperty {
constructor(value, ueType = 'DoubleProperty', guidInfo = undefined, index = 0) {

@@ -269,3 +283,3 @@ super('DoubleProperty', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = DoubleProperty.ReadValue(reader);

@@ -281,3 +295,3 @@ return new DoubleProperty(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
DoubleProperty.SerializeValue(writer, property.value);

@@ -289,3 +303,4 @@ }

}
export class StrProperty extends BasicProperty {
exports.DoubleProperty = DoubleProperty;
class StrProperty extends BasicProperty {
constructor(value, ueType = 'StrProperty', guidInfo = undefined, index = 0) {

@@ -296,3 +311,3 @@ super('StrProperty', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = StrProperty.ReadValue(reader);

@@ -308,3 +323,3 @@ return new StrProperty(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
StrProperty.SerializeValue(writer, property.value);

@@ -316,3 +331,4 @@ }

}
export class ObjectProperty extends BasicProperty {
exports.StrProperty = StrProperty;
class ObjectProperty extends BasicProperty {
constructor(value, ueType = 'ObjectProperty', guidInfo = undefined, index = 0) {

@@ -323,3 +339,3 @@ super('ObjectProperty', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = ObjectProperty.ReadValue(reader);

@@ -339,3 +355,3 @@ return new ObjectProperty(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
ObjectProperty.SerializeValue(writer, property.value);

@@ -348,3 +364,4 @@ }

}
export class EnumProperty extends BasicProperty {
exports.ObjectProperty = ObjectProperty;
class EnumProperty extends BasicProperty {
constructor(value, ueType = 'EnumProperty', guidInfo = undefined, index = 0) {

@@ -356,3 +373,3 @@ super('EnumProperty', ueType, guidInfo, index);

let name = reader.readString();
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = EnumProperty.ReadValue(reader);

@@ -370,3 +387,3 @@ const property = new EnumProperty({ name, value }, ueType, guidInfo, index);

writer.writeString(property.value.name);
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
EnumProperty.SerializeValue(writer, property.value.value);

@@ -378,3 +395,4 @@ }

}
export class TextProperty extends BasicProperty {
exports.EnumProperty = EnumProperty;
class TextProperty extends BasicProperty {
constructor(value, ueType = 'TextProperty', guidInfo = undefined, index = 0) {

@@ -385,3 +403,3 @@ super('TextProperty', ueType, guidInfo, index);

static Parse(reader, ueType, index = 0) {
const guidInfo = GUIDInfo.read(reader);
const guidInfo = GUIDInfo_1.GUIDInfo.read(reader);
const value = TextProperty.ParseValue(reader);

@@ -439,3 +457,3 @@ return new TextProperty(value, ueType, guidInfo, index);

static Serialize(writer, property) {
GUIDInfo.write(writer, property.guidInfo);
GUIDInfo_1.GUIDInfo.write(writer, property.guidInfo);
TextProperty.SerializeValue(writer, property.value);

@@ -484,3 +502,4 @@ }

}
export class StructProperty extends AbstractBaseProperty {
exports.TextProperty = TextProperty;
class StructProperty extends AbstractBaseProperty {
constructor(subtype, ueType = 'StructProperty', index = 0, guid = 0) {

@@ -522,6 +541,6 @@ super('StructProperty', ueType, index);

case 'Color':
value = ParseCol4BGRA(reader);
value = (0, util_types_1.ParseCol4BGRA)(reader);
break;
case 'LinearColor':
value = ParseCol4RGBA(reader);
value = (0, util_types_1.ParseCol4RGBA)(reader);
break;

@@ -531,3 +550,3 @@ case 'Vector':

case 'Vector2D':
value = (size === 12) ? ParseVec3f(reader) : ParseVec3(reader);
value = (size === 12) ? (0, util_types_1.ParseVec3f)(reader) : (0, util_types_1.ParseVec3)(reader);
break;

@@ -537,12 +556,12 @@ case 'Quat':

case 'Vector4D':
value = (size === 16) ? ParseVec4f(reader) : ParseVec4(reader);
value = (size === 16) ? (0, util_types_1.ParseVec4f)(reader) : (0, util_types_1.ParseVec4)(reader);
break;
case 'Box':
value = (size === 25) ? {
min: ParseVec3f(reader),
max: ParseVec3f(reader),
min: (0, util_types_1.ParseVec3f)(reader),
max: (0, util_types_1.ParseVec3f)(reader),
isValid: reader.readByte() >= 1
} : {
min: ParseVec3(reader),
max: ParseVec3(reader),
min: (0, util_types_1.ParseVec3)(reader),
max: (0, util_types_1.ParseVec3)(reader),
isValid: reader.readByte() >= 1

@@ -586,7 +605,7 @@ };

case 'FINNetworkTrace':
value = ReadFINNetworkTrace(reader);
value = (0, exports.ReadFINNetworkTrace)(reader);
break;
case 'FINLuaProcessorStateStorage':
value = {
values: ReadFINLuaProcessorStateStorage(reader, size)
values: (0, exports.ReadFINLuaProcessorStateStorage)(reader, size)
};

@@ -601,3 +620,3 @@ break;

default:
value = ParseDynamicStructData(reader, 0, subtype);
value = (0, exports.ParseDynamicStructData)(reader, 0, subtype);
}

@@ -622,7 +641,7 @@ return value;

value = value;
SerializeCol4BGRA(writer, value);
(0, util_types_1.SerializeCol4BGRA)(writer, value);
break;
case 'LinearColor':
value = value;
SerializeCol4RGBA(writer, value);
(0, util_types_1.SerializeCol4RGBA)(writer, value);
break;

@@ -633,3 +652,3 @@ case 'Vector':

value = value;
SerializeVec3(writer, value);
(0, util_types_1.SerializeVec3)(writer, value);
break;

@@ -640,8 +659,8 @@ case 'Quat':

value = value;
SerializeVec4(writer, value);
(0, util_types_1.SerializeVec4)(writer, value);
break;
case 'Box':
value = value;
SerializeVec3(writer, value.min);
SerializeVec3(writer, value.max);
(0, util_types_1.SerializeVec3)(writer, value.min);
(0, util_types_1.SerializeVec3)(writer, value.max);
writer.writeByte(value.isValid ? 1 : 0);

@@ -685,7 +704,7 @@ break;

value = value;
SerializeFINNetworkTrace(writer, value);
(0, exports.SerializeFINNetworkTrace)(writer, value);
break;
case 'FINLuaProcessorStateStorage':
value = value;
SerializeFINLuaProcessorStateStorage(writer, value.values);
(0, exports.SerializeFINLuaProcessorStateStorage)(writer, value.values);
break;

@@ -699,7 +718,8 @@ case 'FICFrameRange':

value = value;
SerializeDynamicStructData(writer, 0, value);
(0, exports.SerializeDynamicStructData)(writer, 0, value);
}
}
}
export class ArrayProperty extends BasicProperty {
exports.StructProperty = StructProperty;
class ArrayProperty extends BasicProperty {
constructor(subtype, values, ueType = 'ArrayProperty', index = 0, structValueFields) {

@@ -850,3 +870,4 @@ super('ArrayProperty', ueType, undefined, index);

}
export class SetProperty extends BasicProperty {
exports.ArrayProperty = ArrayProperty;
class SetProperty extends BasicProperty {
constructor(subtype, values, ueType, index) {

@@ -905,3 +926,3 @@ super('SetProperty', ueType, undefined, index);

case "StructProperty":
property.values.forEach(v => SerializeVec3f(writer, v));
property.values.forEach(v => (0, util_types_1.SerializeVec3f)(writer, v));
break;

@@ -913,3 +934,4 @@ default:

}
export class MapProperty extends BasicProperty {
exports.SetProperty = SetProperty;
class MapProperty extends BasicProperty {
constructor(keyType, valueType, ueType, index) {

@@ -941,3 +963,3 @@ super('MapProperty', ueType, undefined, index);

else {
key = ParseDynamicStructData(reader, 0, property.keyType);
key = (0, exports.ParseDynamicStructData)(reader, 0, property.keyType);
}

@@ -967,3 +989,3 @@ break;

case 'StructProperty':
value = ParseDynamicStructData(reader, 0, property.valueType);
value = (0, exports.ParseDynamicStructData)(reader, 0, property.valueType);
break;

@@ -1010,3 +1032,3 @@ case 'ObjectProperty':

else {
SerializeDynamicStructData(writer, 0, entry[0]);
(0, exports.SerializeDynamicStructData)(writer, 0, entry[0]);
}

@@ -1036,3 +1058,3 @@ break;

case 'StructProperty':
SerializeDynamicStructData(writer, 0, entry[1]);
(0, exports.SerializeDynamicStructData)(writer, 0, entry[1]);
break;

@@ -1062,3 +1084,4 @@ case 'ObjectProperty':

}
export const ParseDynamicStructData = (reader, buildVersion, type) => {
exports.MapProperty = MapProperty;
const ParseDynamicStructData = (reader, buildVersion, type) => {
const data = {

@@ -1070,3 +1093,3 @@ type, properties: {}

while (propertyName !== 'None') {
const parsedProperty = DataFields.ParseProperty(reader, buildVersion, propertyName);
const parsedProperty = DataFields_1.DataFields.ParseProperty(reader, buildVersion, propertyName);
if (data.properties[propertyName]) {

@@ -1085,7 +1108,8 @@ if (!Array.isArray(data.properties[propertyName])) {

};
export const SerializeDynamicStructData = (writer, buildVersion, data) => {
exports.ParseDynamicStructData = ParseDynamicStructData;
const SerializeDynamicStructData = (writer, buildVersion, data) => {
for (const key in data.properties) {
for (const prop of (Array.isArray(data.properties[key]) ? data.properties[key] : [data.properties[key]])) {
writer.writeString(key);
DataFields.SerializeProperty(writer, prop, key, buildVersion);
DataFields_1.DataFields.SerializeProperty(writer, prop, key, buildVersion);
}

@@ -1095,8 +1119,9 @@ }

};
export const ReadFINNetworkTrace = (reader) => {
exports.SerializeDynamicStructData = SerializeDynamicStructData;
const ReadFINNetworkTrace = (reader) => {
const networkTrace = {};
networkTrace.ref = ObjectReference.read(reader);
networkTrace.ref = ObjectReference_1.ObjectReference.read(reader);
networkTrace.hasPrev = reader.readInt32();
if (networkTrace.hasPrev) {
networkTrace.prev = ReadFINNetworkTrace(reader);
networkTrace.prev = (0, exports.ReadFINNetworkTrace)(reader);
}

@@ -1109,8 +1134,9 @@ networkTrace.hasStep = reader.readInt32();

};
export const SerializeFINNetworkTrace = (writer, obj) => {
exports.ReadFINNetworkTrace = ReadFINNetworkTrace;
const SerializeFINNetworkTrace = (writer, obj) => {
const networkTrace = {};
ObjectReference.write(writer, obj.ref);
ObjectReference_1.ObjectReference.write(writer, obj.ref);
writer.writeInt32(obj.hasPrev);
if (obj.hasPrev) {
SerializeFINNetworkTrace(writer, obj.prev);
(0, exports.SerializeFINNetworkTrace)(writer, obj.prev);
}

@@ -1122,3 +1148,4 @@ writer.writeInt32(obj.hasStep);

};
export const ReadFINLuaProcessorStateStorage = (reader, size) => {
exports.SerializeFINNetworkTrace = SerializeFINNetworkTrace;
const ReadFINLuaProcessorStateStorage = (reader, size) => {
const stateStorage = { traces: [], references: [], thread: '', globals: '', remainingStructData: {} };

@@ -1128,7 +1155,7 @@ const start = reader.getBufferPosition();

for (let i = 0; i < traceCount; i++) {
stateStorage.traces.push(ReadFINNetworkTrace(reader));
stateStorage.traces.push((0, exports.ReadFINNetworkTrace)(reader));
}
const refCount = reader.readInt32();
for (let i = 0; i < refCount; i++) {
stateStorage.references.push(ObjectReference.read(reader));
stateStorage.references.push(ObjectReference_1.ObjectReference.read(reader));
}

@@ -1141,10 +1168,11 @@ stateStorage.thread = reader.readString();

};
export const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
exports.ReadFINLuaProcessorStateStorage = ReadFINLuaProcessorStateStorage;
const SerializeFINLuaProcessorStateStorage = (writer, stateStorage) => {
writer.writeInt32(stateStorage.traces.length);
for (const trace of stateStorage.traces) {
SerializeFINNetworkTrace(writer, trace);
(0, exports.SerializeFINNetworkTrace)(writer, trace);
}
writer.writeInt32(stateStorage.references.length);
for (const ref of stateStorage.references) {
ObjectReference.write(writer, ref);
ObjectReference_1.ObjectReference.write(writer, ref);
}

@@ -1155,1 +1183,2 @@ writer.writeString(stateStorage.thread);

};
exports.SerializeFINLuaProcessorStateStorage = SerializeFINLuaProcessorStateStorage;

@@ -1,6 +0,10 @@

import { SaveObject } from "./SaveObject";
export const isSaveComponent = (obj) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveComponent = exports.isSaveComponent = void 0;
const SaveObject_1 = require("./SaveObject");
const isSaveComponent = (obj) => {
return obj.type === 'SaveComponent';
};
class SaveComponent extends SaveObject {
exports.isSaveComponent = isSaveComponent;
class SaveComponent extends SaveObject_1.SaveObject {
constructor(typePath, rootObject, instanceName, parentEntityName = '') {

@@ -15,14 +19,14 @@ super(typePath, rootObject, instanceName);

static ParseHeader(reader, obj) {
SaveObject.ParseHeader(reader, obj);
SaveObject_1.SaveObject.ParseHeader(reader, obj);
obj.parentEntityName = reader.readString();
}
static SerializeHeader(writer, component) {
SaveObject.SerializeHeader(writer, component);
SaveObject_1.SaveObject.SerializeHeader(writer, component);
writer.writeString(component.parentEntityName);
}
static ParseData(component, length, reader, buildVersion, typePath) {
SaveObject.ParseData(component, length, reader, buildVersion, typePath);
SaveObject_1.SaveObject.ParseData(component, length, reader, buildVersion, typePath);
}
}
SaveComponent.TypeID = 0;
export { SaveComponent };
exports.SaveComponent = SaveComponent;

@@ -1,8 +0,12 @@

import { ParseTransform, SerializeTransform } from "../structs/util.types";
import { ObjectReference } from "./ObjectReference";
import { SaveObject } from "./SaveObject";
export const isSaveEntity = (obj) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveEntity = exports.isSaveEntity = void 0;
const util_types_1 = require("../structs/util.types");
const ObjectReference_1 = require("./ObjectReference");
const SaveObject_1 = require("./SaveObject");
const isSaveEntity = (obj) => {
return obj.type === 'SaveEntity';
};
class SaveEntity extends SaveObject {
exports.isSaveEntity = isSaveEntity;
class SaveEntity extends SaveObject_1.SaveObject {
constructor(typePath, rootObject, instanceName, parentEntityName = '', needsTransform = false) {

@@ -27,5 +31,5 @@ super(typePath, rootObject, instanceName);

static ParseHeader(reader, obj) {
SaveObject.ParseHeader(reader, obj);
SaveObject_1.SaveObject.ParseHeader(reader, obj);
obj.needTransform = reader.readInt32() == 1;
obj.transform = ParseTransform(reader);
obj.transform = (0, util_types_1.ParseTransform)(reader);
obj.wasPlacedInLevel = reader.readInt32() == 1;

@@ -39,12 +43,12 @@ }

for (let i = 0; i < componentCount; i++) {
var componentRef = ObjectReference.read(reader);
var componentRef = ObjectReference_1.ObjectReference.read(reader);
entity.components.push(componentRef);
}
const remainingSize = length - (reader.getBufferPosition() - afterSizeIndicator);
return SaveObject.ParseData(entity, remainingSize, reader, buildVersion, typePath);
return SaveObject_1.SaveObject.ParseData(entity, remainingSize, reader, buildVersion, typePath);
}
static SerializeHeader(writer, entity) {
SaveObject.SerializeHeader(writer, entity);
SaveObject_1.SaveObject.SerializeHeader(writer, entity);
writer.writeInt32(entity.needTransform ? 1 : 0);
SerializeTransform(writer, entity.transform);
(0, util_types_1.SerializeTransform)(writer, entity.transform);
writer.writeInt32(entity.wasPlacedInLevel ? 1 : 0);

@@ -60,6 +64,6 @@ }

}
SaveObject.SerializeData(writer, entity, buildVersion);
SaveObject_1.SaveObject.SerializeData(writer, entity, buildVersion);
}
}
SaveEntity.TypeID = 1;
export { SaveEntity };
exports.SaveEntity = SaveEntity;

@@ -1,3 +0,6 @@

import { DataFields } from "./DataFields";
export class SaveObject {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveObject = void 0;
const DataFields_1 = require("./DataFields");
class SaveObject {
constructor(typePath, rootObject, instanceName) {

@@ -24,7 +27,8 @@ this.typePath = typePath;

static ParseData(obj, length, reader, buildVersion, typePath) {
DataFields.ParseProperties(obj, length, reader, buildVersion, typePath);
DataFields_1.DataFields.ParseProperties(obj, length, reader, buildVersion, typePath);
}
static SerializeData(writer, obj, buildVersion) {
DataFields.Serialize(obj, writer, buildVersion, obj.typePath);
DataFields_1.DataFields.Serialize(obj, writer, buildVersion, obj.typePath);
}
}
exports.SaveObject = SaveObject;

@@ -1,2 +0,5 @@

export var GUID;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GUID = void 0;
var GUID;
(function (GUID) {

@@ -17,3 +20,3 @@ GUID.read = (reader) => {

};
})(GUID || (GUID = {}));
})(GUID = exports.GUID || (exports.GUID = {}));
;

@@ -1,2 +0,5 @@

export var MD5Hash;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MD5Hash = void 0;
var MD5Hash;
(function (MD5Hash) {

@@ -17,3 +20,3 @@ MD5Hash.read = (reader) => {

};
})(MD5Hash || (MD5Hash = {}));
})(MD5Hash = exports.MD5Hash || (exports.MD5Hash = {}));
;

@@ -1,5 +0,8 @@

import { isSaveComponent, SaveComponent } from "../objects/SaveComponent";
import { isSaveEntity, SaveEntity } from "../objects/SaveEntity";
import { Level } from "./level.class";
export class AsynchronousLevel {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AsynchronousLevel = void 0;
const SaveComponent_1 = require("../objects/SaveComponent");
const SaveEntity_1 = require("../objects/SaveEntity");
const level_class_1 = require("./level.class");
class AsynchronousLevel {
static async StreamReadObjectContents(reader, objectsList, buildVersion, writer, onProgressCallback) {

@@ -27,7 +30,7 @@ const binarySize = reader.readInt32();

const obj = objectsList[i];
if (isSaveEntity(obj)) {
SaveEntity.ParseData(obj, len, reader, buildVersion, obj.typePath);
if ((0, SaveEntity_1.isSaveEntity)(obj)) {
SaveEntity_1.SaveEntity.ParseData(obj, len, reader, buildVersion, obj.typePath);
}
else if (isSaveComponent(obj)) {
SaveComponent.ParseData(obj, len, reader, buildVersion, obj.typePath);
else if ((0, SaveComponent_1.isSaveComponent)(obj)) {
SaveComponent_1.SaveComponent.ParseData(obj, len, reader, buildVersion, obj.typePath);
}

@@ -47,9 +50,9 @@ dynamicObjectBatch.push(obj);

static async StreamReadLevel(reader, levelName, buildVersion, writer) {
const level = new Level(levelName);
const level = new level_class_1.Level(levelName);
const binaryLength = reader.readInt32();
await reader.allocate(binaryLength);
await writer.openLevel(levelName);
Level.ReadObjectHeaders(reader, level.objects, reader.onProgressCallback);
level_class_1.Level.ReadObjectHeaders(reader, level.objects, reader.onProgressCallback);
reader.onProgressCallback(reader.getBufferProgress());
level.collectables = Level.ReadCollectablesList(reader, undefined);
level.collectables = level_class_1.Level.ReadCollectablesList(reader, undefined);
console.log(`before object contents buffer pos ${reader.getBufferPosition()}`);

@@ -60,3 +63,3 @@ await AsynchronousLevel.StreamReadObjectContents(reader, level.objects, buildVersion, writer, reader.onProgressCallback);

reader.onProgressCallback(reader.getBufferProgress());
Level.ReadCollectablesList(reader, undefined);
level_class_1.Level.ReadCollectablesList(reader, undefined);
await writer.endLevel();

@@ -66,1 +69,2 @@ return level;

}
exports.AsynchronousLevel = AsynchronousLevel;

@@ -1,5 +0,8 @@

import { ObjectReference } from "../objects/ObjectReference";
import { SaveComponent, isSaveComponent } from "../objects/SaveComponent";
import { SaveEntity, isSaveEntity } from "../objects/SaveEntity";
export class Level {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Level = void 0;
const ObjectReference_1 = require("../objects/ObjectReference");
const SaveComponent_1 = require("../objects/SaveComponent");
const SaveEntity_1 = require("../objects/SaveEntity");
class Level {
constructor(name) {

@@ -16,8 +19,8 @@ this.name = name;

case 'SaveEntity':
writer.writeInt32(SaveEntity.TypeID);
SaveEntity.SerializeHeader(writer, obj);
writer.writeInt32(SaveEntity_1.SaveEntity.TypeID);
SaveEntity_1.SaveEntity.SerializeHeader(writer, obj);
break;
case 'SaveComponent':
writer.writeInt32(SaveComponent.TypeID);
SaveComponent.SerializeHeader(writer, obj);
writer.writeInt32(SaveComponent_1.SaveComponent.TypeID);
SaveComponent_1.SaveComponent.SerializeHeader(writer, obj);
break;

@@ -50,7 +53,7 @@ default:

writer.writeInt32(0);
if (isSaveEntity(obj)) {
SaveEntity.SerializeData(writer, obj, buildVersion);
if ((0, SaveEntity_1.isSaveEntity)(obj)) {
SaveEntity_1.SaveEntity.SerializeData(writer, obj, buildVersion);
}
else if (isSaveComponent(obj)) {
SaveComponent.SerializeData(writer, obj, buildVersion);
else if ((0, SaveComponent_1.isSaveComponent)(obj)) {
SaveComponent_1.SaveComponent.SerializeData(writer, obj, buildVersion);
}

@@ -69,10 +72,10 @@ writer.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);

switch (objectType) {
case SaveEntity.TypeID:
let object = new SaveEntity('', '', '', '');
SaveEntity.ParseHeader(reader, object);
case SaveEntity_1.SaveEntity.TypeID:
let object = new SaveEntity_1.SaveEntity('', '', '', '');
SaveEntity_1.SaveEntity.ParseHeader(reader, object);
objectsList.push(object);
break;
case SaveComponent.TypeID:
let component = new SaveComponent('', '', '', '');
SaveComponent.ParseHeader(reader, component);
case SaveComponent_1.SaveComponent.TypeID:
let component = new SaveComponent_1.SaveComponent('', '', '', '');
SaveComponent_1.SaveComponent.ParseHeader(reader, component);
objectsList.push(component);

@@ -100,7 +103,7 @@ break;

const before = reader.getBufferPosition();
if (isSaveEntity(obj)) {
SaveEntity.ParseData(obj, binarySize, reader, buildVersion, obj.typePath);
if ((0, SaveEntity_1.isSaveEntity)(obj)) {
SaveEntity_1.SaveEntity.ParseData(obj, binarySize, reader, buildVersion, obj.typePath);
}
else if (isSaveComponent(obj)) {
SaveComponent.ParseData(obj, binarySize, reader, buildVersion, obj.typePath);
else if ((0, SaveComponent_1.isSaveComponent)(obj)) {
SaveComponent_1.SaveComponent.ParseData(obj, binarySize, reader, buildVersion, obj.typePath);
}

@@ -145,3 +148,3 @@ const after = reader.getBufferPosition();

for (const collectable of collectables) {
ObjectReference.write(writer, collectable);
ObjectReference_1.ObjectReference.write(writer, collectable);
}

@@ -154,3 +157,3 @@ }

for (let i = 0; i < countSmthing; i++) {
const collectable = ObjectReference.read(reader);
const collectable = ObjectReference_1.ObjectReference.read(reader);
collected.push(collectable);

@@ -165,1 +168,2 @@ }

}
exports.Level = Level;

@@ -1,2 +0,5 @@

export class SatisfactorySave {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SatisfactorySave = void 0;
class SatisfactorySave {
constructor(name, header) {

@@ -11,1 +14,2 @@ this.gridHash = [0, 0, 0, 0];

}
exports.SatisfactorySave = SatisfactorySave;

@@ -1,12 +0,18 @@

import Pako from "pako";
import { Alignment } from "../../byte/alignment.enum";
import { ByteReader } from "../../byte/byte-reader.class";
import { CompressionLibraryError, CorruptSaveError, ParserError, UnsupportedVersionError } from "../../error/parser.error";
import { MD5Hash } from '../objects/ue/MD5Hash';
import { AsynchronousLevel } from "./asynchronous-level.class";
import { Level } from "./level.class";
export const DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;
class SaveReader extends ByteReader {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveReader = exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = void 0;
const pako_1 = __importDefault(require("pako"));
const alignment_enum_1 = require("../../byte/alignment.enum");
const byte_reader_class_1 = require("../../byte/byte-reader.class");
const parser_error_1 = require("../../error/parser.error");
const MD5Hash_1 = require("../objects/ue/MD5Hash");
const asynchronous_level_class_1 = require("./asynchronous-level.class");
const level_class_1 = require("./level.class");
exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;
class SaveReader extends byte_reader_class_1.ByteReader {
constructor(fileBuffer, onProgressCallback = () => { }) {
super(fileBuffer, Alignment.LITTLE_ENDIAN);
super(fileBuffer, alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.onProgressCallback = onProgressCallback;

@@ -18,3 +24,3 @@ this.levels = [];

maxUncompressedChunkContentSize: 0,
chunkHeaderSize: DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE
chunkHeaderSize: exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE
};

@@ -96,3 +102,3 @@ this.readSaveBodyHash = () => {

if (this.header.saveHeaderType >= 12) {
this.header.consistencyHashBytes = MD5Hash.read(this);
this.header.consistencyHashBytes = MD5Hash_1.MD5Hash.read(this);
}

@@ -105,3 +111,3 @@ if (this.header.saveHeaderType >= 13) {

else {
throw new UnsupportedVersionError("The save version is too old to support encoding currently. Save in newer game version.");
throw new parser_error_1.UnsupportedVersionError("The save version is too old to support encoding currently. Save in newer game version.");
}

@@ -122,9 +128,9 @@ return this.header;

if (this.compressionInfo.packageFileTag <= 0) {
this.compressionInfo.packageFileTag = chunkHeader.getUint32(0, this.alignment === Alignment.LITTLE_ENDIAN);
this.compressionInfo.packageFileTag = chunkHeader.getUint32(0, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
}
if (this.compressionInfo.maxUncompressedChunkContentSize <= 0) {
this.compressionInfo.maxUncompressedChunkContentSize = chunkHeader.getInt32(8, this.alignment === Alignment.LITTLE_ENDIAN);
this.compressionInfo.maxUncompressedChunkContentSize = chunkHeader.getInt32(8, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
}
const chunkCompressedLength = chunkHeader.getInt32(33, this.alignment === Alignment.LITTLE_ENDIAN);
const chunkUncompressedLength = chunkHeader.getInt32(25, this.alignment === Alignment.LITTLE_ENDIAN);
const chunkCompressedLength = chunkHeader.getInt32(33, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
const chunkUncompressedLength = chunkHeader.getInt32(25, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
totalUncompressedBodySize += chunkUncompressedLength;

@@ -139,7 +145,7 @@ const currentChunkSize = chunkCompressedLength;

let currentInflatedChunk = null;
currentInflatedChunk = Pako.inflate(currentChunk);
currentInflatedChunk = pako_1.default.inflate(currentChunk);
currentChunks.push(currentInflatedChunk);
}
catch (err) {
throw new CompressionLibraryError("Failed to inflate compressed save data. " + err);
throw new parser_error_1.CompressionLibraryError("Failed to inflate compressed save data. " + err);
}

@@ -159,3 +165,3 @@ }

if (totalUncompressedBodySize !== dataLength + 8) {
throw new CorruptSaveError(`Possibly corrupt. Indicated size of total save body (${dataLength + 8}) does not match the uncompressed real size of ${totalUncompressedBodySize}.`);
throw new parser_error_1.CorruptSaveError(`Possibly corrupt. Indicated size of total save body (${dataLength + 8}) does not match the uncompressed real size of ${totalUncompressedBodySize}.`);
}

@@ -169,9 +175,9 @@ return {

if (!this.header) {
throw new ParserError('ParserError', 'Header must be set before objects can be read.');
throw new parser_error_1.ParserError('ParserError', 'Header must be set before objects can be read.');
}
if (this.header.saveVersion < 29) {
throw new UnsupportedVersionError('Game Version < U6 is not supported.');
throw new parser_error_1.UnsupportedVersionError('Game Version < U6 is not supported.');
}
if (this.header.saveHeaderType < 13) {
throw new UnsupportedVersionError('Game Version < U8 is not supported in this package version. Consider downgrading to the latest package version supporting it, which is 0.0.34');
throw new parser_error_1.UnsupportedVersionError('Game Version < U8 is not supported in this package version. Consider downgrading to the latest package version supporting it, which is 0.0.34');
}

@@ -186,6 +192,6 @@ const levels = [];

}
levels.push(Level.ReadLevel(this, levelSingleName, this.header.buildVersion));
levels.push(level_class_1.Level.ReadLevel(this, levelSingleName, this.header.buildVersion));
}
levels.push(Level.ReadLevel(this, this.header.mapName, this.header.buildVersion));
const trailingStuffToIgnore = Level.ReadCollectablesList(this, 'collectables 6!');
levels.push(level_class_1.Level.ReadLevel(this, this.header.mapName, this.header.buildVersion));
const trailingStuffToIgnore = level_class_1.Level.ReadCollectablesList(this, 'collectables 6!');
this.onProgressCallback(this.getBufferProgress(), 'finished parsing.');

@@ -201,3 +207,3 @@ return levels;

this.onProgressCallback(this.getBufferProgress(), `reading level [${(j + 1)}/${(numSubLevels + 1)}] ${levelName}`);
this.levels[j] = await AsynchronousLevel.StreamReadLevel(this, levelName, this.header.buildVersion, writer);
this.levels[j] = await asynchronous_level_class_1.AsynchronousLevel.StreamReadLevel(this, levelName, this.header.buildVersion, writer);
}

@@ -220,2 +226,2 @@ await writer.endLevels();

};
export { SaveReader };
exports.SaveReader = SaveReader;

@@ -1,12 +0,18 @@

import Pako from "pako";
import { Alignment } from "../../byte/alignment.enum";
import { ByteWriter } from "../../byte/byte-writer.class";
import { CompressionLibraryError, ParserError, UnsupportedVersionError } from "../../error/parser.error";
import { CompressionAlgorithmCode } from "../../file.types";
import { MD5Hash } from '../objects/ue/MD5Hash';
import { Level } from "./level.class";
import { SaveReader } from "./save-reader";
class SaveWriter extends ByteWriter {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveWriter = void 0;
const pako_1 = __importDefault(require("pako"));
const alignment_enum_1 = require("../../byte/alignment.enum");
const byte_writer_class_1 = require("../../byte/byte-writer.class");
const parser_error_1 = require("../../error/parser.error");
const file_types_1 = require("../../file.types");
const MD5Hash_1 = require("../objects/ue/MD5Hash");
const level_class_1 = require("./level.class");
const save_reader_1 = require("./save-reader");
class SaveWriter extends byte_writer_class_1.ByteWriter {
constructor() {
super(Alignment.LITTLE_ENDIAN);
super(alignment_enum_1.Alignment.LITTLE_ENDIAN);
}

@@ -21,3 +27,3 @@ static WriteHeader(writer, header) {

writer.writeInt32(header.playDurationSeconds);
writer.writeInt64(BigInt(header.saveDateTime) * 10000n + SaveReader.EPOCH_TICKS);
writer.writeInt64(BigInt(header.saveDateTime) * 10000n + save_reader_1.SaveReader.EPOCH_TICKS);
writer.writeByte(header.sessionVisibility);

@@ -43,3 +49,3 @@ if (header.saveHeaderType >= 7) {

if (header.saveHeaderType >= 12) {
MD5Hash.write(writer, header.consistencyHashBytes);
MD5Hash_1.MD5Hash.write(writer, header.consistencyHashBytes);
}

@@ -52,3 +58,3 @@ if (header.saveHeaderType >= 13) {

else {
throw new UnsupportedVersionError("The save version is too old to be supported currently.");
throw new parser_error_1.UnsupportedVersionError("The save version is too old to be supported currently.");
}

@@ -62,7 +68,7 @@ }

}
Level.WriteLevel(writer, level, buildVersion);
level_class_1.Level.WriteLevel(writer, level, buildVersion);
}
Level.SerializeCollectablesList(writer, save.trailingCollectedObjects ?? []);
level_class_1.Level.SerializeCollectablesList(writer, save.trailingCollectedObjects ?? []);
}
static GenerateCompressedChunksFromData(bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, alignment = Alignment.LITTLE_ENDIAN) {
static GenerateCompressedChunksFromData(bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, alignment = alignment_enum_1.Alignment.LITTLE_ENDIAN) {
const errors = [];

@@ -73,3 +79,3 @@ const totalUncompressedSize = bufferArray.byteLength;

const miniView = new DataView(saveBody.buffer);
miniView.setInt32(0, totalUncompressedSize, alignment === Alignment.LITTLE_ENDIAN);
miniView.setInt32(0, totalUncompressedSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
onBinaryBeforeCompressing(saveBody.buffer);

@@ -83,6 +89,6 @@ let handledByte = 0;

try {
compressedChunk = Pako.deflate(uncompressedChunk);
compressedChunk = pako_1.default.deflate(uncompressedChunk);
}
catch (err) {
throw new CompressionLibraryError("Could not compress save data. " + err);
throw new parser_error_1.CompressionLibraryError("Could not compress save data. " + err);
}

@@ -92,15 +98,15 @@ const chunk = new Uint8Array(compressionInfo.chunkHeaderSize + compressedChunk.byteLength);

const view = new DataView(chunk.buffer);
view.setInt32(0, compressionInfo.packageFileTag, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(4, 0x22222222, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(8, compressionInfo.maxUncompressedChunkContentSize, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(12, 0, alignment === Alignment.LITTLE_ENDIAN);
view.setUint8(16, CompressionAlgorithmCode.ZLIB);
view.setInt32(17, compressedChunk.byteLength, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(21, 0, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(25, uncompressedContentSize, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(29, 0, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(33, compressedChunk.byteLength, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(37, 0, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(41, uncompressedContentSize, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(45, 0, alignment === Alignment.LITTLE_ENDIAN);
view.setInt32(0, compressionInfo.packageFileTag, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(4, 0x22222222, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(8, compressionInfo.maxUncompressedChunkContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(12, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setUint8(16, file_types_1.CompressionAlgorithmCode.ZLIB);
view.setInt32(17, compressedChunk.byteLength, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(21, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(25, uncompressedContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(29, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(33, compressedChunk.byteLength, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(37, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(41, uncompressedContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
view.setInt32(45, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
onChunk(chunk);

@@ -117,3 +123,3 @@ chunkSummary.push({

if (posAfterHeader <= 0) {
throw new ParserError('ParserError', 'Seems like this buffer has no header. Please write the header first before you can generate chunks.');
throw new parser_error_1.ParserError('ParserError', 'Seems like this buffer has no header. Please write the header first before you can generate chunks.');
}

@@ -149,2 +155,2 @@ const header = new Uint8Array(this.bufferArray.slice(0, posAfterHeader));

};
export { SaveWriter };
exports.SaveWriter = SaveWriter;

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,2 +0,5 @@

export const SerializeCol4RGBA = (writer, value) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SerializeTransform = exports.ParseTransform = exports.SerializeVec2f = exports.ParseVec2f = exports.SerializeVec2 = exports.ParseVec2 = exports.SerializeVec3f = exports.ParseVec3f = exports.SerializeVec3 = exports.ParseVec3 = exports.norm = exports.mult = exports.length = exports.add = exports.sub = exports.SerializeVec4f = exports.ParseVec4f = exports.SerializeVec4 = exports.ParseVec4 = exports.ParseCol4BGRA = exports.SerializeCol4BGRA = exports.ParseCol4RGBA = exports.SerializeCol4RGBA = void 0;
const SerializeCol4RGBA = (writer, value) => {
writer.writeFloat(value.r);

@@ -7,3 +10,4 @@ writer.writeFloat(value.g);

};
export const ParseCol4RGBA = (reader) => {
exports.SerializeCol4RGBA = SerializeCol4RGBA;
const ParseCol4RGBA = (reader) => {
return {

@@ -16,3 +20,4 @@ r: reader.readFloat32(),

};
export const SerializeCol4BGRA = (writer, value) => {
exports.ParseCol4RGBA = ParseCol4RGBA;
const SerializeCol4BGRA = (writer, value) => {
writer.writeByte(value.b);

@@ -23,3 +28,4 @@ writer.writeByte(value.g);

};
export const ParseCol4BGRA = (reader) => {
exports.SerializeCol4BGRA = SerializeCol4BGRA;
const ParseCol4BGRA = (reader) => {
return {

@@ -32,48 +38,62 @@ b: reader.readByte(),

};
export const ParseVec4 = (reader) => {
exports.ParseCol4BGRA = ParseCol4BGRA;
const ParseVec4 = (reader) => {
return {
...(ParseVec3(reader)),
...((0, exports.ParseVec3)(reader)),
w: reader.readDouble()
};
};
export const SerializeVec4 = (writer, vec) => {
SerializeVec3(writer, vec);
exports.ParseVec4 = ParseVec4;
const SerializeVec4 = (writer, vec) => {
(0, exports.SerializeVec3)(writer, vec);
writer.writeDouble(vec.w);
};
export const ParseVec4f = (reader) => {
exports.SerializeVec4 = SerializeVec4;
const ParseVec4f = (reader) => {
return {
...(ParseVec3f(reader)),
...((0, exports.ParseVec3f)(reader)),
w: reader.readFloat32()
};
};
export const SerializeVec4f = (writer, vec) => {
SerializeVec3f(writer, vec);
exports.ParseVec4f = ParseVec4f;
const SerializeVec4f = (writer, vec) => {
(0, exports.SerializeVec3f)(writer, vec);
writer.writeFloat(vec.w);
};
export const sub = (other, vec) => ({ x: other.x - vec.x, y: other.y - vec.y, z: other.z - vec.z });
export const add = (vec, other) => ({ x: vec.x + other.x, y: vec.y + other.y, z: vec.z + other.z });
export const length = (vec) => Math.sqrt(vec.x ** 2 + vec.y ** 2 + vec.z ** 2);
export const mult = (vec, scale) => ({ x: vec.x * scale, y: vec.y * scale, z: vec.z * scale });
export const norm = (vec) => mult(vec, 1. / length(vec));
export const ParseVec3 = (reader) => {
exports.SerializeVec4f = SerializeVec4f;
const sub = (other, vec) => ({ x: other.x - vec.x, y: other.y - vec.y, z: other.z - vec.z });
exports.sub = sub;
const add = (vec, other) => ({ x: vec.x + other.x, y: vec.y + other.y, z: vec.z + other.z });
exports.add = add;
const length = (vec) => Math.sqrt(vec.x ** 2 + vec.y ** 2 + vec.z ** 2);
exports.length = length;
const mult = (vec, scale) => ({ x: vec.x * scale, y: vec.y * scale, z: vec.z * scale });
exports.mult = mult;
const norm = (vec) => (0, exports.mult)(vec, 1. / (0, exports.length)(vec));
exports.norm = norm;
const ParseVec3 = (reader) => {
return {
...(ParseVec2(reader)),
...((0, exports.ParseVec2)(reader)),
z: reader.readDouble()
};
};
export const SerializeVec3 = (writer, vec) => {
SerializeVec2(writer, vec);
exports.ParseVec3 = ParseVec3;
const SerializeVec3 = (writer, vec) => {
(0, exports.SerializeVec2)(writer, vec);
writer.writeDouble(vec.z);
};
export const ParseVec3f = (reader) => {
exports.SerializeVec3 = SerializeVec3;
const ParseVec3f = (reader) => {
return {
...(ParseVec2f(reader)),
...((0, exports.ParseVec2f)(reader)),
z: reader.readFloat32()
};
};
export const SerializeVec3f = (writer, vec) => {
SerializeVec2f(writer, vec);
exports.ParseVec3f = ParseVec3f;
const SerializeVec3f = (writer, vec) => {
(0, exports.SerializeVec2f)(writer, vec);
writer.writeFloat(vec.z);
};
export const ParseVec2 = (reader) => {
exports.SerializeVec3f = SerializeVec3f;
const ParseVec2 = (reader) => {
return {

@@ -84,7 +104,9 @@ x: reader.readDouble(),

};
export const SerializeVec2 = (writer, vec) => {
exports.ParseVec2 = ParseVec2;
const SerializeVec2 = (writer, vec) => {
writer.writeDouble(vec.x);
writer.writeDouble(vec.y);
};
export const ParseVec2f = (reader) => {
exports.SerializeVec2 = SerializeVec2;
const ParseVec2f = (reader) => {
return {

@@ -95,17 +117,21 @@ x: reader.readFloat32(),

};
export const SerializeVec2f = (writer, vec) => {
exports.ParseVec2f = ParseVec2f;
const SerializeVec2f = (writer, vec) => {
writer.writeFloat(vec.x);
writer.writeFloat(vec.y);
};
export const ParseTransform = (reader) => {
exports.SerializeVec2f = SerializeVec2f;
const ParseTransform = (reader) => {
return {
rotation: ParseVec4f(reader),
translation: ParseVec3f(reader),
scale3d: ParseVec3f(reader),
rotation: (0, exports.ParseVec4f)(reader),
translation: (0, exports.ParseVec3f)(reader),
scale3d: (0, exports.ParseVec3f)(reader),
};
};
export const SerializeTransform = (writer, transform) => {
SerializeVec4f(writer, transform.rotation);
SerializeVec3f(writer, transform.translation);
SerializeVec3f(writer, transform.scale3d);
exports.ParseTransform = ParseTransform;
const SerializeTransform = (writer, transform) => {
(0, exports.SerializeVec4f)(writer, transform.rotation);
(0, exports.SerializeVec3f)(writer, transform.translation);
(0, exports.SerializeVec3f)(writer, transform.scale3d);
};
exports.SerializeTransform = SerializeTransform;

@@ -1,6 +0,9 @@

import { Alignment } from "../byte/alignment.enum";
import { ByteWriter } from "../byte/byte-writer.class";
import { CorruptSaveError, TimeoutError, UnimplementedError } from "../error/parser.error";
export class ByteStreamReader {
constructor(reader, onCloseCallback, timeout = 30000, maxBufferThreshold = 100 * 1000 * 1000, alignment = Alignment.LITTLE_ENDIAN) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ByteStreamReader = void 0;
const alignment_enum_1 = require("../byte/alignment.enum");
const byte_writer_class_1 = require("../byte/byte-writer.class");
const parser_error_1 = require("../error/parser.error");
class ByteStreamReader {
constructor(reader, onCloseCallback, timeout = 30000, maxBufferThreshold = 100 * 1000 * 1000, alignment = alignment_enum_1.Alignment.LITTLE_ENDIAN) {
this.reader = reader;

@@ -21,3 +24,3 @@ this.onCloseCallback = onCloseCallback;

const trailingPos = Math.max(0, this.currentByte - this.trailingBufferSize);
this.operatingStreamBuffer = new Uint8Array(ByteWriter.AppendBuffer(this.operatingStreamBuffer.slice(trailingPos), value));
this.operatingStreamBuffer = new Uint8Array(byte_writer_class_1.ByteWriter.AppendBuffer(this.operatingStreamBuffer.slice(trailingPos), value));
this.operatingDataView = new DataView(this.operatingStreamBuffer.buffer);

@@ -80,3 +83,3 @@ this.currentByte = Math.min(this.currentByte, this.trailingBufferSize);

if (this.inputStreamIsDone) {
throw new CorruptSaveError('Input Stream has finished before needed data was received.');
throw new parser_error_1.CorruptSaveError('Input Stream has finished before needed data was received.');
}

@@ -111,3 +114,3 @@ if (this.paused) {

if (!this.inputStreamIsDone) {
reject(new TimeoutError(`Timed out before ${this.neededNextAmountOfBytes} bytes were available to read next.`));
reject(new parser_error_1.TimeoutError(`Timed out before ${this.neededNextAmountOfBytes} bytes were available to read next.`));
}

@@ -152,3 +155,3 @@ return resolve();

this.totalNumberOfBytesRead += 2;
let data = this.operatingDataView.getInt16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getInt16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -159,3 +162,3 @@ return data;

this.totalNumberOfBytesRead += 2;
let data = this.operatingDataView.getUint16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getUint16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -166,3 +169,3 @@ return data;

this.totalNumberOfBytesRead += 4;
let data = this.operatingDataView.getInt32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getInt32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -173,3 +176,3 @@ return data;

this.totalNumberOfBytesRead += 4;
let data = this.operatingDataView.getUint32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getUint32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -180,3 +183,3 @@ return data;

this.totalNumberOfBytesRead += 8;
let data = this.operatingDataView.getBigInt64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getBigInt64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -190,3 +193,3 @@ return data;

this.totalNumberOfBytesRead += 8;
let data = this.operatingDataView.getBigUint64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getBigUint64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -197,3 +200,3 @@ return data;

this.totalNumberOfBytesRead += 4;
let data = this.operatingDataView.getFloat32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getFloat32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -204,3 +207,3 @@ return data;

this.totalNumberOfBytesRead += 8;
let data = this.operatingDataView.getFloat64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.operatingDataView.getFloat64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -240,3 +243,3 @@ return data;

getBufferProgress() {
throw new UnimplementedError();
throw new parser_error_1.UnimplementedError();
}

@@ -250,1 +253,2 @@ getBufferLength() {

}
exports.ByteStreamReader = ByteStreamReader;

@@ -1,3 +0,6 @@

import { JsonStreamWritable } from "./json-stream-writable";
export class JsonStreamStateWriter extends JsonStreamWritable {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonStreamStateWriter = void 0;
const json_stream_writable_1 = require("./json-stream-writable");
class JsonStreamStateWriter extends json_stream_writable_1.JsonStreamWritable {
constructor(pushWritable, startState) {

@@ -15,1 +18,2 @@ super(pushWritable);

}
exports.JsonStreamStateWriter = JsonStreamStateWriter;

@@ -1,2 +0,5 @@

export class JsonStreamWritable {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonStreamWritable = void 0;
class JsonStreamWritable {
constructor(pushWritable) {

@@ -80,1 +83,2 @@ this.pushWritable = pushWritable;

}
exports.JsonStreamWritable = JsonStreamWritable;

@@ -1,3 +0,6 @@

import { JsonStreamStateWriter } from "./json-stream-state-writer";
export class JsonStreamWriter extends JsonStreamStateWriter {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonStreamWriter = void 0;
const json_stream_state_writer_1 = require("./json-stream-state-writer");
class JsonStreamWriter extends json_stream_state_writer_1.JsonStreamStateWriter {
constructor(writer) {

@@ -124,1 +127,2 @@ super(async (value) => await writer.write(value), 'BEFORE_START');

}
exports.JsonStreamWriter = JsonStreamWriter;

@@ -0,8 +1,11 @@

"use strict";
var _a;
import { SatisfactorySave } from "../../satisfactory/save/satisfactory-save";
import { SaveReader } from "../../satisfactory/save/save-reader";
import { ReadableStream } from 'web-streams-polyfill';
import { SaveComponent, isSaveComponent } from "../../satisfactory/objects/SaveComponent";
import { SaveEntity, isSaveEntity } from "../../satisfactory/objects/SaveEntity";
import { Level } from "../../satisfactory/save/level.class";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReadableStreamParser = void 0;
const satisfactory_save_1 = require("../../satisfactory/save/satisfactory-save");
const save_reader_1 = require("../../satisfactory/save/save-reader");
const web_streams_polyfill_1 = require("web-streams-polyfill");
const SaveComponent_1 = require("../../satisfactory/objects/SaveComponent");
const SaveEntity_1 = require("../../satisfactory/objects/SaveEntity");
const level_class_1 = require("../../satisfactory/save/level.class");
const DEFAULT_BYTE_HIGHWATERMARK = 1024 * 1024 * 200;

@@ -97,3 +100,3 @@ const createStringLengthQueuingStrategy = (highWaterMark = DEFAULT_BYTE_HIGHWATERMARK / 4) => ({

await write('], "collectables": [', false);
const collectables = Level.ReadCollectablesList(reader);
const collectables = level_class_1.Level.ReadCollectablesList(reader);
await write(`${collectables.map(obj => JSON.stringify(obj)).join(', ')}`, true);

@@ -108,3 +111,3 @@ await write(']', false);

let ourController = null;
const stream = new ReadableStream({
const stream = new web_streams_polyfill_1.ReadableStream({
start: (controller) => {

@@ -150,5 +153,5 @@ ourController = controller;

const startStreaming = async () => {
const reader = new SaveReader(bytes.buffer, onProgress);
const reader = new save_reader_1.SaveReader(bytes.buffer, onProgress);
const header = reader.readHeader();
const save = new SatisfactorySave(name, header);
const save = new satisfactory_save_1.SatisfactorySave(name, header);
const inflateResult = reader.inflateChunks();

@@ -175,9 +178,9 @@ onDecompressedSaveBody(reader.getBuffer());

switch (objectType) {
case SaveEntity.TypeID:
obj = new SaveEntity('', '', '', '');
SaveEntity.ParseHeader(reader, obj);
case SaveEntity_1.SaveEntity.TypeID:
obj = new SaveEntity_1.SaveEntity('', '', '', '');
SaveEntity_1.SaveEntity.ParseHeader(reader, obj);
break;
case SaveComponent.TypeID:
obj = new SaveComponent('', '', '', '');
SaveComponent.ParseHeader(reader, obj);
case SaveComponent_1.SaveComponent.TypeID:
obj = new SaveComponent_1.SaveComponent('', '', '', '');
SaveComponent_1.SaveComponent.ParseHeader(reader, obj);
break;

@@ -197,10 +200,10 @@ default:

const before = reader.getBufferPosition();
if (isSaveEntity(objects[i])) {
SaveEntity.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
if ((0, SaveEntity_1.isSaveEntity)(objects[i])) {
SaveEntity_1.SaveEntity.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
}
else if (isSaveComponent(objects[i])) {
SaveComponent.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
else if ((0, SaveComponent_1.isSaveComponent)(objects[i])) {
SaveComponent_1.SaveComponent.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
}
}
};
export { ReadableStreamParser };
exports.ReadableStreamParser = ReadableStreamParser;

@@ -1,10 +0,13 @@

import { Level, SatisfactorySave, SaveComponent, SaveEntity, SaveReader } from '../../..';
import { isSaveComponent } from '../../satisfactory/objects/SaveComponent';
import { isSaveEntity } from '../../satisfactory/objects/SaveEntity';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamParser = void 0;
const __1 = require("../../..");
const SaveComponent_1 = require("../../satisfactory/objects/SaveComponent");
const SaveEntity_1 = require("../../satisfactory/objects/SaveEntity");
class StreamParser {
static async ParseSaveFileToJsonStream(name, bytes, outputJson, onDecompressedSaveBody = () => { }, onProgress = () => { }) {
const reader = new SaveReader(bytes.buffer, onProgress);
const reader = new __1.SaveReader(bytes.buffer, onProgress);
const writer = outputJson.getWriter();
const header = reader.readHeader();
const save = new SatisfactorySave(name, header);
const save = new __1.SatisfactorySave(name, header);
const inflateResult = reader.inflateChunks();

@@ -63,3 +66,3 @@ onDecompressedSaveBody(reader.getBuffer());

await writer.write('], "collectables": [');
const collectables = Level.ReadCollectablesList(reader);
const collectables = __1.Level.ReadCollectablesList(reader);
await writer.write(`${collectables.map(obj => JSON.stringify(obj)).join(', ')}`);

@@ -78,9 +81,9 @@ await writer.write(']');

switch (objectType) {
case SaveEntity.TypeID:
obj = new SaveEntity('', '', '', '');
SaveEntity.ParseHeader(reader, obj);
case __1.SaveEntity.TypeID:
obj = new __1.SaveEntity('', '', '', '');
__1.SaveEntity.ParseHeader(reader, obj);
break;
case SaveComponent.TypeID:
obj = new SaveComponent('', '', '', '');
SaveComponent.ParseHeader(reader, obj);
case __1.SaveComponent.TypeID:
obj = new __1.SaveComponent('', '', '', '');
__1.SaveComponent.ParseHeader(reader, obj);
break;

@@ -100,10 +103,10 @@ default:

const before = reader.getBufferPosition();
if (isSaveEntity(objects[i])) {
SaveEntity.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
if ((0, SaveEntity_1.isSaveEntity)(objects[i])) {
__1.SaveEntity.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
}
else if (isSaveComponent(objects[i])) {
SaveComponent.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
else if ((0, SaveComponent_1.isSaveComponent)(objects[i])) {
__1.SaveComponent.ParseData(objects[i], binarySize, reader, buildVersion, objects[i].typePath);
}
}
};
export { StreamParser };
exports.StreamParser = StreamParser;

@@ -1,5 +0,8 @@

import { SaveStreamWriter } from "./save-stream-writer.class";
export class SaveStreamJsonStringifier {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveStreamJsonStringifier = void 0;
const save_stream_writer_class_1 = require("./save-stream-writer.class");
class SaveStreamJsonStringifier {
static async StreamStringifySave(save, output) {
const writer = new SaveStreamWriter(output.getWriter());
const writer = new save_stream_writer_class_1.SaveStreamWriter(output.getWriter());
await writer.beginSave();

@@ -32,1 +35,2 @@ await writer.writeHeader(save.header);

}
exports.SaveStreamJsonStringifier = SaveStreamJsonStringifier;

@@ -1,9 +0,15 @@

import Pako from "pako";
import { CompressionLibraryError, CorruptSaveError, UnsupportedVersionError } from "../..";
import { Alignment } from "../byte/alignment.enum";
import { ByteStreamReader } from "./byte-stream-reader.class";
import { StreamLevel } from "./stream-level.class";
class SaveStreamReader extends ByteStreamReader {
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveStreamReader = void 0;
const pako_1 = __importDefault(require("pako"));
const __1 = require("../..");
const alignment_enum_1 = require("../byte/alignment.enum");
const byte_stream_reader_class_1 = require("./byte-stream-reader.class");
const stream_level_class_1 = require("./stream-level.class");
class SaveStreamReader extends byte_stream_reader_class_1.ByteStreamReader {
constructor(reader, maxBufferThreshold, onCloseCallback = async () => { }) {
super(reader, onCloseCallback, 30000, maxBufferThreshold, Alignment.LITTLE_ENDIAN);
super(reader, onCloseCallback, 30000, maxBufferThreshold, alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.compressionInfo = {

@@ -58,3 +64,3 @@ packageFileTag: 0,

else {
throw new UnsupportedVersionError("The save version is too old to support encoding currently. Save in newer game version.");
throw new __1.UnsupportedVersionError("The save version is too old to support encoding currently. Save in newer game version.");
}

@@ -69,9 +75,9 @@ return header;

if (this.compressionInfo.packageFileTag <= 0) {
this.compressionInfo.packageFileTag = this.operatingDataView.getInt32(0, this.alignment === Alignment.LITTLE_ENDIAN);
this.compressionInfo.packageFileTag = this.operatingDataView.getInt32(0, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
}
if (this.compressionInfo.maxUncompressedChunkContentSize <= 0) {
this.compressionInfo.maxUncompressedChunkContentSize = this.operatingDataView.getInt32(8, this.alignment === Alignment.LITTLE_ENDIAN);
this.compressionInfo.maxUncompressedChunkContentSize = this.operatingDataView.getInt32(8, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
}
const chunkCompressedLength = this.operatingDataView.getInt32(32, this.alignment === Alignment.LITTLE_ENDIAN);
const chunkUncompressedLength = this.operatingDataView.getInt32(40, this.alignment === Alignment.LITTLE_ENDIAN);
const chunkCompressedLength = this.operatingDataView.getInt32(32, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
const chunkUncompressedLength = this.operatingDataView.getInt32(40, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte = this.compressionInfo.chunkHeaderSize;

@@ -83,5 +89,5 @@ await this.allocate(chunkCompressedLength);

try {
const uncompressedChunk = Pako.inflate(currentChunk);
const uncompressedChunk = pako_1.default.inflate(currentChunk);
if (uncompressedChunk.byteLength !== chunkUncompressedLength) {
throw new CorruptSaveError('indicated save body chunk size does not match the inflated result. Save is possibly corrupt.');
throw new __1.CorruptSaveError('indicated save body chunk size does not match the inflated result. Save is possibly corrupt.');
}

@@ -94,3 +100,3 @@ if (this.debug) {

catch (err) {
throw new CompressionLibraryError("Failed to inflate compressed save data. " + err);
throw new __1.CompressionLibraryError("Failed to inflate compressed save data. " + err);
}

@@ -103,3 +109,3 @@ }

if (header.saveVersion < 29) {
throw new UnsupportedVersionError('Support for < U6 is not yet implemented.');
throw new __1.UnsupportedVersionError('Support for < U6 is not yet implemented.');
}

@@ -113,3 +119,3 @@ await this.allocate(100);

}
await StreamLevel.ReadLevelAsync(this, writer, levelName, header.buildVersion);
await stream_level_class_1.StreamLevel.ReadLevelAsync(this, writer, levelName, header.buildVersion);
}

@@ -121,2 +127,2 @@ return;

SaveStreamReader.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 48;
export { SaveStreamReader };
exports.SaveStreamReader = SaveStreamReader;

@@ -0,1 +1,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveStreamWriter = void 0;
class ModeStateTracker {

@@ -14,3 +17,3 @@ constructor(mode) {

}
export class SaveStreamWriter {
class SaveStreamWriter {
constructor(writer) {

@@ -84,1 +87,2 @@ this.writer = writer;

}
exports.SaveStreamWriter = SaveStreamWriter;

@@ -1,5 +0,8 @@

import { Level, ParseTransform } from "../..";
import { SaveComponent } from "../satisfactory/objects/SaveComponent";
import { SaveEntity } from "../satisfactory/objects/SaveEntity";
export class StreamLevel {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamLevel = void 0;
const __1 = require("../..");
const SaveComponent_1 = require("../satisfactory/objects/SaveComponent");
const SaveEntity_1 = require("../satisfactory/objects/SaveEntity");
class StreamLevel {
constructor(name) {

@@ -12,3 +15,3 @@ this.name = name;

const objectHeaders = StreamLevel.ReadObjectHeaders(reader);
const collectables = Level.ReadCollectablesList(reader);
const collectables = __1.Level.ReadCollectablesList(reader);
await writer.openLevel(levelName);

@@ -19,3 +22,3 @@ await StreamLevel.StreamObjectContentsAsync(reader, writer, objectHeaders, buildVersion);

await writer.endLevel();
Level.ReadCollectablesList(reader);
__1.Level.ReadCollectablesList(reader);
return;

@@ -35,3 +38,3 @@ }

needTransform: reader.readInt32() == 1,
transform: ParseTransform(reader),
transform: (0, __1.ParseTransform)(reader),
wasPlacedInLevel: reader.readInt32() == 1

@@ -81,9 +84,9 @@ });

if (!isComponent) {
const entity = new SaveEntity(obj.typePath, obj.rootObject, obj.instanceName, '', obj.needTransform);
SaveEntity.ParseData(entity, len, reader, buildVersion, obj.typePath);
const entity = new SaveEntity_1.SaveEntity(obj.typePath, obj.rootObject, obj.instanceName, '', obj.needTransform);
SaveEntity_1.SaveEntity.ParseData(entity, len, reader, buildVersion, obj.typePath);
bufferedObjects.push(entity);
}
else if (isComponent) {
const component = new SaveComponent(obj.typePath, obj.rootObject, obj.instanceName, obj.parentEntityName);
SaveComponent.ParseData(component, len, reader, buildVersion, obj.typePath);
const component = new SaveComponent_1.SaveComponent(obj.typePath, obj.rootObject, obj.instanceName, obj.parentEntityName);
SaveComponent_1.SaveComponent.ParseData(component, len, reader, buildVersion, obj.typePath);
bufferedObjects.push(component);

@@ -104,1 +107,2 @@ }

}
exports.StreamLevel = StreamLevel;

@@ -1,6 +0,9 @@

import { Alignment } from "../byte/alignment.enum";
export class StreamParserReader {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StreamParserReader = void 0;
const alignment_enum_1 = require("../byte/alignment.enum");
class StreamParserReader {
constructor(minBufferSize) {
this.minBufferSize = minBufferSize;
this.alignment = Alignment.LITTLE_ENDIAN;
this.alignment = alignment_enum_1.Alignment.LITTLE_ENDIAN;
this.getAmountLeftToRead = () => {

@@ -154,3 +157,3 @@ return this.view.byteLength - this.currentByte;

readInt16() {
let data = this.view.getInt16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getInt16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -160,3 +163,3 @@ return data;

readUint16() {
let data = this.view.getUint16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getUint16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 2;

@@ -166,3 +169,3 @@ return data;

readInt32() {
let data = this.view.getInt32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getInt32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -172,3 +175,3 @@ return data;

readUint32() {
let data = this.view.getUint32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getUint32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -178,3 +181,3 @@ return data;

readLong() {
let data = this.view.getBigInt64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getBigInt64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -187,3 +190,3 @@ return data;

readUint64() {
let data = this.view.getBigUint64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getBigUint64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -193,3 +196,3 @@ return data;

readFloat32() {
let data = this.view.getFloat32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getFloat32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 4;

@@ -199,3 +202,3 @@ return data;

readDouble() {
let data = this.view.getFloat64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);
let data = this.view.getFloat64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
this.currentByte += 8;

@@ -230,1 +233,2 @@ return data;

}
exports.StreamParserReader = StreamParserReader;
{
"name": "@etothepii/satisfactory-file-parser",
"author": "etothepii",
"version": "0.1.26",
"version": "0.1.27",
"description": "A file parser for satisfactory files. Includes save files and blueprint files.",

@@ -6,0 +6,0 @@ "types": "./build/index.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc