Socket
Socket
Sign inDemoInstall

satisfactory-json

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satisfactory-json - npm Package Compare versions

Comparing version 0.0.9 to 0.0.10

11

lib/json2sav.js

@@ -412,2 +412,3 @@ "use strict";

break;
// tslint:disable: max-line-length
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':

@@ -423,2 +424,3 @@ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':

case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
// tslint:enable
this.writeConveyorBeltExtra(entity);

@@ -437,3 +439,3 @@ break;

for (const circuit of entity.extra.circuits) {
this.buffer.writeHex(circuit.unknown);
this.buffer.writeInt(circuit.circuitId);
this.buffer.writeLengthPrefixedString(circuit.levelName);

@@ -482,8 +484,11 @@ this.buffer.writeLengthPrefixedString(circuit.pathName);

for (const item of entity.extra.items) {
this.buffer.writeHex(item.unknown1);
this.buffer.writeByte(0);
this.buffer.writeLengthPrefixedString(item.name);
this.buffer.writeHex(item.unknown2);
this.buffer.writeByte(0);
this.buffer.writeByte(0);
this.buffer.writeFloat(item.position);
}
}
error(message) {
// tslint:disable-next-line: no-console
console.trace('error: ' + message);

@@ -490,0 +495,0 @@ if (this.uuid) {

@@ -15,2 +15,3 @@ /// <reference types="node" />

readLengthPrefixedString(): string;
assertNullByteString(length: number, result: string): void;
assertNullByte(): void;

@@ -28,3 +29,3 @@ resetBytesRead(): void;

readProperty(buffer: DataBuffer, properties: Property[]): boolean;
readExtra(entity: Entity, className: string): void;
readExtra(entity: Entity, className: string, length: number): void;
private readPowerLineExtra;

@@ -31,0 +32,0 @@ private readCircuitSubsystemExtra;

@@ -59,3 +59,3 @@ "use strict";

// Thanks to @Goz3rr we know that this is now an utf16 based string
// throw new Error("length of string < 0: " + length);
// throw new Error('length of string < 0: ' + length);
length = -2 * length;

@@ -66,2 +66,3 @@ utf16 = true;

console.log(this.readHex(32));
// tslint:disable-next-line: no-console
console.trace('buffer < ' + length);

@@ -87,12 +88,20 @@ throw new Error('cannot read string of length: ' + length);

if (utf16) {
this.assertNullByte(); // two null bytes for utf16
this.assertNullByteString(length, resultStr); // two null bytes for utf16
}
this.assertNullByte();
this.assertNullByteString(length, resultStr);
return resultStr;
}
assertNullByteString(length, result) {
const zero = this.buffer.readInt8(this.cursor);
if (zero !== 0) {
throw new Error('string (length: ' + length +
') does not end with zero, but with ' + zero + ': ' + result);
}
this.cursor += 1;
this.bytesRead += 1;
}
assertNullByte() {
const zero = this.buffer.readInt8(this.cursor);
if (zero !== 0) {
throw new Error('string does not end with 0 byte, but ' + zero);
// TODO return error
throw new Error('expected 0 byte, but got ' + zero);
}

@@ -235,3 +244,3 @@ this.cursor += 1;

}
this.readExtra(entity, className);
this.readExtra(entity, className, length);
const missing = length - buffer.bytesRead;

@@ -648,3 +657,3 @@ if (missing > 0) {

}
readExtra(entity, className) {
readExtra(entity, className, length) {
switch (className) {

@@ -674,2 +683,3 @@ case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C':

break;
// tslint:disable: max-line-length
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C':

@@ -685,3 +695,4 @@ case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C':

case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C':
this.readConveyorBeltExtra(entity);
// tslint:enable
this.readConveyorBeltExtra(entity, length);
break;

@@ -703,3 +714,3 @@ }

circuits.push({
unknown: this.buffer.readHex(4),
circuitId: this.buffer.readInt(),
levelName: this.buffer.readLengthPrefixedString(),

@@ -747,6 +758,6 @@ pathName: this.buffer.readLengthPrefixedString()

pathName: this.buffer.readLengthPrefixedString(),
worldSecond: this.buffer.readLengthPrefixedString(),
entitySecond: this.buffer.readLengthPrefixedString(),
worldTimetable: this.buffer.readLengthPrefixedString(),
entityTimetable: this.buffer.readLengthPrefixedString()
levelSecond: this.buffer.readLengthPrefixedString(),
pathSecond: this.buffer.readLengthPrefixedString(),
levelTimetable: this.buffer.readLengthPrefixedString(),
pathTimetable: this.buffer.readLengthPrefixedString()
});

@@ -776,10 +787,18 @@ }

}
readConveyorBeltExtra(entity) {
readConveyorBeltExtra(entity, length) {
const itemCount = this.buffer.readInt();
const items = [];
for (let i = 0; i < itemCount; i++) {
if (this.buffer.bytesRead >= length) {
console.warn('Item count is ' + itemCount +
' while there are only ' + i + ' items in there');
break;
}
this.buffer.assertNullByte();
const name = this.buffer.readLengthPrefixedString();
this.buffer.assertNullByte();
this.buffer.assertNullByte();
items.push({
unknown1: this.buffer.readHex(4),
name: this.buffer.readLengthPrefixedString(),
unknown2: this.buffer.readHex(12),
name,
position: this.buffer.readFloat()
});

@@ -792,2 +811,3 @@ }

error(message) {
// tslint:disable-next-line: no-console
console.trace('error: ' + message);

@@ -794,0 +814,0 @@ if (this.buffer) {

{
"name": "satisfactory-json",
"version": "0.0.9",
"version": "0.0.10",
"description": "Convert Satisfactory save files to JSON and back",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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