@etothepii/satisfactory-file-parser 4.0.1 → 4.1.0
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/CHANGELOG.md +9 -0
- package/build/index.d.ts +29 -25
- package/build/index.d.ts.map +1 -1
- package/build/index.js +29 -25
- package/build/index.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/containers/StructProperty.d.ts +2 -9
- package/build/parser/satisfactory/types/property/generic/containers/StructProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/containers/StructProperty.js +3 -20
- package/build/parser/satisfactory/types/property/generic/containers/StructProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.d.ts +4 -22
- package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.js +6 -50
- package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/structs/FGDynamicStruct.js +2 -2
- package/build/parser/satisfactory/types/structs/FGDynamicStruct.js.map +1 -1
- package/build/parser/satisfactory/types/structs/binary/FConveyorBeltItem.d.ts +12 -0
- package/build/parser/satisfactory/types/structs/binary/FConveyorBeltItem.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FConveyorBeltItem.js +21 -0
- package/build/parser/satisfactory/types/structs/binary/FConveyorBeltItem.js.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FConveyorChainSplineSegment.d.ts +38 -0
- package/build/parser/satisfactory/types/structs/binary/FConveyorChainSplineSegment.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FConveyorChainSplineSegment.js +57 -0
- package/build/parser/satisfactory/types/structs/binary/FConveyorChainSplineSegment.js.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FInventoryItem.d.ts +14 -0
- package/build/parser/satisfactory/types/structs/binary/FInventoryItem.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/binary/FInventoryItem.js +34 -0
- package/build/parser/satisfactory/types/structs/binary/FInventoryItem.js.map +1 -0
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.d.ts +1 -1
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.d.ts.map +1 -1
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.js +1 -2
- package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.js.map +1 -1
- package/build/test/parser.spec.d.ts +2 -0
- package/build/test/parser.spec.d.ts.map +1 -0
- package/build/test/parser.spec.js +299 -0
- package/build/test/parser.spec.js.map +1 -0
- package/docs/assets/hierarchy.js +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/BlueprintConfigWriter.html +4 -4
- package/docs/classes/BlueprintReader.html +4 -4
- package/docs/classes/BlueprintWriter.html +4 -4
- package/docs/classes/ByteReader.html +4 -4
- package/docs/classes/ByteWriter.html +4 -4
- package/docs/classes/CompressionLibraryError.html +2 -2
- package/docs/classes/ContextReader.html +4 -4
- package/docs/classes/ContextWriter.html +4 -4
- package/docs/classes/CorruptBlueprintError.html +2 -2
- package/docs/classes/CorruptSaveError.html +2 -2
- package/docs/classes/Parser.html +6 -6
- package/docs/classes/ParserError.html +2 -2
- 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/SaveWriter.html +4 -4
- package/docs/classes/TimeoutError.html +2 -2
- package/docs/classes/UnimplementedError.html +2 -2
- package/docs/classes/UnsupportedVersionError.html +2 -2
- package/docs/enums/Alignment.html +2 -2
- package/docs/enums/BlueprintConfigVersion.html +2 -2
- package/docs/enums/BlueprintHeaderVersion.html +2 -2
- package/docs/enums/CompressionAlgorithmCode.html +2 -2
- package/docs/enums/ETextHistoryType.html +2 -2
- package/docs/enums/EUnrealEngineObjectUE5Version.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.CreateFromTag.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/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/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/DataBlob.Read.html +1 -1
- package/docs/functions/DataBlob.ReadNObjectContents.html +1 -1
- package/docs/functions/DataBlob.SkipOver.html +1 -1
- package/docs/functions/DataBlob.Write.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/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 -1
- package/docs/functions/FClientIdentityInfo.write.html +1 -1
- package/docs/functions/FColor.read.html +1 -1
- package/docs/functions/FColor.write.html +1 -1
- package/docs/functions/FConveyorBeltItem.read.html +1 -0
- package/docs/functions/FConveyorBeltItem.write.html +1 -0
- package/docs/functions/FConveyorChainSplineSegment.read.html +1 -0
- package/docs/functions/FConveyorChainSplineSegment.write.html +1 -0
- package/docs/functions/FCustomVersion.read.html +1 -1
- package/docs/functions/FCustomVersion.write.html +1 -1
- package/docs/functions/FCustomVersionContainer.read.html +1 -1
- package/docs/functions/FCustomVersionContainer.write.html +1 -1
- package/docs/functions/FEngineVersion.read.html +1 -1
- package/docs/functions/FEngineVersion.write.html +1 -1
- package/docs/functions/FGDynamicStruct.Parse.html +1 -1
- package/docs/functions/FGDynamicStruct.Serialize.html +1 -1
- package/docs/functions/FICFrameRange.read.html +1 -1
- package/docs/functions/FICFrameRange.write.html +1 -1
- package/docs/functions/FINGPUT1BufferPixel.read.html +1 -1
- package/docs/functions/FINGPUT1BufferPixel.write.html +1 -1
- package/docs/functions/FINItemStateFileSystem.IsFINItemStateFileSystem.html +1 -1
- package/docs/functions/FINItemStateFileSystem.read.html +1 -1
- package/docs/functions/FINItemStateFileSystem.write.html +1 -1
- package/docs/functions/FINLuaRuntimePersistenceState.read.html +1 -1
- package/docs/functions/FINLuaRuntimePersistenceState.write.html +1 -1
- package/docs/functions/FINNetworkTrace.read.html +1 -1
- package/docs/functions/FINNetworkTrace.write.html +1 -1
- package/docs/functions/FInventoryItem.read.html +1 -0
- package/docs/functions/FInventoryItem.write.html +1 -0
- package/docs/functions/FLBBalancerIndexing.read.html +1 -1
- package/docs/functions/FLBBalancerIndexing.write.html +1 -1
- package/docs/functions/FLinearColor.read.html +1 -1
- package/docs/functions/FLinearColor.write.html +1 -1
- package/docs/functions/FLocalUserNetIdBundle.read.html +1 -1
- package/docs/functions/FLocalUserNetIdBundle.write.html +1 -1
- package/docs/functions/FPackageFileVersion.read.html +1 -1
- package/docs/functions/FPackageFileVersion.write.html +1 -1
- package/docs/functions/FPlayerInfoHandle.read.html +1 -1
- package/docs/functions/FPlayerInfoHandle.write.html +1 -1
- package/docs/functions/FPropertyTag.IsCompletePropertyTagType.html +1 -1
- package/docs/functions/FPropertyTag.read.html +1 -1
- package/docs/functions/FPropertyTag.write.html +1 -1
- package/docs/functions/FPropertyTag.writeFromProperty.html +1 -1
- package/docs/functions/FPropertyTagNode.read.html +1 -1
- package/docs/functions/FPropertyTagNode.write.html +1 -1
- package/docs/functions/FSaveObjectVersionData.read.html +1 -1
- package/docs/functions/FSaveObjectVersionData.write.html +1 -1
- package/docs/functions/FUniqueNetIdRepl.read.html +1 -1
- package/docs/functions/FUniqueNetIdRepl.write.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/HierarchyVersion.CreateOnHeader.html +1 -1
- package/docs/functions/HierarchyVersion.SetOnLevel.html +1 -1
- package/docs/functions/HierarchyVersion.SetOnObject.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.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/IntProperty.Parse.html +1 -1
- package/docs/functions/IntProperty.ReadValue.html +1 -1
- package/docs/functions/IntProperty.Serialize.html +1 -1
- package/docs/functions/IntProperty.SerializeValue.html +1 -1
- package/docs/functions/InterfaceProperty.Parse.html +1 -1
- package/docs/functions/InterfaceProperty.ReadValue.html +1 -1
- package/docs/functions/InterfaceProperty.Serialize.html +1 -1
- package/docs/functions/InterfaceProperty.SerializeValue.html +1 -1
- package/docs/functions/LBBalancerIndexing.read.html +1 -1
- package/docs/functions/LBBalancerIndexing.write.html +1 -1
- package/docs/functions/Level.Read.html +1 -1
- package/docs/functions/Level.Serialize.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.Parse.html +1 -1
- package/docs/functions/MapProperty.Serialize.html +1 -1
- package/docs/functions/NameProperty.Parse.html +1 -1
- package/docs/functions/NameProperty.ReadValue.html +1 -1
- package/docs/functions/NameProperty.Serialize.html +1 -1
- package/docs/functions/NameProperty.SerializeValue.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/ObjectReferencesList.ReadList.html +1 -1
- package/docs/functions/ObjectReferencesList.SerializeList.html +1 -1
- package/docs/functions/ObjectsListSpecialProperties.Parse.html +1 -1
- package/docs/functions/ObjectsListSpecialProperties.Serialize.html +1 -1
- package/docs/functions/OptionalGUID.read.html +1 -1
- package/docs/functions/OptionalGUID.write.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.Parse.html +1 -1
- package/docs/functions/SetProperty.Serialize.html +1 -1
- package/docs/functions/SingleProperty.Parse.html +1 -1
- package/docs/functions/SingleProperty.ReadValue.html +1 -1
- package/docs/functions/SingleProperty.Serialize.html +1 -1
- package/docs/functions/SingleProperty.SerializeValue.html +1 -1
- package/docs/functions/SoftObjectProperty.Parse.html +1 -1
- package/docs/functions/SoftObjectProperty.ReadValue.html +1 -1
- package/docs/functions/SoftObjectProperty.Serialize.html +1 -1
- package/docs/functions/SoftObjectProperty.SerializeValue.html +1 -1
- 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/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/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/TOCBlob.Read.html +1 -1
- package/docs/functions/TOCBlob.ReadNObjectHeaders.html +1 -1
- package/docs/functions/TOCBlob.SerializeAllObjectHeaders.html +1 -1
- package/docs/functions/TOCBlob.SkipOver.html +1 -1
- package/docs/functions/TOCBlob.Write.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.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/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.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/isBoolProperty.html +1 -1
- package/docs/functions/isBuildableSubsystemSpecialProperties.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/isDoubleProperty.html +1 -1
- package/docs/functions/isEmptySpecialProperties.html +1 -1
- package/docs/functions/isEnumProperty.html +1 -1
- package/docs/functions/isFloatProperty.html +1 -1
- package/docs/functions/isInt64Property.html +1 -1
- package/docs/functions/isInt8Property.html +1 -1
- package/docs/functions/isIntProperty.html +1 -1
- package/docs/functions/isInterfaceProperty.html +1 -1
- package/docs/functions/isMapProperty.html +1 -1
- package/docs/functions/isNameProperty.html +1 -1
- package/docs/functions/isObjectProperty.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/isSingleProperty.html +1 -1
- package/docs/functions/isSoftObjectProperty.html +1 -1
- package/docs/functions/isSpecialDroneActionProperties.html +1 -1
- package/docs/functions/isStrProperty.html +1 -1
- package/docs/functions/isStructProperty.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/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/interfaces/BinaryOperable.html +2 -2
- package/docs/interfaces/BinaryReadable.html +2 -2
- package/docs/interfaces/BinaryWritable.html +2 -2
- package/docs/interfaces/Blueprint.html +2 -2
- package/docs/interfaces/BlueprintConfig.html +4 -4
- package/docs/interfaces/SaveComponentHeader.html +2 -2
- package/docs/interfaces/SaveEntityHeader.html +2 -2
- package/docs/interfaces/SaveObjectHeader.html +2 -2
- package/docs/modules/FConveyorBeltItem.html +1 -0
- package/docs/modules/FConveyorChainSplineSegment.html +1 -0
- package/docs/modules/FInventoryItem.html +1 -0
- package/docs/modules.html +1 -1
- package/docs/types/AbstractBaseProperty.html +2 -2
- package/docs/types/ArrayProperty.html +1 -1
- package/docs/types/BasicMultipleStructPropertyValue.html +2 -2
- package/docs/types/BasicStructPropertyValue.html +2 -2
- package/docs/types/BlueprintHeader.html +2 -2
- package/docs/types/BlueprintReaderWriterContext.html +2 -2
- package/docs/types/BoolArrayProperty.html +1 -1
- package/docs/types/BoolProperty.html +1 -1
- package/docs/types/BoxStructPropertyValue.html +2 -2
- package/docs/types/BuildableSubsystemSpecialProperties.html +2 -2
- package/docs/types/BuildableTypeInstance.html +2 -2
- package/docs/types/ByteArrayProperty.html +1 -1
- package/docs/types/ByteProperty.html +1 -1
- package/docs/types/BytePropertyValue.html +2 -2
- package/docs/types/ChunkCompressionInfo.html +2 -2
- package/docs/types/ChunkSummary.html +2 -2
- package/docs/types/CircuitSpecialProperties.html +2 -2
- package/docs/types/ConveyorChainActorSpecialProperties.html +2 -2
- package/docs/types/ConveyorSpecialProperties.html +2 -2
- package/docs/types/DoubleArrayProperty.html +1 -1
- package/docs/types/DoubleProperty.html +1 -1
- package/docs/types/DynamicStructPropertyValue.html +2 -2
- package/docs/types/EmptySpecialProperties.html +2 -2
- package/docs/types/EnumArrayProperty.html +1 -1
- package/docs/types/EnumProperty.html +1 -1
- package/docs/types/FClientIdentityInfo.html +2 -2
- package/docs/types/FColor.html +1 -1
- package/docs/types/FConveyorBeltItem.html +3 -0
- package/docs/types/FConveyorChainSplineSegment.html +10 -0
- package/docs/types/FCustomVersion.html +2 -2
- package/docs/types/FCustomVersionContainer.html +2 -2
- package/docs/types/FEngineVersion.html +2 -2
- package/docs/types/FGDynamicStruct.html +2 -2
- package/docs/types/FICFrameRange.html +2 -2
- package/docs/types/FICFrameRangeStructPropertyValue.html +2 -2
- package/docs/types/FINGPUT1BufferPixel.html +2 -2
- package/docs/types/FINItemStateFileSystem.html +1 -1
- package/docs/types/FINLuaRuntimePersistenceState.html +2 -2
- package/docs/types/FINNetworkTrace.html +2 -2
- package/docs/types/FIRInstancedStruct.html +1 -1
- package/docs/types/FInventoryItem.html +4 -0
- package/docs/types/FLBBalancerIndexing.html +2 -2
- package/docs/types/FLinearColor.html +1 -1
- package/docs/types/FLocalUserNetIdBundle.html +2 -2
- package/docs/types/FPackageFileVersion.html +2 -2
- package/docs/types/FPlayerInfoHandle.html +2 -2
- package/docs/types/FPropertyTag.html +2 -2
- package/docs/types/FPropertyTagNode.html +2 -2
- package/docs/types/FSaveObjectVersionData.html +2 -2
- package/docs/types/FUniqueNetIdRepl.html +2 -2
- package/docs/types/FloatArrayProperty.html +1 -1
- package/docs/types/FloatProperty.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.html +1 -1
- package/docs/types/Grids.html +1 -1
- package/docs/types/HierarchyVersion.html +2 -2
- package/docs/types/Int64ArrayProperty.html +1 -1
- package/docs/types/Int64Property.html +1 -1
- package/docs/types/Int8Property.html +1 -1
- package/docs/types/IntArrayProperty.html +1 -1
- package/docs/types/IntProperty.html +1 -1
- package/docs/types/IntSetProperty.html +1 -1
- package/docs/types/InterfaceArrayProperty.html +1 -1
- package/docs/types/InterfaceProperty.html +1 -1
- package/docs/types/LBBalancerIndexing.html +2 -2
- package/docs/types/Level.html +2 -2
- package/docs/types/LevelToDestroyedActorsMap.html +1 -1
- package/docs/types/Levels.html +1 -1
- package/docs/types/MD5Hash.html +2 -2
- package/docs/types/MapProperty.html +1 -1
- package/docs/types/ModData.html +2 -2
- package/docs/types/NameProperty.html +1 -1
- package/docs/types/NameSetProperty.html +1 -1
- package/docs/types/ObjectArrayProperty.html +1 -1
- package/docs/types/ObjectProperty.html +1 -1
- package/docs/types/ObjectReference.html +2 -2
- package/docs/types/ObjectSetProperty.html +1 -1
- package/docs/types/ObjectsListSpecialProperties.html +2 -2
- package/docs/types/OptionalGUID.html +1 -1
- package/docs/types/PlayerSpecialProperties.html +2 -2
- package/docs/types/PowerLineSpecialProperties.html +2 -2
- package/docs/types/PropertiesMap.html +1 -1
- package/docs/types/RailroadTrackPositionStructPropertyValue.html +2 -2
- package/docs/types/ReaderWriterContext.html +1 -1
- package/docs/types/RoughSaveVersion.html +1 -1
- package/docs/types/SatisfactoryModMetadata.html +2 -2
- package/docs/types/SatisfactorySaveHeader.html +2 -2
- package/docs/types/SaveBodyChunks.html +2 -2
- package/docs/types/SaveBodyValidation.html +2 -2
- package/docs/types/SaveReaderWriterContext.html +2 -2
- package/docs/types/SetProperty.html +1 -1
- package/docs/types/SingleProperty.html +1 -1
- package/docs/types/SoftObjectArrayProperty.html +1 -1
- package/docs/types/SoftObjectProperty.html +1 -1
- package/docs/types/SoftObjectReference.html +2 -2
- package/docs/types/SpecialDroneAction.html +2 -2
- package/docs/types/SpecialDroneActionProperties.html +2 -2
- package/docs/types/SpecialProperties.AvailableSpecialPropertiesTypes.html +1 -1
- package/docs/types/StrArrayProperty.html +1 -1
- package/docs/types/StrProperty.html +1 -1
- package/docs/types/StrSetProperty.html +1 -1
- package/docs/types/StructArrayProperty.html +1 -1
- package/docs/types/StructProperty.html +1 -1
- package/docs/types/StructSetProperty.html +1 -1
- package/docs/types/TextArrayProperty.html +1 -1
- package/docs/types/TextProperty.html +1 -1
- package/docs/types/TextPropertyValue.html +2 -2
- package/docs/types/Transform.html +2 -2
- package/docs/types/Uint32Property.html +1 -1
- package/docs/types/Uint32SetProperty.html +1 -1
- package/docs/types/Uint64Property.html +1 -1
- package/docs/types/Uint8Property.html +1 -1
- package/docs/types/VehiclePhysicsData.html +2 -2
- package/docs/types/VehicleSpecialProperties.html +2 -2
- package/docs/types/col4.html +2 -2
- package/docs/types/vec2.html +2 -2
- package/docs/types/vec3.html +1 -1
- package/docs/types/vec4.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 -1
- package/docs/variables/SaveBodyChunks.HEADER_V1.html +1 -1
- package/docs/variables/SaveBodyChunks.HEADER_V2.html +1 -1
- package/docs/variables/isBoolArrayProperty.html +1 -1
- package/docs/variables/isByteArrayProperty.html +1 -1
- package/docs/variables/isDoubleArrayProperty.html +1 -1
- package/docs/variables/isEnumArrayProperty.html +1 -1
- package/docs/variables/isFloatArrayProperty.html +1 -1
- package/docs/variables/isInt64ArrayProperty.html +1 -1
- package/docs/variables/isIntArrayProperty.html +1 -1
- package/docs/variables/isIntSetProperty.html +1 -1
- package/docs/variables/isInterfaceArrayProperty.html +1 -1
- package/docs/variables/isNameSetProperty.html +1 -1
- package/docs/variables/isObjectArrayProperty.html +1 -1
- package/docs/variables/isObjectSetProperty.html +1 -1
- package/docs/variables/isSoftObjectArrayProperty.html +1 -1
- package/docs/variables/isStrArrayProperty.html +1 -1
- package/docs/variables/isStrSetProperty.html +1 -1
- package/docs/variables/isStructArrayPRoperty.html +1 -1
- package/docs/variables/isStructSetProperty.html +1 -1
- package/docs/variables/isTextArrayProperty.html +1 -1
- package/docs/variables/isUint32SetProperty.html +1 -1
- package/package.json +1 -1
- package/docs/types/ConveyorChainSegmentSpecialProperties.html +0 -10
- package/docs/types/ConveyorItemSpecialProperties.html +0 -3
- package/docs/types/InventoryItemStructPropertyValue.html +0 -4
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const fs = __importStar(require("node:fs"));
|
|
27
|
+
const path = __importStar(require("node:path"));
|
|
28
|
+
const node_stream_1 = require("node:stream");
|
|
29
|
+
const node_util_1 = require("node:util");
|
|
30
|
+
const index_1 = require("../index");
|
|
31
|
+
const PropertiesListMod = __importStar(require("../parser/satisfactory/types/property/PropertiesList"));
|
|
32
|
+
const FINNetworkTraceMod = __importStar(require("../parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace"));
|
|
33
|
+
beforeAll(() => {
|
|
34
|
+
const logOutput = process.stdout;
|
|
35
|
+
console.log = (...e) => {
|
|
36
|
+
logOutput.write(e.map(el => (0, node_util_1.format)(el)).join(' ') + '\n');
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
const ParseSaveSync = (savename, file, onDecompressedSaveBody, throwErrors = true) => {
|
|
40
|
+
console.log(`## parsing save ${savename}`);
|
|
41
|
+
const save = index_1.Parser.ParseSave(savename, file, {
|
|
42
|
+
onDecompressedSaveBody,
|
|
43
|
+
onProgressCallback: (progress, msg) => {
|
|
44
|
+
console.log(`${savename} parsing progress`, progress, msg);
|
|
45
|
+
},
|
|
46
|
+
throwErrors
|
|
47
|
+
});
|
|
48
|
+
return save;
|
|
49
|
+
};
|
|
50
|
+
const ParseBlueprintSync = (blueprintname, file, configFileBuffer, onDecompressedBlueprintBody) => {
|
|
51
|
+
return index_1.Parser.ParseBlueprintFiles(blueprintname, file, configFileBuffer, {
|
|
52
|
+
onDecompressedBlueprintBody,
|
|
53
|
+
throwErrors: true
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const WriteSaveSync = (save, onBinaryBeforeCompressing) => {
|
|
57
|
+
let mainFileHeader;
|
|
58
|
+
const mainFileBodyChunks = [];
|
|
59
|
+
index_1.Parser.WriteSave(save, header => {
|
|
60
|
+
mainFileHeader = header;
|
|
61
|
+
}, chunk => {
|
|
62
|
+
mainFileBodyChunks.push(chunk);
|
|
63
|
+
}, { onBinaryBeforeCompressing });
|
|
64
|
+
fs.writeFileSync(path.join(__dirname, save.name + '_on-writing.sav'), Buffer.concat([mainFileHeader, ...mainFileBodyChunks]));
|
|
65
|
+
};
|
|
66
|
+
describe('modification of saves', () => {
|
|
67
|
+
const FindFirst = (save, condition) => {
|
|
68
|
+
for (const level of Object.values(save.levels)) {
|
|
69
|
+
const potentialObject = level.objects.find(condition);
|
|
70
|
+
if (potentialObject) {
|
|
71
|
+
return {
|
|
72
|
+
level,
|
|
73
|
+
object: potentialObject
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const ModifyObjects = (save, ...modifiedObjects) => {
|
|
79
|
+
for (const modifiedObject of modifiedObjects) {
|
|
80
|
+
for (const level of Object.values(save.levels)) {
|
|
81
|
+
for (let i = 0; i < level.objects.length; i++) {
|
|
82
|
+
if (level.objects[i].instanceName === modifiedObject.instanceName) {
|
|
83
|
+
level.objects[i] = modifiedObject;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const ModifyPlayer = (save) => {
|
|
90
|
+
const firstPlayer = FindFirst(save, obj => obj.typePath === '/Game/FactoryGame/Character/Player/Char_Player.Char_Player_C');
|
|
91
|
+
firstPlayer.object.transform.translation = {
|
|
92
|
+
x: firstPlayer.object.transform.translation.x + 5000,
|
|
93
|
+
y: firstPlayer.object.transform.translation.y + 5000,
|
|
94
|
+
z: firstPlayer.object.transform.translation.z,
|
|
95
|
+
};
|
|
96
|
+
return [firstPlayer];
|
|
97
|
+
};
|
|
98
|
+
const ModifyStorageContainer = (save) => {
|
|
99
|
+
const firstContainer = FindFirst(save, obj => obj.typePath === '/Game/FactoryGame/Buildable/Factory/StorageContainerMk1/Build_StorageContainerMk1.Build_StorageContainerMk1_C');
|
|
100
|
+
const inventoryReference = firstContainer.object.properties.mStorageInventory;
|
|
101
|
+
const inventory = Object.values(save.levels).flatMap(level => level.objects).find(obj => obj.instanceName === inventoryReference.value.pathName);
|
|
102
|
+
const inventoryStacks = inventory.properties.mInventoryStacks;
|
|
103
|
+
const firstStack = inventoryStacks.values[0];
|
|
104
|
+
firstStack.properties.Item.value.itemReference = {
|
|
105
|
+
levelName: '',
|
|
106
|
+
pathName: '/Game/FactoryGame/Resource/Parts/Rotor/Desc_Rotor.Desc_Rotor_C'
|
|
107
|
+
};
|
|
108
|
+
firstStack.properties.NumItems.value = 5;
|
|
109
|
+
return [firstContainer];
|
|
110
|
+
};
|
|
111
|
+
it.each([
|
|
112
|
+
['modifies position of first player', ModifyPlayer],
|
|
113
|
+
['modifies an item stack in a storage container', ModifyStorageContainer]
|
|
114
|
+
])('example %s correctly', (_, modificationMethod) => {
|
|
115
|
+
const savename = '265';
|
|
116
|
+
const file = new Uint8Array(fs.readFileSync(path.join(__dirname, savename + '.sav'))).buffer;
|
|
117
|
+
const save = ParseSaveSync(savename, file);
|
|
118
|
+
const modifiedObjects = modificationMethod(save);
|
|
119
|
+
ModifyObjects(save, ...modifiedObjects.map(wrapper => wrapper.object));
|
|
120
|
+
WriteSaveSync(save, binary => {
|
|
121
|
+
fs.writeFileSync(path.join(__dirname, savename + '_on-writing.bin'), Buffer.from(binary));
|
|
122
|
+
});
|
|
123
|
+
const modifiedFile = new Uint8Array(fs.readFileSync(path.join(__dirname, save.name + '_on-writing.sav'))).buffer;
|
|
124
|
+
const modifiedSave = ParseSaveSync(savename, modifiedFile);
|
|
125
|
+
for (const modifiedObject of modifiedObjects) {
|
|
126
|
+
const relevantLevel = modifiedSave.levels[modifiedObject.level.name];
|
|
127
|
+
const objectToCheck = relevantLevel.objects.find(obj => obj.instanceName === modifiedObject.object.instanceName);
|
|
128
|
+
expect((0, node_util_1.isDeepStrictEqual)(objectToCheck, modifiedObject.object)).toEqual(true);
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe('parsing of saves', () => {
|
|
133
|
+
const saveList = [
|
|
134
|
+
'EmptySave10WithoutDestroyedActors',
|
|
135
|
+
'Release-001',
|
|
136
|
+
'Release-032',
|
|
137
|
+
'265',
|
|
138
|
+
'269',
|
|
139
|
+
'Fresh-1.1-Dismantled',
|
|
140
|
+
'Unlock-1.1-2',
|
|
141
|
+
'FreshStartU8001-vehicles-2',
|
|
142
|
+
'FreshStart001',
|
|
143
|
+
'FreshStart002',
|
|
144
|
+
'Release-Ported-U1-to-U1.1',
|
|
145
|
+
'Release-Ported-U1-to-U1.1-Collected-Nuts-and-Berry',
|
|
146
|
+
'Release-Ported-U1-to-U1.1-Collected-Blue-Slug',
|
|
147
|
+
'ficsitcam-1',
|
|
148
|
+
'structuralsolutions-1',
|
|
149
|
+
'x3-roads-signs',
|
|
150
|
+
'pep-modtest-1',
|
|
151
|
+
'Modding-Testing-MLB-003',
|
|
152
|
+
'Dunarr-076',
|
|
153
|
+
'Modding-Experimental-01',
|
|
154
|
+
'Empty-Save-Before-1.2',
|
|
155
|
+
'Another-1-2',
|
|
156
|
+
'Ported-11-to-12-Exp'
|
|
157
|
+
];
|
|
158
|
+
it.each(saveList)('can parse a binary save (%s) to json with stream and with sync', async (savename) => {
|
|
159
|
+
const filepath = path.join(__dirname, savename + '.sav');
|
|
160
|
+
const binaryFilepathStream = path.join(__dirname, savename + '.stream.bin');
|
|
161
|
+
const binaryFilepathSync = path.join(__dirname, savename + '.sync.bin');
|
|
162
|
+
const file = new Uint8Array(fs.readFileSync(filepath)).buffer;
|
|
163
|
+
const outJsonPathStream = path.join(__dirname, savename + '.stream.json');
|
|
164
|
+
const outJsonPathSync = path.join(__dirname, savename + '.sync.json');
|
|
165
|
+
const outJsonStream = fs.createWriteStream(outJsonPathStream, { highWaterMark: 1024 * 1024 * 200 });
|
|
166
|
+
const { stream, startStreaming } = index_1.ReadableStreamParser.CreateReadableStreamFromSaveToJson(savename, file, {
|
|
167
|
+
onDecompressedSaveBody: decompressedBody => {
|
|
168
|
+
fs.writeFileSync(binaryFilepathStream, Buffer.from(decompressedBody));
|
|
169
|
+
}, onProgress: (progress, msg) => {
|
|
170
|
+
console.log(`parsing stream progress ${savename}`, progress, msg);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
const start = performance.now();
|
|
174
|
+
startStreaming();
|
|
175
|
+
stream.pipeTo(node_stream_1.Writable.toWeb(outJsonStream));
|
|
176
|
+
let end = 0;
|
|
177
|
+
await new Promise((resolve, reject) => {
|
|
178
|
+
outJsonStream
|
|
179
|
+
.on('close', () => {
|
|
180
|
+
console.log('outstream closed.');
|
|
181
|
+
end = performance.now();
|
|
182
|
+
return resolve();
|
|
183
|
+
})
|
|
184
|
+
.on('error', (err) => {
|
|
185
|
+
console.log('outstream error', err);
|
|
186
|
+
return reject();
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
console.log(`Streaming took ${(end - start) / 1000} seconds.`);
|
|
190
|
+
const start2 = performance.now();
|
|
191
|
+
const save = ParseSaveSync(savename, file, decompressedBody => {
|
|
192
|
+
fs.writeFileSync(binaryFilepathSync, Buffer.from(decompressedBody));
|
|
193
|
+
});
|
|
194
|
+
fs.writeFileSync(outJsonPathSync, JSON.stringify(save));
|
|
195
|
+
const end2 = performance.now();
|
|
196
|
+
console.log(`Sync Parsing took ${(end2 - start2) / 1000} seconds.`);
|
|
197
|
+
const json1 = fs.readFileSync(outJsonPathSync, { encoding: 'utf-8' });
|
|
198
|
+
const json2 = fs.readFileSync(outJsonPathStream, { encoding: 'utf-8' });
|
|
199
|
+
const thing1 = JSON.parse(json1);
|
|
200
|
+
const thing2 = JSON.parse(json2);
|
|
201
|
+
expect(JSON.stringify(thing1).length).toEqual(JSON.stringify(thing2).length);
|
|
202
|
+
const saveSerializedAndRead = () => ParseSaveSync(savename, file);
|
|
203
|
+
expect(saveSerializedAndRead).not.toThrow();
|
|
204
|
+
});
|
|
205
|
+
it.each(saveList)('can write a synchronous save (%s)', async (savename) => {
|
|
206
|
+
const filepath = path.join(__dirname, savename + '.sync.json');
|
|
207
|
+
const save = JSON.parse(fs.readFileSync(filepath, { encoding: 'utf-8' }));
|
|
208
|
+
WriteSaveSync(save, binary => {
|
|
209
|
+
fs.writeFileSync(path.join(__dirname, savename + '_on-writing.bin'), new Uint8Array(Buffer.from(binary)));
|
|
210
|
+
});
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
describe('parsing of blueprints', () => {
|
|
214
|
+
it.each([
|
|
215
|
+
'U1-1-Single-Container',
|
|
216
|
+
'U1-1-Single-Container-2',
|
|
217
|
+
'BlueprintWithHeaderV1',
|
|
218
|
+
'release-single-wall',
|
|
219
|
+
'release-storage-mk1',
|
|
220
|
+
'release-storage-mk2-blueprintmk2',
|
|
221
|
+
'release-two-foundations',
|
|
222
|
+
'two-foundations-1-2',
|
|
223
|
+
'mod-circuitry'
|
|
224
|
+
])('parser can read and write a synchronous blueprint: %s', async (blueprintname) => {
|
|
225
|
+
const filepathBlueprint = path.join(__dirname, blueprintname + '.sbp');
|
|
226
|
+
const filepathBlueprintConfig = path.join(__dirname, blueprintname + '.sbpcfg');
|
|
227
|
+
const binaryFilepath = path.join(__dirname, blueprintname + '.bins');
|
|
228
|
+
const file = new Uint8Array(fs.readFileSync(filepathBlueprint)).buffer;
|
|
229
|
+
const configFileBuffer = new Uint8Array(fs.readFileSync(filepathBlueprintConfig)).buffer;
|
|
230
|
+
let binaryBodyLength = 0;
|
|
231
|
+
const blueprint = ParseBlueprintSync(blueprintname, file, configFileBuffer, (decompressedBody) => {
|
|
232
|
+
binaryBodyLength = decompressedBody.byteLength;
|
|
233
|
+
fs.writeFileSync(binaryFilepath, Buffer.from(decompressedBody));
|
|
234
|
+
});
|
|
235
|
+
fs.writeFileSync(path.join(__dirname, blueprintname + '.json'), JSON.stringify(blueprint, null, 4));
|
|
236
|
+
let mainFileHeader;
|
|
237
|
+
const mainFileBodyChunks = [];
|
|
238
|
+
const response = index_1.Parser.WriteBlueprintFiles(blueprint, header => {
|
|
239
|
+
mainFileHeader = header;
|
|
240
|
+
}, chunk => {
|
|
241
|
+
mainFileBodyChunks.push(chunk);
|
|
242
|
+
}, {
|
|
243
|
+
onMainFileBinaryBeforeCompressing: binary => {
|
|
244
|
+
fs.writeFileSync(path.join(__dirname, blueprintname + '.bins_modified'), new Uint8Array(Buffer.from(binary)));
|
|
245
|
+
expect(binary.byteLength).toEqual(binaryBodyLength);
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
fs.writeFileSync(path.join(__dirname, blueprintname + '.sbp_modified'), new Uint8Array(Buffer.concat([mainFileHeader, ...mainFileBodyChunks])));
|
|
249
|
+
fs.writeFileSync(path.join(__dirname, blueprintname + '.sbpcfg_modified'), new Uint8Array(Buffer.from(response.configFileBinary)));
|
|
250
|
+
const mainFileNew = new Uint8Array(fs.readFileSync(path.join(__dirname, blueprintname + '.sbp_modified'))).buffer;
|
|
251
|
+
const configFileNew = new Uint8Array(fs.readFileSync(path.join(__dirname, blueprintname + '.sbpcfg_modified'))).buffer;
|
|
252
|
+
const blueprintNew = ParseBlueprintSync(blueprintname, mainFileNew, configFileNew, (decompressedBody) => {
|
|
253
|
+
expect(decompressedBody.byteLength).toEqual(binaryBodyLength);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
describe('when ignoring errors', () => {
|
|
258
|
+
let spy;
|
|
259
|
+
const file = new Uint8Array(fs.readFileSync(path.join(__dirname, 'Dunarr-027.sav'))).buffer;
|
|
260
|
+
const parseSaveWithoutErrors = () => ParseSaveSync('Dunarr', file, () => { }, false);
|
|
261
|
+
afterEach(() => {
|
|
262
|
+
spy?.mockRestore();
|
|
263
|
+
});
|
|
264
|
+
it('after encountering an error in the property read method, continues parsing.', () => {
|
|
265
|
+
spy = jest.spyOn(FINNetworkTraceMod.FINNetworkTrace, 'read');
|
|
266
|
+
spy.mockImplementationOnce((reader) => {
|
|
267
|
+
throw new Error('unexpected error.');
|
|
268
|
+
});
|
|
269
|
+
expect(parseSaveWithoutErrors).not.toThrow();
|
|
270
|
+
expect(spy).toHaveBeenCalled();
|
|
271
|
+
});
|
|
272
|
+
it('after reading a wrong number of bytes for a property, continues parsing.', () => {
|
|
273
|
+
spy = jest.spyOn(FINNetworkTraceMod.FINNetworkTrace, 'read');
|
|
274
|
+
spy.mockImplementationOnce((reader) => {
|
|
275
|
+
reader.readInt32();
|
|
276
|
+
return {
|
|
277
|
+
reference: {
|
|
278
|
+
levelName: '',
|
|
279
|
+
pathName: ''
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
expect(parseSaveWithoutErrors).not.toThrow();
|
|
284
|
+
expect(spy).toHaveBeenCalled();
|
|
285
|
+
});
|
|
286
|
+
it('after encountering a severe error, puts data of object into trailing data.', () => {
|
|
287
|
+
spy = jest.spyOn(PropertiesListMod.PropertiesList, 'ParseList');
|
|
288
|
+
spy.mockImplementationOnce((reader) => {
|
|
289
|
+
throw new Error('unexpected error.');
|
|
290
|
+
});
|
|
291
|
+
const save = parseSaveWithoutErrors();
|
|
292
|
+
const firstObjectInSave = Object.values(save.levels).flatMap(level => level.objects).find(obj => obj.instanceName === 'Persistent_Level:PersistentLevel.BP_EnemySpawner371');
|
|
293
|
+
expect(save).toBeDefined();
|
|
294
|
+
expect(firstObjectInSave).toBeDefined();
|
|
295
|
+
expect(firstObjectInSave.trailingData.length).toEqual(475);
|
|
296
|
+
expect(Object.entries(firstObjectInSave.properties).length).toEqual(0);
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
//# sourceMappingURL=parser.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.spec.js","sourceRoot":"","sources":["../../src/test/parser.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,4CAA8B;AAC9B,gDAAkC;AAClC,6CAAuC;AACvC,yCAAsD;AACtD,oCAA+O;AAC/O,wGAA0F;AAC1F,6HAA+G;AAE/G,SAAS,CAAC,GAAG,EAAE;IACd,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IACjC,OAAO,CAAC,GAAG,GAAG,CAAC,GAAG,CAAQ,EAAE,EAAE;QAC7B,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAA,kBAAM,EAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC3D,CAAC,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,IAAqB,EAAE,sBAAwD,EAAE,cAAuB,IAAI,EAAoB,EAAE;IAC1K,OAAO,CAAC,GAAG,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,cAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE;QAC7C,sBAAsB;QACtB,kBAAkB,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE;YACrC,OAAO,CAAC,GAAG,CAAC,GAAG,QAAQ,mBAAmB,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC;QACD,WAAW;KACX,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CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,YAAY,KAAK,qDAAqD,CAAC,CAAC;QAE9K,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3B,MAAM,CAAC,iBAAiB,CAAC,CAAC,WAAW,EAAE,CAAC;QACxC,MAAM,CAAC,iBAAkB,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5D,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,iBAAkB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/// <reference types=\"jest\" />\n/// <reference types=\"node\" />\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { Writable } from 'node:stream';\nimport { format, isDeepStrictEqual } from 'node:util';\nimport { ArrayProperty, ContextReader, DynamicStructPropertyValue, FInventoryItem, IntProperty, Level, ObjectProperty, Parser, ReadableStreamParser, SatisfactorySave, SaveComponent, SaveEntity, SaveObject, StructProperty } from '../index';\nimport * as PropertiesListMod from '../parser/satisfactory/types/property/PropertiesList';\nimport * as FINNetworkTraceMod from '../parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace';\n\nbeforeAll(() => {\n\tconst logOutput = process.stdout;\n\tconsole.log = (...e: any[]) => {\n\t\tlogOutput.write(e.map(el => format(el)).join(' ') + '\\n');\n\t};\n});\n\nconst ParseSaveSync = (savename: string, file: ArrayBufferLike, onDecompressedSaveBody?: (body: ArrayBufferLike) => void, throwErrors: boolean = true): SatisfactorySave => {\n\tconsole.log(`## parsing save ${savename}`);\n\tconst save = Parser.ParseSave(savename, file, {\n\t\tonDecompressedSaveBody,\n\t\tonProgressCallback: (progress, msg) => {\n\t\t\tconsole.log(`${savename} parsing progress`, progress, msg);\n\t\t},\n\t\tthrowErrors\n\t});\n\treturn save;\n};\n\n\nconst ParseBlueprintSync = (\n\tblueprintname: string,\n\tfile: ArrayBufferLike,\n\tconfigFileBuffer: ArrayBufferLike,\n\tonDecompressedBlueprintBody: NonNullable<Parameters<typeof Parser.ParseBlueprintFiles>[3]>['onDecompressedBlueprintBody']\n) => {\n\treturn Parser.ParseBlueprintFiles(blueprintname, file, configFileBuffer, {\n\t\tonDecompressedBlueprintBody,\n\t\tthrowErrors: true\n\t});\n}\n\nconst WriteSaveSync = (save: SatisfactorySave, onBinaryBeforeCompressing?: (binary: ArrayBuffer) => void) => {\n\tlet mainFileHeader: Uint8Array;\n\tconst mainFileBodyChunks: Uint8Array[] = [];\n\tParser.WriteSave(save,\n\t\theader => {\n\t\t\tmainFileHeader = header;\n\t\t},\n\t\tchunk => {\n\t\t\tmainFileBodyChunks.push(chunk);\n\t\t},\n\t\t{ onBinaryBeforeCompressing });\n\n\t// write complete .sav file back to disk\n\tfs.writeFileSync(path.join(__dirname, save.name + '_on-writing.sav'), Buffer.concat([mainFileHeader!, ...mainFileBodyChunks]));\n};\n\n\n\ndescribe('modification of saves', () => {\n\tconst FindFirst = (save: SatisfactorySave, condition: (obj: SaveObject) => boolean): { object: SaveEntity | SaveComponent, level: Level } | undefined => {\n\t\tfor (const level of Object.values(save.levels)) {\n\t\t\tconst potentialObject = level.objects.find(condition);\n\t\t\tif (potentialObject) {\n\t\t\t\treturn {\n\t\t\t\t\tlevel,\n\t\t\t\t\tobject: potentialObject\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n\n\tconst ModifyObjects = (save: SatisfactorySave, ...modifiedObjects: (SaveEntity | SaveComponent)[]) => {\n\t\tfor (const modifiedObject of modifiedObjects) {\n\t\t\tfor (const level of Object.values(save.levels)) {\n\t\t\t\tfor (let i = 0; i < level.objects.length; i++) {\n\t\t\t\t\tif (level.objects[i].instanceName === modifiedObject.instanceName) {\n\t\t\t\t\t\tlevel.objects[i] = modifiedObject;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tconst ModifyPlayer = (save: SatisfactorySave): { object: SaveEntity | SaveComponent, level: Level }[] => {\n\t\tconst firstPlayer = FindFirst(save, obj => obj.typePath === '/Game/FactoryGame/Character/Player/Char_Player.Char_Player_C')!;\n\t\t(firstPlayer.object as SaveEntity).transform.translation = {\n\t\t\tx: (firstPlayer.object as SaveEntity).transform.translation.x + 5000,\n\t\t\ty: (firstPlayer.object as SaveEntity).transform.translation.y + 5000,\n\t\t\tz: (firstPlayer.object as SaveEntity).transform.translation.z,\n\t\t}\n\t\treturn [firstPlayer];\n\t};\n\n\tconst ModifyStorageContainer = (save: SatisfactorySave): { object: SaveEntity | SaveComponent, level: Level }[] => {\n\t\tconst firstContainer = FindFirst(save, obj => obj.typePath === '/Game/FactoryGame/Buildable/Factory/StorageContainerMk1/Build_StorageContainerMk1.Build_StorageContainerMk1_C')!;\n\n\t\tconst inventoryReference = firstContainer.object.properties.mStorageInventory as ObjectProperty;\n\t\tconst inventory = Object.values(save.levels).flatMap(level => level.objects).find(obj => obj.instanceName === inventoryReference.value.pathName) as SaveComponent;\n\t\tconst inventoryStacks = inventory.properties.mInventoryStacks as ArrayProperty;\n\t\tconst firstStack = inventoryStacks.values[0];\n\n\t\t// modify first item stack\n\t\t(((firstStack as DynamicStructPropertyValue).properties.Item as StructProperty).value as FInventoryItem).itemReference = {\n\t\t\tlevelName: '',\n\t\t\tpathName: '/Game/FactoryGame/Resource/Parts/Rotor/Desc_Rotor.Desc_Rotor_C'\n\t\t};\n\t\t((firstStack as DynamicStructPropertyValue).properties.NumItems as IntProperty).value = 5;\n\n\t\treturn [firstContainer];\n\t};\n\n\n\t/**\n\t * this test iterates through a list of \"modificationMethods\", where each modifies one or multiple objects. The test then checks whether the update persists through serialization and de-serialization.\n\t */\n\tit.each([\n\t\t['modifies position of first player', ModifyPlayer],\n\t\t['modifies an item stack in a storage container', ModifyStorageContainer]\n\t])('example %s correctly', (_, modificationMethod: (save: SatisfactorySave) => { object: SaveEntity | SaveComponent, level: Level }[]) => {\n\t\tconst savename = '265';\n\t\tconst file = new Uint8Array(fs.readFileSync(path.join(__dirname, savename + '.sav'))).buffer;\n\t\tconst save = ParseSaveSync(savename, file);\n\n\t\t// modify, write save, read save again\n\t\tconst modifiedObjects = modificationMethod(save);\n\t\tModifyObjects(save, ...modifiedObjects.map(wrapper => wrapper.object));\n\t\tWriteSaveSync(save, binary => {\n\t\t\tfs.writeFileSync(path.join(__dirname, savename + '_on-writing.bin'), Buffer.from(binary));\n\t\t});\n\t\tconst modifiedFile = new Uint8Array(fs.readFileSync(path.join(__dirname, save.name + '_on-writing.sav'))).buffer;\n\t\tconst modifiedSave = ParseSaveSync(savename, modifiedFile);\n\n\t\t// for each modified object, check that modified save file has the equal object.\n\t\tfor (const modifiedObject of modifiedObjects) {\n\t\t\tconst relevantLevel = modifiedSave.levels[modifiedObject.level.name] as Level;\n\t\t\tconst objectToCheck = relevantLevel.objects.find(obj => obj.instanceName === modifiedObject.object.instanceName) as SaveEntity | SaveComponent;\n\t\t\texpect(isDeepStrictEqual(objectToCheck, modifiedObject.object)).toEqual(true);\n\t\t}\n\t});\n});\n\ndescribe('parsing of saves', () => {\n\tconst saveList: string[] = [\n\n\t\t'EmptySave10WithoutDestroyedActors',\t\t\t\t// 1.0 Empty Save without destroyed actors.\n\t\t'Release-001',\t\t\t// 1.0 Save, almost empty.\n\t\t'Release-032',\t\t\t// 1.0 Save\n\t\t'265',\t\t\t\t\t// U8 save ported to 1.0\n\t\t'269',\t\t\t\t\t// U8 save ported to 1.0\n\n\t\t'Fresh-1.1-Dismantled',\t// 1.1 with Dismantled Crashsite.\n\n\t\t'Unlock-1.1-2',\t\t\t// 1.1 Save\n\t\t'FreshStartU8001-vehicles-2',\t// U8 save\n\t\t'FreshStart001',\t\t// U6/U7 save\n\t\t'FreshStart002',\t\t// U6/U7 save, even lower saveVersion (36)\n\n\t\t'Release-Ported-U1-to-U1.1',\t\t\t\t\t\t\t// U1 ported to U1.1\n\t\t'Release-Ported-U1-to-U1.1-Collected-Nuts-and-Berry',\t// U1 ported to U1.1\n\t\t'Release-Ported-U1-to-U1.1-Collected-Blue-Slug',\t\t// U1 ported to U1.1\n\n\t\t// Mods in 1.1\n\t\t'ficsitcam-1',\n\t\t'structuralsolutions-1',\n\t\t'x3-roads-signs',\n\t\t'pep-modtest-1',\n\t\t'Modding-Testing-MLB-003',\t// 1.1 modular LBs and alternates\n\n\t\t'Dunarr-076',\t\t\t\t// 1.1 FicsItNetworks\n\n\t\t'Modding-Experimental-01',\t\t// 1.1 SaveCustomVersion 53. Already has annoying changes to properties.\n\t\t'Empty-Save-Before-1.2',\t\t// 1.1 jsut before 1.2 release\n\t\t'Another-1-2',\t\t\t\t// 1.2 Fresh Release\n\t\t'Ported-11-to-12-Exp'\n\t];\n\n\tit.each(saveList)('can parse a binary save (%s) to json with stream and with sync', async (savename: string) => {\n\n\t\tconst filepath = path.join(__dirname, savename + '.sav');\n\t\tconst binaryFilepathStream = path.join(__dirname, savename + '.stream.bin');\n\t\tconst binaryFilepathSync = path.join(__dirname, savename + '.sync.bin');\n\t\tconst file = new Uint8Array(fs.readFileSync(filepath)).buffer;\n\t\tconst outJsonPathStream = path.join(__dirname, savename + '.stream.json');\n\t\tconst outJsonPathSync = path.join(__dirname, savename + '.sync.json');\n\n\t\t// a high highwatermark can help in not having so many \"pull\"-requests to the readablesource, so less calls on consumer side.\n\t\t// However, the write speed of the writestream is still a limit for consumption.\n\t\tconst outJsonStream = fs.createWriteStream(outJsonPathStream, { highWaterMark: 1024 * 1024 * 200 });\n\t\tconst { stream, startStreaming } = ReadableStreamParser.CreateReadableStreamFromSaveToJson(savename, file, {\n\t\t\tonDecompressedSaveBody: decompressedBody => {\n\t\t\t\tfs.writeFileSync(binaryFilepathStream, Buffer.from(decompressedBody));\n\t\t\t}, onProgress: (progress, msg) => {\n\t\t\t\tconsole.log(`parsing stream progress ${savename}`, progress, msg);\n\t\t\t}\n\t\t});\n\n\t\t// streaming to file, WritableStream is from stream\n\t\tconst start = performance.now();\n\t\tstartStreaming();\n\t\tstream.pipeTo(Writable.toWeb(outJsonStream));\n\n\t\tlet end: number = 0;\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\toutJsonStream\n\t\t\t\t.on('close', () => {\n\t\t\t\t\tconsole.log('outstream closed.');\n\t\t\t\t\tend = performance.now();\n\t\t\t\t\treturn resolve();\n\t\t\t\t})\n\t\t\t\t.on('error', (err) => {\n\t\t\t\t\tconsole.log('outstream error', err);\n\t\t\t\t\treturn reject();\n\t\t\t\t});\n\t\t});\n\t\tconsole.log(`Streaming took ${(end - start) / 1000} seconds.`);\n\n\t\t// parse sync as well.\n\t\tconst start2 = performance.now();\n\t\tconst save = ParseSaveSync(savename, file, decompressedBody => {\n\t\t\tfs.writeFileSync(binaryFilepathSync, Buffer.from(decompressedBody));\n\t\t});\n\n\t\tfs.writeFileSync(outJsonPathSync, JSON.stringify(save));\n\t\tconst end2 = performance.now();\n\t\tconsole.log(`Sync Parsing took ${(end2 - start2) / 1000} seconds.`);\n\n\t\tconst json1 = fs.readFileSync(outJsonPathSync, { encoding: 'utf-8' });\n\t\tconst json2 = fs.readFileSync(outJsonPathStream, { encoding: 'utf-8' });\n\n\t\t// check that the minified jsons of stream and sync parsing are equal.\n\n\t\tconst thing1 = JSON.parse(json1) as SatisfactorySave;\n\t\tconst thing2 = JSON.parse(json2) as SatisfactorySave;\n\t\texpect(JSON.stringify(thing1).length).toEqual(JSON.stringify(thing2).length);\n\n\t\t// check reading back written save\n\t\tconst saveSerializedAndRead = () => ParseSaveSync(savename, file);\n\t\texpect(saveSerializedAndRead).not.toThrow();\n\t});\n\n\n\tit.each(saveList)('can write a synchronous save (%s)', async (savename) => {\n\t\tconst filepath = path.join(__dirname, savename + '.sync.json');\n\t\tconst save = JSON.parse(fs.readFileSync(filepath, { encoding: 'utf-8' })) as SatisfactorySave;\n\t\tWriteSaveSync(save, binary => {\n\t\t\tfs.writeFileSync(path.join(__dirname, savename + '_on-writing.bin'), new Uint8Array(Buffer.from(binary)));\n\t\t});\n\t});\n});\n\ndescribe('parsing of blueprints', () => {\n\tit.each([\n\n\t\t'U1-1-Single-Container',\t// U1.1 \n\t\t'U1-1-Single-Container-2',\t// U1.1\n\n\t\t'BlueprintWithHeaderV1',\t// blueprint saved before v2 header was introduced (in U8 i think)\n\n\t\t'release-single-wall',\t\t\t\t\t// U1\n\t\t'release-storage-mk1',\t\t\t\t\t// U1\n\t\t'release-storage-mk2-blueprintmk2',\t\t// U1\n\t\t'release-two-foundations',\t\t\t\t// U1\n\n\t\t'two-foundations-1-2',\t\t\t\t\t// U1.2\n\n\t\t'mod-circuitry'\t\t\t\t\t\t\t// U1.1 mod circuitry\n\n\t])('parser can read and write a synchronous blueprint: %s', async (blueprintname) => {\n\t\tconst filepathBlueprint = path.join(__dirname, blueprintname + '.sbp');\n\t\tconst filepathBlueprintConfig = path.join(__dirname, blueprintname + '.sbpcfg');\n\t\tconst binaryFilepath = path.join(__dirname, blueprintname + '.bins');\n\t\tconst file = new Uint8Array(fs.readFileSync(filepathBlueprint)).buffer;\n\t\tconst configFileBuffer = new Uint8Array(fs.readFileSync(filepathBlueprintConfig)).buffer;\n\n\t\tlet binaryBodyLength = 0;\n\t\tconst blueprint = ParseBlueprintSync(blueprintname, file, configFileBuffer, (decompressedBody) => {\n\t\t\tbinaryBodyLength = decompressedBody.byteLength;\n\t\t\tfs.writeFileSync(binaryFilepath, Buffer.from(decompressedBody));\n\t\t});\n\n\t\tfs.writeFileSync(path.join(__dirname, blueprintname + '.json'), JSON.stringify(blueprint, null, 4));\n\n\t\t// write again\n\t\tlet mainFileHeader: Uint8Array;\n\t\tconst mainFileBodyChunks: Uint8Array[] = [];\n\t\tconst response = Parser.WriteBlueprintFiles(blueprint,\n\t\t\theader => {\n\t\t\t\tmainFileHeader = header;\n\t\t\t}, chunk => {\n\t\t\t\tmainFileBodyChunks.push(chunk);\n\t\t\t},\n\t\t\t{\n\t\t\t\tonMainFileBinaryBeforeCompressing: binary => {\n\t\t\t\t\tfs.writeFileSync(path.join(__dirname, blueprintname + '.bins_modified'), new Uint8Array(Buffer.from(binary)));\n\t\t\t\t\texpect(binary.byteLength).toEqual(binaryBodyLength);\n\t\t\t\t},\n\t\t\t});\n\n\t\t// write complete .sbp file back to disk\n\t\tfs.writeFileSync(path.join(__dirname, blueprintname + '.sbp_modified'), new Uint8Array(Buffer.concat([mainFileHeader!, ...mainFileBodyChunks])));\n\t\tfs.writeFileSync(path.join(__dirname, blueprintname + '.sbpcfg_modified'), new Uint8Array(Buffer.from(response.configFileBinary)));\n\n\t\t// test reading modified blueprint again.\n\t\tconst mainFileNew = new Uint8Array(fs.readFileSync(path.join(__dirname, blueprintname + '.sbp_modified'))).buffer;\n\t\tconst configFileNew = new Uint8Array(fs.readFileSync(path.join(__dirname, blueprintname + '.sbpcfg_modified'))).buffer;\n\n\t\tconst blueprintNew = ParseBlueprintSync(blueprintname, mainFileNew, configFileNew, (decompressedBody) => {\n\t\t\texpect(decompressedBody.byteLength).toEqual(binaryBodyLength);\n\t\t});\n\t});\n});\n\ndescribe('when ignoring errors', () => {\n\tlet spy: jest.SpyInstance | undefined;\n\tconst file = new Uint8Array(fs.readFileSync(path.join(__dirname, 'Dunarr-027.sav'))).buffer;\n\tconst parseSaveWithoutErrors = () => ParseSaveSync('Dunarr', file, () => { }, false);\n\n\tafterEach(() => {\n\t\tspy?.mockRestore();\n\t});\n\n\tit('after encountering an error in the property read method, continues parsing.', () => {\n\t\tspy = jest.spyOn(FINNetworkTraceMod.FINNetworkTrace, 'read');\n\n\t\t// first call for this test throws, subsequent calls use the original read()\n\t\t(spy as jest.Mock).mockImplementationOnce((reader: any) => {\n\t\t\tthrow new Error('unexpected error.');\n\t\t});\n\n\t\texpect(parseSaveWithoutErrors).not.toThrow();\n\t\texpect(spy).toHaveBeenCalled();\n\t});\n\n\tit('after reading a wrong number of bytes for a property, continues parsing.', () => {\n\t\tspy = jest.spyOn(FINNetworkTraceMod.FINNetworkTrace, 'read');\n\n\t\t(spy as jest.Mock).mockImplementationOnce((reader: ContextReader) => {\n\n\t\t\t// custom parsing method. reads way too little.\n\t\t\treader.readInt32();\n\t\t\treturn {\n\t\t\t\treference: {\n\t\t\t\t\tlevelName: '',\n\t\t\t\t\tpathName: ''\n\t\t\t\t}\n\t\t\t} satisfies FINNetworkTraceMod.FINNetworkTrace;\n\t\t});\n\n\t\texpect(parseSaveWithoutErrors).not.toThrow();\n\t\texpect(spy).toHaveBeenCalled();\n\t});\n\n\tit('after encountering a severe error, puts data of object into trailing data.', () => {\n\t\tspy = jest.spyOn(PropertiesListMod.PropertiesList, 'ParseList');\n\n\t\t(spy as jest.Mock).mockImplementationOnce((reader: any) => {\n\t\t\tthrow new Error('unexpected error.');\n\t\t});\n\n\t\tconst save = parseSaveWithoutErrors();\n\t\tconst firstObjectInSave = Object.values(save!.levels).flatMap(level => level.objects).find(obj => obj.instanceName === 'Persistent_Level:PersistentLevel.BP_EnemySpawner371');\n\n\t\texpect(save).toBeDefined();\n\t\texpect(firstObjectInSave).toBeDefined();\n\t\texpect(firstObjectInSave!.trailingData.length).toEqual(475);\n\t\texpect(Object.entries(firstObjectInSave!.properties).length).toEqual(0);\n\t});\n});"]}
|
package/docs/assets/hierarchy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
window.hierarchyData = "
|
|
1
|
+
window.hierarchyData = "eJyVlk2P2yAQhv8LZ7YFG2Pj465W6qHSVv08rHJw4kmX1sYWJlWjVf57ha14wUkKviRS8g7PvDMDmleku84MqHzOOeaEYUYF3WCkYd/AzshODah8RTm3n6pqAZXoXqpKH5960NW2AYTRb6lqVCYZx+igG1QiqQzofbWD4b0vfvdi2gZhtGuqYUAlMkN9Z6Pv5gj754tsag0Klc8Fw5TxzQmjgl1k8BmqOjqDs3htBklCLJ6yywr80NJE88/i1XxBLT9JiMs/GrCGQM9smhRn9ni0Bc+qm9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