@etothepii/satisfactory-file-parser 3.2.3 → 3.3.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/.vscode/settings.json +6 -0
- package/CHANGELOG.md +15 -1
- package/README.md +18 -1
- package/build/index.d.ts +14 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +15 -6
- package/build/index.js.map +1 -1
- package/build/parser/byte/byte-writer.class.d.ts +2 -0
- package/build/parser/byte/byte-writer.class.d.ts.map +1 -1
- package/build/parser/byte/byte-writer.class.js +8 -0
- package/build/parser/byte/byte-writer.class.js.map +1 -1
- package/build/parser/context/context.d.ts +2 -0
- package/build/parser/context/context.d.ts.map +1 -1
- package/build/parser/context/context.js.map +1 -1
- package/build/parser/parser.d.ts +2 -0
- package/build/parser/parser.d.ts.map +1 -1
- package/build/parser/parser.js +11 -7
- package/build/parser/parser.js.map +1 -1
- package/build/parser/satisfactory/blueprint/blueprint-header.js +5 -5
- package/build/parser/satisfactory/blueprint/blueprint-header.js.map +1 -1
- package/build/parser/satisfactory/save/level.d.ts.map +1 -1
- package/build/parser/satisfactory/save/level.js +32 -17
- package/build/parser/satisfactory/save/level.js.map +1 -1
- package/build/parser/satisfactory/types/objects/SaveObject.d.ts.map +1 -1
- package/build/parser/satisfactory/types/objects/SaveObject.js +24 -5
- package/build/parser/satisfactory/types/objects/SaveObject.js.map +1 -1
- package/build/parser/satisfactory/types/property/PropertiesList.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/PropertiesList.js +118 -97
- package/build/parser/satisfactory/types/property/PropertiesList.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/AbstractBaseProperty.d.ts +1 -0
- package/build/parser/satisfactory/types/property/generic/AbstractBaseProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/AbstractBaseProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts +2 -2
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.js +3 -4
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty.js +1 -1
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts +2 -2
- package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/ByteProperty.js +3 -4
- package/build/parser/satisfactory/types/property/generic/ByteProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts +2 -2
- package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/EnumProperty.js +3 -4
- package/build/parser/satisfactory/types/property/generic/EnumProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts +2 -2
- package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/MapProperty.js +8 -5
- package/build/parser/satisfactory/types/property/generic/MapProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts +2 -2
- package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js +3 -4
- package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.js +1 -1
- package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts +9 -7
- package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/StructProperty.js +81 -47
- package/build/parser/satisfactory/types/property/generic/StructProperty.js.map +1 -1
- package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts +1 -1
- package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts.map +1 -1
- package/build/parser/satisfactory/types/structs/GUIDInfo.js +1 -1
- package/build/parser/satisfactory/types/structs/GUIDInfo.js.map +1 -1
- package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.d.ts +11 -0
- package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.js +31 -0
- package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.js.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FColor.d.ts +9 -0
- package/build/parser/satisfactory/types/structs/binary/FColor.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FColor.js +14 -0
- package/build/parser/satisfactory/types/structs/binary/FColor.js.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FLinearColor.d.ts +9 -0
- package/build/parser/satisfactory/types/structs/binary/FLinearColor.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FLinearColor.js +14 -0
- package/build/parser/satisfactory/types/structs/binary/FLinearColor.js.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/GUID.d.ts +8 -0
- package/build/parser/satisfactory/types/structs/binary/GUID.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/GUID.js +22 -0
- package/build/parser/satisfactory/types/structs/binary/GUID.js.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts +2 -2
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts.map +1 -1
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js +2 -2
- package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js.map +1 -1
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.d.ts +13 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.js +21 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.js.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINLuaRuntimePersistenceState.d.ts +22 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINLuaRuntimePersistenceState.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINLuaRuntimePersistenceState.js +40 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINLuaRuntimePersistenceState.js.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.d.ts +13 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.js +35 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.js.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.d.ts +12 -0
- package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.js +20 -0
- package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.js.map +1 -0
- package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -1
- package/build/parser/stream/reworked/readable-stream-parser.js +14 -11
- package/build/parser/stream/reworked/readable-stream-parser.js.map +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/BlueprintConfigReader.html +4 -4
- package/docs/classes/BlueprintReader.html +4 -4
- package/docs/classes/CompressionLibraryError.html +27 -6
- package/docs/classes/ContextReader.html +36 -0
- package/docs/classes/ContextWriter.html +41 -0
- package/docs/classes/CorruptBlueprintError.html +27 -6
- package/docs/classes/CorruptSaveError.html +27 -6
- package/docs/classes/Parser.html +8 -8
- package/docs/classes/ParserError.html +27 -6
- package/docs/classes/ReadableStreamParser.html +2 -2
- package/docs/classes/SatisfactorySave.html +2 -2
- package/docs/classes/SaveComponent.html +2 -2
- package/docs/classes/SaveEntity.html +2 -2
- package/docs/classes/SaveObject.html +2 -2
- package/docs/classes/SaveReader.html +4 -4
- package/docs/classes/SaveStreamJsonStringifier.html +2 -2
- package/docs/classes/SaveStreamWriter.html +2 -2
- package/docs/classes/SaveWriter.html +6 -4
- package/docs/classes/TimeoutError.html +27 -6
- package/docs/classes/UnimplementedError.html +27 -6
- package/docs/classes/UnsupportedVersionError.html +27 -6
- package/docs/enums/Alignment.html +3 -0
- package/docs/enums/BlueprintConfigVersion.html +2 -2
- package/docs/enums/BlueprintHeaderVersion.html +2 -2
- package/docs/enums/CompressionAlgorithmCode.html +2 -2
- package/docs/enums/FactoryGameCustomVersion.html +2 -2
- package/docs/enums/RuntimeBuildableInstanceDataVersion.html +2 -2
- package/docs/enums/SaveCustomVersion.html +10 -10
- package/docs/enums/SaveHeaderType.html +2 -2
- package/docs/functions/AbstractBaseProperty.Create.html +1 -1
- package/docs/functions/ArrayProperty.CalcOverhead.html +1 -1
- package/docs/functions/ArrayProperty.Parse.html +1 -1
- package/docs/functions/ArrayProperty.Serialize.html +1 -1
- package/docs/functions/BlueprintConfig.Parse.html +1 -1
- package/docs/functions/BlueprintConfig.Serialize.html +1 -1
- package/docs/functions/BlueprintHeader.Parse.html +1 -1
- package/docs/functions/BlueprintHeader.Serialize.html +1 -1
- package/docs/functions/BoolArrayProperty.Parse.html +1 -1
- package/docs/functions/BoolArrayProperty.Serialize.html +1 -1
- package/docs/functions/BoolProperty.CalcOverhead.html +1 -1
- package/docs/functions/BoolProperty.Parse.html +1 -1
- package/docs/functions/BoolProperty.ReadValue.html +1 -1
- package/docs/functions/BoolProperty.Serialize.html +1 -1
- package/docs/functions/BoolProperty.SerializeValue.html +1 -1
- package/docs/functions/BuildableSubsystemSpecialProperties.Parse.html +1 -1
- package/docs/functions/BuildableSubsystemSpecialProperties.Serialize.html +1 -1
- package/docs/functions/BuildableTypeInstance.Parse.html +1 -1
- package/docs/functions/BuildableTypeInstance.Serialize.html +1 -1
- package/docs/functions/ByteArrayProperty.Parse.html +1 -1
- package/docs/functions/ByteArrayProperty.Serialize.html +1 -1
- package/docs/functions/ByteProperty.CalcOverhead.html +1 -1
- package/docs/functions/ByteProperty.Parse.html +1 -1
- package/docs/functions/ByteProperty.ReadValue.html +1 -1
- package/docs/functions/ByteProperty.Serialize.html +1 -1
- package/docs/functions/ByteProperty.SerializeValue.html +1 -1
- package/docs/functions/CircuitSpecialProperties.Parse.html +1 -1
- package/docs/functions/CircuitSpecialProperties.Serialize.html +1 -1
- package/docs/functions/ConveyorChainActorSpecialProperties.Parse.html +1 -1
- package/docs/functions/ConveyorChainActorSpecialProperties.Serialize.html +1 -1
- package/docs/functions/ConveyorSpecialProperties.Parse.html +1 -1
- package/docs/functions/ConveyorSpecialProperties.Serialize.html +1 -1
- package/docs/functions/DoubleArrayProperty.Parse.html +1 -1
- package/docs/functions/DoubleArrayProperty.Serialize.html +1 -1
- package/docs/functions/DoubleProperty.CalcOverhead.html +1 -1
- package/docs/functions/DoubleProperty.Parse.html +1 -1
- package/docs/functions/DoubleProperty.ReadValue.html +1 -1
- package/docs/functions/DoubleProperty.Serialize.html +1 -1
- package/docs/functions/DoubleProperty.SerializeValue.html +1 -1
- package/docs/functions/DynamicStructPropertyValue.read.html +1 -1
- package/docs/functions/DynamicStructPropertyValue.write.html +1 -1
- package/docs/functions/EmptySpecialProperties.Parse.html +1 -1
- package/docs/functions/EmptySpecialProperties.Serialize.html +1 -1
- package/docs/functions/EnumArrayProperty.Parse.html +1 -1
- package/docs/functions/EnumArrayProperty.Serialize.html +1 -1
- package/docs/functions/EnumProperty.CalcOverhead.html +1 -1
- package/docs/functions/EnumProperty.Parse.html +1 -1
- package/docs/functions/EnumProperty.ReadValue.html +1 -1
- package/docs/functions/EnumProperty.Serialize.html +1 -1
- package/docs/functions/EnumProperty.SerializeValue.html +1 -1
- package/docs/functions/FClientIdentityInfo.read.html +1 -0
- package/docs/functions/FClientIdentityInfo.write.html +1 -0
- package/docs/functions/FColor.read.html +1 -0
- package/docs/functions/FColor.write.html +1 -0
- package/docs/functions/FGDynamicStruct.Parse.html +1 -1
- package/docs/functions/FGDynamicStruct.Serialize.html +1 -1
- package/docs/functions/FICFrameRange.read.html +1 -0
- package/docs/functions/FICFrameRange.write.html +1 -0
- package/docs/functions/FINGPUT1BufferPixel.read.html +1 -0
- package/docs/functions/FINGPUT1BufferPixel.write.html +1 -0
- package/docs/functions/FINItemStateFileSystem.IsFINItemStateFileSystem.html +1 -0
- package/docs/functions/FINItemStateFileSystem.read.html +1 -0
- package/docs/functions/FINItemStateFileSystem.write.html +1 -0
- package/docs/functions/FINNetworkTrace.read.html +1 -0
- package/docs/functions/FINNetworkTrace.write.html +1 -0
- package/docs/functions/FLBBalancerIndexing.read.html +1 -0
- package/docs/functions/FLBBalancerIndexing.write.html +1 -0
- package/docs/functions/FLinearColor.read.html +1 -0
- package/docs/functions/FLinearColor.write.html +1 -0
- package/docs/functions/FloatArrayProperty.Parse.html +1 -1
- package/docs/functions/FloatArrayProperty.Serialize.html +1 -1
- package/docs/functions/FloatProperty.CalcOverhead.html +1 -1
- package/docs/functions/FloatProperty.Parse.html +1 -1
- package/docs/functions/FloatProperty.ReadValue.html +1 -1
- package/docs/functions/FloatProperty.Serialize.html +1 -1
- package/docs/functions/FloatProperty.SerializeValue.html +1 -1
- package/docs/functions/GUID.read.html +1 -1
- package/docs/functions/GUID.write.html +1 -1
- package/docs/functions/GUIDInfo.read.html +1 -1
- package/docs/functions/GUIDInfo.write.html +1 -1
- package/docs/functions/Int32ArrayProperty.Parse.html +1 -1
- package/docs/functions/Int32ArrayProperty.Serialize.html +1 -1
- package/docs/functions/Int32Property.CalcOverhead.html +1 -1
- package/docs/functions/Int32Property.Parse.html +1 -1
- package/docs/functions/Int32Property.ReadValue.html +1 -1
- package/docs/functions/Int32Property.Serialize.html +1 -1
- package/docs/functions/Int32Property.SerializeValue.html +1 -1
- package/docs/functions/Int32SetProperty.Parse.html +1 -1
- package/docs/functions/Int32SetProperty.Serialize.html +1 -1
- package/docs/functions/Int64ArrayProperty.Parse.html +1 -1
- package/docs/functions/Int64ArrayProperty.Serialize.html +1 -1
- package/docs/functions/Int64Property.CalcOverhead.html +1 -1
- package/docs/functions/Int64Property.Parse.html +1 -1
- package/docs/functions/Int64Property.ReadValue.html +1 -1
- package/docs/functions/Int64Property.Serialize.html +1 -1
- package/docs/functions/Int64Property.SerializeValue.html +1 -1
- package/docs/functions/Int8Property.CalcOverhead.html +1 -1
- package/docs/functions/Int8Property.Parse.html +1 -1
- package/docs/functions/Int8Property.ReadValue.html +1 -1
- package/docs/functions/Int8Property.Serialize.html +1 -1
- package/docs/functions/Int8Property.SerializeValue.html +1 -1
- package/docs/functions/Level.ReadAllObjectContents.html +1 -1
- package/docs/functions/Level.ReadAllObjectHeaders.html +1 -1
- package/docs/functions/Level.ReadLevel.html +1 -1
- package/docs/functions/Level.ReadNObjectContents.html +1 -1
- package/docs/functions/Level.ReadNObjectHeaders.html +1 -1
- package/docs/functions/Level.SerializeAllObjectContents.html +1 -1
- package/docs/functions/Level.SerializeAllObjectHeaders.html +1 -1
- package/docs/functions/Level.SerializeLevel.html +1 -1
- package/docs/functions/LevelToDestroyedActorsMap.read.html +1 -1
- package/docs/functions/LevelToDestroyedActorsMap.write.html +1 -1
- package/docs/functions/MD5Hash.read.html +1 -1
- package/docs/functions/MD5Hash.write.html +1 -1
- package/docs/functions/MapProperty.CalcOverhead.html +1 -1
- package/docs/functions/MapProperty.Parse.html +1 -1
- package/docs/functions/MapProperty.Serialize.html +1 -1
- package/docs/functions/ObjectArrayProperty.Parse.html +1 -1
- package/docs/functions/ObjectArrayProperty.Serialize.html +1 -1
- package/docs/functions/ObjectProperty.CalcOverhead.html +1 -1
- package/docs/functions/ObjectProperty.Parse.html +1 -1
- package/docs/functions/ObjectProperty.ReadValue.html +1 -1
- package/docs/functions/ObjectProperty.Serialize.html +1 -1
- package/docs/functions/ObjectProperty.SerializeValue.html +1 -1
- package/docs/functions/ObjectReference.IsEqual.html +1 -1
- package/docs/functions/ObjectReference.read.html +1 -1
- package/docs/functions/ObjectReference.write.html +1 -1
- package/docs/functions/ObjectSetProperty.Parse.html +1 -1
- package/docs/functions/ObjectSetProperty.Serialize.html +1 -1
- package/docs/functions/ObjectsListSpecialProperties.Parse.html +1 -1
- package/docs/functions/ObjectsListSpecialProperties.Serialize.html +1 -1
- package/docs/functions/PlayerSpecialProperties.Parse.html +1 -1
- package/docs/functions/PlayerSpecialProperties.Serialize.html +1 -1
- package/docs/functions/PowerLineSpecialProperties.Parse.html +1 -1
- package/docs/functions/PowerLineSpecialProperties.Serialize.html +1 -1
- package/docs/functions/PropertiesList.ParseList.html +1 -1
- package/docs/functions/PropertiesList.ParseSingleProperty.html +1 -1
- package/docs/functions/PropertiesList.SerializeList.html +1 -1
- package/docs/functions/PropertiesList.SerializeSingleProperty.html +1 -1
- package/docs/functions/SatisfactorySaveHeader.Parse.html +1 -1
- package/docs/functions/SatisfactorySaveHeader.Serialize.html +1 -1
- package/docs/functions/SaveBodyChunks.CompressDataIntoChunks.html +1 -1
- package/docs/functions/SaveBodyChunks.DecompressChunks.html +1 -1
- package/docs/functions/SaveBodyValidation.Parse.html +1 -1
- package/docs/functions/SaveBodyValidation.Serialize.html +1 -1
- package/docs/functions/SetProperty.CalcOverhead.html +1 -1
- package/docs/functions/SetProperty.Parse.html +1 -1
- package/docs/functions/SetProperty.Serialize.html +1 -1
- package/docs/functions/SoftObjectArrayProperty.Parse.html +1 -1
- package/docs/functions/SoftObjectArrayProperty.Serialize.html +1 -1
- package/docs/functions/SoftObjectProperty.CalcOverhead.html +1 -0
- package/docs/functions/SoftObjectProperty.Parse.html +1 -0
- package/docs/functions/SoftObjectProperty.ReadValue.html +1 -0
- package/docs/functions/SoftObjectProperty.Serialize.html +1 -0
- package/docs/functions/SoftObjectProperty.SerializeValue.html +1 -0
- package/docs/functions/SoftObjectReference.read.html +1 -1
- package/docs/functions/SoftObjectReference.write.html +1 -1
- package/docs/functions/SpecialDroneActionProperties.Parse.html +1 -1
- package/docs/functions/SpecialDroneActionProperties.Serialize.html +1 -1
- package/docs/functions/SpecialProperties.ParseClassSpecificSpecialProperties.html +1 -1
- package/docs/functions/SpecialProperties.SerializeClassSpecificSpecialProperties.html +1 -1
- package/docs/functions/StrArrayProperty.Parse.html +1 -1
- package/docs/functions/StrArrayProperty.Serialize.html +1 -1
- package/docs/functions/StrProperty.CalcOverhead.html +1 -1
- package/docs/functions/StrProperty.Parse.html +1 -1
- package/docs/functions/StrProperty.ReadValue.html +1 -1
- package/docs/functions/StrProperty.Serialize.html +1 -1
- package/docs/functions/StrProperty.SerializeValue.html +1 -1
- package/docs/functions/StrSetProperty.Parse.html +1 -1
- package/docs/functions/StrSetProperty.Serialize.html +1 -1
- package/docs/functions/StructArrayProperty.Parse.html +1 -1
- package/docs/functions/StructArrayProperty.Serialize.html +1 -1
- package/docs/functions/StructProperty.CalcOverhead.html +1 -1
- package/docs/functions/StructProperty.Parse.html +1 -1
- package/docs/functions/StructProperty.ParseValue.html +1 -1
- package/docs/functions/StructProperty.Serialize.html +1 -1
- package/docs/functions/StructProperty.SerializeValue.html +1 -1
- package/docs/functions/StructSetProperty.Parse.html +1 -1
- package/docs/functions/StructSetProperty.Serialize.html +1 -1
- package/docs/functions/TextArrayProperty.Parse.html +1 -1
- package/docs/functions/TextArrayProperty.Serialize.html +1 -1
- package/docs/functions/TextProperty.CalcOverhead.html +1 -1
- package/docs/functions/TextProperty.Parse.html +1 -1
- package/docs/functions/TextProperty.ReadValue.html +1 -1
- package/docs/functions/TextProperty.Serialize.html +1 -1
- package/docs/functions/TextProperty.SerializeValue.html +1 -1
- package/docs/functions/Transform.Parse.html +1 -1
- package/docs/functions/Transform.ParseF.html +1 -1
- package/docs/functions/Transform.Serialize.html +1 -1
- package/docs/functions/Transform.SerializeF.html +1 -1
- package/docs/functions/Uint32Property.CalcOverhead.html +1 -1
- package/docs/functions/Uint32Property.Parse.html +1 -1
- package/docs/functions/Uint32Property.ReadValue.html +1 -1
- package/docs/functions/Uint32Property.Serialize.html +1 -1
- package/docs/functions/Uint32Property.SerializeValue.html +1 -1
- package/docs/functions/Uint32SetProperty.Parse.html +1 -1
- package/docs/functions/Uint32SetProperty.Serialize.html +1 -1
- package/docs/functions/Uint64Property.CalcOverhead.html +1 -1
- package/docs/functions/Uint64Property.Parse.html +1 -1
- package/docs/functions/Uint64Property.ReadValue.html +1 -1
- package/docs/functions/Uint64Property.Serialize.html +1 -1
- package/docs/functions/Uint64Property.SerializeValue.html +1 -1
- package/docs/functions/Uint8Property.CalcOverhead.html +1 -1
- package/docs/functions/Uint8Property.Parse.html +1 -1
- package/docs/functions/Uint8Property.ReadValue.html +1 -1
- package/docs/functions/Uint8Property.Serialize.html +1 -1
- package/docs/functions/Uint8Property.SerializeValue.html +1 -1
- package/docs/functions/VehiclePhysicsData.Parse.html +1 -1
- package/docs/functions/VehiclePhysicsData.Serialize.html +1 -1
- package/docs/functions/VehicleSpecialProperties.Parse.html +1 -1
- package/docs/functions/VehicleSpecialProperties.Serialize.html +1 -1
- package/docs/functions/col4.ParseBGRA.html +1 -1
- package/docs/functions/col4.ParseRGBA.html +1 -1
- package/docs/functions/col4.SerializeBGRA.html +1 -1
- package/docs/functions/col4.SerializeRGBA.html +1 -1
- package/docs/functions/isArrayProperty.html +1 -1
- package/docs/functions/isBoolArrayProperty.html +1 -1
- package/docs/functions/isBoolProperty.html +1 -1
- package/docs/functions/isBuildableSubsystemSpecialProperties.html +1 -1
- package/docs/functions/isByteArrayProperty.html +1 -1
- package/docs/functions/isByteProperty.html +1 -1
- package/docs/functions/isCircuitSpecialProperties.html +1 -1
- package/docs/functions/isConveyorChainActorSpecialProperties.html +1 -1
- package/docs/functions/isConveyorSpecialProperties.html +1 -1
- package/docs/functions/isDoubleArrayProperty.html +1 -1
- package/docs/functions/isDoubleProperty.html +1 -1
- package/docs/functions/isEmptySpecialProperties.html +1 -1
- package/docs/functions/isEnumArrayProperty.html +1 -1
- package/docs/functions/isEnumProperty.html +1 -1
- package/docs/functions/isFloatArrayProperty.html +1 -1
- package/docs/functions/isFloatProperty.html +1 -1
- package/docs/functions/isInt32ArrayProperty.html +1 -1
- package/docs/functions/isInt32Property.html +1 -1
- package/docs/functions/isInt32SetProperty.html +1 -1
- package/docs/functions/isInt64ArrayProperty.html +1 -1
- package/docs/functions/isInt64Property.html +1 -1
- package/docs/functions/isInt8Property.html +1 -1
- package/docs/functions/isMapProperty.html +1 -1
- package/docs/functions/isObjectArrayProperty.html +1 -1
- package/docs/functions/isObjectProperty.html +1 -1
- package/docs/functions/isObjectSetProperty.html +1 -1
- package/docs/functions/isObjectsListSpecialProperties.html +1 -1
- package/docs/functions/isPlayerSpecialProperties.html +1 -1
- package/docs/functions/isPowerLineSpecialProperties.html +1 -1
- package/docs/functions/isSaveComponent.html +1 -1
- package/docs/functions/isSaveEntity.html +1 -1
- package/docs/functions/isSetProperty.html +1 -1
- package/docs/functions/isSoftObjectArrayProperty.html +1 -1
- package/docs/functions/isSoftObjectProperty.html +1 -0
- package/docs/functions/isSpecialDroneActionProperties.html +1 -1
- package/docs/functions/isStrArrayProperty.html +1 -1
- package/docs/functions/isStrProperty.html +1 -1
- package/docs/functions/isStrSetProperty.html +1 -1
- package/docs/functions/isStructArrayProperty.html +1 -1
- package/docs/functions/isStructProperty.html +1 -1
- package/docs/functions/isStructSetProperty.html +1 -1
- package/docs/functions/isTextArrayProperty.html +1 -1
- package/docs/functions/isTextProperty.html +1 -1
- package/docs/functions/isUInt64Property.html +1 -1
- package/docs/functions/isUint32Property.html +1 -1
- package/docs/functions/isUint32SetProperty.html +1 -1
- package/docs/functions/isUint8Property.html +1 -1
- package/docs/functions/isVehicleSpecialProperties.html +1 -1
- package/docs/functions/vec2.Parse.html +1 -1
- package/docs/functions/vec2.ParseF.html +1 -1
- package/docs/functions/vec2.Serialize.html +1 -1
- package/docs/functions/vec2.SerializeF.html +1 -1
- package/docs/functions/vec3.Parse.html +1 -1
- package/docs/functions/vec3.ParseF.html +1 -1
- package/docs/functions/vec3.ParseInt.html +1 -1
- package/docs/functions/vec3.Serialize.html +1 -1
- package/docs/functions/vec3.SerializeF.html +1 -1
- package/docs/functions/vec3.SerializeInt.html +1 -1
- package/docs/functions/vec3.add.html +1 -1
- package/docs/functions/vec3.length.html +1 -1
- package/docs/functions/vec3.mult.html +1 -1
- package/docs/functions/vec3.norm.html +1 -1
- package/docs/functions/vec3.sub.html +1 -1
- package/docs/functions/vec4.Parse.html +1 -1
- package/docs/functions/vec4.ParseF.html +1 -1
- package/docs/functions/vec4.Serialize.html +1 -1
- package/docs/functions/vec4.SerializeF.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +16 -4
- package/docs/interfaces/Blueprint.html +2 -2
- package/docs/interfaces/BlueprintConfig-1.html +2 -2
- package/docs/interfaces/SaveComponentHeader.html +2 -2
- package/docs/interfaces/SaveEntityHeader.html +2 -2
- package/docs/interfaces/SaveObjectHeader.html +2 -2
- package/docs/modules/AbstractBaseProperty.html +1 -1
- package/docs/modules/ArrayProperty.html +1 -1
- package/docs/modules/BlueprintConfig.html +1 -1
- package/docs/modules/BlueprintHeader.html +1 -1
- package/docs/modules/BoolArrayProperty.html +1 -1
- package/docs/modules/BoolProperty.html +1 -1
- package/docs/modules/BuildableSubsystemSpecialProperties.html +1 -1
- package/docs/modules/BuildableTypeInstance.html +1 -1
- package/docs/modules/ByteArrayProperty.html +1 -1
- package/docs/modules/ByteProperty.html +1 -1
- package/docs/modules/CircuitSpecialProperties.html +1 -1
- package/docs/modules/ConveyorChainActorSpecialProperties.html +1 -1
- package/docs/modules/ConveyorSpecialProperties.html +1 -1
- package/docs/modules/DoubleArrayProperty.html +1 -1
- package/docs/modules/DoubleProperty.html +1 -1
- package/docs/modules/DynamicStructPropertyValue.html +1 -1
- package/docs/modules/EmptySpecialProperties.html +1 -1
- package/docs/modules/EnumArrayProperty.html +1 -1
- package/docs/modules/EnumProperty.html +1 -1
- package/docs/modules/FClientIdentityInfo.html +3 -0
- package/docs/modules/FColor.html +3 -0
- package/docs/modules/FGDynamicStruct.html +1 -1
- package/docs/modules/FICFrameRange.html +3 -2
- package/docs/modules/FINGPUT1BufferPixel.html +4 -0
- package/docs/modules/FINItemStateFileSystem.html +5 -0
- package/docs/modules/FINNetworkTrace.html +4 -0
- package/docs/modules/FLBBalancerIndexing.html +3 -0
- package/docs/modules/FLinearColor.html +3 -0
- package/docs/modules/FloatArrayProperty.html +1 -1
- package/docs/modules/FloatProperty.html +1 -1
- package/docs/modules/GUID.html +1 -1
- package/docs/modules/GUIDInfo.html +1 -1
- package/docs/modules/Int32ArrayProperty.html +1 -1
- package/docs/modules/Int32Property.html +1 -1
- package/docs/modules/Int32SetProperty.html +1 -1
- package/docs/modules/Int64ArrayProperty.html +1 -1
- package/docs/modules/Int64Property.html +1 -1
- package/docs/modules/Int8Property.html +1 -1
- package/docs/modules/Level.html +1 -1
- package/docs/modules/LevelToDestroyedActorsMap.html +1 -1
- package/docs/modules/MD5Hash.html +1 -1
- package/docs/modules/MapProperty.html +1 -1
- package/docs/modules/ObjectArrayProperty.html +1 -1
- package/docs/modules/ObjectProperty.html +1 -1
- package/docs/modules/ObjectReference.html +1 -1
- package/docs/modules/ObjectSetProperty.html +1 -1
- package/docs/modules/ObjectsListSpecialProperties.html +1 -1
- package/docs/modules/PlayerSpecialProperties.html +1 -1
- package/docs/modules/PowerLineSpecialProperties.html +1 -1
- package/docs/modules/PropertiesList.html +1 -1
- package/docs/modules/SatisfactorySaveHeader.html +1 -1
- package/docs/modules/SaveBodyChunks.html +1 -1
- package/docs/modules/SaveBodyValidation.html +1 -1
- package/docs/modules/SetProperty.html +1 -1
- package/docs/modules/SoftObjectArrayProperty.html +1 -1
- package/docs/modules/SoftObjectProperty.html +6 -0
- package/docs/modules/SoftObjectReference.html +1 -1
- package/docs/modules/SpecialDroneActionProperties.html +1 -1
- package/docs/modules/SpecialProperties.html +1 -1
- package/docs/modules/StrArrayProperty.html +1 -1
- package/docs/modules/StrProperty.html +1 -1
- package/docs/modules/StrSetProperty.html +1 -1
- package/docs/modules/StructArrayProperty.html +1 -1
- package/docs/modules/StructProperty.html +1 -1
- package/docs/modules/StructSetProperty.html +1 -1
- package/docs/modules/TextArrayProperty.html +1 -1
- package/docs/modules/TextProperty.html +1 -1
- package/docs/modules/Transform.html +1 -1
- package/docs/modules/Uint32Property.html +1 -1
- package/docs/modules/Uint32SetProperty.html +1 -1
- package/docs/modules/Uint64Property.html +1 -1
- package/docs/modules/Uint8Property.html +1 -1
- package/docs/modules/VehiclePhysicsData.html +1 -1
- package/docs/modules/VehicleSpecialProperties.html +1 -1
- package/docs/modules/col4.html +1 -1
- package/docs/modules/vec2.html +1 -1
- package/docs/modules/vec3.html +1 -1
- package/docs/modules/vec4.html +1 -1
- package/docs/modules.html +24 -4
- package/docs/types/AbstractBaseProperty-1.html +7 -1
- package/docs/types/ArrayProperty.AvailableArrayPropertyTypes.html +1 -1
- package/docs/types/ArrayPropertyStructValueFields.html +1 -1
- package/docs/types/BasicMultipleStructPropertyValue.html +1 -1
- package/docs/types/BasicStructPropertyValue.html +1 -1
- package/docs/types/BlueprintHeader-1.html +1 -1
- package/docs/types/BlueprintReaderWriterContext.html +2 -0
- package/docs/types/BoolArrayProperty-1.html +1 -1
- package/docs/types/BoolProperty-1.html +1 -1
- package/docs/types/BoxStructPropertyValue.html +1 -1
- package/docs/types/BuildableSubsystemSpecialProperties-1.html +1 -1
- package/docs/types/BuildableTypeInstance-1.html +1 -1
- package/docs/types/ByteArrayProperty-1.html +1 -1
- package/docs/types/ByteProperty-1.html +1 -1
- package/docs/types/BytePropertyValue.html +1 -1
- package/docs/types/ChunkCompressionInfo.html +1 -1
- package/docs/types/ChunkSummary.html +1 -1
- package/docs/types/CircuitSpecialProperties-1.html +1 -1
- package/docs/types/ConveyorChainActorSpecialProperties-1.html +1 -1
- package/docs/types/ConveyorChainSegmentSpecialProperties.html +1 -1
- package/docs/types/ConveyorItemSpecialProperties.html +1 -1
- package/docs/types/ConveyorSpecialProperties-1.html +1 -1
- package/docs/types/DoubleArrayProperty-1.html +1 -1
- package/docs/types/DoubleProperty-1.html +1 -1
- package/docs/types/DynamicStructPropertyValue-1.html +1 -1
- package/docs/types/EmptySpecialProperties-1.html +1 -1
- package/docs/types/EnumArrayProperty-1.html +1 -1
- package/docs/types/EnumProperty-1.html +1 -1
- package/docs/types/FClientIdentityInfo-1.html +2 -0
- package/docs/types/FColor-1.html +2 -0
- package/docs/types/FGDynamicStruct-1.html +1 -1
- package/docs/types/FICFrameRange-1.html +1 -1
- package/docs/types/FICFrameRangeStructPropertyValue.html +1 -1
- package/docs/types/FINGPUT1BufferPixel-1.html +1 -0
- package/docs/types/FINItemStateFileSystem-1.html +2 -0
- package/docs/types/FINNetworkTrace-1.html +1 -0
- package/docs/types/FLBBalancerIndexing-1.html +2 -0
- package/docs/types/FLinearColor-1.html +2 -0
- package/docs/types/FloatArrayProperty-1.html +1 -1
- package/docs/types/FloatProperty-1.html +1 -1
- package/docs/types/GENERIC_MAP_KEY_TYPE.html +1 -1
- package/docs/types/GENERIC_MAP_VALUE_TYPE.html +1 -1
- package/docs/types/GENERIC_STRUCT_PROPERTY_VALUE.html +1 -1
- package/docs/types/GUID-1.html +1 -1
- package/docs/types/GUIDInfo-1.html +1 -1
- package/docs/types/Grids.html +1 -1
- package/docs/types/Int32ArrayProperty-1.html +1 -1
- package/docs/types/Int32Property-1.html +1 -1
- package/docs/types/Int32SetProperty-1.html +1 -1
- package/docs/types/Int64ArrayProperty-1.html +1 -1
- package/docs/types/Int64Property-1.html +1 -1
- package/docs/types/Int8Property-1.html +1 -1
- package/docs/types/InventoryItemStructPropertyValue.html +1 -1
- package/docs/types/Level-1.html +1 -2
- package/docs/types/LevelToDestroyedActorsMap-1.html +1 -1
- package/docs/types/Levels.html +1 -1
- package/docs/types/MAP_STRUCT_PROXY.html +1 -1
- package/docs/types/MD5Hash-1.html +1 -1
- package/docs/types/MapProperty-1.html +1 -1
- package/docs/types/ModData.html +1 -1
- package/docs/types/ObjectArrayProperty-1.html +1 -1
- package/docs/types/ObjectProperty-1.html +1 -1
- package/docs/types/ObjectReference-1.html +1 -1
- package/docs/types/ObjectSetProperty-1.html +1 -1
- package/docs/types/ObjectsListSpecialProperties-1.html +1 -1
- package/docs/types/PlayerSpecialProperties-1.html +1 -1
- package/docs/types/PowerLineSpecialProperties-1.html +1 -1
- package/docs/types/PropertiesMap.html +1 -1
- package/docs/types/RailroadTrackPositionStructPropertyValue.html +1 -1
- package/docs/types/ReaderWriterContext.html +2 -0
- package/docs/types/RoughSaveVersion.html +1 -1
- package/docs/types/SatisfactoryModMetadata.html +1 -1
- package/docs/types/SatisfactorySaveHeader-1.html +1 -1
- package/docs/types/SaveBodyChunks-1.html +1 -1
- package/docs/types/SaveBodyValidation-1.html +1 -1
- package/docs/types/SaveReaderWriterContext.html +3 -0
- package/docs/types/SetProperty.AvailableSetPropertyTypes.html +1 -1
- package/docs/types/SoftObjectArrayProperty-1.html +1 -1
- package/docs/types/SoftObjectProperty-1.html +1 -0
- package/docs/types/SoftObjectReference-1.html +1 -1
- package/docs/types/SpecialDroneAction.html +1 -1
- package/docs/types/SpecialDroneActionProperties-1.html +1 -1
- package/docs/types/SpecialProperties.AvailableSpecialPropertiesTypes.html +1 -1
- package/docs/types/StrArrayProperty-1.html +1 -1
- package/docs/types/StrProperty-1.html +1 -1
- package/docs/types/StrSetProperty-1.html +1 -1
- package/docs/types/StructArrayProperty-1.html +1 -1
- package/docs/types/StructProperty-1.html +1 -1
- package/docs/types/StructSetProperty-1.html +1 -1
- package/docs/types/TextArrayProperty-1.html +1 -1
- package/docs/types/TextProperty-1.html +1 -1
- package/docs/types/TextPropertyValue.html +1 -1
- package/docs/types/Transform-1.html +1 -1
- package/docs/types/Uint32Property-1.html +1 -1
- package/docs/types/Uint32SetProperty-1.html +1 -1
- package/docs/types/Uint64Property-1.html +1 -1
- package/docs/types/Uint8Property-1.html +1 -1
- package/docs/types/VehiclePhysicsData-1.html +1 -1
- package/docs/types/VehicleSpecialProperties-1.html +1 -1
- package/docs/types/col4-1.html +1 -1
- package/docs/types/vec2-1.html +1 -1
- package/docs/types/vec3-1.html +1 -1
- package/docs/types/vec4-1.html +1 -1
- package/docs/variables/DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE.html +1 -1
- package/docs/variables/EDIT.html +1 -1
- package/docs/variables/FINItemStateFileSystem.ExactStructReference.html +1 -0
- package/docs/variables/SaveBodyChunks.HEADER_V1.html +1 -1
- package/docs/variables/SaveBodyChunks.HEADER_V2.html +1 -1
- package/jsr.json +1 -1
- package/package.json +6 -5
- package/tsconfig.test.json +13 -0
- package/docs/classes/BlueprintConfigWriter.html +0 -39
- package/docs/classes/BlueprintWriter.html +0 -42
- package/docs/functions/FICFrameRange.Parse.html +0 -1
- package/docs/functions/FICFrameRange.Serialize.html +0 -1
- package/docs/types/ClientIdentityInfo.html +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
-
Make sure to use the same version
|
|
2
|
+
Make sure to use the same version for parsing and serializing saves, if possible.
|
|
3
|
+
|
|
4
|
+
### [3.3.1] (2026-02-08)
|
|
5
|
+
#### Quick Bugfixes
|
|
6
|
+
* Fix parsing a bit more of Mod FicsItNetworks.
|
|
7
|
+
* Fixed a bug where the parser would expect a list of unresolved save data at the end of the save, even though there is none.
|
|
8
|
+
* Fix exporting SoftObjectProperty
|
|
9
|
+
|
|
10
|
+
### [3.3.0] (2025-12-17)
|
|
11
|
+
#### Changed Behavior on Errors! see ([README.md](https://github.com/etothepii4/satisfactory-file-parser?tab=readme-ov-file#error-handling-from-331-on))
|
|
12
|
+
* The parser will no longer throw errors on encountering unknown properties or objects. Only if you explicitly specify `throwErrors: true` when calling the parser. Major errors on the overall save structure still get thrown.
|
|
13
|
+
* Made `AbstractBaseProperty` include `rawBytes`, in case properties can not be parsed. When you specify `throwErrors: false` when calling the parser, unparsed property data lands in there.
|
|
14
|
+
#### Bugfix
|
|
15
|
+
* Bugfix for Mods FicsItNetworks and Modular Load Balancers
|
|
16
|
+
* Some Internal types / functions got moved a bit
|
|
3
17
|
|
|
4
18
|
### [3.2.3] (2025-12-14)
|
|
5
19
|
#### Extending Mod Support
|
package/README.md
CHANGED
|
@@ -52,6 +52,8 @@ If however a Mod should not be working or have just objects with a lot of traili
|
|
|
52
52
|
Some explicitly tested mods include:
|
|
53
53
|
Ficsit-Cam, Structural Solutions, Linear Motion, Container Screens, Conveyor Wall Hole, X3-Signs, X3-Roads
|
|
54
54
|
|
|
55
|
+
⚠️ Exception: `Ficsit Networks` is more complex and not everything is mapped out yet. The data is saved as raw bytes array. if you want, i can have a look at your save.
|
|
56
|
+
|
|
55
57
|
# Reading a Save
|
|
56
58
|
Reading a Save in Memory.
|
|
57
59
|
|
|
@@ -159,10 +161,12 @@ fs.writeFileSync('./MyBlueprint.sbpcfg', new Uint8Array(summary.configFileBinary
|
|
|
159
161
|
## Additional Options on the Parser Methods
|
|
160
162
|
For every parser call, you can pass optional callbacks to receive additional info.
|
|
161
163
|
Like a callback on the decompressed save body. Parsing saves provides a callback for reporting progress [0,1] and an occasional message.
|
|
164
|
+
if `throwErrors` is set to true, the parser will abort immediately on unparseable data.
|
|
162
165
|
```js
|
|
163
166
|
const save = Parser.ParseSave('MySave', file.buffer, {
|
|
164
167
|
onDecompressedSaveBody: (body) => console.log('on decompressed body', body.byteLength),
|
|
165
|
-
onProgressCallback: (progress, msg) => console.log(progress, msg)
|
|
168
|
+
onProgressCallback: (progress, msg) => console.log(progress, msg),
|
|
169
|
+
throwErrors: false
|
|
166
170
|
});
|
|
167
171
|
```
|
|
168
172
|
```js
|
|
@@ -173,6 +177,7 @@ const { stream, startStreaming } = ReadableStreamParser.CreateReadableStreamFrom
|
|
|
173
177
|
```js
|
|
174
178
|
const blueprint = Parser.ParseBlueprintFiles('Myblueprint', file, configFile, {
|
|
175
179
|
onDecompressedBlueprintBody: (body) => console.log('on decompressed body', body.byteLength),
|
|
180
|
+
throwErrors: false
|
|
176
181
|
});
|
|
177
182
|
```
|
|
178
183
|
|
|
@@ -249,6 +254,18 @@ const firstStack = inventoryStacks.values[0];
|
|
|
249
254
|
// modify original save object
|
|
250
255
|
modifyObjects(inventory);
|
|
251
256
|
```
|
|
257
|
+
|
|
258
|
+
# Error Handling (From 3.3.0 on)
|
|
259
|
+
From version `3.3.0`, the parser will no longer throw every error by default.
|
|
260
|
+
Only if you explicitly specify `throwErrors: true` when calling the parser on saves/blueprints, the parser will immediately abort when unparseable data is encountered.
|
|
261
|
+
Else, `throwErrors: false` is the default.
|
|
262
|
+
|
|
263
|
+
When `throwErrors` is `false` the behavior is as follows:
|
|
264
|
+
- for unknown properties, their data lands in the `rawBytes` field of every property.
|
|
265
|
+
- if the error is more severe, affecting the overall property structure: objects have a `trailingData` field where data gets put.
|
|
266
|
+
- Else, objects on a whole scale might be corrupt and will be left out of the parsed JSON entirely.
|
|
267
|
+
- Errors on the broader save structure (order of header, body, structure of body) still get thrown no matter what. Then your save cant be interpreted no matter what.
|
|
268
|
+
|
|
252
269
|
# [Auto-Generated TypeDoc Reference](https://raw.githack.com/etothepii4/satisfactory-file-parser/main/docs/index.html).
|
|
253
270
|
|
|
254
271
|
# [Basic Guide](https://github.com/etothepii4/satisfactory-file-parser/blob/main/GUIDE.md).
|
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export * from './parser/byte/alignment.enum';
|
|
2
|
+
export * from './parser/context/context';
|
|
3
|
+
export * from './parser/context/context-reader';
|
|
4
|
+
export * from './parser/context/context-writer';
|
|
1
5
|
export * from './parser/satisfactory/blueprint/blueprint-config';
|
|
2
6
|
export * from './parser/satisfactory/blueprint/blueprint-config-version';
|
|
3
7
|
export * from './parser/satisfactory/blueprint/blueprint-header';
|
|
@@ -45,6 +49,7 @@ export * from './parser/satisfactory/types/property/generic/SetProperty/SetPrope
|
|
|
45
49
|
export * from './parser/satisfactory/types/property/generic/SetProperty/StrSetProperty';
|
|
46
50
|
export * from './parser/satisfactory/types/property/generic/SetProperty/StructSetProperty';
|
|
47
51
|
export * from './parser/satisfactory/types/property/generic/SetProperty/Uint32SetProperty';
|
|
52
|
+
export * from './parser/satisfactory/types/property/generic/SoftObjectProperty';
|
|
48
53
|
export * from './parser/satisfactory/types/property/generic/StrProperty';
|
|
49
54
|
export * from './parser/satisfactory/types/property/generic/StructProperty';
|
|
50
55
|
export * from './parser/satisfactory/types/property/generic/TextProperty';
|
|
@@ -64,15 +69,22 @@ export * from './parser/satisfactory/types/property/special/runtime-buildable-in
|
|
|
64
69
|
export * from './parser/satisfactory/types/property/special/SpecialDroneActionProperties';
|
|
65
70
|
export * from './parser/satisfactory/types/property/special/SpecialProperties';
|
|
66
71
|
export * from './parser/satisfactory/types/property/special/VehicleSpecialProperties';
|
|
72
|
+
export * from './parser/satisfactory/types/structs/binary/FClientIdentityInfo';
|
|
73
|
+
export * from './parser/satisfactory/types/structs/binary/FColor';
|
|
74
|
+
export * from './parser/satisfactory/types/structs/binary/FLinearColor';
|
|
75
|
+
export * from './parser/satisfactory/types/structs/binary/GUID';
|
|
67
76
|
export * from './parser/satisfactory/types/structs/col4';
|
|
68
77
|
export * from './parser/satisfactory/types/structs/DynamicStructPropertyValue';
|
|
69
78
|
export * from './parser/satisfactory/types/structs/FGDynamicStruct';
|
|
70
|
-
export * from './parser/satisfactory/types/structs/GUID';
|
|
71
79
|
export * from './parser/satisfactory/types/structs/GUIDInfo';
|
|
72
|
-
export * from './parser/satisfactory/types/structs/SaveBodyValidation';
|
|
73
80
|
export * from './parser/satisfactory/types/structs/MD5Hash';
|
|
74
81
|
export * from './parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange';
|
|
82
|
+
export * from './parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel';
|
|
83
|
+
export * from './parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem';
|
|
84
|
+
export * from './parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace';
|
|
85
|
+
export * from './parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing';
|
|
75
86
|
export * from './parser/satisfactory/types/structs/ObjectReference';
|
|
87
|
+
export * from './parser/satisfactory/types/structs/SaveBodyValidation';
|
|
76
88
|
export * from './parser/satisfactory/types/structs/SoftObjectReference';
|
|
77
89
|
export * from './parser/satisfactory/types/structs/Transform';
|
|
78
90
|
export * from './parser/satisfactory/types/structs/vec2';
|
|
@@ -80,7 +92,6 @@ export * from './parser/satisfactory/types/structs/vec3';
|
|
|
80
92
|
export * from './parser/satisfactory/types/structs/vec4';
|
|
81
93
|
export * from './parser/satisfactory/types/structs/VehiclePhysicsData';
|
|
82
94
|
export { BlueprintConfigReader, BlueprintReader } from './parser/satisfactory/blueprint/blueprint-reader';
|
|
83
|
-
export { BlueprintConfigWriter, BlueprintWriter } from './parser/satisfactory/blueprint/blueprint-writer';
|
|
84
95
|
export * from './parser/satisfactory/save/save-reader';
|
|
85
96
|
export { SaveWriter } from './parser/satisfactory/save/save-writer';
|
|
86
97
|
export { SaveStreamJsonStringifier } from './parser/stream/reworked/save-stream-json-stringifier';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,kDAAkD,CAAC;AACjE,cAAc,0DAA0D,CAAC;AACzE,cAAc,kDAAkD,CAAC;AACjE,cAAc,0DAA0D,CA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AC;AACrG,cAAc,2EAA2E,CAAC;AAC1F,cAAc,gEAAgE,CAAC;AAC/E,cAAc,uEAAuE,CAAC;AACtF,cAAc,gEAAgE,CAAC;AAC/E,cAAc,mDAAmD,CAAC;AAClE,cAAc,yDAAyD,CAAC;AACxE,cAAc,iDAAiD,CAAC;AAChE,cAAc,0CAA0C,CAAC;AACzD,cAAc,gEAAgE,CAAC;AAC/E,cAAc,qDAAqD,CAAC;AACpE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,6CAA6C,CAAC;AAC5D,cAAc,kEAAkE,CAAC;AACjF,cAAc,6EAA6E,CAAC;AAC5F,cAAc,gFAAgF,CAAC;AAC/F,cAAc,yEAAyE,CAAC;AACxF,cAAc,mFAAmF,CAAC;AAClG,cAAc,qDAAqD,CAAC;AACpE,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,0CAA0C,CAAC;AACzD,cAAc,wDAAwD,CAAC;AAGvE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AAC1G,cAAc,wCAAwC,CAAC;AACvD,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
|
@@ -14,7 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ReadableStreamParser = exports.Parser = exports.SaveStreamWriter = exports.SaveStreamJsonStringifier = exports.SaveWriter = exports.
|
|
17
|
+
exports.ReadableStreamParser = exports.Parser = exports.SaveStreamWriter = exports.SaveStreamJsonStringifier = exports.SaveWriter = exports.BlueprintReader = exports.BlueprintConfigReader = void 0;
|
|
18
|
+
__exportStar(require("./parser/byte/alignment.enum"), exports);
|
|
19
|
+
__exportStar(require("./parser/context/context"), exports);
|
|
20
|
+
__exportStar(require("./parser/context/context-reader"), exports);
|
|
21
|
+
__exportStar(require("./parser/context/context-writer"), exports);
|
|
18
22
|
__exportStar(require("./parser/satisfactory/blueprint/blueprint-config"), exports);
|
|
19
23
|
__exportStar(require("./parser/satisfactory/blueprint/blueprint-config-version"), exports);
|
|
20
24
|
__exportStar(require("./parser/satisfactory/blueprint/blueprint-header"), exports);
|
|
@@ -62,6 +66,7 @@ __exportStar(require("./parser/satisfactory/types/property/generic/SetProperty/S
|
|
|
62
66
|
__exportStar(require("./parser/satisfactory/types/property/generic/SetProperty/StrSetProperty"), exports);
|
|
63
67
|
__exportStar(require("./parser/satisfactory/types/property/generic/SetProperty/StructSetProperty"), exports);
|
|
64
68
|
__exportStar(require("./parser/satisfactory/types/property/generic/SetProperty/Uint32SetProperty"), exports);
|
|
69
|
+
__exportStar(require("./parser/satisfactory/types/property/generic/SoftObjectProperty"), exports);
|
|
65
70
|
__exportStar(require("./parser/satisfactory/types/property/generic/StrProperty"), exports);
|
|
66
71
|
__exportStar(require("./parser/satisfactory/types/property/generic/StructProperty"), exports);
|
|
67
72
|
__exportStar(require("./parser/satisfactory/types/property/generic/TextProperty"), exports);
|
|
@@ -81,15 +86,22 @@ __exportStar(require("./parser/satisfactory/types/property/special/runtime-build
|
|
|
81
86
|
__exportStar(require("./parser/satisfactory/types/property/special/SpecialDroneActionProperties"), exports);
|
|
82
87
|
__exportStar(require("./parser/satisfactory/types/property/special/SpecialProperties"), exports);
|
|
83
88
|
__exportStar(require("./parser/satisfactory/types/property/special/VehicleSpecialProperties"), exports);
|
|
89
|
+
__exportStar(require("./parser/satisfactory/types/structs/binary/FClientIdentityInfo"), exports);
|
|
90
|
+
__exportStar(require("./parser/satisfactory/types/structs/binary/FColor"), exports);
|
|
91
|
+
__exportStar(require("./parser/satisfactory/types/structs/binary/FLinearColor"), exports);
|
|
92
|
+
__exportStar(require("./parser/satisfactory/types/structs/binary/GUID"), exports);
|
|
84
93
|
__exportStar(require("./parser/satisfactory/types/structs/col4"), exports);
|
|
85
94
|
__exportStar(require("./parser/satisfactory/types/structs/DynamicStructPropertyValue"), exports);
|
|
86
95
|
__exportStar(require("./parser/satisfactory/types/structs/FGDynamicStruct"), exports);
|
|
87
|
-
__exportStar(require("./parser/satisfactory/types/structs/GUID"), exports);
|
|
88
96
|
__exportStar(require("./parser/satisfactory/types/structs/GUIDInfo"), exports);
|
|
89
|
-
__exportStar(require("./parser/satisfactory/types/structs/SaveBodyValidation"), exports);
|
|
90
97
|
__exportStar(require("./parser/satisfactory/types/structs/MD5Hash"), exports);
|
|
91
98
|
__exportStar(require("./parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange"), exports);
|
|
99
|
+
__exportStar(require("./parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel"), exports);
|
|
100
|
+
__exportStar(require("./parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem"), exports);
|
|
101
|
+
__exportStar(require("./parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace"), exports);
|
|
102
|
+
__exportStar(require("./parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing"), exports);
|
|
92
103
|
__exportStar(require("./parser/satisfactory/types/structs/ObjectReference"), exports);
|
|
104
|
+
__exportStar(require("./parser/satisfactory/types/structs/SaveBodyValidation"), exports);
|
|
93
105
|
__exportStar(require("./parser/satisfactory/types/structs/SoftObjectReference"), exports);
|
|
94
106
|
__exportStar(require("./parser/satisfactory/types/structs/Transform"), exports);
|
|
95
107
|
__exportStar(require("./parser/satisfactory/types/structs/vec2"), exports);
|
|
@@ -99,9 +111,6 @@ __exportStar(require("./parser/satisfactory/types/structs/VehiclePhysicsData"),
|
|
|
99
111
|
var blueprint_reader_1 = require("./parser/satisfactory/blueprint/blueprint-reader");
|
|
100
112
|
Object.defineProperty(exports, "BlueprintConfigReader", { enumerable: true, get: function () { return blueprint_reader_1.BlueprintConfigReader; } });
|
|
101
113
|
Object.defineProperty(exports, "BlueprintReader", { enumerable: true, get: function () { return blueprint_reader_1.BlueprintReader; } });
|
|
102
|
-
var blueprint_writer_1 = require("./parser/satisfactory/blueprint/blueprint-writer");
|
|
103
|
-
Object.defineProperty(exports, "BlueprintConfigWriter", { enumerable: true, get: function () { return blueprint_writer_1.BlueprintConfigWriter; } });
|
|
104
|
-
Object.defineProperty(exports, "BlueprintWriter", { enumerable: true, get: function () { return blueprint_writer_1.BlueprintWriter; } });
|
|
105
114
|
__exportStar(require("./parser/satisfactory/save/save-reader"), exports);
|
|
106
115
|
var save_writer_1 = require("./parser/satisfactory/save/save-writer");
|
|
107
116
|
Object.defineProperty(exports, "SaveWriter", { enumerable: true, get: function () { return save_writer_1.SaveWriter; } });
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,mFAAiE;AACjE,2FAAyE;AACzE,mFAAiE;AACjE,2FAAyE;AACzE,kFAAgE;AAChE,yFAAuE;AACvE,mEAAiD;AACjD,2FAAyE;AACzE,+EAA6D;AAC7D,sFAAoE;AACpE,8EAA4D;AAC5D,iFAA+D;AAC/D,8EAA4D;AAC5D,wEAAsD;AACtD,oFAAkE;AAClE,iFAA+D;AAC/D,iFAA+D;AAC/D,oGAAkF;AAClF,2GAAyF;AACzF,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B,8DAA4C;AAG5C,0CAAyC;AAAhC,gGAAA,MAAM,OAAA;AACf,0FAAuF;AAA9E,8HAAA,oBAAoB,OAAA;AAG7B,4EAA0D","sourcesContent":["// types & classes for convenience\nexport * from './parser/byte/alignment.enum';\nexport * from './parser/context/context';\nexport * from './parser/context/context-reader';\nexport * from './parser/context/context-writer';\nexport * from './parser/satisfactory/blueprint/blueprint-config';\nexport * from './parser/satisfactory/blueprint/blueprint-config-version';\nexport * from './parser/satisfactory/blueprint/blueprint-header';\nexport * from './parser/satisfactory/blueprint/blueprint-header-version';\nexport * from './parser/satisfactory/blueprint/blueprint.types';\nexport * from './parser/satisfactory/save/factory-game-custom-version';\nexport * from './parser/satisfactory/save/level';\nexport * from './parser/satisfactory/save/level-to-destroyed-actors-map';\nexport * from './parser/satisfactory/save/satisfactory-save';\nexport * from './parser/satisfactory/save/satisfactory-save-header';\nexport * from './parser/satisfactory/save/save-body-chunks';\nexport * from './parser/satisfactory/save/save-custom-version';\nexport * from './parser/satisfactory/save/save-header-type';\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/objects/SaveObject';\nexport * from './parser/satisfactory/types/property/generic/AbstractBaseProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/BoolArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/ByteArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/DoubleArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/EnumArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/FloatArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/Int32ArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/Int64ArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/ObjectArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/SoftObjectArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/StrArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty';\nexport * from './parser/satisfactory/types/property/generic/ArrayProperty/TextArrayProperty';\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/Int32SetProperty';\nexport * from './parser/satisfactory/types/property/generic/SetProperty/ObjectSetProperty';\nexport * from './parser/satisfactory/types/property/generic/SetProperty/SetProperty';\nexport * from './parser/satisfactory/types/property/generic/SetProperty/StrSetProperty';\nexport * from './parser/satisfactory/types/property/generic/SetProperty/StructSetProperty';\nexport * from './parser/satisfactory/types/property/generic/SetProperty/Uint32SetProperty';\nexport * from './parser/satisfactory/types/property/generic/SoftObjectProperty';\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/BuildableSubsystemSpecialProperties';\nexport * from './parser/satisfactory/types/property/special/CircuitSpecialProperties';\nexport * from './parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties';\nexport * from './parser/satisfactory/types/property/special/ConveyorSpecialProperties';\nexport * from './parser/satisfactory/types/property/special/EmptySpecialProperties';\nexport * from './parser/satisfactory/types/property/special/ObjectsListSpecialProperties';\nexport * from './parser/satisfactory/types/property/special/PlayerSpecialProperties';\nexport * from './parser/satisfactory/types/property/special/PowerLineSpecialProperties';\nexport * from './parser/satisfactory/types/property/special/runtime-buildable-instance-data-version';\nexport * from './parser/satisfactory/types/property/special/SpecialDroneActionProperties';\nexport * from './parser/satisfactory/types/property/special/SpecialProperties';\nexport * from './parser/satisfactory/types/property/special/VehicleSpecialProperties';\nexport * from './parser/satisfactory/types/structs/binary/FClientIdentityInfo';\nexport * from './parser/satisfactory/types/structs/binary/FColor';\nexport * from './parser/satisfactory/types/structs/binary/FLinearColor';\nexport * from './parser/satisfactory/types/structs/binary/GUID';\nexport * from './parser/satisfactory/types/structs/col4';\nexport * from './parser/satisfactory/types/structs/DynamicStructPropertyValue';\nexport * from './parser/satisfactory/types/structs/FGDynamicStruct';\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/mods/FicsItNetworks/FINGPUT1BufferPixel';\nexport * from './parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem';\nexport * from './parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace';\nexport * from './parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing';\nexport * from './parser/satisfactory/types/structs/ObjectReference';\nexport * from './parser/satisfactory/types/structs/SaveBodyValidation';\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';\nexport * from './parser/satisfactory/types/structs/VehiclePhysicsData';\n\n// should better be removed in a future update to prevent shenanigans.\nexport { BlueprintConfigReader, BlueprintReader } from './parser/satisfactory/blueprint/blueprint-reader';\nexport * 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\n"]}
|
|
@@ -11,6 +11,8 @@ export declare abstract class ByteWriter implements BinaryWritable {
|
|
|
11
11
|
writeByte(value: number): void;
|
|
12
12
|
writeBytesArray(bytes: number[]): void;
|
|
13
13
|
writeBytes(bytes: Uint8Array): void;
|
|
14
|
+
hexStringRepresentationToBytes(hex: string, hexSeparator?: string): number[];
|
|
15
|
+
writeHex(hex: string, hexSeparator?: string): void;
|
|
14
16
|
writeInt8(value: number): void;
|
|
15
17
|
writeUint8(value: number): void;
|
|
16
18
|
writeInt16(value: number): void;
|
|
@@ -1 +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,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cAAc,IAAI,IAAI;IAGtB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK/B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKjC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKhC,WAAW,CAAC,KAAK,EAAE,MAAM;IAwBhC,OAAc,iBAAiB,UAAW,MAAM,KAAG,OAAO,CAAiC;IAEpF,iBAAiB,QAAO,MAAM,CAAqB;IAEnD,cAAc,UAAW,MAAM,QAAQ,MAAM,KAAG,WAAW,CAAuC;IAElG,eAAe,QAAO,MAAM,CAAgC;IAE5D,iBAAiB,QAAO,MAAM,CAAmD;IAEjF,2BAA2B,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAahF,SAAS,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAE,MAAY,GAAG,IAAI;IAOpF,SAAS,CAAC,cAAc,IAAI,IAAI;IAIzB,UAAU,IAAI,WAAW;WAKlB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;WAShC,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,GAAG,WAAW;CAMnF"}
|
|
@@ -33,6 +33,14 @@ class ByteWriter {
|
|
|
33
33
|
this.extendBufferIfNeeded(bytes.length);
|
|
34
34
|
bytes.forEach(byte => this.bufferView.setUint8(this.currentByte++, byte));
|
|
35
35
|
}
|
|
36
|
+
hexStringRepresentationToBytes(hex, hexSeparator = ' ') {
|
|
37
|
+
const cleanHex = hex.split(hexSeparator).join('').replace(/\s+/g, '');
|
|
38
|
+
const bytes = Array.from({ length: cleanHex.length / 2 }, (_, i) => parseInt(cleanHex.slice(i * 2, i * 2 + 2), 16));
|
|
39
|
+
return bytes;
|
|
40
|
+
}
|
|
41
|
+
writeHex(hex, hexSeparator = ' ') {
|
|
42
|
+
this.writeBytesArray(this.hexStringRepresentationToBytes(hex, hexSeparator));
|
|
43
|
+
}
|
|
36
44
|
writeInt8(value) {
|
|
37
45
|
this.extendBufferIfNeeded(1);
|
|
38
46
|
this.bufferView.setInt8(this.currentByte, value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"byte-writer.class.js","sourceRoot":"","sources":["../../../src/parser/byte/byte-writer.class.ts"],"names":[],"mappings":";;;AACA,qDAA6C;AAI7C,MAAsB,UAAU;IAQ/B,YAAY,SAAoB,EAAE,aAAqB,GAAG;QA8GnD,sBAAiB,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC;QAEnD,mBAAc,GAAG,CAAC,KAAa,EAAE,GAAY,EAAe,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAElG,oBAAe,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;QAE5D,sBAAiB,GAAG,GAAW,EAAE,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC;QAnHvF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC,UAAU,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACtB,CAAC;IAKM,SAAS,CAAC,QAAgB,CAAC;QACjC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC;IAC3B,CAAC;IACM,MAAM,CAAC,GAAW;QACxB,MAAM,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,iBAAi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W,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,GAAW;QAChC,OAAO,IAAI,UAAU,CAAC;YACrB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE;YACxB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE;YACxB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC;YACvB,CAAC,GAAG,GAAG,UAAU,CAAC;SAClB,CAAC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,YAAY,CAAC,OAAoB,EAAE,OAAoB;QACpE,IAAI,GAAG,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QAClE,GAAG,CAAC,GAAG,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;;AAzKH,gCA0KC;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\t/**\n\t * Writes an int32 and we dismiss it, because its always 0.\n\t */\n\tpublic writeInt32Zero(): void {\n\t\tthis.writeInt32(0);\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}"]}
|
|
1
|
+
{"version":3,"file":"byte-writer.class.js","sourceRoot":"","sources":["../../../src/parser/byte/byte-writer.class.ts"],"names":[],"mappings":";;;AACA,qDAA6C;AAI7C,MAAsB,UA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AAU,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAES,cAAc;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAChE,CAAC;IAEM,UAAU;QAChB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,GAAW;QAChC,OAAO,IAAI,UAAU,CAAC;YACrB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE;YACxB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,EAAE;YACxB,CAAC,GAAG,GAAG,UAAU,CAAC,IAAI,CAAC;YACvB,CAAC,GAAG,GAAG,UAAU,CAAC;SAClB,CAAC,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,YAAY,CAAC,OAAoB,EAAE,OAAoB;QACpE,IAAI,GAAG,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QAClE,GAAG,CAAC,GAAG,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;;AAjLH,gCAkLC;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 hexStringRepresentationToBytes(hex: string, hexSeparator: string = ' '): number[] {\n\t\tconst cleanHex = hex.split(hexSeparator).join('').replace(/\\s+/g, '');\n\t\tconst bytes = Array.from({ length: cleanHex.length / 2 }, (_, i) => parseInt(cleanHex.slice(i * 2, i * 2 + 2), 16));\n\t\treturn bytes;\n\t}\n\tpublic writeHex(hex: string, hexSeparator: string = ' '): void {\n\t\tthis.writeBytesArray(this.hexStringRepresentationToBytes(hex, hexSeparator));\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\t/**\n\t * Writes an int32 and we dismiss it, because its always 0.\n\t */\n\tpublic writeInt32Zero(): void {\n\t\tthis.writeInt32(0);\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}"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ChunkCompressionInfo } from "../satisfactory/save/save-body-chunks";
|
|
2
2
|
export type ReaderWriterContext = SaveReaderWriterContext & BlueprintReaderWriterContext;
|
|
3
3
|
export type SaveReaderWriterContext = {
|
|
4
|
+
throwErrors: boolean;
|
|
4
5
|
saveHeaderType: number;
|
|
5
6
|
saveVersion: number;
|
|
6
7
|
buildVersion: number;
|
|
@@ -9,6 +10,7 @@ export type SaveReaderWriterContext = {
|
|
|
9
10
|
compressionInfo?: ChunkCompressionInfo;
|
|
10
11
|
};
|
|
11
12
|
export type BlueprintReaderWriterContext = {
|
|
13
|
+
throwErrors: boolean;
|
|
12
14
|
headerVersion: number;
|
|
13
15
|
saveVersion: number;
|
|
14
16
|
buildVersion: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/parser/context/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAK7E,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,4BAA4B,CAAA;AAOxF,MAAM,MAAM,uBAAuB,GAAG;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,oBAAoB,CAAC;CAC1C,CAAA;AAKD,MAAM,MAAM,4BAA4B,GAAG;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,MAAM,CAAC;CAClC,CAAA"}
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/parser/context/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAK7E,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG,4BAA4B,CAAA;AAOxF,MAAM,MAAM,uBAAuB,GAAG;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,oBAAoB,CAAC;CAC1C,CAAA;AAKD,MAAM,MAAM,4BAA4B,GAAG;IACvC,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB,EAAE,MAAM,CAAC;CAClC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/parser/context/context.ts"],"names":[],"mappings":"","sourcesContent":["import { ChunkCompressionInfo } from \"../satisfactory/save/save-body-chunks\";\n\n/**\n * Merged Context Type for Saves and Blueprints.\n */\nexport type ReaderWriterContext = SaveReaderWriterContext & BlueprintReaderWriterContext\n\n/**\n * Context for reading/writing save files.\n * \n * @param mods describes a list of mod names to their versions. Some mods have special needs.\n */\nexport type SaveReaderWriterContext = {\n saveHeaderType: number;\n saveVersion: number;\n buildVersion: number;\n mods: Record<string, string>;\n mapName?: string;\n compressionInfo?: ChunkCompressionInfo;\n}\n\n/**\n * Context for reading/writing blueprint files.\n */\nexport type BlueprintReaderWriterContext = {\n headerVersion: number;\n saveVersion: number;\n buildVersion: number;\n blueprintConfigVersion: number;\n}"]}
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/parser/context/context.ts"],"names":[],"mappings":"","sourcesContent":["import { ChunkCompressionInfo } from \"../satisfactory/save/save-body-chunks\";\n\n/**\n * Merged Context Type for Saves and Blueprints.\n */\nexport type ReaderWriterContext = SaveReaderWriterContext & BlueprintReaderWriterContext\n\n/**\n * Context for reading/writing save files.\n * \n * @param mods describes a list of mod names to their versions. Some mods have special needs.\n */\nexport type SaveReaderWriterContext = {\n throwErrors: boolean;\n saveHeaderType: number;\n saveVersion: number;\n buildVersion: number;\n mods: Record<string, string>;\n mapName?: string;\n compressionInfo?: ChunkCompressionInfo;\n}\n\n/**\n * Context for reading/writing blueprint files.\n */\nexport type BlueprintReaderWriterContext = {\n throwErrors: boolean;\n headerVersion: number;\n saveVersion: number;\n buildVersion: number;\n blueprintConfigVersion: number;\n}"]}
|
package/build/parser/parser.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class Parser {
|
|
|
5
5
|
static ParseSave(name: string, bytes: ArrayBufferLike, options?: Partial<{
|
|
6
6
|
onDecompressedSaveBody: (buffer: ArrayBufferLike) => void;
|
|
7
7
|
onProgressCallback: (progress: number, msg?: string) => void;
|
|
8
|
+
throwErrors: boolean;
|
|
8
9
|
}>): SatisfactorySave;
|
|
9
10
|
static WriteSave(save: SatisfactorySave, onHeader: (header: Uint8Array) => void, onChunk: (chunk: Uint8Array) => void, options?: Partial<{
|
|
10
11
|
onBinaryBeforeCompressing: (buffer: ArrayBuffer) => void;
|
|
@@ -17,6 +18,7 @@ export declare class Parser {
|
|
|
17
18
|
};
|
|
18
19
|
static ParseBlueprintFiles(name: string, blueprintFile: ArrayBufferLike, blueprintConfigFile: ArrayBufferLike, options?: Partial<{
|
|
19
20
|
onDecompressedBlueprintBody: (buffer: ArrayBufferLike) => void;
|
|
21
|
+
throwErrors: boolean;
|
|
20
22
|
}>): Blueprint;
|
|
21
23
|
static JSONStringifyModified: (obj: any, indent?: number) => string;
|
|
22
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AASpE,qBAAa,MAAM;WASJ,SAAS,CACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE,OAAO,CAAC;QACjB,sBAAsB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;QAC1D,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AASpE,qBAAa,MAAM;WASJ,SAAS,CACtB,IAAI,EAAE,MAAM,EACZ,KAA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|
@@ -16,6 +16,7 @@ const SaveBodyValidation_1 = require("./satisfactory/types/structs/SaveBodyValid
|
|
|
16
16
|
class Parser {
|
|
17
17
|
static ParseSave(name, bytes, options) {
|
|
18
18
|
const reader = new save_reader_1.SaveReader(bytes, options?.onProgressCallback);
|
|
19
|
+
reader.context.throwErrors = options?.throwErrors !== undefined ? options.throwErrors : false;
|
|
19
20
|
const header = satisfactory_save_header_1.SatisfactorySaveHeader.Parse(reader);
|
|
20
21
|
const save = new satisfactory_save_1.SatisfactorySave(name, header);
|
|
21
22
|
const roughSaveVersion = save_reader_1.SaveReader.GetRoughSaveVersion(header.saveVersion);
|
|
@@ -31,11 +32,13 @@ class Parser {
|
|
|
31
32
|
save.saveBodyValidation = SaveBodyValidation_1.SaveBodyValidation.Parse(reader);
|
|
32
33
|
}
|
|
33
34
|
save.levels = reader.readLevels();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (reader.getBufferPosition() < reader.getBufferLength()) {
|
|
36
|
+
const countUnresolvedWorldSaveData = reader.readInt32();
|
|
37
|
+
if (countUnresolvedWorldSaveData) {
|
|
38
|
+
save.unresolvedWorldSaveData = [];
|
|
39
|
+
for (let i = 0; i < countUnresolvedWorldSaveData; i++) {
|
|
40
|
+
save.unresolvedWorldSaveData.push(ObjectReference_1.ObjectReference.read(reader));
|
|
41
|
+
}
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
reader.onProgressCallback(reader.getBufferProgress(), 'finished parsing.');
|
|
@@ -55,8 +58,8 @@ class Parser {
|
|
|
55
58
|
}
|
|
56
59
|
save_writer_1.SaveWriter.WriteLevels(writer, save);
|
|
57
60
|
if (save.unresolvedWorldSaveData && save.unresolvedWorldSaveData.length > 0) {
|
|
58
|
-
writer.writeInt32(save.unresolvedWorldSaveData
|
|
59
|
-
for (const actor of save.unresolvedWorldSaveData
|
|
61
|
+
writer.writeInt32(save.unresolvedWorldSaveData.length);
|
|
62
|
+
for (const actor of save.unresolvedWorldSaveData) {
|
|
60
63
|
ObjectReference_1.ObjectReference.write(writer, actor);
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -96,6 +99,7 @@ class Parser {
|
|
|
96
99
|
const config = blueprint_config_1.BlueprintConfig.Parse(blueprintConfigReader);
|
|
97
100
|
const blueprintReader = new blueprint_reader_1.BlueprintReader(blueprintFile);
|
|
98
101
|
blueprintReader.context.blueprintConfigVersion = config.configVersion;
|
|
102
|
+
blueprintReader.context.throwErrors = options?.throwErrors !== undefined ? options.throwErrors : false;
|
|
99
103
|
const header = blueprint_header_1.BlueprintHeader.Parse(blueprintReader);
|
|
100
104
|
const inflateResult = blueprintReader.inflateChunks();
|
|
101
105
|
if (options?.onDecompressedBlueprintBody !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":";;;AAAA,uDAA+D;AAC/D,gFAA4E;AAC5E,gFAA4E;AAC5E,gFAAmG;AACnG,gFAAmG;AAEnG,6EAAyE;AACzE,2FAAsF;AAEtF,iFAA4E;AAC5E,iEAA6D;AAC7D,iEAA6D;AAC7D,kFAA+E;AAC/E,wFAAqF;AAIrF,MAAa,MAAM;IASX,MAAM,CAAC,SAAS,CACtB,IAAY,EACZ,KAAsB,EACtB,OAGE;QAGF,MAAM,MAAM,GAAG,IAAI,wBAAU,CAAC,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;QAElE,MAAM,MAAM,GAAG,iDAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,oCAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAGhD,MAAM,gBAAgB,GAAG,wBAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5E,IAAI,gBAAgB,KAAK,KAAK,EAAE,CAAC;YAChC,MAAM,IAAI,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AAC,GAAQ,EAAE,SAAiB,CAAC,EAAU,EAAE,CAC9E,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;SAAM,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC,EAAE,MAAM,CAAC,CAAA","sourcesContent":["import { UnsupportedVersionError } from './error/parser.error';\nimport { BlueprintConfig } from './satisfactory/blueprint/blueprint-config';\nimport { BlueprintHeader } from './satisfactory/blueprint/blueprint-header';\nimport { BlueprintConfigReader, BlueprintReader } from \"./satisfactory/blueprint/blueprint-reader\";\nimport { BlueprintConfigWriter, BlueprintWriter } from \"./satisfactory/blueprint/blueprint-writer\";\nimport { Blueprint } from \"./satisfactory/blueprint/blueprint.types\";\nimport { SatisfactorySave } from \"./satisfactory/save/satisfactory-save\";\nimport { SatisfactorySaveHeader } from './satisfactory/save/satisfactory-save-header';\nimport { ChunkSummary } from './satisfactory/save/save-body-chunks';\nimport { SaveCustomVersion } from './satisfactory/save/save-custom-version';\nimport { SaveReader } from './satisfactory/save/save-reader';\nimport { SaveWriter } from \"./satisfactory/save/save-writer\";\nimport { ObjectReference } from './satisfactory/types/structs/ObjectReference';\nimport { SaveBodyValidation } from './satisfactory/types/structs/SaveBodyValidation';\n\n\n/** @public */\nexport class Parser {\n\n\t/**\n\t * Parses a given binary buffer as {@link SatisfactorySave}\n\t * @param name the save name. It won't be serialized, so it does not matter how you name it.\n\t * @param bytes the actual binary buffer\n\t * @param options provides callbacks. Either on the decompressed save body or on reported progress as a number [0,1] with an occasional message.\n\t * @returns \n\t */\n\tpublic static ParseSave(\n\t\tname: string,\n\t\tbytes: ArrayBufferLike,\n\t\toptions?: Partial<{\n\t\t\tonDecompressedSaveBody: (buffer: ArrayBufferLike) => void,\n\t\t\tonProgressCallback: (progress: number, msg?: string) => void\n\t\t}>\n\t): SatisfactorySave {\n\n\t\tconst reader = new SaveReader(bytes, options?.onProgressCallback);\n\n\t\tconst header = SatisfactorySaveHeader.Parse(reader);\n\t\tconst save = new SatisfactorySave(name, header);\n\n\t\t// guard save version\n\t\tconst roughSaveVersion = SaveReader.GetRoughSaveVersion(header.saveVersion);\n\t\tif (roughSaveVersion === '<U6') {\n\t\t\tthrow new UnsupportedVersionError('Game Version < U6 is not supported in the parser. Please save the file in a newer game version.');\n\t\t}\n\n\t\t// inflate chunks\n\t\tconst inflateResult = reader.inflateChunks();\n\t\tsave.compressionInfo = inflateResult.compressionInfo;\n\n\t\t// call callback on decompressed save body\n\t\tif (options?.onDecompressedSaveBody !== undefined) {\n\t\t\toptions.onDecompressedSaveBody(reader.getBuffer());\n\t\t}\n\n\t\t// world partition and validation\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\tsave.saveBodyValidation = SaveBodyValidation.Parse(reader);\n\t\t}\n\n\n\t\t// parse levels\n\t\tsave.levels = reader.readLevels();\n\n\t\t// unresolved data, probably not even useful.\n\t\tconst countUnresolvedWorldSaveData = reader.readInt32();\n\t\tif (countUnresolvedWorldSaveData) {\n\t\t\tsave.unresolvedWorldSaveData = [];\n\t\t\tfor (let i = 0; i < countUnresolvedWorldSaveData; i++) {\n\t\t\t\tsave.unresolvedWorldSaveData.push(ObjectReference.read(reader));\n\t\t\t}\n\t\t}\n\n\t\treader.onProgressCallback(reader.getBufferProgress(), 'finished parsing.');\n\n\t\treturn save;\n\t}\n\n\t/**\n\t * serializes a {@link SatisfactorySave} into binary and reports back on individual callbacks.\n\t * @param save the {@link SatisfactorySave} to serialize into binary.\n\t * @param options provides callbacks. onBinaryBeforeCompressing gets called on the binary save body before it is compressed.\n\t * onHeader gets called on the binary save header, which is always uncompressed.\n\t * onChunk gets called when a chunk of the compressed save body was generated. Often, files' save bodies consist of multiple chunks.\n\t * @returns a summary of the generated chunks.\n\t */\n\tpublic static WriteSave(save: SatisfactorySave,\n\t\tonHeader: (header: Uint8Array) => void,\n\t\tonChunk: (chunk: Uint8Array) => void,\n\t\toptions?: Partial<{\n\t\t\tonBinaryBeforeCompressing: (buffer: ArrayBuffer) => void,\n\t\t}>\n\t): ChunkSummary[] {\n\n\t\tconst writer = new SaveWriter();\n\t\twriter.context.saveHeaderType = save.header.saveHeaderType;\n\t\twriter.context.saveVersion = save.header.saveVersion;\n\t\twriter.context.buildVersion = save.header.buildVersion;\n\t\twriter.context.mapName = save.header.mapName;\n\t\twriter.context.mods = Object.fromEntries(save.header.modMetadata?.Mods?.map(mod => [mod.Reference, mod.Version]) ?? []);\n\n\t\tSatisfactorySaveHeader.Serialize(writer, save.header);\n\t\tconst posAfterHeader = writer.getBufferPosition();\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\tSaveBodyValidation.Serialize(writer, save.saveBodyValidation);\n\t\t}\n\n\t\tSaveWriter.WriteLevels(writer, save);\n\n\t\t// unresolved data\n\t\t// TODO: check if we ever encounter it.\n\t\tif (save.unresolvedWorldSaveData && save.unresolvedWorldSaveData.length > 0) {\n\t\t\twriter.writeInt32(save.unresolvedWorldSaveData?.length ?? 0);\n\t\t\tfor (const actor of save.unresolvedWorldSaveData ?? []) {\n\t\t\t\tObjectReference.write(writer, actor);\n\t\t\t}\n\t\t}\n\n\t\twriter.endWriting();\n\t\tconst chunkSummary = writer.generateChunks(save.compressionInfo!, posAfterHeader, options?.onBinaryBeforeCompressing ?? (() => { }), onHeader, onChunk);\n\t\treturn chunkSummary;\n\t}\n\n\t/**\n\t * Writes a {@link Blueprint} object to binary. And reports back on individual callbacks.\n\t * @param blueprint the blueprint to be written\n\t * @param options onMainFileBinaryBeforeCompressing gets called back when the main blueprint file binary is ready before compressing.\n\t * onMainFileHeader gets called back when the main blueprint file header is ready. onMainFileChunk gets called back when a main blueprint file chunk is ready.\n\t * @returns a chunk summary of the main file generated chunks. Plus the binary data of the config file, since it is often very small.\n\t */\n\tpublic static WriteBlueprintFiles(\n\t\tblueprint: Blueprint,\n\t\tonMainFileHeader: (header: Uint8Array) => void,\n\t\tonMainFileChunk: (chunk: Uint8Array) => void,\n\t\toptions?: Partial<{\n\t\t\tonMainFileBinaryBeforeCompressing: (binary: ArrayBuffer) => void,\n\t\t}>\n\t): {\n\t\tmainFileChunkSummary: ChunkSummary[],\n\t\tconfigFileBinary: ArrayBuffer\n\t} {\n\n\t\t// write main blueprint file\n\t\tconst blueprintWriter = new BlueprintWriter();\n\t\tblueprintWriter.context.blueprintConfigVersion = blueprint.config.configVersion;\n\t\tblueprintWriter.context.saveVersion = blueprint.header.saveVersion;\n\t\tblueprintWriter.context.buildVersion = blueprint.header.buildVersion;\n\n\t\tBlueprintHeader.Serialize(blueprintWriter, blueprint.header);\n\t\tconst saveBodyPos = blueprintWriter.getBufferPosition();\n\t\tBlueprintWriter.SerializeObjects(blueprintWriter, blueprint.objects);\n\t\tblueprintWriter.endWriting();\n\t\tlet binaryChunks: Uint8Array[] = [];\n\t\tlet binaryHeader: Uint8Array;\n\t\tconst mainFileChunkSummary = blueprintWriter.generateChunks(\n\t\t\tblueprint.compressionInfo,\n\t\t\tsaveBodyPos,\n\t\t\t{\n\t\t\t\tonBinaryBeforeCompressing: options?.onMainFileBinaryBeforeCompressing ?? (() => { }),\n\t\t\t\tonHeader: onMainFileHeader,\n\t\t\t\tonChunk: onMainFileChunk\n\t\t\t}\n\t\t);\n\n\t\t// write config as well.\n\t\tconst configWriter = new BlueprintConfigWriter();\n\t\tconfigWriter.context.blueprintConfigVersion = blueprint.config.configVersion;\n\t\tblueprintWriter.context.saveVersion = blueprint.header.saveVersion;\n\t\tblueprintWriter.context.buildVersion = blueprint.header.buildVersion;\n\n\t\tBlueprintConfig.Serialize(configWriter, blueprint.config);\n\t\tconst configFileBinary = configWriter.endWriting();\n\n\t\treturn {\n\t\t\tmainFileChunkSummary,\n\t\t\tconfigFileBinary\n\t\t}\n\t}\n\n\t/**\n\t * Parses two buffers (main blueprint file + config file) into a {@link Blueprint object}\n\t * @param name the name of the blueprint, since it is not part of the binary data and has to be passed.\n\t * @param blueprintFile the main blueprint file \".sbp\"\n\t * @param blueprintConfigFile the config blueprint file \".sbpcfg\"\n\t * @param options provides callbacks. onDecompressedBlueprintBody gets called when the body of the main blueprint file is decompressed.\n\t * @returns \n\t */\n\tpublic static ParseBlueprintFiles(\n\t\tname: string,\n\t\tblueprintFile: ArrayBufferLike,\n\t\tblueprintConfigFile: ArrayBufferLike,\n\t\toptions?: Partial<{\n\t\t\tonDecompressedBlueprintBody: (buffer: ArrayBufferLike) => void\n\t\t}>\n\t): Blueprint {\n\n\t\t// read config file\n\t\tconst blueprintConfigReader = new BlueprintConfigReader(blueprintConfigFile);\n\t\tconst config = BlueprintConfig.Parse(blueprintConfigReader);\n\n\t\t// read actual blueprint file. with context from config\n\t\tconst blueprintReader = new BlueprintReader(blueprintFile);\n\t\tblueprintReader.context.blueprintConfigVersion = config.configVersion;\n\t\tconst header = BlueprintHeader.Parse(blueprintReader);\n\t\tconst inflateResult = blueprintReader.inflateChunks();\n\n\t\t// call back on decompressed body.\n\t\tif (options?.onDecompressedBlueprintBody !== undefined) {\n\t\t\toptions.onDecompressedBlueprintBody(inflateResult.inflatedData);\n\t\t}\n\n\t\tconst blueprintObjects = BlueprintReader.ParseObjects(blueprintReader);\n\t\tconst blueprint: Blueprint = {\n\t\t\tname,\n\t\t\tcompressionInfo: blueprintReader.compressionInfo,\n\t\t\theader: header,\n\t\t\tconfig,\n\t\t\tobjects: blueprintObjects\n\t\t};\n\t\treturn blueprint;\n\t}\n\n\t/**\n\t * It JSON.stringifies any parsed content safely. The original JSON.stringify() has some flaws that get in the way, so it is custom wrapped. The original has some problems:\n\t * 1. it cannot stringify bigints. So we help out by converting it into a string.\n\t * 2. It cannot distinguish between 0 and -0. But a float32 is encoded in a uint8Array for 0 to be [0,0,0,0] (0x00000000) and -0 to be [0,0,0,128] (0x00000080) in little endian.\n\t * @param obj basically anything that can be stringified\n\t * @param indent the indentation, just like with the real JSON stringify.\n\t * @returns a string that is safely stringified.\n\t */\n\tpublic static JSONStringifyModified = (obj: any, indent: number = 0): string =>\n\t\tJSON.stringify(obj, (key, value) => {\n\t\t\tif (typeof value === 'bigint') {\n\t\t\t\treturn value.toString();\n\t\t\t} else if (value === 0 && 1 / value < 0) {\t// -0\n\t\t\t\treturn '-0';\n\t\t\t}\n\t\t\treturn value;\n\t\t}, indent)\n\n}"]}
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/parser/parser.ts"],"names":[],"mappings":";;;AAAA,uDAA+D;AAC/D,gFAA4E;AAC5E,gFAA4E;AAC5E,gFAAmG;AACnG,gFAAmG;AAEnG,6EAAyE;AACzE,2FAAsF;AAEtF,iFAA4E;AAC5E,iEAA6D;AAC7D,iEAA6D;AAC7D,kFAA+E;AAC/E,wFAAqF;AAIrF,MAAa,MAAM;IASX,MAAM,CAAC,SAAS,CACtB,IAAY,EACZ,KAAsB,EACtB,OAIE;QAGF,MAAM,MAAM,GAAG,IAAI,wBAAU,CAAC,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC;QAClE,MAAM,CAAC,OAAO,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC;QAE9F,MAAM,MAAM,GAAG,iDAAsB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,oCAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAGhD,MAAM,gBAAgB,GAAG,wBAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5E,IAAI,gBAAgB,KA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,YAAY,CAAC,eAAe,CAAC,CAAC;QACvE,MAAM,SAAS,GAAc;YAC5B,IAAI;YACJ,eAAe,EAAE,eAAe,CAAC,eAAe;YAChD,MAAM,EAAE,MAAM;YACd,MAAM;YACN,OAAO,EAAE,gBAAgB;SACzB,CAAC;QACF,OAAO,SAAS,CAAC;IAClB,CAAC;;AAnNF,wBAuOC;AAVc,4BAAqB,GAAG,CAAC,GAAQ,EAAE,SAAiB,CAAC,EAAU,EAAE,CAC9E,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;SAAM,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC,EAAE,MAAM,CAAC,CAAA","sourcesContent":["import { UnsupportedVersionError } from './error/parser.error';\nimport { BlueprintConfig } from './satisfactory/blueprint/blueprint-config';\nimport { BlueprintHeader } from './satisfactory/blueprint/blueprint-header';\nimport { BlueprintConfigReader, BlueprintReader } from \"./satisfactory/blueprint/blueprint-reader\";\nimport { BlueprintConfigWriter, BlueprintWriter } from \"./satisfactory/blueprint/blueprint-writer\";\nimport { Blueprint } from \"./satisfactory/blueprint/blueprint.types\";\nimport { SatisfactorySave } from \"./satisfactory/save/satisfactory-save\";\nimport { SatisfactorySaveHeader } from './satisfactory/save/satisfactory-save-header';\nimport { ChunkSummary } from './satisfactory/save/save-body-chunks';\nimport { SaveCustomVersion } from './satisfactory/save/save-custom-version';\nimport { SaveReader } from './satisfactory/save/save-reader';\nimport { SaveWriter } from \"./satisfactory/save/save-writer\";\nimport { ObjectReference } from './satisfactory/types/structs/ObjectReference';\nimport { SaveBodyValidation } from './satisfactory/types/structs/SaveBodyValidation';\n\n\n/** @public */\nexport class Parser {\n\n\t/**\n\t * Parses a given binary buffer as {@link SatisfactorySave}\n\t * @param name the save name. It won't be serialized, so it does not matter how you name it.\n\t * @param bytes the actual binary buffer\n\t * @param options provides callbacks. Either on the decompressed save body or on reported progress as a number [0,1] with an occasional message.\n\t * @returns \n\t */\n\tpublic static ParseSave(\n\t\tname: string,\n\t\tbytes: ArrayBufferLike,\n\t\toptions?: Partial<{\n\t\t\tonDecompressedSaveBody: (buffer: ArrayBufferLike) => void,\n\t\t\tonProgressCallback: (progress: number, msg?: string) => void,\n\t\t\tthrowErrors: boolean\n\t\t}>\n\t): SatisfactorySave {\n\n\t\tconst reader = new SaveReader(bytes, options?.onProgressCallback);\n\t\treader.context.throwErrors = options?.throwErrors !== undefined ? options.throwErrors : false;\n\n\t\tconst header = SatisfactorySaveHeader.Parse(reader);\n\t\tconst save = new SatisfactorySave(name, header);\n\n\t\t// guard save version\n\t\tconst roughSaveVersion = SaveReader.GetRoughSaveVersion(header.saveVersion);\n\t\tif (roughSaveVersion === '<U6') {\n\t\t\tthrow new UnsupportedVersionError('Game Version < U6 is not supported in the parser. Please save the file in a newer game version.');\n\t\t}\n\n\t\t// inflate chunks\n\t\tconst inflateResult = reader.inflateChunks();\n\t\tsave.compressionInfo = inflateResult.compressionInfo;\n\n\t\t// call callback on decompressed save body\n\t\tif (options?.onDecompressedSaveBody !== undefined) {\n\t\t\toptions.onDecompressedSaveBody(reader.getBuffer());\n\t\t}\n\n\t\t// world partition and validation\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\tsave.saveBodyValidation = SaveBodyValidation.Parse(reader);\n\t\t}\n\n\n\t\t// parse levels\n\t\tsave.levels = reader.readLevels();\n\n\t\t// unresolved data, probably not even useful.\n\t\tif (reader.getBufferPosition() < reader.getBufferLength()) {\n\t\t\tconst countUnresolvedWorldSaveData = reader.readInt32();\n\t\t\tif (countUnresolvedWorldSaveData) {\n\t\t\t\tsave.unresolvedWorldSaveData = [];\n\t\t\t\tfor (let i = 0; i < countUnresolvedWorldSaveData; i++) {\n\t\t\t\t\tsave.unresolvedWorldSaveData.push(ObjectReference.read(reader));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treader.onProgressCallback(reader.getBufferProgress(), 'finished parsing.');\n\n\t\treturn save;\n\t}\n\n\t/**\n\t * serializes a {@link SatisfactorySave} into binary and reports back on individual callbacks.\n\t * @param save the {@link SatisfactorySave} to serialize into binary.\n\t * @param options provides callbacks. onBinaryBeforeCompressing gets called on the binary save body before it is compressed.\n\t * onHeader gets called on the binary save header, which is always uncompressed.\n\t * onChunk gets called when a chunk of the compressed save body was generated. Often, files' save bodies consist of multiple chunks.\n\t * @returns a summary of the generated chunks.\n\t */\n\tpublic static WriteSave(save: SatisfactorySave,\n\t\tonHeader: (header: Uint8Array) => void,\n\t\tonChunk: (chunk: Uint8Array) => void,\n\t\toptions?: Partial<{\n\t\t\tonBinaryBeforeCompressing: (buffer: ArrayBuffer) => void,\n\t\t}>\n\t): ChunkSummary[] {\n\n\t\tconst writer = new SaveWriter();\n\t\twriter.context.saveHeaderType = save.header.saveHeaderType;\n\t\twriter.context.saveVersion = save.header.saveVersion;\n\t\twriter.context.buildVersion = save.header.buildVersion;\n\t\twriter.context.mapName = save.header.mapName;\n\t\twriter.context.mods = Object.fromEntries(save.header.modMetadata?.Mods?.map(mod => [mod.Reference, mod.Version]) ?? []);\n\n\t\tSatisfactorySaveHeader.Serialize(writer, save.header);\n\t\tconst posAfterHeader = writer.getBufferPosition();\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\tSaveBodyValidation.Serialize(writer, save.saveBodyValidation);\n\t\t}\n\n\t\tSaveWriter.WriteLevels(writer, save);\n\n\t\t// unresolved data\n\t\t// TODO: check if we ever encounter it.\n\t\tif (save.unresolvedWorldSaveData && save.unresolvedWorldSaveData.length > 0) {\n\t\t\twriter.writeInt32(save.unresolvedWorldSaveData.length);\n\t\t\tfor (const actor of save.unresolvedWorldSaveData) {\n\t\t\t\tObjectReference.write(writer, actor);\n\t\t\t}\n\t\t}\n\n\t\twriter.endWriting();\n\t\tconst chunkSummary = writer.generateChunks(save.compressionInfo!, posAfterHeader, options?.onBinaryBeforeCompressing ?? (() => { }), onHeader, onChunk);\n\t\treturn chunkSummary;\n\t}\n\n\t/**\n\t * Writes a {@link Blueprint} object to binary. And reports back on individual callbacks.\n\t * @param blueprint the blueprint to be written\n\t * @param options onMainFileBinaryBeforeCompressing gets called back when the main blueprint file binary is ready before compressing.\n\t * onMainFileHeader gets called back when the main blueprint file header is ready. onMainFileChunk gets called back when a main blueprint file chunk is ready.\n\t * @returns a chunk summary of the main file generated chunks. Plus the binary data of the config file, since it is often very small.\n\t */\n\tpublic static WriteBlueprintFiles(\n\t\tblueprint: Blueprint,\n\t\tonMainFileHeader: (header: Uint8Array) => void,\n\t\tonMainFileChunk: (chunk: Uint8Array) => void,\n\t\toptions?: Partial<{\n\t\t\tonMainFileBinaryBeforeCompressing: (binary: ArrayBuffer) => void,\n\t\t}>\n\t): {\n\t\tmainFileChunkSummary: ChunkSummary[],\n\t\tconfigFileBinary: ArrayBuffer\n\t} {\n\n\t\t// write main blueprint file\n\t\tconst blueprintWriter = new BlueprintWriter();\n\t\tblueprintWriter.context.blueprintConfigVersion = blueprint.config.configVersion;\n\t\tblueprintWriter.context.saveVersion = blueprint.header.saveVersion;\n\t\tblueprintWriter.context.buildVersion = blueprint.header.buildVersion;\n\n\t\tBlueprintHeader.Serialize(blueprintWriter, blueprint.header);\n\t\tconst saveBodyPos = blueprintWriter.getBufferPosition();\n\t\tBlueprintWriter.SerializeObjects(blueprintWriter, blueprint.objects);\n\t\tblueprintWriter.endWriting();\n\t\tlet binaryChunks: Uint8Array[] = [];\n\t\tlet binaryHeader: Uint8Array;\n\t\tconst mainFileChunkSummary = blueprintWriter.generateChunks(\n\t\t\tblueprint.compressionInfo,\n\t\t\tsaveBodyPos,\n\t\t\t{\n\t\t\t\tonBinaryBeforeCompressing: options?.onMainFileBinaryBeforeCompressing ?? (() => { }),\n\t\t\t\tonHeader: onMainFileHeader,\n\t\t\t\tonChunk: onMainFileChunk\n\t\t\t}\n\t\t);\n\n\t\t// write config as well.\n\t\tconst configWriter = new BlueprintConfigWriter();\n\t\tconfigWriter.context.blueprintConfigVersion = blueprint.config.configVersion;\n\t\tblueprintWriter.context.saveVersion = blueprint.header.saveVersion;\n\t\tblueprintWriter.context.buildVersion = blueprint.header.buildVersion;\n\n\t\tBlueprintConfig.Serialize(configWriter, blueprint.config);\n\t\tconst configFileBinary = configWriter.endWriting();\n\n\t\treturn {\n\t\t\tmainFileChunkSummary,\n\t\t\tconfigFileBinary\n\t\t}\n\t}\n\n\t/**\n\t * Parses two buffers (main blueprint file + config file) into a {@link Blueprint object}\n\t * @param name the name of the blueprint, since it is not part of the binary data and has to be passed.\n\t * @param blueprintFile the main blueprint file \".sbp\"\n\t * @param blueprintConfigFile the config blueprint file \".sbpcfg\"\n\t * @param options provides callbacks. onDecompressedBlueprintBody gets called when the body of the main blueprint file is decompressed.\n\t * @returns \n\t */\n\tpublic static ParseBlueprintFiles(\n\t\tname: string,\n\t\tblueprintFile: ArrayBufferLike,\n\t\tblueprintConfigFile: ArrayBufferLike,\n\t\toptions?: Partial<{\n\t\t\tonDecompressedBlueprintBody: (buffer: ArrayBufferLike) => void;\n\t\t\tthrowErrors: boolean;\n\t\t}>\n\t): Blueprint {\n\n\t\t// read config file\n\t\tconst blueprintConfigReader = new BlueprintConfigReader(blueprintConfigFile);\n\t\tconst config = BlueprintConfig.Parse(blueprintConfigReader);\n\n\t\t// read actual blueprint file. with context from config\n\t\tconst blueprintReader = new BlueprintReader(blueprintFile);\n\t\tblueprintReader.context.blueprintConfigVersion = config.configVersion;\n\n\t\tblueprintReader.context.throwErrors = options?.throwErrors !== undefined ? options.throwErrors : false;\n\t\tconst header = BlueprintHeader.Parse(blueprintReader);\n\t\tconst inflateResult = blueprintReader.inflateChunks();\n\n\t\t// call back on decompressed body.\n\t\tif (options?.onDecompressedBlueprintBody !== undefined) {\n\t\t\toptions.onDecompressedBlueprintBody(inflateResult.inflatedData);\n\t\t}\n\n\t\tconst blueprintObjects = BlueprintReader.ParseObjects(blueprintReader);\n\t\tconst blueprint: Blueprint = {\n\t\t\tname,\n\t\t\tcompressionInfo: blueprintReader.compressionInfo,\n\t\t\theader: header,\n\t\t\tconfig,\n\t\t\tobjects: blueprintObjects\n\t\t};\n\t\treturn blueprint;\n\t}\n\n\t/**\n\t * It JSON.stringifies any parsed content safely. The original JSON.stringify() has some flaws that get in the way, so it is custom wrapped. The original has some problems:\n\t * 1. it cannot stringify bigints. So we help out by converting it into a string.\n\t * 2. It cannot distinguish between 0 and -0. But a float32 is encoded in a uint8Array for 0 to be [0,0,0,0] (0x00000000) and -0 to be [0,0,0,128] (0x00000080) in little endian.\n\t * @param obj basically anything that can be stringified\n\t * @param indent the indentation, just like with the real JSON stringify.\n\t * @returns a string that is safely stringified.\n\t */\n\tpublic static JSONStringifyModified = (obj: any, indent: number = 0): string =>\n\t\tJSON.stringify(obj, (key, value) => {\n\t\t\tif (typeof value === 'bigint') {\n\t\t\t\treturn value.toString();\n\t\t\t} else if (value === 0 && 1 / value < 0) {\t// -0\n\t\t\t\treturn '-0';\n\t\t\t}\n\t\t\treturn value;\n\t\t}, indent)\n\n}"]}
|
|
@@ -9,7 +9,7 @@ var BlueprintHeader;
|
|
|
9
9
|
const headerVersion = reader.readInt32();
|
|
10
10
|
const saveVersion = reader.readInt32();
|
|
11
11
|
const buildVersion = reader.readInt32();
|
|
12
|
-
const
|
|
12
|
+
const designerDimension = vec3_1.vec3.ParseInt(reader);
|
|
13
13
|
reader.context.headerVersion = headerVersion;
|
|
14
14
|
reader.context.saveVersion = saveVersion;
|
|
15
15
|
reader.context.buildVersion = buildVersion;
|
|
@@ -21,17 +21,17 @@ var BlueprintHeader;
|
|
|
21
21
|
itemCosts[i] = [itemPathName, itemCount];
|
|
22
22
|
}
|
|
23
23
|
let recipeCount = reader.readInt32();
|
|
24
|
-
const
|
|
24
|
+
const recipeReferences = new Array(recipeCount).fill({ levelName: '', pathName: '' });
|
|
25
25
|
for (let i = 0; i < recipeCount; i++) {
|
|
26
26
|
const recipeName = ObjectReference_1.ObjectReference.read(reader);
|
|
27
|
-
|
|
27
|
+
recipeReferences[i] = recipeName;
|
|
28
28
|
}
|
|
29
29
|
return {
|
|
30
30
|
headerVersion,
|
|
31
31
|
saveVersion,
|
|
32
32
|
buildVersion,
|
|
33
|
-
designerDimension
|
|
34
|
-
recipeReferences
|
|
33
|
+
designerDimension,
|
|
34
|
+
recipeReferences,
|
|
35
35
|
itemCosts
|
|
36
36
|
};
|
|
37
37
|
};
|