@etothepii/satisfactory-file-parser 3.2.2 → 3.3.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.
Files changed (614) hide show
  1. package/CHANGELOG.md +16 -1
  2. package/README.md +16 -1
  3. package/build/index.d.ts +13 -3
  4. package/build/index.d.ts.map +1 -1
  5. package/build/index.js +14 -6
  6. package/build/index.js.map +1 -1
  7. package/build/parser/byte/byte-writer.class.d.ts +2 -0
  8. package/build/parser/byte/byte-writer.class.d.ts.map +1 -1
  9. package/build/parser/byte/byte-writer.class.js +8 -0
  10. package/build/parser/byte/byte-writer.class.js.map +1 -1
  11. package/build/parser/context/context.d.ts +2 -0
  12. package/build/parser/context/context.d.ts.map +1 -1
  13. package/build/parser/context/context.js.map +1 -1
  14. package/build/parser/parser.d.ts +2 -0
  15. package/build/parser/parser.d.ts.map +1 -1
  16. package/build/parser/parser.js +2 -0
  17. package/build/parser/parser.js.map +1 -1
  18. package/build/parser/satisfactory/blueprint/blueprint-header.js +5 -5
  19. package/build/parser/satisfactory/blueprint/blueprint-header.js.map +1 -1
  20. package/build/parser/satisfactory/save/level.d.ts.map +1 -1
  21. package/build/parser/satisfactory/save/level.js +32 -17
  22. package/build/parser/satisfactory/save/level.js.map +1 -1
  23. package/build/parser/satisfactory/types/objects/SaveObject.d.ts.map +1 -1
  24. package/build/parser/satisfactory/types/objects/SaveObject.js +24 -5
  25. package/build/parser/satisfactory/types/objects/SaveObject.js.map +1 -1
  26. package/build/parser/satisfactory/types/property/PropertiesList.d.ts.map +1 -1
  27. package/build/parser/satisfactory/types/property/PropertiesList.js +118 -97
  28. package/build/parser/satisfactory/types/property/PropertiesList.js.map +1 -1
  29. package/build/parser/satisfactory/types/property/generic/AbstractBaseProperty.d.ts +2 -1
  30. package/build/parser/satisfactory/types/property/generic/AbstractBaseProperty.d.ts.map +1 -1
  31. package/build/parser/satisfactory/types/property/generic/AbstractBaseProperty.js.map +1 -1
  32. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts +2 -2
  33. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts.map +1 -1
  34. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.js +3 -4
  35. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.js.map +1 -1
  36. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty.js +1 -1
  37. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty.js.map +1 -1
  38. package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts +2 -2
  39. package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts.map +1 -1
  40. package/build/parser/satisfactory/types/property/generic/ByteProperty.js +3 -4
  41. package/build/parser/satisfactory/types/property/generic/ByteProperty.js.map +1 -1
  42. package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts +2 -2
  43. package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts.map +1 -1
  44. package/build/parser/satisfactory/types/property/generic/EnumProperty.js +3 -4
  45. package/build/parser/satisfactory/types/property/generic/EnumProperty.js.map +1 -1
  46. package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts +2 -2
  47. package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts.map +1 -1
  48. package/build/parser/satisfactory/types/property/generic/MapProperty.js +8 -5
  49. package/build/parser/satisfactory/types/property/generic/MapProperty.js.map +1 -1
  50. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts +2 -2
  51. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts.map +1 -1
  52. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js +3 -4
  53. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js.map +1 -1
  54. package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.js +1 -1
  55. package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.js.map +1 -1
  56. package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts +8 -7
  57. package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts.map +1 -1
  58. package/build/parser/satisfactory/types/property/generic/StructProperty.js +71 -47
  59. package/build/parser/satisfactory/types/property/generic/StructProperty.js.map +1 -1
  60. package/build/parser/satisfactory/types/structs/FGDynamicStruct.d.ts +1 -0
  61. package/build/parser/satisfactory/types/structs/FGDynamicStruct.d.ts.map +1 -1
  62. package/build/parser/satisfactory/types/structs/FGDynamicStruct.js +20 -13
  63. package/build/parser/satisfactory/types/structs/FGDynamicStruct.js.map +1 -1
  64. package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts +1 -1
  65. package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts.map +1 -1
  66. package/build/parser/satisfactory/types/structs/GUIDInfo.js +1 -1
  67. package/build/parser/satisfactory/types/structs/GUIDInfo.js.map +1 -1
  68. package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.d.ts +11 -0
  69. package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.d.ts.map +1 -0
  70. package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.js +31 -0
  71. package/build/parser/satisfactory/types/structs/binary/FClientIdentityInfo.js.map +1 -0
  72. package/build/parser/satisfactory/types/structs/binary/FColor.d.ts +9 -0
  73. package/build/parser/satisfactory/types/structs/binary/FColor.d.ts.map +1 -0
  74. package/build/parser/satisfactory/types/structs/binary/FColor.js +14 -0
  75. package/build/parser/satisfactory/types/structs/binary/FColor.js.map +1 -0
  76. package/build/parser/satisfactory/types/structs/binary/FLinearColor.d.ts +9 -0
  77. package/build/parser/satisfactory/types/structs/binary/FLinearColor.d.ts.map +1 -0
  78. package/build/parser/satisfactory/types/structs/binary/FLinearColor.js +14 -0
  79. package/build/parser/satisfactory/types/structs/binary/FLinearColor.js.map +1 -0
  80. package/build/parser/satisfactory/types/structs/binary/GUID.d.ts +8 -0
  81. package/build/parser/satisfactory/types/structs/binary/GUID.d.ts.map +1 -0
  82. package/build/parser/satisfactory/types/structs/binary/GUID.js +22 -0
  83. package/build/parser/satisfactory/types/structs/binary/GUID.js.map +1 -0
  84. package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts +2 -2
  85. package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts.map +1 -1
  86. package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js +2 -2
  87. package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js.map +1 -1
  88. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.d.ts +13 -0
  89. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.d.ts.map +1 -0
  90. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.js +21 -0
  91. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINGPUT1BufferPixel.js.map +1 -0
  92. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.d.ts +12 -0
  93. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.d.ts.map +1 -0
  94. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.js +22 -0
  95. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINItemStateFileSystem.js.map +1 -0
  96. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.d.ts +13 -0
  97. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.d.ts.map +1 -0
  98. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.js +35 -0
  99. package/build/parser/satisfactory/types/structs/mods/FicsItNetworks/FINNetworkTrace.js.map +1 -0
  100. package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.d.ts +12 -0
  101. package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.d.ts.map +1 -0
  102. package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.js +20 -0
  103. package/build/parser/satisfactory/types/structs/mods/ModularLoadBalancers/FLBBalancerIndexing.js.map +1 -0
  104. package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -1
  105. package/build/parser/stream/reworked/readable-stream-parser.js +6 -5
  106. package/build/parser/stream/reworked/readable-stream-parser.js.map +1 -1
  107. package/docs/assets/navigation.js +1 -1
  108. package/docs/assets/search.js +1 -1
  109. package/docs/classes/BlueprintConfigReader.html +4 -4
  110. package/docs/classes/BlueprintReader.html +4 -4
  111. package/docs/classes/CompressionLibraryError.html +2 -2
  112. package/docs/classes/ContextReader.html +36 -0
  113. package/docs/classes/ContextWriter.html +41 -0
  114. package/docs/classes/CorruptBlueprintError.html +2 -2
  115. package/docs/classes/CorruptSaveError.html +2 -2
  116. package/docs/classes/Parser.html +8 -8
  117. package/docs/classes/ParserError.html +2 -2
  118. package/docs/classes/ReadableStreamParser.html +2 -2
  119. package/docs/classes/SatisfactorySave.html +3 -4
  120. package/docs/classes/SaveComponent.html +2 -2
  121. package/docs/classes/SaveEntity.html +2 -2
  122. package/docs/classes/SaveObject.html +2 -2
  123. package/docs/classes/SaveReader.html +4 -5
  124. package/docs/classes/SaveStreamJsonStringifier.html +2 -2
  125. package/docs/classes/SaveStreamWriter.html +3 -4
  126. package/docs/classes/SaveWriter.html +6 -5
  127. package/docs/classes/TimeoutError.html +2 -2
  128. package/docs/classes/UnimplementedError.html +2 -2
  129. package/docs/classes/UnsupportedVersionError.html +2 -2
  130. package/docs/enums/Alignment.html +3 -0
  131. package/docs/enums/BlueprintConfigVersion.html +2 -2
  132. package/docs/enums/BlueprintHeaderVersion.html +2 -2
  133. package/docs/enums/CompressionAlgorithmCode.html +2 -2
  134. package/docs/enums/FactoryGameCustomVersion.html +2 -2
  135. package/docs/enums/RuntimeBuildableInstanceDataVersion.html +2 -2
  136. package/docs/enums/SaveCustomVersion.html +10 -10
  137. package/docs/enums/SaveHeaderType.html +2 -2
  138. package/docs/functions/AbstractBaseProperty.Create.html +1 -1
  139. package/docs/functions/ArrayProperty.CalcOverhead.html +1 -1
  140. package/docs/functions/ArrayProperty.Parse.html +1 -1
  141. package/docs/functions/ArrayProperty.Serialize.html +1 -1
  142. package/docs/functions/BlueprintConfig.Parse.html +1 -1
  143. package/docs/functions/BlueprintConfig.Serialize.html +1 -1
  144. package/docs/functions/BlueprintHeader.Parse.html +1 -1
  145. package/docs/functions/BlueprintHeader.Serialize.html +1 -1
  146. package/docs/functions/BoolArrayProperty.Parse.html +1 -1
  147. package/docs/functions/BoolArrayProperty.Serialize.html +1 -1
  148. package/docs/functions/BoolProperty.CalcOverhead.html +1 -1
  149. package/docs/functions/BoolProperty.Parse.html +1 -1
  150. package/docs/functions/BoolProperty.ReadValue.html +1 -1
  151. package/docs/functions/BoolProperty.Serialize.html +1 -1
  152. package/docs/functions/BoolProperty.SerializeValue.html +1 -1
  153. package/docs/functions/BuildableSubsystemSpecialProperties.Parse.html +1 -1
  154. package/docs/functions/BuildableSubsystemSpecialProperties.Serialize.html +1 -1
  155. package/docs/functions/BuildableTypeInstance.Parse.html +1 -1
  156. package/docs/functions/BuildableTypeInstance.Serialize.html +1 -1
  157. package/docs/functions/ByteArrayProperty.Parse.html +1 -1
  158. package/docs/functions/ByteArrayProperty.Serialize.html +1 -1
  159. package/docs/functions/ByteProperty.CalcOverhead.html +1 -1
  160. package/docs/functions/ByteProperty.Parse.html +1 -1
  161. package/docs/functions/ByteProperty.ReadValue.html +1 -1
  162. package/docs/functions/ByteProperty.Serialize.html +1 -1
  163. package/docs/functions/ByteProperty.SerializeValue.html +1 -1
  164. package/docs/functions/CircuitSpecialProperties.Parse.html +1 -1
  165. package/docs/functions/CircuitSpecialProperties.Serialize.html +1 -1
  166. package/docs/functions/ConveyorChainActorSpecialProperties.Parse.html +1 -1
  167. package/docs/functions/ConveyorChainActorSpecialProperties.Serialize.html +1 -1
  168. package/docs/functions/ConveyorSpecialProperties.Parse.html +1 -1
  169. package/docs/functions/ConveyorSpecialProperties.Serialize.html +1 -1
  170. package/docs/functions/DoubleArrayProperty.Parse.html +1 -1
  171. package/docs/functions/DoubleArrayProperty.Serialize.html +1 -1
  172. package/docs/functions/DoubleProperty.CalcOverhead.html +1 -1
  173. package/docs/functions/DoubleProperty.Parse.html +1 -1
  174. package/docs/functions/DoubleProperty.ReadValue.html +1 -1
  175. package/docs/functions/DoubleProperty.Serialize.html +1 -1
  176. package/docs/functions/DoubleProperty.SerializeValue.html +1 -1
  177. package/docs/functions/DynamicStructPropertyValue.read.html +1 -1
  178. package/docs/functions/DynamicStructPropertyValue.write.html +1 -1
  179. package/docs/functions/EmptySpecialProperties.Parse.html +1 -1
  180. package/docs/functions/EmptySpecialProperties.Serialize.html +1 -1
  181. package/docs/functions/EnumArrayProperty.Parse.html +1 -1
  182. package/docs/functions/EnumArrayProperty.Serialize.html +1 -1
  183. package/docs/functions/EnumProperty.CalcOverhead.html +1 -1
  184. package/docs/functions/EnumProperty.Parse.html +1 -1
  185. package/docs/functions/EnumProperty.ReadValue.html +1 -1
  186. package/docs/functions/EnumProperty.Serialize.html +1 -1
  187. package/docs/functions/EnumProperty.SerializeValue.html +1 -1
  188. package/docs/functions/FClientIdentityInfo.read.html +1 -0
  189. package/docs/functions/FClientIdentityInfo.write.html +1 -0
  190. package/docs/functions/FColor.read.html +1 -0
  191. package/docs/functions/FColor.write.html +1 -0
  192. package/docs/functions/FGDynamicStruct.Parse.html +1 -1
  193. package/docs/functions/FGDynamicStruct.Serialize.html +1 -1
  194. package/docs/functions/FICFrameRange.read.html +1 -0
  195. package/docs/functions/FICFrameRange.write.html +1 -0
  196. package/docs/functions/FINGPUT1BufferPixel.read.html +1 -0
  197. package/docs/functions/FINGPUT1BufferPixel.write.html +1 -0
  198. package/docs/functions/FINItemStateFileSystem.IsFINItemStateFileSystem.html +1 -0
  199. package/docs/functions/FINItemStateFileSystem.read.html +1 -0
  200. package/docs/functions/FINItemStateFileSystem.write.html +1 -0
  201. package/docs/functions/FINNetworkTrace.read.html +1 -0
  202. package/docs/functions/FINNetworkTrace.write.html +1 -0
  203. package/docs/functions/FLBBalancerIndexing.read.html +1 -0
  204. package/docs/functions/FLBBalancerIndexing.write.html +1 -0
  205. package/docs/functions/FLinearColor.read.html +1 -0
  206. package/docs/functions/FLinearColor.write.html +1 -0
  207. package/docs/functions/FloatArrayProperty.Parse.html +1 -1
  208. package/docs/functions/FloatArrayProperty.Serialize.html +1 -1
  209. package/docs/functions/FloatProperty.CalcOverhead.html +1 -1
  210. package/docs/functions/FloatProperty.Parse.html +1 -1
  211. package/docs/functions/FloatProperty.ReadValue.html +1 -1
  212. package/docs/functions/FloatProperty.Serialize.html +1 -1
  213. package/docs/functions/FloatProperty.SerializeValue.html +1 -1
  214. package/docs/functions/GUID.read.html +1 -1
  215. package/docs/functions/GUID.write.html +1 -1
  216. package/docs/functions/GUIDInfo.read.html +1 -1
  217. package/docs/functions/GUIDInfo.write.html +1 -1
  218. package/docs/functions/Int32ArrayProperty.Parse.html +1 -1
  219. package/docs/functions/Int32ArrayProperty.Serialize.html +1 -1
  220. package/docs/functions/Int32Property.CalcOverhead.html +1 -1
  221. package/docs/functions/Int32Property.Parse.html +1 -1
  222. package/docs/functions/Int32Property.ReadValue.html +1 -1
  223. package/docs/functions/Int32Property.Serialize.html +1 -1
  224. package/docs/functions/Int32Property.SerializeValue.html +1 -1
  225. package/docs/functions/Int32SetProperty.Parse.html +1 -1
  226. package/docs/functions/Int32SetProperty.Serialize.html +1 -1
  227. package/docs/functions/Int64ArrayProperty.Parse.html +1 -1
  228. package/docs/functions/Int64ArrayProperty.Serialize.html +1 -1
  229. package/docs/functions/Int64Property.CalcOverhead.html +1 -1
  230. package/docs/functions/Int64Property.Parse.html +1 -1
  231. package/docs/functions/Int64Property.ReadValue.html +1 -1
  232. package/docs/functions/Int64Property.Serialize.html +1 -1
  233. package/docs/functions/Int64Property.SerializeValue.html +1 -1
  234. package/docs/functions/Int8Property.CalcOverhead.html +1 -1
  235. package/docs/functions/Int8Property.Parse.html +1 -1
  236. package/docs/functions/Int8Property.ReadValue.html +1 -1
  237. package/docs/functions/Int8Property.Serialize.html +1 -1
  238. package/docs/functions/Int8Property.SerializeValue.html +1 -1
  239. package/docs/functions/Level.ReadAllObjectContents.html +1 -1
  240. package/docs/functions/Level.ReadAllObjectHeaders.html +1 -1
  241. package/docs/functions/Level.ReadLevel.html +1 -1
  242. package/docs/functions/Level.ReadNObjectContents.html +1 -1
  243. package/docs/functions/Level.ReadNObjectHeaders.html +1 -1
  244. package/docs/functions/Level.SerializeAllObjectContents.html +1 -1
  245. package/docs/functions/Level.SerializeAllObjectHeaders.html +1 -1
  246. package/docs/functions/Level.SerializeLevel.html +1 -1
  247. package/docs/functions/LevelToDestroyedActorsMap.read.html +1 -1
  248. package/docs/functions/LevelToDestroyedActorsMap.write.html +1 -1
  249. package/docs/functions/MD5Hash.read.html +1 -1
  250. package/docs/functions/MD5Hash.write.html +1 -1
  251. package/docs/functions/MapProperty.CalcOverhead.html +1 -1
  252. package/docs/functions/MapProperty.Parse.html +1 -1
  253. package/docs/functions/MapProperty.Serialize.html +1 -1
  254. package/docs/functions/ObjectArrayProperty.Parse.html +1 -1
  255. package/docs/functions/ObjectArrayProperty.Serialize.html +1 -1
  256. package/docs/functions/ObjectProperty.CalcOverhead.html +1 -1
  257. package/docs/functions/ObjectProperty.Parse.html +1 -1
  258. package/docs/functions/ObjectProperty.ReadValue.html +1 -1
  259. package/docs/functions/ObjectProperty.Serialize.html +1 -1
  260. package/docs/functions/ObjectProperty.SerializeValue.html +1 -1
  261. package/docs/functions/ObjectReference.IsEqual.html +1 -1
  262. package/docs/functions/ObjectReference.read.html +1 -1
  263. package/docs/functions/ObjectReference.write.html +1 -1
  264. package/docs/functions/ObjectSetProperty.Parse.html +1 -1
  265. package/docs/functions/ObjectSetProperty.Serialize.html +1 -1
  266. package/docs/functions/ObjectsListSpecialProperties.Parse.html +1 -1
  267. package/docs/functions/ObjectsListSpecialProperties.Serialize.html +1 -1
  268. package/docs/functions/PlayerSpecialProperties.Parse.html +1 -1
  269. package/docs/functions/PlayerSpecialProperties.Serialize.html +1 -1
  270. package/docs/functions/PowerLineSpecialProperties.Parse.html +1 -1
  271. package/docs/functions/PowerLineSpecialProperties.Serialize.html +1 -1
  272. package/docs/functions/PropertiesList.ParseList.html +1 -1
  273. package/docs/functions/PropertiesList.ParseSingleProperty.html +1 -1
  274. package/docs/functions/PropertiesList.SerializeList.html +1 -1
  275. package/docs/functions/PropertiesList.SerializeSingleProperty.html +1 -1
  276. package/docs/functions/SatisfactorySaveHeader.Parse.html +1 -1
  277. package/docs/functions/SatisfactorySaveHeader.Serialize.html +1 -1
  278. package/docs/functions/SaveBodyChunks.CompressDataIntoChunks.html +1 -1
  279. package/docs/functions/SaveBodyChunks.DecompressChunks.html +1 -1
  280. package/docs/functions/SaveBodyValidation.Parse.html +1 -0
  281. package/docs/functions/SaveBodyValidation.Serialize.html +1 -0
  282. package/docs/functions/SetProperty.CalcOverhead.html +1 -1
  283. package/docs/functions/SetProperty.Parse.html +1 -1
  284. package/docs/functions/SetProperty.Serialize.html +1 -1
  285. package/docs/functions/SoftObjectArrayProperty.Parse.html +1 -1
  286. package/docs/functions/SoftObjectArrayProperty.Serialize.html +1 -1
  287. package/docs/functions/SoftObjectReference.read.html +1 -1
  288. package/docs/functions/SoftObjectReference.write.html +1 -1
  289. package/docs/functions/SpecialDroneActionProperties.Parse.html +1 -1
  290. package/docs/functions/SpecialDroneActionProperties.Serialize.html +1 -1
  291. package/docs/functions/SpecialProperties.ParseClassSpecificSpecialProperties.html +1 -1
  292. package/docs/functions/SpecialProperties.SerializeClassSpecificSpecialProperties.html +1 -1
  293. package/docs/functions/StrArrayProperty.Parse.html +1 -1
  294. package/docs/functions/StrArrayProperty.Serialize.html +1 -1
  295. package/docs/functions/StrProperty.CalcOverhead.html +1 -1
  296. package/docs/functions/StrProperty.Parse.html +1 -1
  297. package/docs/functions/StrProperty.ReadValue.html +1 -1
  298. package/docs/functions/StrProperty.Serialize.html +1 -1
  299. package/docs/functions/StrProperty.SerializeValue.html +1 -1
  300. package/docs/functions/StrSetProperty.Parse.html +1 -1
  301. package/docs/functions/StrSetProperty.Serialize.html +1 -1
  302. package/docs/functions/StructArrayProperty.Parse.html +1 -1
  303. package/docs/functions/StructArrayProperty.Serialize.html +1 -1
  304. package/docs/functions/StructProperty.CalcOverhead.html +1 -1
  305. package/docs/functions/StructProperty.Parse.html +1 -1
  306. package/docs/functions/StructProperty.ParseValue.html +1 -1
  307. package/docs/functions/StructProperty.Serialize.html +1 -1
  308. package/docs/functions/StructProperty.SerializeValue.html +1 -1
  309. package/docs/functions/StructSetProperty.Parse.html +1 -1
  310. package/docs/functions/StructSetProperty.Serialize.html +1 -1
  311. package/docs/functions/TextArrayProperty.Parse.html +1 -1
  312. package/docs/functions/TextArrayProperty.Serialize.html +1 -1
  313. package/docs/functions/TextProperty.CalcOverhead.html +1 -1
  314. package/docs/functions/TextProperty.Parse.html +1 -1
  315. package/docs/functions/TextProperty.ReadValue.html +1 -1
  316. package/docs/functions/TextProperty.Serialize.html +1 -1
  317. package/docs/functions/TextProperty.SerializeValue.html +1 -1
  318. package/docs/functions/Transform.Parse.html +1 -1
  319. package/docs/functions/Transform.ParseF.html +1 -1
  320. package/docs/functions/Transform.Serialize.html +1 -1
  321. package/docs/functions/Transform.SerializeF.html +1 -1
  322. package/docs/functions/Uint32Property.CalcOverhead.html +1 -1
  323. package/docs/functions/Uint32Property.Parse.html +1 -1
  324. package/docs/functions/Uint32Property.ReadValue.html +1 -1
  325. package/docs/functions/Uint32Property.Serialize.html +1 -1
  326. package/docs/functions/Uint32Property.SerializeValue.html +1 -1
  327. package/docs/functions/Uint32SetProperty.Parse.html +1 -1
  328. package/docs/functions/Uint32SetProperty.Serialize.html +1 -1
  329. package/docs/functions/Uint64Property.CalcOverhead.html +1 -1
  330. package/docs/functions/Uint64Property.Parse.html +1 -1
  331. package/docs/functions/Uint64Property.ReadValue.html +1 -1
  332. package/docs/functions/Uint64Property.Serialize.html +1 -1
  333. package/docs/functions/Uint64Property.SerializeValue.html +1 -1
  334. package/docs/functions/Uint8Property.CalcOverhead.html +1 -1
  335. package/docs/functions/Uint8Property.Parse.html +1 -1
  336. package/docs/functions/Uint8Property.ReadValue.html +1 -1
  337. package/docs/functions/Uint8Property.Serialize.html +1 -1
  338. package/docs/functions/Uint8Property.SerializeValue.html +1 -1
  339. package/docs/functions/VehiclePhysicsData.Parse.html +1 -1
  340. package/docs/functions/VehiclePhysicsData.Serialize.html +1 -1
  341. package/docs/functions/VehicleSpecialProperties.Parse.html +1 -1
  342. package/docs/functions/VehicleSpecialProperties.Serialize.html +1 -1
  343. package/docs/functions/col4.ParseBGRA.html +1 -1
  344. package/docs/functions/col4.ParseRGBA.html +1 -1
  345. package/docs/functions/col4.SerializeBGRA.html +1 -1
  346. package/docs/functions/col4.SerializeRGBA.html +1 -1
  347. package/docs/functions/isArrayProperty.html +1 -1
  348. package/docs/functions/isBoolArrayProperty.html +1 -1
  349. package/docs/functions/isBoolProperty.html +1 -1
  350. package/docs/functions/isBuildableSubsystemSpecialProperties.html +1 -1
  351. package/docs/functions/isByteArrayProperty.html +1 -1
  352. package/docs/functions/isByteProperty.html +1 -1
  353. package/docs/functions/isCircuitSpecialProperties.html +1 -1
  354. package/docs/functions/isConveyorChainActorSpecialProperties.html +1 -1
  355. package/docs/functions/isConveyorSpecialProperties.html +1 -1
  356. package/docs/functions/isDoubleArrayProperty.html +1 -1
  357. package/docs/functions/isDoubleProperty.html +1 -1
  358. package/docs/functions/isEmptySpecialProperties.html +1 -1
  359. package/docs/functions/isEnumArrayProperty.html +1 -1
  360. package/docs/functions/isEnumProperty.html +1 -1
  361. package/docs/functions/isFloatArrayProperty.html +1 -1
  362. package/docs/functions/isFloatProperty.html +1 -1
  363. package/docs/functions/isInt32ArrayProperty.html +1 -1
  364. package/docs/functions/isInt32Property.html +1 -1
  365. package/docs/functions/isInt32SetProperty.html +1 -1
  366. package/docs/functions/isInt64ArrayProperty.html +1 -1
  367. package/docs/functions/isInt64Property.html +1 -1
  368. package/docs/functions/isInt8Property.html +1 -1
  369. package/docs/functions/isMapProperty.html +1 -1
  370. package/docs/functions/isObjectArrayProperty.html +1 -1
  371. package/docs/functions/isObjectProperty.html +1 -1
  372. package/docs/functions/isObjectSetProperty.html +1 -1
  373. package/docs/functions/isObjectsListSpecialProperties.html +1 -1
  374. package/docs/functions/isPlayerSpecialProperties.html +1 -1
  375. package/docs/functions/isPowerLineSpecialProperties.html +1 -1
  376. package/docs/functions/isSaveComponent.html +1 -1
  377. package/docs/functions/isSaveEntity.html +1 -1
  378. package/docs/functions/isSetProperty.html +1 -1
  379. package/docs/functions/isSoftObjectArrayProperty.html +1 -1
  380. package/docs/functions/isSpecialDroneActionProperties.html +1 -1
  381. package/docs/functions/isStrArrayProperty.html +1 -1
  382. package/docs/functions/isStrProperty.html +1 -1
  383. package/docs/functions/isStrSetProperty.html +1 -1
  384. package/docs/functions/isStructArrayProperty.html +1 -1
  385. package/docs/functions/isStructProperty.html +1 -1
  386. package/docs/functions/isStructSetProperty.html +1 -1
  387. package/docs/functions/isTextArrayProperty.html +1 -1
  388. package/docs/functions/isTextProperty.html +1 -1
  389. package/docs/functions/isUInt64Property.html +1 -1
  390. package/docs/functions/isUint32Property.html +1 -1
  391. package/docs/functions/isUint32SetProperty.html +1 -1
  392. package/docs/functions/isUint8Property.html +1 -1
  393. package/docs/functions/isVehicleSpecialProperties.html +1 -1
  394. package/docs/functions/vec2.Parse.html +1 -1
  395. package/docs/functions/vec2.ParseF.html +1 -1
  396. package/docs/functions/vec2.Serialize.html +1 -1
  397. package/docs/functions/vec2.SerializeF.html +1 -1
  398. package/docs/functions/vec3.Parse.html +1 -1
  399. package/docs/functions/vec3.ParseF.html +1 -1
  400. package/docs/functions/vec3.ParseInt.html +1 -1
  401. package/docs/functions/vec3.Serialize.html +1 -1
  402. package/docs/functions/vec3.SerializeF.html +1 -1
  403. package/docs/functions/vec3.SerializeInt.html +1 -1
  404. package/docs/functions/vec3.add.html +1 -1
  405. package/docs/functions/vec3.length.html +1 -1
  406. package/docs/functions/vec3.mult.html +1 -1
  407. package/docs/functions/vec3.norm.html +1 -1
  408. package/docs/functions/vec3.sub.html +1 -1
  409. package/docs/functions/vec4.Parse.html +1 -1
  410. package/docs/functions/vec4.ParseF.html +1 -1
  411. package/docs/functions/vec4.Serialize.html +1 -1
  412. package/docs/functions/vec4.SerializeF.html +1 -1
  413. package/docs/hierarchy.html +1 -1
  414. package/docs/index.html +17 -5
  415. package/docs/interfaces/Blueprint.html +2 -2
  416. package/docs/interfaces/BlueprintConfig-1.html +2 -2
  417. package/docs/interfaces/SaveComponentHeader.html +2 -2
  418. package/docs/interfaces/SaveEntityHeader.html +2 -2
  419. package/docs/interfaces/SaveObjectHeader.html +2 -2
  420. package/docs/modules/AbstractBaseProperty.html +1 -1
  421. package/docs/modules/ArrayProperty.html +1 -1
  422. package/docs/modules/BlueprintConfig.html +1 -1
  423. package/docs/modules/BlueprintHeader.html +1 -1
  424. package/docs/modules/BoolArrayProperty.html +1 -1
  425. package/docs/modules/BoolProperty.html +1 -1
  426. package/docs/modules/BuildableSubsystemSpecialProperties.html +1 -1
  427. package/docs/modules/BuildableTypeInstance.html +1 -1
  428. package/docs/modules/ByteArrayProperty.html +1 -1
  429. package/docs/modules/ByteProperty.html +1 -1
  430. package/docs/modules/CircuitSpecialProperties.html +1 -1
  431. package/docs/modules/ConveyorChainActorSpecialProperties.html +1 -1
  432. package/docs/modules/ConveyorSpecialProperties.html +1 -1
  433. package/docs/modules/DoubleArrayProperty.html +1 -1
  434. package/docs/modules/DoubleProperty.html +1 -1
  435. package/docs/modules/DynamicStructPropertyValue.html +1 -1
  436. package/docs/modules/EmptySpecialProperties.html +1 -1
  437. package/docs/modules/EnumArrayProperty.html +1 -1
  438. package/docs/modules/EnumProperty.html +1 -1
  439. package/docs/modules/FClientIdentityInfo.html +3 -0
  440. package/docs/modules/FColor.html +3 -0
  441. package/docs/modules/FGDynamicStruct.html +1 -1
  442. package/docs/modules/FICFrameRange.html +3 -2
  443. package/docs/modules/FINGPUT1BufferPixel.html +4 -0
  444. package/docs/modules/FINItemStateFileSystem.html +5 -0
  445. package/docs/modules/FINNetworkTrace.html +4 -0
  446. package/docs/modules/FLBBalancerIndexing.html +3 -0
  447. package/docs/modules/FLinearColor.html +3 -0
  448. package/docs/modules/FloatArrayProperty.html +1 -1
  449. package/docs/modules/FloatProperty.html +1 -1
  450. package/docs/modules/GUID.html +1 -1
  451. package/docs/modules/GUIDInfo.html +1 -1
  452. package/docs/modules/Int32ArrayProperty.html +1 -1
  453. package/docs/modules/Int32Property.html +1 -1
  454. package/docs/modules/Int32SetProperty.html +1 -1
  455. package/docs/modules/Int64ArrayProperty.html +1 -1
  456. package/docs/modules/Int64Property.html +1 -1
  457. package/docs/modules/Int8Property.html +1 -1
  458. package/docs/modules/Level.html +1 -1
  459. package/docs/modules/LevelToDestroyedActorsMap.html +1 -1
  460. package/docs/modules/MD5Hash.html +1 -1
  461. package/docs/modules/MapProperty.html +1 -1
  462. package/docs/modules/ObjectArrayProperty.html +1 -1
  463. package/docs/modules/ObjectProperty.html +1 -1
  464. package/docs/modules/ObjectReference.html +1 -1
  465. package/docs/modules/ObjectSetProperty.html +1 -1
  466. package/docs/modules/ObjectsListSpecialProperties.html +1 -1
  467. package/docs/modules/PlayerSpecialProperties.html +1 -1
  468. package/docs/modules/PowerLineSpecialProperties.html +1 -1
  469. package/docs/modules/PropertiesList.html +1 -1
  470. package/docs/modules/SatisfactorySaveHeader.html +1 -1
  471. package/docs/modules/SaveBodyChunks.html +1 -1
  472. package/docs/modules/SaveBodyValidation.html +6 -0
  473. package/docs/modules/SetProperty.html +1 -1
  474. package/docs/modules/SoftObjectArrayProperty.html +1 -1
  475. package/docs/modules/SoftObjectReference.html +1 -1
  476. package/docs/modules/SpecialDroneActionProperties.html +1 -1
  477. package/docs/modules/SpecialProperties.html +1 -1
  478. package/docs/modules/StrArrayProperty.html +1 -1
  479. package/docs/modules/StrProperty.html +1 -1
  480. package/docs/modules/StrSetProperty.html +1 -1
  481. package/docs/modules/StructArrayProperty.html +1 -1
  482. package/docs/modules/StructProperty.html +1 -1
  483. package/docs/modules/StructSetProperty.html +1 -1
  484. package/docs/modules/TextArrayProperty.html +1 -1
  485. package/docs/modules/TextProperty.html +1 -1
  486. package/docs/modules/Transform.html +1 -1
  487. package/docs/modules/Uint32Property.html +1 -1
  488. package/docs/modules/Uint32SetProperty.html +1 -1
  489. package/docs/modules/Uint64Property.html +1 -1
  490. package/docs/modules/Uint8Property.html +1 -1
  491. package/docs/modules/VehiclePhysicsData.html +1 -1
  492. package/docs/modules/VehicleSpecialProperties.html +1 -1
  493. package/docs/modules/col4.html +1 -1
  494. package/docs/modules/vec2.html +1 -1
  495. package/docs/modules/vec3.html +1 -1
  496. package/docs/modules/vec4.html +1 -1
  497. package/docs/modules.html +24 -7
  498. package/docs/types/AbstractBaseProperty-1.html +7 -1
  499. package/docs/types/ArrayProperty.AvailableArrayPropertyTypes.html +1 -1
  500. package/docs/types/ArrayPropertyStructValueFields.html +1 -1
  501. package/docs/types/BasicMultipleStructPropertyValue.html +1 -1
  502. package/docs/types/BasicStructPropertyValue.html +1 -1
  503. package/docs/types/BlueprintHeader-1.html +1 -1
  504. package/docs/types/BlueprintReaderWriterContext.html +2 -0
  505. package/docs/types/BoolArrayProperty-1.html +1 -1
  506. package/docs/types/BoolProperty-1.html +1 -1
  507. package/docs/types/BoxStructPropertyValue.html +1 -1
  508. package/docs/types/BuildableSubsystemSpecialProperties-1.html +1 -1
  509. package/docs/types/BuildableTypeInstance-1.html +1 -1
  510. package/docs/types/ByteArrayProperty-1.html +1 -1
  511. package/docs/types/ByteProperty-1.html +1 -1
  512. package/docs/types/BytePropertyValue.html +1 -1
  513. package/docs/types/ChunkCompressionInfo.html +1 -1
  514. package/docs/types/ChunkSummary.html +1 -1
  515. package/docs/types/CircuitSpecialProperties-1.html +1 -1
  516. package/docs/types/ConveyorChainActorSpecialProperties-1.html +1 -1
  517. package/docs/types/ConveyorChainSegmentSpecialProperties.html +1 -1
  518. package/docs/types/ConveyorItemSpecialProperties.html +1 -1
  519. package/docs/types/ConveyorSpecialProperties-1.html +1 -1
  520. package/docs/types/DoubleArrayProperty-1.html +1 -1
  521. package/docs/types/DoubleProperty-1.html +1 -1
  522. package/docs/types/DynamicStructPropertyValue-1.html +1 -1
  523. package/docs/types/EmptySpecialProperties-1.html +1 -1
  524. package/docs/types/EnumArrayProperty-1.html +1 -1
  525. package/docs/types/EnumProperty-1.html +1 -1
  526. package/docs/types/FClientIdentityInfo-1.html +2 -0
  527. package/docs/types/FColor-1.html +2 -0
  528. package/docs/types/FGDynamicStruct-1.html +6 -1
  529. package/docs/types/FICFrameRange-1.html +1 -1
  530. package/docs/types/FICFrameRangeStructPropertyValue.html +1 -1
  531. package/docs/types/FINGPUT1BufferPixel-1.html +1 -0
  532. package/docs/types/FINItemStateFileSystem-1.html +2 -0
  533. package/docs/types/FINNetworkTrace-1.html +1 -0
  534. package/docs/types/FLBBalancerIndexing-1.html +2 -0
  535. package/docs/types/FLinearColor-1.html +2 -0
  536. package/docs/types/FloatArrayProperty-1.html +1 -1
  537. package/docs/types/FloatProperty-1.html +1 -1
  538. package/docs/types/GENERIC_MAP_KEY_TYPE.html +1 -1
  539. package/docs/types/GENERIC_MAP_VALUE_TYPE.html +1 -1
  540. package/docs/types/GENERIC_STRUCT_PROPERTY_VALUE.html +1 -1
  541. package/docs/types/GUID-1.html +1 -1
  542. package/docs/types/GUIDInfo-1.html +1 -1
  543. package/docs/types/Grids.html +1 -1
  544. package/docs/types/Int32ArrayProperty-1.html +1 -1
  545. package/docs/types/Int32Property-1.html +1 -1
  546. package/docs/types/Int32SetProperty-1.html +1 -1
  547. package/docs/types/Int64ArrayProperty-1.html +1 -1
  548. package/docs/types/Int64Property-1.html +1 -1
  549. package/docs/types/Int8Property-1.html +1 -1
  550. package/docs/types/InventoryItemStructPropertyValue.html +1 -1
  551. package/docs/types/Level-1.html +1 -2
  552. package/docs/types/LevelToDestroyedActorsMap-1.html +1 -1
  553. package/docs/types/Levels.html +1 -1
  554. package/docs/types/MAP_STRUCT_PROXY.html +1 -0
  555. package/docs/types/MD5Hash-1.html +1 -1
  556. package/docs/types/MapProperty-1.html +1 -1
  557. package/docs/types/ModData.html +1 -1
  558. package/docs/types/ObjectArrayProperty-1.html +1 -1
  559. package/docs/types/ObjectProperty-1.html +1 -1
  560. package/docs/types/ObjectReference-1.html +1 -1
  561. package/docs/types/ObjectSetProperty-1.html +1 -1
  562. package/docs/types/ObjectsListSpecialProperties-1.html +1 -1
  563. package/docs/types/PlayerSpecialProperties-1.html +1 -1
  564. package/docs/types/PowerLineSpecialProperties-1.html +1 -1
  565. package/docs/types/PropertiesMap.html +1 -1
  566. package/docs/types/RailroadTrackPositionStructPropertyValue.html +1 -1
  567. package/docs/types/ReaderWriterContext.html +2 -0
  568. package/docs/types/RoughSaveVersion.html +1 -1
  569. package/docs/types/SatisfactoryModMetadata.html +1 -1
  570. package/docs/types/SatisfactorySaveHeader-1.html +1 -1
  571. package/docs/types/SaveBodyChunks-1.html +1 -1
  572. package/docs/types/SaveBodyValidation-1.html +1 -0
  573. package/docs/types/SaveReaderWriterContext.html +3 -0
  574. package/docs/types/SetProperty.AvailableSetPropertyTypes.html +1 -1
  575. package/docs/types/SoftObjectArrayProperty-1.html +1 -1
  576. package/docs/types/SoftObjectReference-1.html +1 -1
  577. package/docs/types/SpecialDroneAction.html +1 -1
  578. package/docs/types/SpecialDroneActionProperties-1.html +1 -1
  579. package/docs/types/SpecialProperties.AvailableSpecialPropertiesTypes.html +1 -1
  580. package/docs/types/StrArrayProperty-1.html +1 -1
  581. package/docs/types/StrProperty-1.html +1 -1
  582. package/docs/types/StrSetProperty-1.html +1 -1
  583. package/docs/types/StructArrayProperty-1.html +1 -1
  584. package/docs/types/StructProperty-1.html +1 -1
  585. package/docs/types/StructSetProperty-1.html +1 -1
  586. package/docs/types/TextArrayProperty-1.html +1 -1
  587. package/docs/types/TextProperty-1.html +1 -1
  588. package/docs/types/TextPropertyValue.html +1 -1
  589. package/docs/types/Transform-1.html +1 -1
  590. package/docs/types/Uint32Property-1.html +1 -1
  591. package/docs/types/Uint32SetProperty-1.html +1 -1
  592. package/docs/types/Uint64Property-1.html +1 -1
  593. package/docs/types/Uint8Property-1.html +1 -1
  594. package/docs/types/VehiclePhysicsData-1.html +1 -1
  595. package/docs/types/VehicleSpecialProperties-1.html +1 -1
  596. package/docs/types/col4-1.html +1 -1
  597. package/docs/types/vec2-1.html +1 -1
  598. package/docs/types/vec3-1.html +1 -1
  599. package/docs/types/vec4-1.html +1 -1
  600. package/docs/variables/DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE.html +1 -1
  601. package/docs/variables/EDIT.html +1 -1
  602. package/docs/variables/FINItemStateFileSystem.ExactStructReference.html +1 -0
  603. package/docs/variables/SaveBodyChunks.HEADER_V1.html +1 -1
  604. package/docs/variables/SaveBodyChunks.HEADER_V2.html +1 -1
  605. package/jsr.json +1 -1
  606. package/package.json +3 -3
  607. package/docs/classes/BlueprintConfigWriter.html +0 -39
  608. package/docs/classes/BlueprintWriter.html +0 -42
  609. package/docs/functions/FICFrameRange.Parse.html +0 -1
  610. package/docs/functions/FICFrameRange.Serialize.html +0 -1
  611. package/docs/types/ByteArray4.html +0 -1
  612. package/docs/types/ClientIdentityInfo.html +0 -1
  613. package/docs/types/MAP_STRUCT_KEY_PROXY.html +0 -1
  614. package/docs/types/SaveBodyValidation.html +0 -1
@@ -15,6 +15,7 @@ var Level;
15
15
  objects: [],
16
16
  collectables: []
17
17
  };
18
+ const isPersistentLevel = reader.context.mapName === levelName;
18
19
  const headersBinLen = reader.readInt32();
19
20
  if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
20
21
  reader.readInt32Zero();
@@ -23,7 +24,7 @@ var Level;
23
24
  Level.ReadAllObjectHeaders(reader, level.objects);
24
25
  let remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
25
26
  if (remainingSize > 0) {
26
- if (levelName === reader.context.mapName) {
27
+ if (isPersistentLevel) {
27
28
  level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
28
29
  }
29
30
  else {
@@ -42,16 +43,17 @@ var Level;
42
43
  }
43
44
  const posBeforeContents = reader.getBufferPosition();
44
45
  Level.ReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);
46
+ level.objects = level.objects.filter(Boolean);
45
47
  const posAfterContents = reader.getBufferPosition();
46
48
  if (posAfterContents - posBeforeContents !== objectContentsBinLen) {
47
- console.warn('save seems corrupt.', level.name);
49
+ console.warn(`save seems corrupt. Level ${level.name} is not even obeying the object count checksum.`, level.name);
48
50
  }
49
- if (levelName !== reader.context.mapName) {
51
+ if (!isPersistentLevel) {
50
52
  if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {
51
53
  level.saveCustomVersion = reader.readInt32();
52
54
  }
53
55
  }
54
- if (levelName === reader.context.mapName) {
56
+ if (isPersistentLevel) {
55
57
  level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
56
58
  }
57
59
  else {
@@ -60,26 +62,27 @@ var Level;
60
62
  return level;
61
63
  };
62
64
  Level.SerializeLevel = (writer, level) => {
65
+ const isPersistentLevel = level.name === writer.context.mapName;
63
66
  const lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();
64
67
  writer.writeInt32(0);
65
68
  if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
66
69
  writer.writeInt32Zero();
67
70
  }
68
71
  Level.SerializeAllObjectHeaders(writer, level.objects);
69
- if (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {
72
+ if (isPersistentLevel && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {
70
73
  level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);
71
74
  }
72
- else if (level.name !== writer.context.mapName && level.collectables.length > 0) {
75
+ else if (!isPersistentLevel && level.collectables.length > 0) {
73
76
  object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
74
77
  }
75
78
  writer.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);
76
79
  Level.SerializeAllObjectContents(writer, level.objects, level.name);
77
- if (level.name !== writer.context.mapName) {
80
+ if (!isPersistentLevel) {
78
81
  if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {
79
82
  writer.writeInt32(level.saveCustomVersion ?? save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion);
80
83
  }
81
84
  }
82
- if (level.name === writer.context.mapName) {
85
+ if (isPersistentLevel) {
83
86
  level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});
84
87
  }
85
88
  else {
@@ -113,15 +116,27 @@ var Level;
113
116
  }
114
117
  const binarySize = reader.readInt32();
115
118
  const before = reader.getBufferPosition();
116
- if ((0, SaveEntity_1.isSaveEntity)(objects[i + objectListOffset])) {
117
- SaveEntity_1.SaveEntity.ParseData(objects[i + objectListOffset], binarySize, reader, objects[i + objectListOffset].typePath);
118
- }
119
- else if ((0, SaveComponent_1.isSaveComponent)(objects[i + objectListOffset])) {
120
- SaveComponent_1.SaveComponent.ParseData(objects[i + objectListOffset], binarySize, reader, objects[i + objectListOffset].typePath);
121
- }
122
- const after = reader.getBufferPosition();
123
- if (after - before !== binarySize) {
124
- throw new parser_error_1.CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);
119
+ try {
120
+ if ((0, SaveEntity_1.isSaveEntity)(objects[i + objectListOffset])) {
121
+ SaveEntity_1.SaveEntity.ParseData(objects[i + objectListOffset], binarySize, reader, objects[i + objectListOffset].typePath);
122
+ }
123
+ else if ((0, SaveComponent_1.isSaveComponent)(objects[i + objectListOffset])) {
124
+ SaveComponent_1.SaveComponent.ParseData(objects[i + objectListOffset], binarySize, reader, objects[i + objectListOffset].typePath);
125
+ }
126
+ const after = reader.getBufferPosition();
127
+ if (after - before !== binarySize) {
128
+ throw new parser_error_1.CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);
129
+ }
130
+ }
131
+ catch (error) {
132
+ if (reader.context.throwErrors) {
133
+ throw error;
134
+ }
135
+ else {
136
+ console.warn(`Could not read object ${objects[i + objectListOffset].instanceName} of type ${objects[i + objectListOffset].typePath} as a whole. will be removed from level's object list.`);
137
+ reader.skipBytes(before - reader.getBufferPosition() + binarySize);
138
+ objects[i + objectListOffset] = null;
139
+ }
125
140
  }
126
141
  }
127
142
  };
@@ -1 +1 @@
1
- {"version":3,"file":"level.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.ts"],"names":[],"mappings":";;;AAGA,2DAAgF;AAChF,kEAAgF;AAChF,4DAAuE;AAGvE,mFAA4E;AAC5E,qEAAgE;AAChE,+DAA0D;AAgB1D,IAAiB,KAAK,CAsPrB;AAtPD,WAAiB,KAAK;IAER,eAAS,GAAG,CAAC,MAAkB,EAAE,SAAiB,EAAS,EAAE;QACzE,MAAM,KAAK,GAAU;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,EAAE;SAChB,CAAA;QAGD,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,uCAAiB,CAAC,aAAa,EAAE,CAAC;YACnE,MAAM,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AG,UAAU,CAAC,CAAC;YACjE,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC;IAChB,CAAC,CAAA;IAEY,+BAAyB,GAAG,CAAC,MAAqB,EAAE,OAAuC,EAAQ,EAAE;QACjH,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAE3B,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,YAAY;oBAChB,MAAM,CAAC,UAAU,CAAC,uBAAU,CAAC,MAAM,CAAC,CAAC;oBACrC,uBAAU,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBACxC,MAAM;gBACP,KAAK,eAAe;oBACnB,MAAM,CAAC,UAAU,CAAC,6BAAa,CAAC,MAAM,CAAC,CAAC;oBACxC,6BAAa,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBAC3C,MAAM;gBACP;oBACC,MAAM,IAAI,iCAAkB,CAAC,uBAAwB,GAAsB,CAAC,IAAI,oBAAoB,CAAC,CAAC;oBACtG,MAAM;YACR,CAAC;QACF,CAAC;IACF,CAAC,CAAA;AACF,CAAC,EAtPgB,KAAK,qBAAL,KAAK,QAsPrB","sourcesContent":["\nimport { ContextReader } from '../../context/context-reader';\nimport { ContextWriter } from '../../context/context-writer';\nimport { CorruptSaveError, UnimplementedError } from '../../error/parser.error';\nimport { SaveComponent, isSaveComponent } from \"../types/objects/SaveComponent\";\nimport { SaveEntity, isSaveEntity } from \"../types/objects/SaveEntity\";\nimport { SaveObject } from \"../types/objects/SaveObject\";\nimport { ObjectReference } from \"../types/structs/ObjectReference\";\nimport { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';\nimport { ObjectReferencesList } from './object-references-list';\nimport { SaveCustomVersion } from './save-custom-version';\nimport { SaveReader } from './save-reader';\n\n/**\n * type for levels\n * @param fiftyOne Use unclear. Added in Update 1.1\n */\nexport type Level = {\n\tname: string;\n\tobjects: (SaveEntity | SaveComponent)[];\n\tcollectables: ObjectReference[];\n\tsaveCustomVersion?: number;\n\tdestroyedActorsMap?: LevelToDestroyedActorsMap\n}\nexport type Levels = { [levelName: string]: Level };\n\nexport namespace Level {\n\n\texport const ReadLevel = (reader: SaveReader, levelName: string): Level => {\n\t\tconst level: Level = {\n\t\t\tname: levelName,\n\t\t\tobjects: [],\n\t\t\tcollectables: []\n\t\t}\n\n\t\t// checksum object headers.\n\t\tconst headersBinLen = reader.readInt32(); // object headers + binary length\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// object headers\n\t\tconst posBeforeHeaders = reader.getBufferPosition();\n\t\tReadAllObjectHeaders(reader, level.objects);\n\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles. Only listed here since U8.\n\t\tlet remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize > 0) {\n\n\t\t\tif (levelName === reader.context.mapName) {\n\t\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t\t} else {\n\t\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// its perfectly possible for ported saves to have nothing here.\n\t\t}\n\n\n\t\tremainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize !== 0) {\n\t\t\tconsole.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);\n\t\t}\n\n\t\t// checksum for object content size\n\t\tconst objectContentsBinLen = reader.readInt32();\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// objects contents\n\t\tconst posBeforeContents = reader.getBufferPosition();\n\t\tReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);\n\t\tconst posAfterContents = reader.getBufferPosition();\n\t\tif (posAfterContents - posBeforeContents !== objectContentsBinLen) {\n\t\t\t//WARNING\n\t\t\tconsole.warn('save seems corrupt.', level.name);\n\t\t}\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (levelName !== reader.context.mapName) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\tlevel.saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\t// Listed here since < U8 and in U8 as well. So this is the best list you can rely on.\n\t\tif (levelName === reader.context.mapName) {\n\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t} else {\n\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t}\n\n\t\treturn level;\n\t}\n\n\texport const SerializeLevel = (writer: ContextWriter, level: Level): void => {\n\t\tconst lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\t// len indicator\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\tSerializeAllObjectHeaders(writer, level.objects);\n\n\t\t// <--- destroyed actors is the same as collectables list. Seems like its not there if count 0.\n\t\tif (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);\n\t\t} else if (level.name !== writer.context.mapName && level.collectables.length > 0) {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\n\t\t// replace binary size from earlier for - object headers + collectables\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);\n\n\t\t// write entities\n\t\tSerializeAllObjectContents(writer, level.objects, level.name);\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (level.name !== writer.context.mapName) {\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\twriter.writeInt32(level.saveCustomVersion ?? SaveCustomVersion.SerializePerStreamableLevelTOCVersion);\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\tif (level.name === writer.context.mapName) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});\n\t\t} else {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\t}\n\n\texport const ReadAllObjectContents = (levelName: string, reader: ContextReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void): void => {\n\t\tconst countEntities = reader.readInt32();\n\t\tif (countEntities !== objectsList.length) {\n\t\t\tthrow new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);\n\t\t}\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectsCount = 0;\n\t\tlet lastProgressReport = 0;\n\t\twhile (readObjectsCount < countEntities) {\n\t\t\tReadNObjectContents(reader, Math.min(batchSize, countEntities - readObjectsCount), objectsList, readObjectsCount);\n\t\t\treadObjectsCount += Math.min(batchSize, countEntities - readObjectsCount);\n\n\t\t\tif (readObjectsCount - lastProgressReport > batchSize) {\n\t\t\t\tonProgressCallback(reader.getBufferProgress(), `read object count [${(readObjectsCount)}/${(countEntities)}] in level ${levelName}`);\n\t\t\t\tlastProgressReport = readObjectsCount;\n\t\t\t}\n\t\t}\n\t}\n\n\texport const ReadNObjectContents = (reader: ContextReader, count: number, objects: SaveObject[], objectListOffset: number = 0): void => {\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].shouldMigrateObjectRefsToPersistent = reader.readInt32() >= 1;\n\t\t\t}\n\n\t\t\tconst binarySize = reader.readInt32();\n\n\t\t\tconst before = reader.getBufferPosition();\n\t\t\tif (isSaveEntity(objects[i + objectListOffset])) {\n\t\t\t\tSaveEntity.ParseData(objects[i + objectListOffset] as SaveEntity, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t} else if (isSaveComponent(objects[i + objectListOffset])) {\n\t\t\t\tSaveComponent.ParseData(objects[i + objectListOffset] as SaveComponent, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t}\n\n\t\t\tconst after = reader.getBufferPosition();\n\t\t\tif (after - before !== binarySize) {\n\t\t\t\tthrow new CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);\n\t\t\t}\n\t\t}\n\t}\n\n\texport const SerializeAllObjectContents = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[], levelName: string): void => {\n\t\tconst lenIndicatorEntities = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.saveCustomVersion);\n\t\t\t}\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.shouldMigrateObjectRefsToPersistent ? 1 : 0);\n\t\t\t}\n\t\t\tconst lenReplacementPosition = writer.getBufferPosition();\n\t\t\twriter.writeInt32(0);\n\n\t\t\tif (isSaveEntity(obj)) {\n\t\t\t\tSaveEntity.SerializeData(writer, obj);\n\t\t\t} else if (isSaveComponent(obj)) {\n\t\t\t\tSaveComponent.SerializeData(writer, obj);\n\t\t\t}\n\n\t\t\twriter.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);\n\t\t}\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorEntities, lenIndicatorEntities + 8);\n\t}\n\n\texport const ReadAllObjectHeaders = (reader: ContextReader, objectsList: SaveObject[]): void => {\n\t\tlet countObjectHeaders = reader.readInt32();\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectHeadersCount = 0;\n\t\twhile (readObjectHeadersCount < countObjectHeaders) {\n\t\t\tobjectsList.push(...ReadNObjectHeaders(reader, Math.min(batchSize, countObjectHeaders - readObjectHeadersCount)));\n\t\t\treadObjectHeadersCount += Math.min(batchSize, countObjectHeaders - readObjectHeadersCount);\n\t\t}\n\t}\n\n\texport const ReadNObjectHeaders = (reader: ContextReader, count: number): (SaveEntity | SaveComponent)[] => {\n\t\tlet objects: (SaveEntity | SaveComponent)[] = [];\n\t\tlet objectsRead = 0;\n\t\tfor (; objectsRead < count; objectsRead++) {\n\n\t\t\tlet obj: SaveEntity | SaveComponent;\n\t\t\tlet objectType = reader.readInt32();\n\t\t\tswitch (objectType) {\n\t\t\t\tcase SaveEntity.TypeID:\n\t\t\t\t\tobj = new SaveEntity('', '', '', '');\n\t\t\t\t\tSaveEntity.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SaveComponent.TypeID:\n\t\t\t\t\tobj = new SaveComponent('', '', '', '');\n\t\t\t\t\tSaveComponent.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new CorruptSaveError('Unknown object type' + objectType);\n\t\t\t}\n\t\t\tobjects.push(obj);\n\t\t}\n\t\treturn objects;\n\t}\n\n\texport const SerializeAllObjectHeaders = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[]): void => {\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tswitch (obj.type) {\n\t\t\t\tcase 'SaveEntity':\n\t\t\t\t\twriter.writeInt32(SaveEntity.TypeID);\n\t\t\t\t\tSaveEntity.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'SaveComponent':\n\t\t\t\t\twriter.writeInt32(SaveComponent.TypeID);\n\t\t\t\t\tSaveComponent.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new UnimplementedError(`Unknown object type ${(obj as unknown as any).type}. Not implemented.`);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}"]}
1
+ {"version":3,"file":"level.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.ts"],"names":[],"mappings":";;;AAGA,2DAAgF;AAChF,kEAAgF;AAChF,4DAAuE;AAGvE,mFAA4E;AAC5E,qEAAgE;AAChE,+DAA0D;AAe1D,IAAiB,KAAK,CAkQrB;AAlQD,WAAiB,KAAK;IAER,eAAS,GAAG,CAAC,MAAkB,EAAE,SAAiB,EAAS,EAAE;QACzE,MAAM,KAAK,GAAU;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,EAAE;SAChB,CAAA;QACD,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC;QAG/D,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,uCAAiB,CAAC,aAAa,EAAE,CAAC;YACnE,MAAM,CAAC,aAAa,EAAE,CAAC;QACxB,CAAC;QAGD,MAAM,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACpD,MAAA,oBAAoB,CAAC,MAAM,EAAE,KAA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,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBACpC,MAAM;gBACP,KAAK,6BAAa,CAAC,MAAM;oBACxB,GAAG,GAAG,IAAI,6BAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;oBACxC,6BAAa,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBACvC,MAAM;gBACP;oBACC,MAAM,IAAI,+BAAgB,CAAC,qBAAqB,GAAG,UAAU,CAAC,CAAC;YACjE,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC;IAChB,CAAC,CAAA;IAEY,+BAAyB,GAAG,CAAC,MAAqB,EAAE,OAAuC,EAAQ,EAAE;QACjH,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAE3B,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;gBAClB,KAAK,YAAY;oBAChB,MAAM,CAAC,UAAU,CAAC,uBAAU,CAAC,MAAM,CAAC,CAAC;oBACrC,uBAAU,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBACxC,MAAM;gBACP,KAAK,eAAe;oBACnB,MAAM,CAAC,UAAU,CAAC,6BAAa,CAAC,MAAM,CAAC,CAAC;oBACxC,6BAAa,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBAC3C,MAAM;gBACP;oBACC,MAAM,IAAI,iCAAkB,CAAC,uBAAwB,GAAsB,CAAC,IAAI,oBAAoB,CAAC,CAAC;oBACtG,MAAM;YACR,CAAC;QACF,CAAC;IACF,CAAC,CAAA;AACF,CAAC,EAlQgB,KAAK,qBAAL,KAAK,QAkQrB","sourcesContent":["\nimport { ContextReader } from '../../context/context-reader';\nimport { ContextWriter } from '../../context/context-writer';\nimport { CorruptSaveError, UnimplementedError } from '../../error/parser.error';\nimport { SaveComponent, isSaveComponent } from \"../types/objects/SaveComponent\";\nimport { SaveEntity, isSaveEntity } from \"../types/objects/SaveEntity\";\nimport { SaveObject } from \"../types/objects/SaveObject\";\nimport { ObjectReference } from \"../types/structs/ObjectReference\";\nimport { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';\nimport { ObjectReferencesList } from './object-references-list';\nimport { SaveCustomVersion } from './save-custom-version';\nimport { SaveReader } from './save-reader';\n\n/**\n * type for levels\n */\nexport type Level = {\n\tname: string;\n\tobjects: (SaveEntity | SaveComponent)[];\n\tcollectables: ObjectReference[];\n\tsaveCustomVersion?: number;\n\tdestroyedActorsMap?: LevelToDestroyedActorsMap;\n}\nexport type Levels = { [levelName: string]: Level };\n\nexport namespace Level {\n\n\texport const ReadLevel = (reader: SaveReader, levelName: string): Level => {\n\t\tconst level: Level = {\n\t\t\tname: levelName,\n\t\t\tobjects: [],\n\t\t\tcollectables: []\n\t\t}\n\t\tconst isPersistentLevel = reader.context.mapName === levelName;\n\n\t\t// checksum object headers.\n\t\tconst headersBinLen = reader.readInt32(); // object headers + binary length\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// object headers\n\t\tconst posBeforeHeaders = reader.getBufferPosition();\n\t\tReadAllObjectHeaders(reader, level.objects);\n\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles. Only listed here since U8.\n\t\tlet remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize > 0) {\n\n\t\t\tif (isPersistentLevel) {\n\t\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t\t} else {\n\t\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// its perfectly possible for ported saves to have nothing here.\n\t\t}\n\n\n\t\tremainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize !== 0) {\n\t\t\tconsole.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);\n\t\t}\n\n\t\t// checksum for object content size\n\t\tconst objectContentsBinLen = reader.readInt32();\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// objects contents\n\t\tconst posBeforeContents = reader.getBufferPosition();\n\t\tReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);\n\t\tlevel.objects = level.objects.filter(Boolean);\n\t\tconst posAfterContents = reader.getBufferPosition();\n\t\tif (posAfterContents - posBeforeContents !== objectContentsBinLen) {\n\t\t\tconsole.warn(`save seems corrupt. Level ${level.name} is not even obeying the object count checksum.`, level.name);\n\t\t}\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (!isPersistentLevel) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\tlevel.saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\t// Listed here since < U8 and in U8 as well. So this is the best list you can rely on.\n\t\tif (isPersistentLevel) {\n\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t} else {\n\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t}\n\n\t\treturn level;\n\t}\n\n\texport const SerializeLevel = (writer: ContextWriter, level: Level): void => {\n\t\tconst isPersistentLevel = level.name === writer.context.mapName;\n\t\tconst lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\t// len indicator\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\tSerializeAllObjectHeaders(writer, level.objects);\n\n\t\t// <--- destroyed actors is the same as collectables list. Seems like its not there if count 0.\n\t\tif (isPersistentLevel && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);\n\t\t} else if (!isPersistentLevel && level.collectables.length > 0) {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\n\t\t// replace binary size from earlier for - object headers + collectables\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);\n\n\t\t// write entities\n\t\tSerializeAllObjectContents(writer, level.objects, level.name);\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (!isPersistentLevel) {\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\twriter.writeInt32(level.saveCustomVersion ?? SaveCustomVersion.SerializePerStreamableLevelTOCVersion);\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\tif (isPersistentLevel) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});\n\t\t} else {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\t}\n\n\texport const ReadAllObjectContents = (levelName: string, reader: ContextReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void): void => {\n\t\tconst countEntities = reader.readInt32();\n\t\tif (countEntities !== objectsList.length) {\n\t\t\tthrow new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);\n\t\t}\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectsCount = 0;\n\t\tlet lastProgressReport = 0;\n\t\twhile (readObjectsCount < countEntities) {\n\t\t\tReadNObjectContents(reader, Math.min(batchSize, countEntities - readObjectsCount), objectsList, readObjectsCount);\n\t\t\treadObjectsCount += Math.min(batchSize, countEntities - readObjectsCount);\n\n\t\t\tif (readObjectsCount - lastProgressReport > batchSize) {\n\t\t\t\tonProgressCallback(reader.getBufferProgress(), `read object count [${(readObjectsCount)}/${(countEntities)}] in level ${levelName}`);\n\t\t\t\tlastProgressReport = readObjectsCount;\n\t\t\t}\n\t\t}\n\t}\n\n\texport const ReadNObjectContents = (reader: ContextReader, count: number, objects: SaveObject[], objectListOffset: number = 0): void => {\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].shouldMigrateObjectRefsToPersistent = reader.readInt32() >= 1;\n\t\t\t}\n\n\t\t\tconst binarySize = reader.readInt32();\n\t\t\tconst before = reader.getBufferPosition();\n\n\t\t\ttry {\n\t\t\t\tif (isSaveEntity(objects[i + objectListOffset])) {\n\t\t\t\t\tSaveEntity.ParseData(objects[i + objectListOffset] as SaveEntity, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t\t} else if (isSaveComponent(objects[i + objectListOffset])) {\n\t\t\t\t\tSaveComponent.ParseData(objects[i + objectListOffset] as SaveComponent, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t\t}\n\n\t\t\t\tconst after = reader.getBufferPosition();\n\t\t\t\tif (after - before !== binarySize) {\n\t\t\t\t\tthrow new CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (reader.context.throwErrors) {\n\t\t\t\t\tthrow error;\n\t\t\t\t} else {\n\t\t\t\t\tconsole.warn(`Could not read object ${objects[i + objectListOffset].instanceName} of type ${objects[i + objectListOffset].typePath} as a whole. will be removed from level's object list.`);\n\t\t\t\t\treader.skipBytes(before - reader.getBufferPosition() + binarySize);\n\t\t\t\t\tobjects[i + objectListOffset] = null as unknown as SaveObject;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\texport const SerializeAllObjectContents = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[], levelName: string): void => {\n\t\tconst lenIndicatorEntities = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.saveCustomVersion);\n\t\t\t}\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.shouldMigrateObjectRefsToPersistent ? 1 : 0);\n\t\t\t}\n\t\t\tconst lenReplacementPosition = writer.getBufferPosition();\n\t\t\twriter.writeInt32(0);\n\n\t\t\tif (isSaveEntity(obj)) {\n\t\t\t\tSaveEntity.SerializeData(writer, obj);\n\t\t\t} else if (isSaveComponent(obj)) {\n\t\t\t\tSaveComponent.SerializeData(writer, obj);\n\t\t\t}\n\n\t\t\twriter.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);\n\t\t}\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorEntities, lenIndicatorEntities + 8);\n\t}\n\n\texport const ReadAllObjectHeaders = (reader: ContextReader, objectsList: SaveObject[]): void => {\n\t\tlet countObjectHeaders = reader.readInt32();\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectHeadersCount = 0;\n\t\twhile (readObjectHeadersCount < countObjectHeaders) {\n\t\t\tobjectsList.push(...ReadNObjectHeaders(reader, Math.min(batchSize, countObjectHeaders - readObjectHeadersCount)));\n\t\t\treadObjectHeadersCount += Math.min(batchSize, countObjectHeaders - readObjectHeadersCount);\n\t\t}\n\t}\n\n\texport const ReadNObjectHeaders = (reader: ContextReader, count: number): (SaveEntity | SaveComponent)[] => {\n\t\tlet objects: (SaveEntity | SaveComponent)[] = [];\n\t\tlet objectsRead = 0;\n\t\tfor (; objectsRead < count; objectsRead++) {\n\n\t\t\tlet obj: SaveEntity | SaveComponent;\n\t\t\tlet objectType = reader.readInt32();\n\t\t\tswitch (objectType) {\n\t\t\t\tcase SaveEntity.TypeID:\n\t\t\t\t\tobj = new SaveEntity('', '', '', '');\n\t\t\t\t\tSaveEntity.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SaveComponent.TypeID:\n\t\t\t\t\tobj = new SaveComponent('', '', '', '');\n\t\t\t\t\tSaveComponent.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new CorruptSaveError('Unknown object type' + objectType);\n\t\t\t}\n\t\t\tobjects.push(obj);\n\t\t}\n\t\treturn objects;\n\t}\n\n\texport const SerializeAllObjectHeaders = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[]): void => {\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tswitch (obj.type) {\n\t\t\t\tcase 'SaveEntity':\n\t\t\t\t\twriter.writeInt32(SaveEntity.TypeID);\n\t\t\t\t\tSaveEntity.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'SaveComponent':\n\t\t\t\t\twriter.writeInt32(SaveComponent.TypeID);\n\t\t\t\t\tSaveComponent.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new UnimplementedError(`Unknown object type ${(obj as unknown as any).type}. Not implemented.`);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SaveObject.d.ts","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,EAAE,MAAM,GAAG,IAAI;WAiCzF,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,GAAG,IAAI;CAM/D"}
@@ -35,16 +35,35 @@ class SaveObject {
35
35
  }
36
36
  static ParseData(obj, length, reader, typePath) {
37
37
  const start = reader.getBufferPosition();
38
- obj.properties = PropertiesList_1.PropertiesList.ParseList(reader);
39
- reader.readInt32Zero();
40
- let remainingSize = length - (reader.getBufferPosition() - start);
41
- obj.specialProperties = SpecialProperties_1.SpecialProperties.ParseClassSpecificSpecialProperties(reader, typePath, remainingSize);
38
+ let remainingSize = length;
39
+ try {
40
+ obj.properties = PropertiesList_1.PropertiesList.ParseList(reader);
41
+ reader.readInt32Zero();
42
+ remainingSize = length - (reader.getBufferPosition() - start);
43
+ obj.specialProperties = SpecialProperties_1.SpecialProperties.ParseClassSpecificSpecialProperties(reader, typePath, remainingSize);
44
+ }
45
+ catch (error) {
46
+ if (reader.context.throwErrors) {
47
+ throw error;
48
+ }
49
+ else {
50
+ console.warn(error);
51
+ console.warn(`data of object ${obj.instanceName} could not be read fully. Trailing data will be filled with raw bytes.`);
52
+ }
53
+ }
42
54
  remainingSize = length - (reader.getBufferPosition() - start);
43
55
  if (remainingSize > 0) {
44
56
  obj.trailingData = Array.from(reader.readBytes(remainingSize));
45
57
  }
46
58
  else if (remainingSize < 0) {
47
- throw new parser_error_1.ParserError('ParserError', `Unexpected. Read more bytes than are indicated for entity ${obj.instanceName}. bytes left to read is ${remainingSize}`);
59
+ const error = new parser_error_1.ParserError('ParserError', `Unexpected. Read more bytes than are indicated for entity ${obj.instanceName}. bytes left to read is ${remainingSize}`);
60
+ if (reader.context.throwErrors) {
61
+ throw error;
62
+ }
63
+ else {
64
+ console.warn(error);
65
+ reader.skipBytes(-remainingSize);
66
+ }
48
67
  }
49
68
  }
50
69
  static SerializeData(writer, obj) {
@@ -1 +1 @@
1
- {"version":3,"file":"SaveObject.js","sourceRoot":"","sources":["../../../../../src/parser/satis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Ae,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC1C,CAAC;CACD;AAzDD,gCAyDC","sourcesContent":["import { ContextReader } from '../../../context/context-reader';\nimport { ContextWriter } from '../../../context/context-writer';\nimport { ParserError } from '../../../error/parser.error';\nimport { SaveCustomVersion } from '../../save/save-custom-version';\nimport { PropertiesMap } from \"../property/generic/AbstractBaseProperty\";\nimport { PropertiesList } from '../property/PropertiesList';\nimport { SpecialProperties } from '../property/special/SpecialProperties';\n\nexport interface SaveObjectHeader {\n\ttypePath: string;\n\trootObject: string;\n\tinstanceName: string;\n\tflags?: number;\n}\n\nexport abstract class SaveObject implements SaveObjectHeader {\n\n\tpublic properties: PropertiesMap = {};\n\tpublic specialProperties: SpecialProperties.AvailableSpecialPropertiesTypes = { type: 'EmptySpecialProperties' };\n\tpublic trailingData: number[] = [];\n\n\tpublic saveCustomVersion: number = 0;\n\tpublic shouldMigrateObjectRefsToPersistent: boolean = false;\n\n\tconstructor(public typePath: string, public rootObject: string, public instanceName: string, public flags?: number) {\n\n\t}\n\n\tprotected static ParseHeader(reader: ContextReader, obj: SaveObject): void {\n\t\tobj.typePath = reader.readString();\n\t\tobj.rootObject = reader.readString();\n\t\tobj.instanceName = reader.readString();\n\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.SerializeObjectFlags) {\n\t\t\tobj.flags = reader.readUint32();\n\t\t}\n\t}\n\n\tprotected static SerializeHeader(writer: ContextWriter, obj: SaveObject): void {\n\t\twriter.writeString(obj.typePath);\n\t\twriter.writeString(obj.rootObject);\n\t\twriter.writeString(obj.instanceName);\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.SerializeObjectFlags) {\n\t\t\twriter.writeUint32(obj.flags ?? 0);\n\t\t}\n\t}\n\n\tpublic static ParseData(obj: SaveObject, length: number, reader: ContextReader, typePath: string): void {\n\t\tconst start = reader.getBufferPosition();\n\n\t\tobj.properties = PropertiesList.ParseList(reader);\n\n\t\treader.readInt32Zero();\n\n\t\tlet remainingSize = length - (reader.getBufferPosition() - start);\n\t\tobj.specialProperties = SpecialProperties.ParseClassSpecificSpecialProperties(reader, typePath, remainingSize);\n\n\t\tremainingSize = length - (reader.getBufferPosition() - start);\n\t\tif (remainingSize > 0) {\n\t\t\tobj.trailingData = Array.from(reader.readBytes(remainingSize));\n\t\t} else if (remainingSize < 0) {\n\t\t\tthrow new ParserError('ParserError', `Unexpected. Read more bytes than are indicated for entity ${obj.instanceName}. bytes left to read is ${remainingSize}`);\n\t\t}\n\t}\n\n\tpublic static SerializeData(writer: any, obj: SaveObject): void {\n\t\tPropertiesList.SerializeList(writer, obj.properties);\n\t\twriter.writeInt32Zero();\n\t\tSpecialProperties.SerializeClassSpecificSpecialProperties(writer, obj.typePath, obj.specialProperties);\n\t\twriter.writeBytesArray(obj.trailingData);\n\t}\n}\n"]}
1
+ {"version":3,"file":"SaveObject.js","sourceRoot":"","sources":["../../../../../src/parser/satisfactory/types/objects/SaveObject.ts"],"names":[],"mappings":";;;AAEA,8DAA0D;AAC1D,wEAAmE;AAEnE,+DAA4D;AAC5D,6EAA0E;AAS1E,MAAsB,UAAU;IAS/B,YAAmB,QAAgB,EAAS,UAAkB,EAAS,YAAoB,EAAS,KAAc;QAA/F,aAAQ,GAAR,QAAQ,CAAQ;QAAS,eAAU,GAAV,UAAU,CAAQ;QAAS,iBAAY,GAAZ,YAAY,CAAQ;QAAS,UAAK,GAAL,KAAK,CAAS;QAP3G,eAAU,GAAkB,EAAE,CAAC;QAC/B,sBAAiB,GAAsD,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;QAC1G,iBAAY,GAAa,EAAE,CAAC;QAE5B,sBAAiB,GAAW,CAAC,CAAC;QAC9B,wCAAmC,GAAY,KAAK,CAAC;IAI5D,CAAC;IAES,MAAM,CAAC,WAAW,CAAC,MAAqB,EAAE,GAAe;QAClE,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,GAAG,CAAC,UAAU,GAAG,MAA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ader } from '../../../context/context-reader';\nimport { ContextWriter } from '../../../context/context-writer';\nimport { ParserError } from '../../../error/parser.error';\nimport { SaveCustomVersion } from '../../save/save-custom-version';\nimport { PropertiesMap } from \"../property/generic/AbstractBaseProperty\";\nimport { PropertiesList } from '../property/PropertiesList';\nimport { SpecialProperties } from '../property/special/SpecialProperties';\n\nexport interface SaveObjectHeader {\n\ttypePath: string;\n\trootObject: string;\n\tinstanceName: string;\n\tflags?: number;\n}\n\nexport abstract class SaveObject implements SaveObjectHeader {\n\n\tpublic properties: PropertiesMap = {};\n\tpublic specialProperties: SpecialProperties.AvailableSpecialPropertiesTypes = { type: 'EmptySpecialProperties' };\n\tpublic trailingData: number[] = [];\n\n\tpublic saveCustomVersion: number = 0;\n\tpublic shouldMigrateObjectRefsToPersistent: boolean = false;\n\n\tconstructor(public typePath: string, public rootObject: string, public instanceName: string, public flags?: number) {\n\n\t}\n\n\tprotected static ParseHeader(reader: ContextReader, obj: SaveObject): void {\n\t\tobj.typePath = reader.readString();\n\t\tobj.rootObject = reader.readString();\n\t\tobj.instanceName = reader.readString();\n\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.SerializeObjectFlags) {\n\t\t\tobj.flags = reader.readUint32();\n\t\t}\n\t}\n\n\tprotected static SerializeHeader(writer: ContextWriter, obj: SaveObject): void {\n\t\twriter.writeString(obj.typePath);\n\t\twriter.writeString(obj.rootObject);\n\t\twriter.writeString(obj.instanceName);\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.SerializeObjectFlags) {\n\t\t\twriter.writeUint32(obj.flags ?? 0);\n\t\t}\n\t}\n\n\tpublic static ParseData(obj: SaveObject, length: number, reader: ContextReader, typePath: string): void {\n\t\tconst start = reader.getBufferPosition();\n\t\tlet remainingSize = length;\n\n\t\ttry {\n\t\t\tobj.properties = PropertiesList.ParseList(reader);\n\t\t\treader.readInt32Zero();\n\n\t\t\tremainingSize = length - (reader.getBufferPosition() - start);\n\t\t\tobj.specialProperties = SpecialProperties.ParseClassSpecificSpecialProperties(reader, typePath, remainingSize);\n\t\t} catch (error) {\n\t\t\tif (reader.context.throwErrors) {\n\t\t\t\tthrow error;\n\t\t\t} else {\n\t\t\t\tconsole.warn(error);\n\t\t\t\tconsole.warn(`data of object ${obj.instanceName} could not be read fully. Trailing data will be filled with raw bytes.`);\n\t\t\t}\n\t\t}\n\n\t\tremainingSize = length - (reader.getBufferPosition() - start);\n\t\tif (remainingSize > 0) {\n\t\t\tobj.trailingData = Array.from(reader.readBytes(remainingSize));\n\t\t} else if (remainingSize < 0) {\n\t\t\tconst error = new ParserError('ParserError', `Unexpected. Read more bytes than are indicated for entity ${obj.instanceName}. bytes left to read is ${remainingSize}`);\n\t\t\tif (reader.context.throwErrors) {\n\t\t\t\tthrow error;\n\t\t\t} else {\n\t\t\t\tconsole.warn(error);\n\t\t\t\treader.skipBytes(-remainingSize);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static SerializeData(writer: any, obj: SaveObject): void {\n\t\tPropertiesList.SerializeList(writer, obj.properties);\n\t\twriter.writeInt32Zero();\n\t\tSpecialProperties.SerializeClassSpecificSpecialProperties(writer, obj.typePath, obj.specialProperties);\n\t\twriter.writeBytesArray(obj.trailingData);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PropertiesList.d.ts","sourceRoot":"","sources":["../../../../../src/parser/satisfactory/types/property/PropertiesList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAsBrF,yBAAiB,cAAc,CAAC;IAExB,MAAM,SAAS,WAAY,aAAa,KAAG,aAqBjD,CAAA;IAEM,MAAM,aAAa,WAAY,aAAa,cAAc,aAAa,KAAG,IAMhF,CAAA;IAEM,MAAM,mBAAmB,WAAY,aAAa,gBAAgB,MAAM,KAAG,oBA4HjF,CAAA;IAEM,MAAM,uBAAuB,WAAY,aAAa,YAAY,oBAAoB,KAAG,IA4H/F,CAAA;CACD"}
1
+ {"version":3,"file":"PropertiesList.d.ts","sourceRoot":"","sources":["../../../../../src/parser/satisfactory/types/property/PropertiesList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAsBrF,yBAAiB,cAAc,CAAC;IAExB,MAAM,SAAS,WAAY,aAAa,KAAG,aAsBjD,CAAA;IAEM,MAAM,aAAa,WAAY,aAAa,cAAc,aAAa,KAAG,IAMhF,CAAA;IAEM,MAAM,mBAAmB,WAAY,aAAa,gBAAgB,MAAM,KAAG,oBAmJjF,CAAA;IAEM,MAAM,uBAAuB,WAAY,aAAa,YAAY,oBAAoB,KAAG,IA6H/F,CAAA;CACD"}
@@ -55,98 +55,123 @@ var PropertiesList;
55
55
  const index = reader.readInt32();
56
56
  const before = reader.getBufferPosition();
57
57
  let overhead = 0;
58
- switch (propertyType) {
59
- case 'BoolProperty':
60
- currentProperty = BoolProperty_1.BoolProperty.Parse(reader, propertyType, index);
61
- overhead = BoolProperty_1.BoolProperty.CalcOverhead(currentProperty);
62
- break;
63
- case 'ByteProperty':
64
- currentProperty = ByteProperty_1.ByteProperty.Parse(reader, propertyType, index);
65
- overhead = ByteProperty_1.ByteProperty.CalcOverhead(currentProperty);
66
- break;
67
- case 'Int8Property':
68
- currentProperty = Int8Property_1.Int8Property.Parse(reader, propertyType, index);
69
- overhead = Int8Property_1.Int8Property.CalcOverhead(currentProperty);
70
- break;
71
- case 'UInt8Property':
72
- currentProperty = Uint8Property_1.Uint8Property.Parse(reader, propertyType, index);
73
- overhead = Uint8Property_1.Uint8Property.CalcOverhead(currentProperty);
74
- break;
75
- case 'IntProperty':
76
- case 'Int32Property':
77
- currentProperty = Int32Property_1.Int32Property.Parse(reader, propertyType, index);
78
- overhead = Int32Property_1.Int32Property.CalcOverhead(currentProperty);
79
- break;
80
- case 'UInt32Property':
81
- currentProperty = Uint32Property_1.Uint32Property.Parse(reader, propertyType, index);
82
- overhead = Uint32Property_1.Uint32Property.CalcOverhead(currentProperty);
83
- break;
84
- case 'Int64Property':
85
- currentProperty = Int64Property_1.Int64Property.Parse(reader, propertyType, index);
86
- overhead = Int64Property_1.Int64Property.CalcOverhead(currentProperty);
87
- break;
88
- case 'UInt64Property':
89
- currentProperty = Uint64Property_1.Uint64Property.Parse(reader, propertyType, index);
90
- break;
91
- case 'SingleProperty':
92
- case 'FloatProperty':
93
- currentProperty = FloatProperty_1.FloatProperty.Parse(reader, propertyType, index);
94
- overhead = FloatProperty_1.FloatProperty.CalcOverhead(currentProperty);
95
- break;
96
- case 'DoubleProperty':
97
- currentProperty = DoubleProperty_1.DoubleProperty.Parse(reader, propertyType, index);
98
- overhead = DoubleProperty_1.DoubleProperty.CalcOverhead(currentProperty);
99
- break;
100
- case 'StrProperty':
101
- case 'NameProperty':
102
- currentProperty = StrProperty_1.StrProperty.Parse(reader, propertyType, index);
103
- overhead = StrProperty_1.StrProperty.CalcOverhead(currentProperty);
104
- break;
105
- case 'ObjectProperty':
106
- case 'InterfaceProperty':
107
- currentProperty = ObjectProperty_1.ObjectProperty.Parse(reader, propertyType, index);
108
- overhead = ObjectProperty_1.ObjectProperty.CalcOverhead(currentProperty);
109
- break;
110
- case 'SoftObjectProperty':
111
- currentProperty = SoftObjectProperty_1.SoftObjectProperty.Parse(reader, propertyType, index);
112
- overhead = SoftObjectProperty_1.SoftObjectProperty.CalcOverhead(currentProperty);
113
- break;
114
- case 'EnumProperty':
115
- currentProperty = EnumProperty_1.EnumProperty.Parse(reader, propertyType, index);
116
- overhead = EnumProperty_1.EnumProperty.CalcOverhead(currentProperty);
117
- break;
118
- case 'StructProperty':
119
- currentProperty = StructProperty_1.StructProperty.Parse(reader, propertyType, index, binarySize);
120
- overhead = StructProperty_1.StructProperty.CalcOverhead(currentProperty);
121
- break;
122
- case 'ArrayProperty':
123
- currentProperty = ArrayProperty_1.ArrayProperty.Parse(reader, propertyType, index, binarySize);
124
- overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(currentProperty);
125
- break;
126
- case 'MapProperty':
127
- currentProperty = MapProperty_1.MapProperty.Parse(reader, propertyName, binarySize);
128
- overhead = MapProperty_1.MapProperty.CalcOverhead(currentProperty);
129
- break;
130
- case 'TextProperty':
131
- currentProperty = TextProperty_1.TextProperty.Parse(reader, propertyType, index);
132
- overhead = TextProperty_1.TextProperty.CalcOverhead(currentProperty);
133
- break;
134
- case 'SetProperty':
135
- currentProperty = SetProperty_1.SetProperty.Parse(reader, propertyType, index, propertyName);
136
- overhead = SetProperty_1.SetProperty.CalcOverhead(currentProperty);
137
- break;
138
- default:
139
- throw new Error(`Unimplemented type ${propertyType}, at byte position ${reader.getBufferPosition()}`);
58
+ let subtype = '';
59
+ try {
60
+ switch (propertyType) {
61
+ case 'BoolProperty':
62
+ overhead = BoolProperty_1.BoolProperty.CalcOverhead(currentProperty);
63
+ currentProperty = BoolProperty_1.BoolProperty.Parse(reader, propertyType, index);
64
+ break;
65
+ case 'ByteProperty':
66
+ const type = reader.readString();
67
+ overhead = ByteProperty_1.ByteProperty.CalcOverhead(currentProperty, type);
68
+ currentProperty = ByteProperty_1.ByteProperty.Parse(reader, propertyType, index, type);
69
+ break;
70
+ case 'Int8Property':
71
+ overhead = Int8Property_1.Int8Property.CalcOverhead(currentProperty);
72
+ currentProperty = Int8Property_1.Int8Property.Parse(reader, propertyType, index);
73
+ break;
74
+ case 'UInt8Property':
75
+ overhead = Uint8Property_1.Uint8Property.CalcOverhead(currentProperty);
76
+ currentProperty = Uint8Property_1.Uint8Property.Parse(reader, propertyType, index);
77
+ break;
78
+ case 'IntProperty':
79
+ case 'Int32Property':
80
+ overhead = Int32Property_1.Int32Property.CalcOverhead(currentProperty);
81
+ currentProperty = Int32Property_1.Int32Property.Parse(reader, propertyType, index);
82
+ break;
83
+ case 'UInt32Property':
84
+ overhead = Uint32Property_1.Uint32Property.CalcOverhead(currentProperty);
85
+ currentProperty = Uint32Property_1.Uint32Property.Parse(reader, propertyType, index);
86
+ break;
87
+ case 'Int64Property':
88
+ overhead = Int64Property_1.Int64Property.CalcOverhead(currentProperty);
89
+ currentProperty = Int64Property_1.Int64Property.Parse(reader, propertyType, index);
90
+ break;
91
+ case 'UInt64Property':
92
+ overhead = Uint64Property_1.Uint64Property.CalcOverhead(currentProperty);
93
+ currentProperty = Uint64Property_1.Uint64Property.Parse(reader, propertyType, index);
94
+ break;
95
+ case 'SingleProperty':
96
+ case 'FloatProperty':
97
+ overhead = FloatProperty_1.FloatProperty.CalcOverhead(currentProperty);
98
+ currentProperty = FloatProperty_1.FloatProperty.Parse(reader, propertyType, index);
99
+ break;
100
+ case 'DoubleProperty':
101
+ overhead = DoubleProperty_1.DoubleProperty.CalcOverhead(currentProperty);
102
+ currentProperty = DoubleProperty_1.DoubleProperty.Parse(reader, propertyType, index);
103
+ break;
104
+ case 'StrProperty':
105
+ case 'NameProperty':
106
+ overhead = StrProperty_1.StrProperty.CalcOverhead(currentProperty);
107
+ currentProperty = StrProperty_1.StrProperty.Parse(reader, propertyType, index);
108
+ break;
109
+ case 'ObjectProperty':
110
+ case 'InterfaceProperty':
111
+ overhead = ObjectProperty_1.ObjectProperty.CalcOverhead(currentProperty);
112
+ currentProperty = ObjectProperty_1.ObjectProperty.Parse(reader, propertyType, index);
113
+ break;
114
+ case 'SoftObjectProperty':
115
+ overhead = SoftObjectProperty_1.SoftObjectProperty.CalcOverhead(currentProperty);
116
+ currentProperty = SoftObjectProperty_1.SoftObjectProperty.Parse(reader, propertyType, index);
117
+ break;
118
+ case 'EnumProperty':
119
+ const name = reader.readString();
120
+ overhead = EnumProperty_1.EnumProperty.CalcOverhead(currentProperty, name);
121
+ currentProperty = EnumProperty_1.EnumProperty.Parse(reader, propertyType, name, index);
122
+ break;
123
+ case 'StructProperty':
124
+ subtype = reader.readString();
125
+ overhead = StructProperty_1.StructProperty.CalcOverhead(currentProperty, subtype);
126
+ currentProperty = StructProperty_1.StructProperty.Parse(reader, propertyType, index, binarySize, subtype);
127
+ break;
128
+ case 'ArrayProperty':
129
+ subtype = reader.readString();
130
+ overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(currentProperty, subtype);
131
+ currentProperty = ArrayProperty_1.ArrayProperty.Parse(reader, propertyType, index, binarySize, subtype);
132
+ break;
133
+ case 'MapProperty':
134
+ const keyType = reader.readString();
135
+ const valueType = reader.readString();
136
+ overhead = MapProperty_1.MapProperty.CalcOverhead(currentProperty, keyType, valueType);
137
+ currentProperty = MapProperty_1.MapProperty.Parse(reader, propertyName, binarySize, keyType, valueType);
138
+ break;
139
+ case 'TextProperty':
140
+ overhead = TextProperty_1.TextProperty.CalcOverhead(currentProperty);
141
+ currentProperty = TextProperty_1.TextProperty.Parse(reader, propertyType, index);
142
+ break;
143
+ case 'SetProperty':
144
+ subtype = reader.readString();
145
+ overhead = SetProperty_1.SetProperty.CalcOverhead(currentProperty, subtype);
146
+ currentProperty = SetProperty_1.SetProperty.Parse(reader, propertyType, index, propertyName, subtype);
147
+ break;
148
+ default:
149
+ throw new Error(`Unimplemented type ${propertyType}, at byte position ${reader.getBufferPosition()}`);
150
+ }
151
+ currentProperty.name = propertyName;
152
+ const readBytes = reader.getBufferPosition() - before - overhead;
153
+ if (readBytes !== binarySize) {
154
+ throw new parser_error_1.ParserError('ParserError', `Property possibly corrupt. Read ${readBytes} bytes for ${propertyType} ${propertyName}, but ${binarySize} bytes were indicated.`);
155
+ }
140
156
  }
141
- currentProperty.name = propertyName;
142
- const readBytes = reader.getBufferPosition() - before - overhead;
143
- if (readBytes !== binarySize) {
144
- console.warn(`possibly corrupt. Read ${readBytes} for ${propertyType} ${propertyName}, but ${binarySize} were indicated.`);
145
- throw new parser_error_1.ParserError('ParserError', `possibly corrupt. Read ${readBytes} bytes for ${propertyType} ${propertyName}, but ${binarySize} bytes were indicated.`);
157
+ catch (error) {
158
+ if (reader.context.throwErrors) {
159
+ throw error;
160
+ }
161
+ else {
162
+ console.warn(error);
163
+ console.warn(`property ${propertyName} of type ${propertyType} is therefore dumped as raw bytes.`);
164
+ reader.skipBytes(before - reader.getBufferPosition());
165
+ currentProperty.rawBytes = Array.from(reader.readBytes(binarySize + overhead));
166
+ }
146
167
  }
147
168
  return currentProperty;
148
169
  };
149
170
  PropertiesList.SerializeSingleProperty = (writer, property) => {
171
+ if (property.rawBytes !== undefined) {
172
+ writer.writeBytesArray(property.rawBytes);
173
+ return;
174
+ }
150
175
  writer.writeString(property.ueType);
151
176
  const lenIndicator = writer.getBufferPosition();
152
177
  writer.writeInt32(0);
@@ -159,7 +184,7 @@ var PropertiesList;
159
184
  BoolProperty_1.BoolProperty.Serialize(writer, property);
160
185
  break;
161
186
  case 'ByteProperty':
162
- overhead = ByteProperty_1.ByteProperty.CalcOverhead(property);
187
+ overhead = ByteProperty_1.ByteProperty.CalcOverhead(property, property.value.type);
163
188
  ByteProperty_1.ByteProperty.Serialize(writer, property);
164
189
  break;
165
190
  case 'Int8Property':
@@ -211,23 +236,19 @@ var PropertiesList;
211
236
  SoftObjectProperty_1.SoftObjectProperty.Serialize(writer, property);
212
237
  break;
213
238
  case 'EnumProperty':
214
- overhead = EnumProperty_1.EnumProperty.CalcOverhead(property);
239
+ overhead = EnumProperty_1.EnumProperty.CalcOverhead(property, property.value.name);
215
240
  EnumProperty_1.EnumProperty.Serialize(writer, property);
216
241
  break;
217
- case 'ByteProperty':
218
- overhead = ByteProperty_1.ByteProperty.CalcOverhead(property);
219
- ByteProperty_1.ByteProperty.Serialize(writer, property);
220
- break;
221
242
  case 'StructProperty':
222
- overhead = StructProperty_1.StructProperty.CalcOverhead(property);
243
+ overhead = StructProperty_1.StructProperty.CalcOverhead(property, property.subtype);
223
244
  StructProperty_1.StructProperty.Serialize(writer, property);
224
245
  break;
225
246
  case 'ArrayProperty':
226
- overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(property);
247
+ overhead = ArrayProperty_1.ArrayProperty.CalcOverhead(property, property.subtype);
227
248
  ArrayProperty_1.ArrayProperty.Serialize(writer, property);
228
249
  break;
229
250
  case 'MapProperty':
230
- overhead = MapProperty_1.MapProperty.CalcOverhead(property);
251
+ overhead = MapProperty_1.MapProperty.CalcOverhead(property, property.keyType, property.valueType);
231
252
  MapProperty_1.MapProperty.Serialize(writer, property);
232
253
  break;
233
254
  case 'TextProperty':
@@ -235,7 +256,7 @@ var PropertiesList;
235
256
  TextProperty_1.TextProperty.Serialize(writer, property);
236
257
  break;
237
258
  case 'SetProperty':
238
- overhead = SetProperty_1.SetProperty.CalcOverhead(property);
259
+ overhead = SetProperty_1.SetProperty.CalcOverhead(property, property.subtype);
239
260
  SetProperty_1.SetProperty.Serialize(writer, property);
240
261
  break;
241
262
  default: