@etothepii/satisfactory-file-parser 0.5.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -41
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1 -0
- package/build/index.js.map +1 -0
- package/build/parser/byte/alignment.enum.d.ts +1 -0
- package/build/parser/byte/alignment.enum.d.ts.map +1 -0
- package/build/parser/byte/alignment.enum.js +1 -0
- package/build/parser/byte/alignment.enum.js.map +1 -0
- package/build/parser/byte/binary-operable.interface.d.ts +1 -0
- package/build/parser/byte/binary-operable.interface.d.ts.map +1 -0
- package/build/parser/byte/binary-operable.interface.js +1 -0
- package/build/parser/byte/binary-operable.interface.js.map +1 -0
- package/build/parser/byte/binary-readable.interface.d.ts +1 -0
- package/build/parser/byte/binary-readable.interface.d.ts.map +1 -0
- package/build/parser/byte/binary-readable.interface.js +1 -0
- package/build/parser/byte/binary-readable.interface.js.map +1 -0
- package/build/parser/byte/binary-writable.interface.d.ts +1 -0
- package/build/parser/byte/binary-writable.interface.d.ts.map +1 -0
- package/build/parser/byte/binary-writable.interface.js +1 -0
- package/build/parser/byte/binary-writable.interface.js.map +1 -0
- package/build/parser/byte/byte-reader.class.d.ts +1 -0
- package/build/parser/byte/byte-reader.class.d.ts.map +1 -0
- package/build/parser/byte/byte-reader.class.js +4 -4
- package/build/parser/byte/byte-reader.class.js.map +1 -0
- package/build/parser/byte/byte-writer.class.d.ts +1 -0
- package/build/parser/byte/byte-writer.class.d.ts.map +1 -0
- package/build/parser/byte/byte-writer.class.js +1 -0
- package/build/parser/byte/byte-writer.class.js.map +1 -0
- package/build/parser/error/parser.error.d.ts +1 -0
- package/build/parser/error/parser.error.d.ts.map +1 -0
- package/build/parser/error/parser.error.js +1 -0
- package/build/parser/error/parser.error.js.map +1 -0
- package/build/parser/file.types.d.ts +1 -0
- package/build/parser/file.types.d.ts.map +1 -0
- package/build/parser/file.types.js +1 -0
- package/build/parser/file.types.js.map +1 -0
- package/build/parser/parser.d.ts +18 -3
- package/build/parser/parser.d.ts.map +1 -0
- package/build/parser/parser.js +40 -6
- package/build/parser/parser.js.map +1 -0
- package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts +1 -0
- package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts.map +1 -0
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +2 -1
- package/build/parser/satisfactory/blueprint/blueprint-reader.js.map +1 -0
- package/build/parser/satisfactory/blueprint/blueprint-writer.d.ts +6 -1
- package/build/parser/satisfactory/blueprint/blueprint-writer.d.ts.map +1 -0
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +7 -4
- package/build/parser/satisfactory/blueprint/blueprint-writer.js.map +1 -0
- package/build/parser/satisfactory/blueprint/blueprint.types.d.ts +1 -0
- package/build/parser/satisfactory/blueprint/blueprint.types.d.ts.map +1 -0
- package/build/parser/satisfactory/blueprint/blueprint.types.js +1 -0
- package/build/parser/satisfactory/blueprint/blueprint.types.js.map +1 -0
- package/build/parser/satisfactory/edit/edit-constants.d.ts +1 -0
- package/build/parser/satisfactory/edit/edit-constants.d.ts.map +1 -0
- package/build/parser/satisfactory/edit/edit-constants.js +1 -0
- package/build/parser/satisfactory/edit/edit-constants.js.map +1 -0
- package/build/parser/satisfactory/save/level.class.d.ts +13 -8
- package/build/parser/satisfactory/save/level.class.d.ts.map +1 -0
- package/build/parser/satisfactory/save/level.class.js +104 -48
- package/build/parser/satisfactory/save/level.class.js.map +1 -0
- package/build/parser/satisfactory/save/object-references-list.d.ts +8 -0
- package/build/parser/satisfactory/save/object-references-list.d.ts.map +1 -0
- package/build/parser/satisfactory/save/object-references-list.js +22 -0
- package/build/parser/satisfactory/save/object-references-list.js.map +1 -0
- package/build/parser/satisfactory/save/satisfactory-save.d.ts +4 -3
- package/build/parser/satisfactory/save/satisfactory-save.d.ts.map +1 -0
- package/build/parser/satisfactory/save/satisfactory-save.js +2 -1
- package/build/parser/satisfactory/save/satisfactory-save.js.map +1 -0
- package/build/parser/satisfactory/save/save-reader.d.ts +11 -3
- package/build/parser/satisfactory/save/save-reader.d.ts.map +1 -0
- package/build/parser/satisfactory/save/save-reader.js +59 -21
- package/build/parser/satisfactory/save/save-reader.js.map +1 -0
- package/build/parser/satisfactory/save/save-writer.d.ts +3 -2
- package/build/parser/satisfactory/save/save-writer.d.ts.map +1 -0
- package/build/parser/satisfactory/save/save-writer.js +12 -12
- package/build/parser/satisfactory/save/save-writer.js.map +1 -0
- package/build/parser/satisfactory/save/save.types.d.ts +1 -0
- package/build/parser/satisfactory/save/save.types.d.ts.map +1 -0
- package/build/parser/satisfactory/save/save.types.js +1 -0
- package/build/parser/satisfactory/save/save.types.js.map +1 -0
- package/build/parser/satisfactory/types/objects/SaveComponent.d.ts +1 -0
- package/build/parser/satisfactory/types/objects/SaveComponent.d.ts.map +1 -0
- package/build/parser/satisfactory/types/objects/SaveComponent.js +1 -0
- package/build/parser/satisfactory/types/objects/SaveComponent.js.map +1 -0
- package/build/parser/satisfactory/types/objects/SaveEntity.d.ts +1 -0
- package/build/parser/satisfactory/types/objects/SaveEntity.d.ts.map +1 -0
- package/build/parser/satisfactory/types/objects/SaveEntity.js +1 -0
- package/build/parser/satisfactory/types/objects/SaveEntity.js.map +1 -0
- package/build/parser/satisfactory/types/objects/SaveObject.d.ts +1 -0
- package/build/parser/satisfactory/types/objects/SaveObject.d.ts.map +1 -0
- package/build/parser/satisfactory/types/objects/SaveObject.js +1 -0
- package/build/parser/satisfactory/types/objects/SaveObject.js.map +1 -0
- package/build/parser/satisfactory/types/property/PropertiesList.d.ts +1 -0
- package/build/parser/satisfactory/types/property/PropertiesList.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/PropertiesList.js +1 -0
- package/build/parser/satisfactory/types/property/PropertiesList.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/ArrayProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/ArrayProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/ArrayProperty.js +3 -2
- package/build/parser/satisfactory/types/property/generic/ArrayProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/BasicProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/BasicProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/BasicProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/BasicProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/BoolProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/BoolProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/BoolProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/BoolProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/ByteProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/ByteProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/DoubleProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/DoubleProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/DoubleProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/DoubleProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/EnumProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/EnumProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/FloatProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/FloatProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/FloatProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/FloatProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Int32Property.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/Int32Property.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Int32Property.js +1 -0
- package/build/parser/satisfactory/types/property/generic/Int32Property.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Int64Property.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/Int64Property.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Int64Property.js +1 -0
- package/build/parser/satisfactory/types/property/generic/Int64Property.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Int8Property.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/Int8Property.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Int8Property.js +1 -0
- package/build/parser/satisfactory/types/property/generic/Int8Property.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/MapProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/MapProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/ObjectProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/ObjectProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/ObjectProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/ObjectProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/SetProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/SetProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/SetProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/SetProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/StrProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/StrProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/StrProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/StrProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/StructProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/StructProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/TextProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/TextProperty.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/TextProperty.js +1 -0
- package/build/parser/satisfactory/types/property/generic/TextProperty.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint32Property.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint32Property.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint32Property.js +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint32Property.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint64Property.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint64Property.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint64Property.js +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint64Property.js.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint8Property.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint8Property.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint8Property.js +1 -0
- package/build/parser/satisfactory/types/property/generic/Uint8Property.js.map +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperties.d.ts +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperties.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperties.js +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperties.js.map +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts.map +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialProperties.js +1 -0
- package/build/parser/satisfactory/types/property/special/SpecialProperties.js.map +1 -0
- package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.js +1 -0
- package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.js.map +1 -0
- package/build/parser/satisfactory/types/structs/GUID.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/GUID.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/GUID.js +1 -0
- package/build/parser/satisfactory/types/structs/GUID.js.map +1 -0
- package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/GUIDInfo.js +1 -0
- package/build/parser/satisfactory/types/structs/GUIDInfo.js.map +1 -0
- package/build/parser/satisfactory/types/structs/MD5Hash.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/MD5Hash.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/MD5Hash.js +1 -0
- package/build/parser/satisfactory/types/structs/MD5Hash.js.map +1 -0
- package/build/parser/satisfactory/types/structs/ObjectReference.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/ObjectReference.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/ObjectReference.js +1 -0
- package/build/parser/satisfactory/types/structs/ObjectReference.js.map +1 -0
- package/build/parser/satisfactory/types/structs/SoftObjectReference.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/SoftObjectReference.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/SoftObjectReference.js +1 -0
- package/build/parser/satisfactory/types/structs/SoftObjectReference.js.map +1 -0
- package/build/parser/satisfactory/types/structs/Transform.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/Transform.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/Transform.js +1 -0
- package/build/parser/satisfactory/types/structs/Transform.js.map +1 -0
- package/build/parser/satisfactory/types/structs/col4.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/col4.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/col4.js +1 -0
- package/build/parser/satisfactory/types/structs/col4.js.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js.map +1 -0
- package/build/parser/satisfactory/types/structs/vec2.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/vec2.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/vec2.js +1 -0
- package/build/parser/satisfactory/types/structs/vec2.js.map +1 -0
- package/build/parser/satisfactory/types/structs/vec3.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/vec3.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/vec3.js +1 -0
- package/build/parser/satisfactory/types/structs/vec3.js.map +1 -0
- package/build/parser/satisfactory/types/structs/vec4.d.ts +1 -0
- package/build/parser/satisfactory/types/structs/vec4.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/vec4.js +1 -0
- package/build/parser/satisfactory/types/structs/vec4.js.map +1 -0
- package/build/parser/stream/reworked/readable-stream-parser.d.ts +6 -5
- package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -0
- package/build/parser/stream/reworked/readable-stream-parser.js +21 -66
- package/build/parser/stream/reworked/readable-stream-parser.js.map +1 -0
- package/build/parser/stream/reworked/save-stream-json-stringifier.d.ts +1 -0
- package/build/parser/stream/reworked/save-stream-json-stringifier.d.ts.map +1 -0
- package/build/parser/stream/reworked/save-stream-json-stringifier.js +1 -0
- package/build/parser/stream/reworked/save-stream-json-stringifier.js.map +1 -0
- package/build/parser/stream/reworked/save-stream-writer.class.d.ts +3 -2
- package/build/parser/stream/reworked/save-stream-writer.class.d.ts.map +1 -0
- package/build/parser/stream/reworked/save-stream-writer.class.js +1 -0
- package/build/parser/stream/reworked/save-stream-writer.class.js.map +1 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1493 -0
- package/docs/classes/AbstractBaseProperty.html +6 -0
- package/docs/classes/AbstractProperty.html +4 -0
- package/docs/classes/ArrayProperty.html +13 -0
- package/docs/classes/BasicProperty.html +7 -0
- package/docs/classes/BlueprintConfigReader.html +35 -0
- package/docs/classes/BlueprintConfigWriter.html +37 -0
- package/docs/classes/BlueprintReader.html +36 -0
- package/docs/classes/BlueprintWriter.html +40 -0
- package/docs/classes/BoolProperty.html +13 -0
- package/docs/classes/ByteProperty.html +13 -0
- package/docs/classes/CompressionLibraryError.html +11 -0
- package/docs/classes/CorruptSaveError.html +11 -0
- package/docs/classes/DoubleProperty.html +13 -0
- package/docs/classes/EnumProperty.html +13 -0
- package/docs/classes/FloatProperty.html +13 -0
- package/docs/classes/Int32Property.html +13 -0
- package/docs/classes/Int64Property.html +13 -0
- package/docs/classes/Int8Property.html +13 -0
- package/docs/classes/MapProperty.html +17 -0
- package/docs/classes/ObjectProperty.html +13 -0
- package/docs/classes/Parser.html +35 -0
- package/docs/classes/ParserError.html +11 -0
- package/docs/classes/ReadableStreamParser.html +8 -0
- package/docs/classes/SatisfactorySave.html +8 -0
- package/docs/classes/SaveComponent.html +17 -0
- package/docs/classes/SaveEntity.html +23 -0
- package/docs/classes/SaveReader.html +43 -0
- package/docs/classes/SaveStreamJsonStringifier.html +4 -0
- package/docs/classes/SaveStreamWriter.html +16 -0
- package/docs/classes/SaveWriter.html +42 -0
- package/docs/classes/SetProperty.html +12 -0
- package/docs/classes/StrProperty.html +13 -0
- package/docs/classes/StructProperty.html +18 -0
- package/docs/classes/TextProperty.html +13 -0
- package/docs/classes/TimeoutError.html +11 -0
- package/docs/classes/Uint32Property.html +13 -0
- package/docs/classes/Uint64Property.html +13 -0
- package/docs/classes/Uint8Property.html +13 -0
- package/docs/classes/UnimplementedError.html +11 -0
- package/docs/classes/UnsupportedVersionError.html +11 -0
- package/docs/functions/DynamicStructPropertyValue.read.html +1 -0
- package/docs/functions/DynamicStructPropertyValue.write.html +1 -0
- package/docs/functions/FICFrameRange.Parse.html +1 -0
- package/docs/functions/FICFrameRange.Serialize.html +1 -0
- package/docs/functions/GUID.read.html +1 -0
- package/docs/functions/GUID.write.html +1 -0
- package/docs/functions/GUIDInfo.read.html +1 -0
- package/docs/functions/GUIDInfo.write.html +1 -0
- package/docs/functions/Level.ReadAllObjectContents.html +1 -0
- package/docs/functions/Level.ReadAllObjectHeaders.html +1 -0
- package/docs/functions/Level.ReadLevel.html +1 -0
- package/docs/functions/Level.ReadNObjectContents.html +1 -0
- package/docs/functions/Level.ReadNObjectHeaders.html +1 -0
- package/docs/functions/Level.SerializeAllObjectContents.html +1 -0
- package/docs/functions/Level.SerializeAllObjectHeaders.html +1 -0
- package/docs/functions/Level.SerializeLevel.html +1 -0
- package/docs/functions/MD5Hash.read.html +1 -0
- package/docs/functions/MD5Hash.write.html +1 -0
- package/docs/functions/ObjectReference.read.html +1 -0
- package/docs/functions/ObjectReference.write.html +1 -0
- package/docs/functions/PropertiesList.ParseList.html +1 -0
- package/docs/functions/PropertiesList.ParseSingleProperty.html +1 -0
- package/docs/functions/PropertiesList.SerializeList.html +1 -0
- package/docs/functions/PropertiesList.SerializeSingleProperty.html +1 -0
- package/docs/functions/SoftObjectReference.read.html +1 -0
- package/docs/functions/SoftObjectReference.write.html +1 -0
- package/docs/functions/SpecialProperties.ParseClassSpecificSpecialProperties.html +1 -0
- package/docs/functions/SpecialProperties.SerializeClassSpecificSpecialProperties.html +1 -0
- package/docs/functions/Transform.Parse.html +1 -0
- package/docs/functions/Transform.ParseF.html +1 -0
- package/docs/functions/Transform.Serialize.html +1 -0
- package/docs/functions/Transform.SerializeF.html +1 -0
- package/docs/functions/col4.ParseBGRA.html +1 -0
- package/docs/functions/col4.ParseRGBA.html +1 -0
- package/docs/functions/col4.SerializeBGRA.html +1 -0
- package/docs/functions/col4.SerializeRGBA.html +1 -0
- package/docs/functions/isArrayProperty.html +1 -0
- package/docs/functions/isBoolProperty.html +1 -0
- package/docs/functions/isByteProperty.html +1 -0
- package/docs/functions/isDoubleProperty.html +1 -0
- package/docs/functions/isEnumProperty.html +1 -0
- package/docs/functions/isFloatProperty.html +1 -0
- package/docs/functions/isInt32Property.html +1 -0
- package/docs/functions/isInt64Property.html +1 -0
- package/docs/functions/isInt8Property.html +1 -0
- package/docs/functions/isMapProperty.html +1 -0
- package/docs/functions/isObjectProperty.html +1 -0
- package/docs/functions/isSaveComponent.html +1 -0
- package/docs/functions/isSaveEntity.html +1 -0
- package/docs/functions/isSetProperty.html +1 -0
- package/docs/functions/isStrProperty.html +1 -0
- package/docs/functions/isStructProperty.html +1 -0
- package/docs/functions/isTextProperty.html +1 -0
- package/docs/functions/isUInt64Property.html +1 -0
- package/docs/functions/isUint32Property.html +1 -0
- package/docs/functions/isUint8Property.html +1 -0
- package/docs/functions/vec2.Parse.html +1 -0
- package/docs/functions/vec2.ParseF.html +1 -0
- package/docs/functions/vec2.Serialize.html +1 -0
- package/docs/functions/vec2.SerializeF.html +1 -0
- package/docs/functions/vec3.Parse.html +1 -0
- package/docs/functions/vec3.ParseF.html +1 -0
- package/docs/functions/vec3.ParseInt.html +1 -0
- package/docs/functions/vec3.Serialize.html +1 -0
- package/docs/functions/vec3.SerializeF.html +1 -0
- package/docs/functions/vec3.SerializeInt.html +1 -0
- package/docs/functions/vec3.add.html +1 -0
- package/docs/functions/vec3.length.html +1 -0
- package/docs/functions/vec3.mult.html +1 -0
- package/docs/functions/vec3.norm.html +1 -0
- package/docs/functions/vec3.sub.html +1 -0
- package/docs/functions/vec4.Parse.html +1 -0
- package/docs/functions/vec4.ParseF.html +1 -0
- package/docs/functions/vec4.Serialize.html +1 -0
- package/docs/functions/vec4.SerializeF.html +1 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +146 -0
- package/docs/interfaces/Blueprint.html +6 -0
- package/docs/interfaces/BlueprintConfig.html +6 -0
- package/docs/interfaces/ModData.html +4 -0
- package/docs/interfaces/SatisfactoryModMetadata.html +4 -0
- package/docs/interfaces/SatisfactorySaveHeader.html +18 -0
- package/docs/interfaces/SaveComponentHeader.html +5 -0
- package/docs/interfaces/SaveEntityHeader.html +7 -0
- package/docs/modules/DynamicStructPropertyValue.html +3 -0
- package/docs/modules/FICFrameRange.html +3 -0
- package/docs/modules/GUID.html +3 -0
- package/docs/modules/GUIDInfo.html +3 -0
- package/docs/modules/Level.html +9 -0
- package/docs/modules/MD5Hash.html +3 -0
- package/docs/modules/ObjectReference.html +3 -0
- package/docs/modules/PropertiesList.html +5 -0
- package/docs/modules/SoftObjectReference.html +3 -0
- package/docs/modules/SpecialProperties.html +3 -0
- package/docs/modules/Transform.html +5 -0
- package/docs/modules/col4.html +5 -0
- package/docs/modules/vec2.html +5 -0
- package/docs/modules/vec3.html +12 -0
- package/docs/modules/vec4.html +5 -0
- package/docs/modules.html +123 -0
- package/docs/types/ArrayPropertyStructValueFields.html +1 -0
- package/docs/types/BasicMultipleStructPropertyValue.html +1 -0
- package/docs/types/BasicStructPropertyValue.html +1 -0
- package/docs/types/BlueprintHeader.html +1 -0
- package/docs/types/BoxStructPropertyValue.html +1 -0
- package/docs/types/BuildableSubsystemSpecialProperties.html +1 -0
- package/docs/types/BuildableTypeInstance.html +1 -0
- package/docs/types/BytePropertyValue.html +1 -0
- package/docs/types/ClientIdentityInfo.html +1 -0
- package/docs/types/ConveyorChainActorSpecialProperties.html +1 -0
- package/docs/types/ConveyorChainSegmentSpecialProperties.html +1 -0
- package/docs/types/ConveyorItemSpecialProperties.html +1 -0
- package/docs/types/DynamicStructPropertyValue-1.html +1 -0
- package/docs/types/EmptySpecialProperties.html +1 -0
- package/docs/types/FICFrameRange-1.html +1 -0
- package/docs/types/FICFrameRangeStructPropertyValue.html +1 -0
- package/docs/types/GENERIC_MAP_KEY_TYPE.html +1 -0
- package/docs/types/GENERIC_MAP_VALUE_TYPE.html +1 -0
- package/docs/types/GENERIC_STRUCT_PROPERTY_VALUE.html +1 -0
- package/docs/types/GUID-1.html +1 -0
- package/docs/types/GUIDInfo-1.html +1 -0
- package/docs/types/InventoryItemStructPropertyValue.html +1 -0
- package/docs/types/Level-1.html +1 -0
- package/docs/types/MAP_STRUCT_KEY_PROXY.html +1 -0
- package/docs/types/MD5Hash-1.html +1 -0
- package/docs/types/ObjectReference-1.html +1 -0
- package/docs/types/PlayerSpecialProperties.html +1 -0
- package/docs/types/PowerLineSpecialProperties.html +1 -0
- package/docs/types/PropertiesMap.html +1 -0
- package/docs/types/RailroadTrackPositionStructPropertyValue.html +1 -0
- package/docs/types/RoughSaveVersion.html +1 -0
- package/docs/types/SoftObjectReference-1.html +1 -0
- package/docs/types/SpecialAnyProperties.html +1 -0
- package/docs/types/TextPropertyValue.html +1 -0
- package/docs/types/Transform-1.html +1 -0
- package/docs/types/col4-1.html +1 -0
- package/docs/types/vec2-1.html +1 -0
- package/docs/types/vec3-1.html +1 -0
- package/docs/types/vec4-1.html +1 -0
- package/docs/variables/EDIT.html +1 -0
- package/package.json +5 -10
- package/build/parser/satisfactory/objects/DataFields.d.ts +0 -15
- package/build/parser/satisfactory/objects/DataFields.js +0 -491
- package/build/parser/satisfactory/objects/GUIDInfo.d.ts +0 -8
- package/build/parser/satisfactory/objects/GUIDInfo.js +0 -26
- package/build/parser/satisfactory/objects/SaveComponent.d.ts +0 -19
- package/build/parser/satisfactory/objects/SaveComponent.js +0 -31
- package/build/parser/satisfactory/objects/SaveEntity.d.ts +0 -30
- package/build/parser/satisfactory/objects/SaveEntity.js +0 -66
- package/build/parser/satisfactory/objects/SaveObject.d.ts +0 -24
- package/build/parser/satisfactory/objects/SaveObject.js +0 -33
- package/build/parser/satisfactory/objects/property/generic/ArrayProperty.d.ts +0 -21
- package/build/parser/satisfactory/objects/property/generic/ArrayProperty.js +0 -169
- package/build/parser/satisfactory/objects/property/generic/BasicProperty.d.ts +0 -25
- package/build/parser/satisfactory/objects/property/generic/BasicProperty.js +0 -27
- package/build/parser/satisfactory/objects/property/generic/BoolProperty.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/BoolProperty.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/ByteProperty.d.ts +0 -17
- package/build/parser/satisfactory/objects/property/generic/ByteProperty.js +0 -50
- package/build/parser/satisfactory/objects/property/generic/DoubleProperty.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/DoubleProperty.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/EnumProperty.d.ts +0 -19
- package/build/parser/satisfactory/objects/property/generic/EnumProperty.js +0 -33
- package/build/parser/satisfactory/objects/property/generic/FloatProperty.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/FloatProperty.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/Int32Property.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/Int32Property.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/Int64Property.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/Int64Property.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/Int8Property.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/Int8Property.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/MapProperty.d.ts +0 -21
- package/build/parser/satisfactory/objects/property/generic/MapProperty.js +0 -160
- package/build/parser/satisfactory/objects/property/generic/ObjectProperty.d.ts +0 -14
- package/build/parser/satisfactory/objects/property/generic/ObjectProperty.js +0 -35
- package/build/parser/satisfactory/objects/property/generic/SetProperty.d.ts +0 -11
- package/build/parser/satisfactory/objects/property/generic/SetProperty.js +0 -92
- package/build/parser/satisfactory/objects/property/generic/SoftObjectProperty.d.ts +0 -12
- package/build/parser/satisfactory/objects/property/generic/SoftObjectProperty.js +0 -25
- package/build/parser/satisfactory/objects/property/generic/StrProperty.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/StrProperty.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/StructProperty.d.ts +0 -66
- package/build/parser/satisfactory/objects/property/generic/StructProperty.js +0 -361
- package/build/parser/satisfactory/objects/property/generic/TextProperty.d.ts +0 -29
- package/build/parser/satisfactory/objects/property/generic/TextProperty.js +0 -109
- package/build/parser/satisfactory/objects/property/generic/Uint32Property.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/Uint32Property.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/Uint64Property.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/Uint64Property.js +0 -30
- package/build/parser/satisfactory/objects/property/generic/Uint8Property.d.ts +0 -13
- package/build/parser/satisfactory/objects/property/generic/Uint8Property.js +0 -30
- package/build/parser/satisfactory/objects/property/special/SpecialAnyProperty.d.ts +0 -52
- package/build/parser/satisfactory/objects/property/special/SpecialAnyProperty.js +0 -2
- package/build/parser/satisfactory/objects/ue/MD5Hash.d.ts +0 -10
- package/build/parser/satisfactory/objects/ue/MD5Hash.js +0 -21
- package/build/parser/satisfactory/objects/values/GUID.d.ts +0 -7
- package/build/parser/satisfactory/objects/values/GUID.js +0 -21
- package/build/parser/satisfactory/objects/values/ObjectReference.d.ts +0 -10
- package/build/parser/satisfactory/objects/values/ObjectReference.js +0 -17
- package/build/parser/satisfactory/objects/values/SoftObjectReference.d.ts +0 -11
- package/build/parser/satisfactory/objects/values/SoftObjectReference.js +0 -19
- package/build/parser/satisfactory/structs/util.types.d.ts +0 -60
- package/build/parser/satisfactory/structs/util.types.js +0 -147
- package/build/parser/satisfactory/types/property/DataFields.d.ts +0 -15
- package/build/parser/satisfactory/types/property/DataFields.js +0 -493
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperty.d.ts +0 -54
- package/build/parser/satisfactory/types/property/special/SpecialAnyProperty.js +0 -2
package/README.md
CHANGED
|
@@ -21,31 +21,40 @@ Game Version Files of U5 and below are NOT supported.
|
|
|
21
21
|
# Installation via npm
|
|
22
22
|
`npm install @etothepii/satisfactory-file-parser`
|
|
23
23
|
|
|
24
|
-
#
|
|
24
|
+
# Mod Support ✅
|
|
25
|
+
By Default, most Mods just reuse Properties and Structs of the base game.
|
|
26
|
+
If however a Mod should not be working or have just objects with a lot of trailing unparseable data, Raise an issue or contact me.
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
Some explicitly tested mods include:
|
|
29
|
+
Ficsit-Cam, Structural Solutions, Linear Motion, Container Screens, Conveyor Wall Hole, X3-Signs, X3-Roads
|
|
30
|
+
|
|
31
|
+
# Reading a Save
|
|
32
|
+
Reading a Save in Memory.
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
import * as fs from 'fs';
|
|
36
|
+
import { Parser } from '@etothepii/satisfactory-file-parser';
|
|
37
|
+
|
|
38
|
+
const file = fs.readFileSync('./MySave.sav');
|
|
39
|
+
const save = Parser.ParseSave('MySave', file.buffer);
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
You can also read a Save via stream, to save RAM.
|
|
44
|
+
The binary data of the whole save will still be in memory, but the converted JSON can be streamed. (You can of course keep reading the stream in memory).
|
|
27
45
|
The returned `stream` is a readable WHATWG stream of type string and represents a `SatisfactorySave` object. this object can be serialized again.
|
|
28
46
|
WHATWG is used by default by browsers. Node js can use them using `Writable.toWeb()` and `Writable.fromWeb()` for example.
|
|
29
|
-
|
|
30
47
|
```js
|
|
31
48
|
import * as fs from 'fs';
|
|
32
|
-
import * as path from 'path';
|
|
33
49
|
import { Writable } from 'stream';
|
|
34
50
|
import { WritableStream } from 'stream/web';
|
|
35
51
|
import { ReadableStreamParser } from '@etothepii/satisfactory-file-parser';
|
|
36
52
|
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const outJsonPath = path.join(__dirname, 'MySave.json');
|
|
40
|
-
const jsonFileStream = fs.createWriteStream(outJsonPath, { highWaterMark: 1024 * 1024 * 200 }); // your outgoing JSON stream. In this case directly to file.
|
|
53
|
+
const file = fs.readFileSync('./MySave.sav');
|
|
54
|
+
const jsonFileStream = fs.createWriteStream('./MySave.json', { highWaterMark: 1024 * 1024 * 200 }); // your outgoing JSON stream. In this case directly to file.
|
|
41
55
|
const whatwgWriteStream = Writable.toWeb(jsonFileStream) as WritableStream<string>; // convert the file stream to WHATWG-compliant stream
|
|
42
56
|
|
|
43
|
-
const { stream, startStreaming } = ReadableStreamParser.CreateReadableStreamFromSaveToJson('MySave', file
|
|
44
|
-
console.log('on binary body data.');
|
|
45
|
-
}, (progress: number, msg: string | undefined) => {
|
|
46
|
-
// a callback for reporting progress as number [0,1]. Sometimes has a message.
|
|
47
|
-
console.log(`progress`, progress, msg);
|
|
48
|
-
});
|
|
57
|
+
const { stream, startStreaming } = ReadableStreamParser.CreateReadableStreamFromSaveToJson('MySave', file);
|
|
49
58
|
|
|
50
59
|
stream.pipeTo(whatwgWriteStream);
|
|
51
60
|
jsonFileStream.on('close', () => {
|
|
@@ -55,18 +64,15 @@ jsonFileStream.on('close', () => {
|
|
|
55
64
|
startStreaming();
|
|
56
65
|
```
|
|
57
66
|
|
|
67
|
+
|
|
58
68
|
Consequently, writing a parsed save file back is just as easy.
|
|
59
69
|
The SaveParser has callbacks to assist during syncing on different occasions during the process.
|
|
60
70
|
For example, when writing the header or when writing a chunk of the save body.
|
|
61
71
|
The splitting in individual chunks enables you to more easily stream the binary data to somewhere else.
|
|
62
72
|
```js
|
|
63
73
|
import * as fs from 'fs';
|
|
64
|
-
import * as path from 'path';
|
|
65
74
|
import { Parser } from "@etothepii/satisfactory-file-parser";
|
|
66
75
|
|
|
67
|
-
// save is your SatisfactorySave object to serialize. In this example i read it back in from a json file.
|
|
68
|
-
const save = JSON.parse(fs.readFileSync(path.join(__dirname, 'MySave.json'), {encoding: 'utf-8'}));
|
|
69
|
-
|
|
70
76
|
let fileHeader: Uint8Array;
|
|
71
77
|
const bodyChunks: Uint8Array[] = [];
|
|
72
78
|
Parser.WriteSave(save, binaryBeforeCompressed => {
|
|
@@ -85,7 +91,6 @@ fs.writeFileSync('./MyModifiedSave.sav', Buffer.concat([fileHeader!, ...bodyChun
|
|
|
85
91
|
|
|
86
92
|
|
|
87
93
|
## Inspecting Save Objects
|
|
88
|
-
Once you have the complete parsing done, the JSON is a `SatisfactorySave` object.
|
|
89
94
|
You can for example loop through players and print their cached names and positions.
|
|
90
95
|
|
|
91
96
|
```js
|
|
@@ -109,7 +114,7 @@ import { Parser } from "@etothepii/satisfactory-file-parser";
|
|
|
109
114
|
|
|
110
115
|
const mainFile = fs.readFileSync('./MyBlueprint.sbp');
|
|
111
116
|
const configFile = fs.readFileSync('./MyBlueprint.sbpcfg');
|
|
112
|
-
const
|
|
117
|
+
const blueprint = Parser.ParseBlueprintFiles('Myblueprint', mainFile, configFile);
|
|
113
118
|
```
|
|
114
119
|
|
|
115
120
|
Consequently, writing a blueprint into binary data works the same way with getting callbacks in the same style as the save parsing.
|
|
@@ -119,37 +124,57 @@ import { Parser } from "@etothepii/satisfactory-file-parser";
|
|
|
119
124
|
|
|
120
125
|
let mainFileHeader: Uint8Array;
|
|
121
126
|
const mainFileBodyChunks: Uint8Array[] = [];
|
|
122
|
-
const summary = Parser.WriteBlueprintFiles(blueprint,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
const summary = Parser.WriteBlueprintFiles(blueprint, {
|
|
128
|
+
onMainFileHeader: header => {
|
|
129
|
+
console.log('on main file header.');
|
|
130
|
+
mainFileHeader = header;
|
|
131
|
+
}, onMainFileChunk: chunk => {
|
|
132
|
+
console.log('on main file body chunk.');
|
|
133
|
+
mainFileBodyChunks.push(chunk);
|
|
134
|
+
}
|
|
130
135
|
});
|
|
131
136
|
|
|
132
137
|
// write complete .sbp file back to disk
|
|
133
|
-
fs.writeFileSync('./
|
|
138
|
+
fs.writeFileSync('./MyBlueprint.sbp', Buffer.concat([mainFileHeader!, ...mainFileBodyChunks]));
|
|
134
139
|
|
|
135
140
|
// write .sbpcfg file back to disk, we get that data from the result of WriteBlueprintFiles
|
|
136
|
-
fs.writeFileSync('./
|
|
141
|
+
fs.writeFileSync('./MyBlueprint.sbpcfg', Buffer.from(summary.configFileBinary));
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
# Additional Infos
|
|
145
|
+
For every parser call, you can pass optional callbacks to receive additional info.
|
|
146
|
+
Like a callback on the decompressed save body. Parsing saves provides a callback for reporting progress [0,1] and an occasional message.
|
|
147
|
+
```js
|
|
148
|
+
const save = Parser.ParseSave('MySave', file.buffer, {
|
|
149
|
+
onDecompressedSaveBody: (body) => console.log('on decompressed body', body.byteLength),
|
|
150
|
+
onProgressCallback: (progress, msg) => console.log(progress, msg)
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
```js
|
|
154
|
+
const { stream, startStreaming } = ReadableStreamParser.CreateReadableStreamFromSaveToJson(savename, file, {
|
|
155
|
+
onProgress: (progress, msg) => console.log(`progress`, progress, msg);
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
```js
|
|
159
|
+
const blueprint = Parser.ParseBlueprintFiles('Myblueprint', file, configFile, {
|
|
160
|
+
onDecompressedBlueprintBody: (body) => console.log('on decompressed body', body.byteLength),
|
|
161
|
+
});
|
|
137
162
|
```
|
|
138
163
|
|
|
139
164
|
# Bug Reports or Feedback
|
|
140
|
-
|
|
141
|
-
If you find a bug or have feedback about the parser, you can just open an issue on the github repo or hit me up on the satisfactory discord `etothepii`.
|
|
142
|
-
|
|
143
|
-
# Explicitly Supported/Tested Mods (No guarantee for other mods)
|
|
144
|
-
### Ficsit-Cam (`FicsItCam`)
|
|
145
|
-
### Structural Solutions (`SS_Mod`)
|
|
146
|
-
### Linear Motion (`LinearMotion`)
|
|
147
|
-
### Container Screens (`ContainerScreen`)
|
|
148
|
-
### Conveyor Wall Hole (`WallHoleConveyor`)
|
|
149
|
-
### X3-Signs (`x3_signs`)
|
|
150
|
-
### X3-Roads (`x3_roads`)
|
|
165
|
+
You can always raise an issue on the linked github project or hit me up on the satisfactory discord `etothepii`.
|
|
151
166
|
|
|
152
167
|
# Changelog
|
|
168
|
+
### [1.0.1] (2024-10-17)
|
|
169
|
+
#### Major breaking changes on Parser usage
|
|
170
|
+
* Cleaned Usage methods of Save / Blueprint Parsing. The callbacks are an optional additional parameter object now instead of required.
|
|
171
|
+
* Re-Added a method to parse Saves in memory again. (sorry for the inconvenience)
|
|
172
|
+
#### Internal structure changes
|
|
173
|
+
* `SatisfactorySave` structure changed, the `grids` and `gridHash` fields are slightly different now, since their meaning became more clear. Not relevant for normal save editing.
|
|
174
|
+
* `Level` is a namespace instead of a class now, since the classes had only static methods anyway.
|
|
175
|
+
#### module build now includes source maps
|
|
176
|
+
#### module build should now include a docs folder for auto-generated documentation
|
|
177
|
+
|
|
153
178
|
### [0.5.1] (2024-10-15)
|
|
154
179
|
#### Added Mod Support
|
|
155
180
|
#### Internal Renamings
|
package/build/index.d.ts
CHANGED
|
@@ -48,3 +48,4 @@ export * from './parser/error/parser.error';
|
|
|
48
48
|
export { Parser } from './parser/parser';
|
|
49
49
|
export { ReadableStreamParser } from './parser/stream/reworked/readable-stream-parser';
|
|
50
50
|
export * from './parser/satisfactory/edit/edit-constants';
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iDAAiD,CAAC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CAAwC,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAGrF,cAAc,6BAA6B,CAAC;AAG5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AAGvF,cAAc,2CAA2C,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -75,3 +75,4 @@ Object.defineProperty(exports, "Parser", { enumerable: true, get: function () {
|
|
|
75
75
|
var readable_stream_parser_1 = require("./parser/stream/reworked/readable-stream-parser");
|
|
76
76
|
Object.defineProperty(exports, "ReadableStreamParser", { enumerable: true, get: function () { return readable_stream_parser_1.ReadableStreamParser; } });
|
|
77
77
|
__exportStar(require("./parser/satisfactory/edit/edit-constants"), exports);
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,kFAAgE;AAChE,yEAAuD;AACvD,+EAA6D;AAC7D,wEAAsD;AACtD,oFAAkE;AAClE,iFAA+D;AAC/D,6FAA2E;AAC3E,6FAA2E;AAC3E,4FAA0E;AAC1E,4FAA0E;AAC1E,8FAA4E;AAC5E,4FAA0E;AAC1E,6FAA2E;AAC3E,6FAA2E;AAC3E,6FAA2E;AAC3E,4FAA0E;AAC1E,2FAAyE;AACzE,8FAA4E;AAC5E,2FAAyE;AACzE,2FAAyE;AACzE,8FAA4E;AAC5E,4FAA0E;AAC1E,8FAA4E;AAC5E,8FAA4E;AAC5E,6FAA2E;AAC3E,sFAAoE;AACpE,oGAAkF;AAClF,iGAA+E;AAC/E,2EAAyD;AACzD,iGAA+E;AAC/E,2EAAyD;AACzD,+EAA6D;AAC7D,8EAA4D;AAC5D,mGAAiF;AACjF,sFAAoE;AACpE,0FAAwE;AACxE,gFAA8D;AAC9D,2EAAyD;AACzD,2EAAyD;AACzD,2EAAyD;AAGzD,qFAA0G;AAAjG,yHAAA,qBAAqB,OAAA;AAAE,mHAAA,eAAe,OAAA;AAC/C,qFAA0G;AAAjG,yHAAA,qBAAqB,OAAA;AAAE,mHAAA,eAAe,OAAA;AAC/C,sEAAoE;AAA3D,yGAAA,UAAU,OAAA;AACnB,sEAAoE;AAA3D,yGAAA,UAAU,OAAA;AACnB,sGAAkG;AAAzF,yIAAA,yBAAyB,OAAA;AAClC,8FAAqF;AAA5E,4HAAA,gBAAgB,OAAA;AAGzB,8DAA4C;AAG5C,0CAAyC;AAAhC,gGAAA,MAAM,OAAA;AACf,0FAAuF;AAA9E,8HAAA,oBAAoB,OAAA;AAG7B,4EAA0D","sourcesContent":["// types & classes for convenience\nexport * from './parser/satisfactory/blueprint/blueprint.types';\nexport * from './parser/satisfactory/save/level.class';\nexport * from './parser/satisfactory/save/satisfactory-save';\nexport * from './parser/satisfactory/save/save.types';\nexport * from './parser/satisfactory/types/objects/SaveComponent';\nexport * from './parser/satisfactory/types/objects/SaveEntity';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/BasicProperty';\nexport * from './parser/satisfactory/types/property/generic/BoolProperty';\nexport * from './parser/satisfactory/types/property/generic/ByteProperty';\nexport * from './parser/satisfactory/types/property/generic/DoubleProperty';\nexport * from './parser/satisfactory/types/property/generic/EnumProperty';\nexport * from './parser/satisfactory/types/property/generic/FloatProperty';\nexport * from './parser/satisfactory/types/property/generic/Int32Property';\nexport * from './parser/satisfactory/types/property/generic/Int64Property';\nexport * from './parser/satisfactory/types/property/generic/Int8Property';\nexport * from './parser/satisfactory/types/property/generic/MapProperty';\nexport * from './parser/satisfactory/types/property/generic/ObjectProperty';\nexport * from './parser/satisfactory/types/property/generic/SetProperty';\nexport * from './parser/satisfactory/types/property/generic/StrProperty';\nexport * from './parser/satisfactory/types/property/generic/StructProperty';\nexport * from './parser/satisfactory/types/property/generic/TextProperty';\nexport * from './parser/satisfactory/types/property/generic/Uint32Property';\nexport * from './parser/satisfactory/types/property/generic/Uint64Property';\nexport * from './parser/satisfactory/types/property/generic/Uint8Property';\nexport * from './parser/satisfactory/types/property/PropertiesList';\nexport * from './parser/satisfactory/types/property/special/SpecialAnyProperties';\nexport * from './parser/satisfactory/types/property/special/SpecialProperties';\nexport * from './parser/satisfactory/types/structs/col4';\nexport * from './parser/satisfactory/types/structs/DynamicStructPropertyValue';\nexport * from './parser/satisfactory/types/structs/GUID';\nexport * from './parser/satisfactory/types/structs/GUIDInfo';\nexport * from './parser/satisfactory/types/structs/MD5Hash';\nexport * from './parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange';\nexport * from './parser/satisfactory/types/structs/ObjectReference';\nexport * from './parser/satisfactory/types/structs/SoftObjectReference';\nexport * from './parser/satisfactory/types/structs/Transform';\nexport * from './parser/satisfactory/types/structs/vec2';\nexport * from './parser/satisfactory/types/structs/vec3';\nexport * from './parser/satisfactory/types/structs/vec4';\n\n// should better be removed in a future update to prevent shenanigans.\nexport { BlueprintConfigReader, BlueprintReader } from './parser/satisfactory/blueprint/blueprint-reader';\nexport { BlueprintConfigWriter, BlueprintWriter } from './parser/satisfactory/blueprint/blueprint-writer';\nexport { SaveReader } from './parser/satisfactory/save/save-reader';\nexport { SaveWriter } from './parser/satisfactory/save/save-writer';\nexport { SaveStreamJsonStringifier } from './parser/stream/reworked/save-stream-json-stringifier';\nexport { SaveStreamWriter } from './parser/stream/reworked/save-stream-writer.class';\n\n// errors\nexport * from './parser/error/parser.error';\n\n// facade\nexport { Parser } from './parser/parser';\nexport { ReadableStreamParser } from './parser/stream/reworked/readable-stream-parser';\n\n// edit\nexport * from './parser/satisfactory/edit/edit-constants';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignment.enum.d.ts","sourceRoot":"","sources":["../../../src/parser/byte/alignment.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS;IACpB,UAAU,IAAA;IACV,aAAa,IAAA;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alignment.enum.js","sourceRoot":"","sources":["../../../src/parser/byte/alignment.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAGX;AAHD,WAAY,SAAS;IACpB,qDAAU,CAAA;IACV,2DAAa,CAAA;AACd,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB","sourcesContent":["export enum Alignment {\n\tBIG_ENDIAN,\n\tLITTLE_ENDIAN\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-operable.interface.d.ts","sourceRoot":"","sources":["../../../src/parser/byte/binary-operable.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAK7C,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,SAAS,CAAC;IAErB,iBAAiB,EAAE,MAAM,MAAM,CAAC;IAChC,eAAe,EAAE,MAAM,MAAM,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-operable.interface.js","sourceRoot":"","sources":["../../../src/parser/byte/binary-operable.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { Alignment } from \"./alignment.enum\";\n\n/**\n * Describes the ability to operate bytes with the help of some sort of buffer.\n */\nexport interface BinaryOperable {\n alignment: Alignment;\n\n getBufferPosition: () => number;\n getBufferLength: () => number;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-readable.interface.d.ts","sourceRoot":"","sources":["../../../src/parser/byte/binary-readable.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAK7D,MAAM,WAAW,cAAe,SAAQ,cAAc;IAElD,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC;IACzC,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,MAAM,CAAC;IAEzB,iBAAiB,EAAE,MAAM,MAAM,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-readable.interface.js","sourceRoot":"","sources":["../../../src/parser/byte/binary-readable.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { BinaryOperable } from \"./binary-operable.interface\";\n\n/**\n * Describes the ability to read bytes in different forms.\n */\nexport interface BinaryReadable extends BinaryOperable {\n\n skipBytes: (count?: number) => void;\n readBytes: (count: number) => Uint8Array;\n readByte: () => number;\n readHex: (count: number) => string;\n readInt8: () => number;\n readUint8: () => number;\n readInt16: () => number;\n readUint16: () => number;\n readInt32: () => number;\n readUint32: () => number;\n readInt64: () => bigint;\n readUint64: () => bigint;\n readFloat32: () => number;\n readDouble: () => number;\n readString: () => string;\n\n getBufferProgress: () => number;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-writable.interface.d.ts","sourceRoot":"","sources":["../../../src/parser/byte/binary-writable.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAK7D,MAAM,WAAW,cAAe,SAAQ,cAAc;IAElD,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC,iBAAiB,EAAE,MAAM,MAAM,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-writable.interface.js","sourceRoot":"","sources":["../../../src/parser/byte/binary-writable.interface.ts"],"names":[],"mappings":"","sourcesContent":["import { BinaryOperable } from \"./binary-operable.interface\";\n\n/**\n * Describes the ability to read bytes in different forms.\n */\nexport interface BinaryWritable extends BinaryOperable {\n\n skipBytes: (count?: number) => void;\n jumpTo(position: number): void;\n writeByte: (value: number) => void;\n writeBytes: (bytes: Uint8Array) => void;\n writeBytesArray: (bytes: number[]) => void;\n writeInt8: (value: number) => void;\n writeUint8: (value: number) => void;\n writeInt16: (value: number) => void;\n writeUint16: (value: number) => void;\n writeInt32: (value: number) => void;\n writeUint32: (value: number) => void;\n writeInt64: (value: bigint) => void;\n writeUint64: (value: bigint) => void;\n writeFloat32: (value: number) => void;\n writeDouble: (value: number) => void;\n writeString: (value: string) => void;\n\n getBufferProgress: () => number;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byte-reader.class.d.ts","sourceRoot":"","sources":["../../../src/parser/byte/byte-reader.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,8BAAsB,UAAW,YAAW,cAAc;IAEzD,SAAS,CAAC,UAAU,EAAG,QAAQ,CAAC;IAChC,SAAS,CAAC,UAAU,EAAG,WAAW,CAAC;IAC5B,SAAS,EAAE,SAAS,CAAC;IAE5B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAK;IAClC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAK;IAClC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAK;gBAElB,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS;IASlD,KAAK,CAAC,aAAa,EAAE,WAAW;IAWhC,SAAS,CAAC,UAAU,SAAI,GAAG,IAAI;IAI/B,QAAQ,IAAI,MAAM;IAIlB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAG3C,OAAO,CAAC,wBAAwB;IAGzB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;IAG9D,QAAQ,IAAI,MAAM;IAIlB,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;IAKnB,UAAU,IAAI,MAAM;IAKpB,SAAS,IAAI,MAAM;IAKnB,UAAU,IAAI,MAAM;IAKpB,QAAQ,IAAI,MAAM;IAKlB,SAAS,IAAI,MAAM;IAGnB,UAAU,IAAI,MAAM;IAMpB,WAAW,IAAI,MAAM;IAKrB,UAAU,IAAI,MAAM;IAKpB,UAAU,IAAI,MAAM;IAgCpB,iBAAiB,QAAO,MAAM,CAAqB;IAEnD,cAAc,UAAW,MAAM,OAAO,MAAM,GAAG,SAAS,KAAG,WAAW,CAA6C;IAEnH,iBAAiB,QAAO,MAAM,CAAyD;IAEvF,eAAe,QAAO,MAAM,CAAsC;IAElE,SAAS,QAAO,WAAW,CAA2B;CAC7D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ByteReader = void 0;
|
|
4
|
+
const parser_error_1 = require("../error/parser.error");
|
|
4
5
|
const alignment_enum_1 = require("./alignment.enum");
|
|
5
6
|
class ByteReader {
|
|
6
7
|
constructor(fileBuffer, alignment) {
|
|
@@ -17,7 +18,7 @@ class ByteReader {
|
|
|
17
18
|
}
|
|
18
19
|
reset(newFileBuffer) {
|
|
19
20
|
this.fileBuffer = newFileBuffer;
|
|
20
|
-
this.bufferView = new DataView(newFileBuffer, 0,
|
|
21
|
+
this.bufferView = new DataView(newFileBuffer, 0, this.fileBuffer.byteLength);
|
|
21
22
|
this.maxByte = newFileBuffer.byteLength;
|
|
22
23
|
this.currentByte = 0;
|
|
23
24
|
this.handledByte = 0;
|
|
@@ -110,10 +111,9 @@ class ByteReader {
|
|
|
110
111
|
return string.join('');
|
|
111
112
|
}
|
|
112
113
|
catch (error) {
|
|
113
|
-
|
|
114
|
-
console.log(errorMessage, error);
|
|
115
|
-
throw error;
|
|
114
|
+
throw new parser_error_1.CorruptSaveError(`Cannot read UTF8 string of length ${strLength} at position ${this.currentByte}.`);
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
118
|
exports.ByteReader = ByteReader;
|
|
119
|
+
//# sourceMappingURL=byte-reader.class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byte-reader.class.js","sourceRoot":"","sources":["../../../src/parser/byte/byte-reader.class.ts"],"names":[],"mappings":";;;AAAA,wDAAyD;AACzD,qDAA6C;AAI7C,MAAsB,UAAU;IAU/B,YAAY,UAAuB,EAAE,SAAoB;QAJ/C,gBAAW,GAAW,CAAC,CAAC;QACxB,gBAAW,GAAW,CAAC,CAAC;QACxB,YAAO,GAAW,CAAC,CAAC;QA2HvB,sBAAiB,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC;QAEnD,mBAAc,GAAG,CAAC,KAAa,EAAE,GAAuB,EAAe,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAEnH,sBAAiB,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC;QAEvF,oBAAe,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC;QAElE,cAAS,GAAG,GAAgB,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAhI5D,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC;IAMM,KAAK,CAAC,aAA0B;QACtC,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC,EAA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C,UAAU,EAAE,CAAC;YAC7J,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC;QAGD,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;YACnG,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;YACtB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC;QAGD,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YACjG,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC;YACtB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACd,MAAM,IAAI,+BAAgB,CAAC,qCAAqC,SAAS,gBAAgB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QAC/G,CAAC;IACF,CAAC;CAWD;AA5ID,gCA4IC","sourcesContent":["import { CorruptSaveError } from '../error/parser.error';\nimport { Alignment } from \"./alignment.enum\";\nimport { BinaryReadable } from \"./binary-readable.interface\";\n\n/** @public */\nexport abstract class ByteReader implements BinaryReadable {\n\n\tprotected bufferView!: DataView;\n\tprotected fileBuffer!: ArrayBuffer;\n\tpublic alignment: Alignment;\n\n\tprotected currentByte: number = 0;\n\tprotected handledByte: number = 0;\n\tprotected maxByte: number = 0;\n\n\tconstructor(fileBuffer: ArrayBuffer, alignment: Alignment) {\n\t\tthis.alignment = alignment;\n\t\tthis.reset(fileBuffer);\n\t}\n\n\t/**\n\t * Resets the reader on the given arraybuffer to start from the beginning.\n\t * @param newFileBuffer the new array buffer to be read.\n\t */\n\tpublic reset(newFileBuffer: ArrayBuffer) {\n\t\tthis.fileBuffer = newFileBuffer;\n\t\tthis.bufferView = new DataView(newFileBuffer, 0, this.fileBuffer.byteLength);\n\t\tthis.maxByte = newFileBuffer.byteLength;\n\t\tthis.currentByte = 0;\n\t\tthis.handledByte = 0;\n\t}\n\n\t/*\n\t * Byte Manipulation\n\t */\n\tpublic skipBytes(byteLength = 1): void {\n\t\tthis.currentByte += byteLength;\n\t\treturn;\n\t}\n\tpublic readByte(): number {\n\t\t// TODO can i not just readByte() ??\n\t\treturn parseInt(this.bufferView.getUint8(this.currentByte++).toString());\n\t}\n\tpublic readBytes(count: number): Uint8Array {\n\t\treturn new Uint8Array(new Array(count).fill(0).map(pl => this.bufferView.getUint8(this.currentByte++)));\n\t}\n\tprivate uint8ToHexRepresentation(byte: number): string {\n\t\treturn ('0' + byte.toString(16)).slice(-2);\n\t}\n\tpublic readHex(byteLength: number, hexSeparator: string = ''): string {\n\t\treturn Array.from(this.readBytes(byteLength)).map(byte => this.uint8ToHexRepresentation(byte)).join(hexSeparator);\n\t}\n\tpublic readInt8(): number {\n\t\tlet data = this.bufferView.getInt8(this.currentByte++);\n\t\treturn data;\n\t}\n\tpublic readUint8(): number {\n\t\tlet data = this.bufferView.getUint8(this.currentByte++);\n\t\treturn data;\n\t}\n\tpublic readInt16(): number {\n\t\tlet data = this.bufferView.getInt16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 2;\n\t\treturn data;\n\t}\n\tpublic readUint16(): number {\n\t\tlet data = this.bufferView.getUint16(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 2;\n\t\treturn data;\n\t}\n\tpublic readInt32(): number {\n\t\tlet data = this.bufferView.getInt32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 4;\n\t\treturn data;\n\t}\n\tpublic readUint32(): number {\n\t\tlet data = this.bufferView.getUint32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 4;\n\t\treturn data;\n\t}\n\tpublic readLong(): bigint {\n\t\tlet data = this.bufferView.getBigInt64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 8;\n\t\treturn data;\n\t}\n\tpublic readInt64(): bigint {\n\t\treturn this.readLong();\n\t}\n\tpublic readUint64(): bigint {\n\t\tlet data = this.bufferView.getBigUint64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 8;\n\t\treturn data;\n\t}\n\n\tpublic readFloat32(): number {\n\t\tlet data = this.bufferView.getFloat32(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 4;\n\t\treturn data;\n\t}\n\tpublic readDouble(): number {\n\t\tlet data = this.bufferView.getFloat64(this.currentByte, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 8;\n\t\treturn data;\n\t}\n\tpublic readString(): string {\n\t\tlet strLength = this.readInt32();\n\t\tlet startBytes = this.currentByte;\n\n\t\tif (strLength === 0) {\n\t\t\treturn '';\n\t\t}\n\n\t\t// Range error!\n\t\tif (strLength > (this.bufferView.buffer.byteLength - this.currentByte)) {\n\t\t\tlet errorMessage = `Cannot read string of length ${strLength} at position ${this.currentByte} as it exceeds the end at ${this.bufferView.buffer.byteLength}`;\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\t// it uses UTF16 if text is non-ascii, even if it would fit into UTF8.\n\t\tif (strLength < 0) {\n\t\t\tconst string = new Array(-strLength - 1).fill('').map(c => String.fromCharCode(this.readUint16()));\n\t\t\tthis.currentByte += 2;\n\t\t\treturn string.join('');\n\t\t}\n\n\t\t//default UTF-8\n\t\ttry {\n\t\t\tconst string = new Array(strLength - 1).fill('').map(c => String.fromCharCode(this.readUint8()));\n\t\t\tthis.currentByte += 1;\n\t\t\treturn string.join('');\n\t\t}\n\t\tcatch (error) {\n\t\t\tthrow new CorruptSaveError(`Cannot read UTF8 string of length ${strLength} at position ${this.currentByte}.`);\n\t\t}\n\t}\n\n\tpublic getBufferPosition = (): number => this.currentByte;\n\n\tpublic getBufferSlice = (begin: number, end: number | undefined): ArrayBuffer => this.bufferView.buffer.slice(begin, end);\n\n\tpublic getBufferProgress = (): number => this.currentByte / this.bufferView.buffer.byteLength;\n\n\tpublic getBufferLength = (): number => this.bufferView.buffer.byteLength;\n\n\tpublic getBuffer = (): ArrayBuffer => this.bufferView.buffer;\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byte-writer.class.d.ts","sourceRoot":"","sources":["../../../src/parser/byte/byte-writer.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,8BAAsB,UAAW,YAAW,cAAc;IAElD,SAAS,EAAE,SAAS,CAAC;IAC5B,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC;IAE/B,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC;gBAElB,SAAS,EAAE,SAAS,EAAE,UAAU,GAAE,MAAY;IAUnD,SAAS,CAAC,KAAK,GAAE,MAAU,GAAG,IAAI;IAIlC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIzB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK9B,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;IAGtC,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAInC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK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G,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,GAAG,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO,GAAG,CAAC,MAAM,CAAC;IACnB,CAAC;IAAA,CAAC;;AAnKH,gCAoKC;AAtDc,4BAAiB,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,AAA3D,CAA4D","sourcesContent":["\nimport { Alignment } from \"./alignment.enum\";\nimport { BinaryWritable } from './binary-writable.interface';\n\n/** @public */\nexport abstract class ByteWriter implements BinaryWritable {\n\n\tpublic alignment: Alignment;\n\tprotected bufferArray: ArrayBuffer;\n\tprotected bufferView: DataView;\n\n\tprotected currentByte: number;\n\n\tconstructor(alignment: Alignment, bufferSize: number = 500) {\n\t\tthis.alignment = alignment;\n\t\tthis.bufferArray = new ArrayBuffer(bufferSize);\n\t\tthis.bufferView = new DataView(this.bufferArray);\n\t\tthis.currentByte = 0;\n\t}\n\n\t/*\n\t * Byte Manipulation\n\t */\n\tpublic skipBytes(count: number = 1): void {\n\t\tthis.extendBufferIfNeeded(count);\n\t\tthis.currentByte += count;\n\t}\n\tpublic jumpTo(pos: number): void {\n\t\tconst count = pos - this.getBufferPosition();\n\t\tthis.skipBytes(count);\n\t}\n\tpublic writeByte(value: number): void {\n\t\tthis.extendBufferIfNeeded(1);\n\t\tthis.bufferView.setUint8(this.currentByte, value);\n\t\tthis.currentByte += 1;\n\t}\n\tpublic writeBytesArray(bytes: number[]): void {\n\t\tthis.writeBytes(new Uint8Array(bytes));\n\t}\n\tpublic writeBytes(bytes: Uint8Array): void {\n\t\tthis.extendBufferIfNeeded(bytes.length);\n\t\tbytes.forEach(byte => this.bufferView.setUint8(this.currentByte++, byte));\n\t}\n\tpublic writeInt8(value: number): void {\n\t\tthis.extendBufferIfNeeded(1);\n\t\tthis.bufferView.setInt8(this.currentByte, value);\n\t\tthis.currentByte += 1;\n\t}\n\tpublic writeUint8(value: number): void {\n\t\tthis.writeByte(value);\n\t}\n\tpublic writeInt16(value: number): void {\n\t\tthis.extendBufferIfNeeded(2);\n\t\tthis.bufferView.setInt16(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 2;\n\t}\n\tpublic writeUint16(value: number): void {\n\t\tthis.extendBufferIfNeeded(2);\n\t\tthis.bufferView.setUint16(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 2;\n\t}\n\tpublic writeInt32(value: number): void {\n\t\tthis.extendBufferIfNeeded(4);\n\t\tthis.bufferView.setInt32(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 4;\n\t}\n\tpublic writeUint32(value: number): void {\n\t\tthis.extendBufferIfNeeded(4);\n\t\tthis.bufferView.setUint32(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 4;\n\t}\n\tpublic writeInt64(value: bigint): void {\n\t\tthis.extendBufferIfNeeded(8);\n\t\tthis.bufferView.setBigInt64(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 8;\n\t}\n\tpublic writeUint64(value: bigint): void {\n\t\tthis.extendBufferIfNeeded(8);\n\t\tthis.bufferView.setBigUint64(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 8;\n\t}\n\tpublic writeFloat32(value: number): void {\n\t\tthis.extendBufferIfNeeded(4);\n\t\tthis.bufferView.setFloat32(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 4;\n\t}\n\tpublic writeDouble(value: number): void {\n\t\tthis.extendBufferIfNeeded(8);\n\t\tthis.bufferView.setFloat64(this.currentByte, value, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\tthis.currentByte += 8;\n\t}\n\tpublic writeString(value: string) {\n\t\tif (value.length === 0) {\n\t\t\tthis.writeInt32(0);\n\t\t\treturn;\n\t\t}\n\n\t\t// if it's safe to use ASCII, use UTF8.\n\t\tif (ByteWriter.IsASCIICompatible(value)) {\n\t\t\tthis.writeInt32(value.length + 1);\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tthis.writeByte(value.charCodeAt(i));\n\t\t\t}\n\t\t\tthis.writeUint8(0);\n\t\t}\n\t\t// write UTF16\n\t\telse {\n\t\t\tthis.writeInt32(-value.length - 1);\n\t\t\tfor (let i = 0; i < value.length; i++) {\n\t\t\t\tthis.writeUint16(value.charCodeAt(i));\n\t\t\t}\n\t\t\tthis.writeUint16(0);\n\t\t}\n\t}\n\n\tpublic static IsASCIICompatible = (value: string): boolean => /^[\\x00-\\x7F]*$/.test(value);\n\n\tpublic getBufferPosition = (): number => this.currentByte;\n\n\tpublic getBufferSlice = (start: number, end?: number): ArrayBuffer => this.bufferArray.slice(start, end);\n\n\tpublic getBufferLength = (): number => this.bufferArray.byteLength;\n\n\tpublic getBufferProgress = (): number => this.currentByte / this.bufferArray.byteLength;\n\n\tpublic writeBinarySizeFromPosition(lenIndicatorPos: number, start: number): void {\n\t\tconst after = this.getBufferPosition();\n\t\tconst writtenBytes = after - start;\n\t\tthis.jumpTo(lenIndicatorPos);\n\t\tthis.writeInt32(writtenBytes);\n\t\tthis.jumpTo(after);\n\t}\n\n\t/**\n\t * automatically extends the current buffer if the given space exceeds the available rest capacity of the current buffer.\n\t * @param countNeededBytes the needed space\n\t * @param factor how big the appended buffer should be in comparison to the current one. Values >= 1 make sense.\n\t */\n\tprotected extendBufferIfNeeded(countNeededBytes: number, factor: number = 1.5): void {\n\t\tif (this.currentByte + countNeededBytes > this.bufferView.byteLength) {\n\t\t\tthis.bufferArray = ByteWriter.AppendBuffer(this.bufferArray, new ArrayBuffer(factor * this.bufferArray.byteLength));\n\t\t\tthis.bufferView = new DataView(this.bufferArray);\n\t\t}\n\t}\n\n\tprotected truncateBuffer(): void {\n\t\tthis.bufferArray = this.bufferArray.slice(0, this.currentByte);\n\t}\n\n\tpublic endWriting(): ArrayBuffer {\n\t\tthis.truncateBuffer();\n\t\treturn this.bufferArray;\n\t}\n\n\tpublic static ToInt32(num: number): Uint8Array {\n\t\treturn new Uint8Array([\n\t\t\t(num & 0xff000000) >> 24,\n\t\t\t(num & 0x00ff0000) >> 16,\n\t\t\t(num & 0x0000ff00) >> 8,\n\t\t\t(num & 0x000000ff)\n\t\t]);\n\t}\n\n\tpublic static AppendBuffer(buffer1: ArrayBuffer, buffer2: ArrayBuffer): ArrayBuffer {\n\t\tvar tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);\n\t\ttmp.set(new Uint8Array(buffer1), 0);\n\t\ttmp.set(new Uint8Array(buffer2), buffer1.byteLength);\n\t\treturn tmp.buffer;\n\t};\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.error.d.ts","sourceRoot":"","sources":["../../../src/parser/error/parser.error.ts"],"names":[],"mappings":"AAEA,qBAAa,WAAY,SAAQ,KAAK;gBACtB,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAI5C;AAED,qBAAa,uBAAwB,SAAQ,WAAW;gBACxC,OAAO,CAAC,EAAE,MAAM;CAG/B;AAED,qBAAa,gBAAiB,SAAQ,WAAW;gBACjC,OAAO,CAAC,EAAE,MAAM;CAG/B;AAED,qBAAa,uBAAwB,SAAQ,WAAW;gBACxC,OAAO,CAAC,EAAE,MAAM;CAG/B;AAED,qBAAa,YAAa,SAAQ,WAAW;gBAC7B,OAAO,CAAC,EAAE,MAAM;CAG/B;AAED,qBAAa,kBAAmB,SAAQ,WAAW;gBACnC,OAAO,CAAC,EAAE,MAAM;CAG/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.error.js","sourceRoot":"","sources":["../../../src/parser/error/parser.error.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAY,SAAQ,KAAK;IAClC,YAAY,IAAY,EAAE,OAAe;QACrC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ;AALD,kCAKC;AAED,MAAa,uBAAwB,SAAQ,WAAW;IACpD,YAAY,OAAgB;QACxB,KAAK,CAAC,yBAAyB,EAAE,OAAO,IAAI,qCAAqC,CAAC,CAAC;IACvF,CAAC;CACJ;AAJD,0DAIC;AAED,MAAa,gBAAiB,SAAQ,WAAW;IAC7C,YAAY,OAAgB;QACxB,KAAK,CAAC,kBAAkB,EAAE,OAAO,IAAI,wCAAwC,CAAC,CAAC;IACnF,CAAC;CACJ;AAJD,4CAIC;AAED,MAAa,uBAAwB,SAAQ,WAAW;IACpD,YAAY,OAAgB;QACxB,KAAK,CAAC,yBAAyB,EAAE,OAAO,IAAI,0CAA0C,CAAC,CAAC;IAC5F,CAAC;CACJ;AAJD,0DAIC;AAED,MAAa,YAAa,SAAQ,WAAW;IACzC,YAAY,OAAgB;QACxB,KAAK,CAAC,cAAc,EAAE,OAAO,IAAI,sBAAsB,CAAC,CAAC;IAC7D,CAAC;CACJ;AAJD,oCAIC;AAED,MAAa,kBAAmB,SAAQ,WAAW;IAC/C,YAAY,OAAgB;QACxB,KAAK,CAAC,oBAAoB,EAAE,OAAO,IAAI,0BAA0B,CAAC,CAAC;IACvE,CAAC;CACJ;AAJD,gDAIC","sourcesContent":["\n\nexport class ParserError extends Error {\n constructor(name: string, message: string) {\n super(message);\n this.name = name;\n }\n}\n\nexport class UnsupportedVersionError extends ParserError {\n constructor(message?: string) {\n super('UnsupportedVersionError', message ?? 'This save version is not supported.');\n }\n}\n\nexport class CorruptSaveError extends ParserError {\n constructor(message?: string) {\n super('CorruptSaveError', message ?? 'This save data is most likely corrupt.');\n }\n}\n\nexport class CompressionLibraryError extends ParserError {\n constructor(message?: string) {\n super('CompressionLibraryError', message ?? 'Failed to compress/decompress save data.');\n }\n}\n\nexport class TimeoutError extends ParserError {\n constructor(message?: string) {\n super('TimeoutError', message ?? 'Operation timed out.');\n }\n}\n\nexport class UnimplementedError extends ParserError {\n constructor(message?: string) {\n super('UnimplementedError', message ?? 'Unimplemented Operation.');\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.types.d.ts","sourceRoot":"","sources":["../../src/parser/file.types.ts"],"names":[],"mappings":"AACA,oBAAY,wBAAwB;IAChC,IAAI,IAAI;CACX;AAED,MAAM,MAAM,oBAAoB,GAAG;IAC/B,oBAAoB,CAAC,EAAE,wBAAwB,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,+BAA+B,EAAE,MAAM,CAAC;CAC3C,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAA;CACzB,CAAA"}
|
|
@@ -5,3 +5,4 @@ var CompressionAlgorithmCode;
|
|
|
5
5
|
(function (CompressionAlgorithmCode) {
|
|
6
6
|
CompressionAlgorithmCode[CompressionAlgorithmCode["ZLIB"] = 3] = "ZLIB";
|
|
7
7
|
})(CompressionAlgorithmCode || (exports.CompressionAlgorithmCode = CompressionAlgorithmCode = {}));
|
|
8
|
+
//# sourceMappingURL=file.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.types.js","sourceRoot":"","sources":["../../src/parser/file.types.ts"],"names":[],"mappings":";;;AACA,IAAY,wBAEX;AAFD,WAAY,wBAAwB;IAChC,uEAAQ,CAAA;AACZ,CAAC,EAFW,wBAAwB,wCAAxB,wBAAwB,QAEnC","sourcesContent":["\nexport enum CompressionAlgorithmCode {\n ZLIB = 3,\n}\n\nexport type ChunkCompressionInfo = {\n compressionAlgorithm?: CompressionAlgorithmCode;\n chunkHeaderSize: number;\n packageFileTag: number;\n maxUncompressedChunkContentSize: number;\n}\n\nexport type ChunkSummary = {\n uncompressedSize: number,\n compressedSize: number\n}\n"]}
|
package/build/parser/parser.d.ts
CHANGED
|
@@ -2,11 +2,26 @@ import { ChunkSummary } from "./file.types";
|
|
|
2
2
|
import { Blueprint } from "./satisfactory/blueprint/blueprint.types";
|
|
3
3
|
import { SatisfactorySave } from "./satisfactory/save/satisfactory-save";
|
|
4
4
|
export declare class Parser {
|
|
5
|
-
static
|
|
6
|
-
|
|
5
|
+
static ParseSave(name: string, bytes: Uint8Array, options?: Partial<{
|
|
6
|
+
onDecompressedSaveBody: (buffer: ArrayBuffer) => void;
|
|
7
|
+
onProgressCallback: (progress: number, msg?: string) => void;
|
|
8
|
+
}>): SatisfactorySave;
|
|
9
|
+
static WriteSave(save: SatisfactorySave, options?: Partial<{
|
|
10
|
+
onBinaryBeforeCompressing: (buffer: ArrayBuffer) => void;
|
|
11
|
+
onHeader: (header: Uint8Array) => void;
|
|
12
|
+
onChunk: (chunk: Uint8Array) => void;
|
|
13
|
+
}>): ChunkSummary[];
|
|
14
|
+
static WriteBlueprintFiles(blueprint: Blueprint, options?: Partial<{
|
|
15
|
+
onMainFileBinaryBeforeCompressing: (binary: ArrayBuffer) => void;
|
|
16
|
+
onMainFileHeader: (header: Uint8Array) => void;
|
|
17
|
+
onMainFileChunk: (chunk: Uint8Array) => void;
|
|
18
|
+
}>): {
|
|
7
19
|
mainFileChunkSummary: ChunkSummary[];
|
|
8
20
|
configFileBinary: ArrayBuffer;
|
|
9
21
|
};
|
|
10
|
-
static ParseBlueprintFiles(name: string, blueprintFile: Buffer, blueprintConfigFile: Buffer,
|
|
22
|
+
static ParseBlueprintFiles(name: string, blueprintFile: Buffer, blueprintConfigFile: Buffer, options?: Partial<{
|
|
23
|
+
onDecompressedBlueprintBody: (buffer: ArrayBuffer) => void;
|
|
24
|
+
}>): Blueprint;
|
|
11
25
|
static JSONStringifyModified: (obj: any, indent?: number) => string;
|
|
12
26
|
}
|
|
27
|
+
//# sourceMappingURL=parser.d.ts.map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AAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,mBAAmB,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;QACjB,2BAA2B,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;KAC1D,CAAC,GACA,SAAS;IAmCZ,OAAc,qBAAqB,QAAS,GAAG,WAAU,MAAM,KAAO,MAAM,CAQjE;CAEX"}
|
package/build/parser/parser.js
CHANGED
|
@@ -1,11 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Parser = void 0;
|
|
4
|
+
const parser_error_1 = require("./error/parser.error");
|
|
4
5
|
const blueprint_reader_1 = require("./satisfactory/blueprint/blueprint-reader");
|
|
5
6
|
const blueprint_writer_1 = require("./satisfactory/blueprint/blueprint-writer");
|
|
7
|
+
const satisfactory_save_1 = require("./satisfactory/save/satisfactory-save");
|
|
8
|
+
const save_reader_1 = require("./satisfactory/save/save-reader");
|
|
6
9
|
const save_writer_1 = require("./satisfactory/save/save-writer");
|
|
7
10
|
class Parser {
|
|
8
|
-
static
|
|
11
|
+
static ParseSave(name, bytes, options) {
|
|
12
|
+
const reader = new save_reader_1.SaveReader(bytes.buffer, options?.onProgressCallback);
|
|
13
|
+
const header = reader.readHeader();
|
|
14
|
+
const save = new satisfactory_save_1.SatisfactorySave(name, header);
|
|
15
|
+
const roughSaveVersion = save_reader_1.SaveReader.GetRoughSaveVersion(header.saveVersion, header.saveHeaderType);
|
|
16
|
+
if (roughSaveVersion === '<U6') {
|
|
17
|
+
throw new parser_error_1.UnsupportedVersionError('Game Version < U6 is not supported.');
|
|
18
|
+
}
|
|
19
|
+
else if (roughSaveVersion === 'U6/U7') {
|
|
20
|
+
throw new parser_error_1.UnsupportedVersionError('Game Version U6/U7 is not supported in this package version. Consider downgrading to the latest package version supporting it, which is 0.0.34');
|
|
21
|
+
}
|
|
22
|
+
else if (roughSaveVersion === 'U8') {
|
|
23
|
+
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.3.7');
|
|
24
|
+
}
|
|
25
|
+
const inflateResult = reader.inflateChunks();
|
|
26
|
+
save.compressionInfo = reader.compressionInfo;
|
|
27
|
+
if (options?.onDecompressedSaveBody !== undefined) {
|
|
28
|
+
options.onDecompressedSaveBody(reader.getBuffer());
|
|
29
|
+
}
|
|
30
|
+
save.gridHash = reader.readSaveBodyHash();
|
|
31
|
+
save.grids = reader.readGrids();
|
|
32
|
+
save.levels = reader.readLevels();
|
|
33
|
+
return save;
|
|
34
|
+
}
|
|
35
|
+
static WriteSave(save, options) {
|
|
9
36
|
const writer = new save_writer_1.SaveWriter();
|
|
10
37
|
save_writer_1.SaveWriter.WriteHeader(writer, save.header);
|
|
11
38
|
const posAfterHeader = writer.getBufferPosition();
|
|
@@ -13,10 +40,10 @@ class Parser {
|
|
|
13
40
|
save_writer_1.SaveWriter.WriteGrids(writer, save.grids);
|
|
14
41
|
save_writer_1.SaveWriter.WriteLevels(writer, save, save.header.buildVersion);
|
|
15
42
|
writer.endWriting();
|
|
16
|
-
const chunkSummary = writer.generateChunks(save.compressionInfo, posAfterHeader, onBinaryBeforeCompressing, onHeader, onChunk);
|
|
43
|
+
const chunkSummary = writer.generateChunks(save.compressionInfo, posAfterHeader, options?.onBinaryBeforeCompressing ?? (() => { }), options?.onHeader ?? (() => { }), options?.onChunk ?? (() => { }));
|
|
17
44
|
return chunkSummary;
|
|
18
45
|
}
|
|
19
|
-
static WriteBlueprintFiles(blueprint,
|
|
46
|
+
static WriteBlueprintFiles(blueprint, options) {
|
|
20
47
|
const blueprintWriter = new blueprint_writer_1.BlueprintWriter();
|
|
21
48
|
blueprint_writer_1.BlueprintWriter.SerializeHeader(blueprintWriter, blueprint.header);
|
|
22
49
|
const saveBodyPos = blueprintWriter.getBufferPosition();
|
|
@@ -24,7 +51,11 @@ class Parser {
|
|
|
24
51
|
blueprintWriter.endWriting();
|
|
25
52
|
let binaryChunks = [];
|
|
26
53
|
let binaryHeader;
|
|
27
|
-
const mainFileChunkSummary = blueprintWriter.generateChunks(blueprint.compressionInfo, saveBodyPos,
|
|
54
|
+
const mainFileChunkSummary = blueprintWriter.generateChunks(blueprint.compressionInfo, saveBodyPos, {
|
|
55
|
+
onBinaryBeforeCompressing: options?.onMainFileBinaryBeforeCompressing ?? (() => { }),
|
|
56
|
+
onHeader: options?.onMainFileHeader ?? (() => { }),
|
|
57
|
+
onChunk: options?.onMainFileChunk ?? (() => { })
|
|
58
|
+
});
|
|
28
59
|
const configWriter = new blueprint_writer_1.BlueprintConfigWriter();
|
|
29
60
|
blueprint_writer_1.BlueprintConfigWriter.SerializeConfig(configWriter, blueprint.config);
|
|
30
61
|
const configFileBinary = configWriter.endWriting();
|
|
@@ -33,13 +64,15 @@ class Parser {
|
|
|
33
64
|
configFileBinary
|
|
34
65
|
};
|
|
35
66
|
}
|
|
36
|
-
static ParseBlueprintFiles(name, blueprintFile, blueprintConfigFile,
|
|
67
|
+
static ParseBlueprintFiles(name, blueprintFile, blueprintConfigFile, options) {
|
|
37
68
|
const blueprintConfigReader = new blueprint_reader_1.BlueprintConfigReader(new Uint8Array(blueprintConfigFile).buffer);
|
|
38
69
|
const config = blueprint_reader_1.BlueprintConfigReader.ParseConfig(blueprintConfigReader);
|
|
39
70
|
const blueprintReader = new blueprint_reader_1.BlueprintReader(new Uint8Array(blueprintFile).buffer);
|
|
40
71
|
const header = blueprint_reader_1.BlueprintReader.ReadHeader(blueprintReader);
|
|
41
72
|
const inflateResult = blueprintReader.inflateChunks();
|
|
42
|
-
onDecompressedBlueprintBody
|
|
73
|
+
if (options?.onDecompressedBlueprintBody !== undefined) {
|
|
74
|
+
options.onDecompressedBlueprintBody(inflateResult.inflatedData);
|
|
75
|
+
}
|
|
43
76
|
const blueprintObjects = blueprint_reader_1.BlueprintReader.ParseObjects(blueprintReader);
|
|
44
77
|
const blueprint = {
|
|
45
78
|
name,
|
|
@@ -61,3 +94,4 @@ Parser.JSONStringifyModified = (obj, indent = 0) => JSON.stringify(obj, (key, va
|
|
|
61
94
|
}
|
|
62
95
|
return value;
|
|
63
96
|
}, indent);
|
|
97
|
+
//# sourceMappingURL=parser.js.map
|