@etothepii/satisfactory-file-parser 3.0.1 → 3.0.3

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 (550) hide show
  1. package/.github/workflows/publish-jsr.yml +21 -0
  2. package/.github/workflows/tests.yml +2 -1
  3. package/CHANGELOG.md +12 -4
  4. package/README.md +6 -6
  5. package/build/index.d.ts +2 -1
  6. package/build/index.d.ts.map +1 -1
  7. package/build/index.js +2 -1
  8. package/build/index.js.map +1 -1
  9. package/build/parser/parser.d.ts.map +1 -1
  10. package/build/parser/parser.js +5 -3
  11. package/build/parser/parser.js.map +1 -1
  12. package/build/parser/satisfactory/blueprint/blueprint-config.d.ts.map +1 -1
  13. package/build/parser/satisfactory/blueprint/blueprint-config.js.map +1 -1
  14. package/build/parser/satisfactory/blueprint/blueprint-header.d.ts +1 -8
  15. package/build/parser/satisfactory/blueprint/blueprint-header.d.ts.map +1 -1
  16. package/build/parser/satisfactory/blueprint/blueprint-header.js.map +1 -1
  17. package/build/parser/satisfactory/blueprint/blueprint-reader.js +2 -2
  18. package/build/parser/satisfactory/blueprint/blueprint-reader.js.map +1 -1
  19. package/build/parser/satisfactory/blueprint/blueprint-writer.js +2 -2
  20. package/build/parser/satisfactory/blueprint/blueprint-writer.js.map +1 -1
  21. package/build/parser/satisfactory/edit/edit-constants.d.ts +62 -0
  22. package/build/parser/satisfactory/edit/edit-constants.d.ts.map +1 -1
  23. package/build/parser/satisfactory/edit/edit-constants.js +62 -0
  24. package/build/parser/satisfactory/edit/edit-constants.js.map +1 -1
  25. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.d.ts +9 -0
  26. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.d.ts.map +1 -0
  27. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.js +32 -0
  28. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.js.map +1 -0
  29. package/build/parser/satisfactory/save/level.class.d.ts +2 -3
  30. package/build/parser/satisfactory/save/level.class.d.ts.map +1 -1
  31. package/build/parser/satisfactory/save/level.class.js +17 -27
  32. package/build/parser/satisfactory/save/level.class.js.map +1 -1
  33. package/build/parser/satisfactory/save/level.d.ts +29 -0
  34. package/build/parser/satisfactory/save/level.d.ts.map +1 -0
  35. package/build/parser/satisfactory/save/level.js +204 -0
  36. package/build/parser/satisfactory/save/level.js.map +1 -0
  37. package/build/parser/satisfactory/save/satisfactory-save-header.d.ts.map +1 -1
  38. package/build/parser/satisfactory/save/satisfactory-save-header.js.map +1 -1
  39. package/build/parser/satisfactory/save/satisfactory-save.d.ts +1 -1
  40. package/build/parser/satisfactory/save/satisfactory-save.d.ts.map +1 -1
  41. package/build/parser/satisfactory/save/satisfactory-save.js.map +1 -1
  42. package/build/parser/satisfactory/save/save-reader.d.ts +1 -1
  43. package/build/parser/satisfactory/save/save-reader.d.ts.map +1 -1
  44. package/build/parser/satisfactory/save/save-reader.js +2 -2
  45. package/build/parser/satisfactory/save/save-reader.js.map +1 -1
  46. package/build/parser/satisfactory/save/save-writer.js +2 -2
  47. package/build/parser/satisfactory/save/save-writer.js.map +1 -1
  48. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts +3 -3
  49. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts.map +1 -1
  50. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.js.map +1 -1
  51. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts +5 -5
  52. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts.map +1 -1
  53. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js.map +1 -1
  54. package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts.map +1 -1
  55. package/build/parser/satisfactory/types/property/generic/StructProperty.js +3 -3
  56. package/build/parser/satisfactory/types/property/generic/StructProperty.js.map +1 -1
  57. package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.d.ts +1 -14
  58. package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.d.ts.map +1 -1
  59. package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.js.map +1 -1
  60. package/build/parser/satisfactory/types/property/special/CircuitSpecialProperties.d.ts.map +1 -1
  61. package/build/parser/satisfactory/types/property/special/CircuitSpecialProperties.js.map +1 -1
  62. package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.d.ts.map +1 -1
  63. package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.js.map +1 -1
  64. package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.d.ts.map +1 -1
  65. package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.js.map +1 -1
  66. package/build/parser/satisfactory/types/property/special/ObjectsListSpecialProperties.d.ts.map +1 -1
  67. package/build/parser/satisfactory/types/property/special/ObjectsListSpecialProperties.js.map +1 -1
  68. package/build/parser/satisfactory/types/property/special/PlayerSpecialProperties.d.ts.map +1 -1
  69. package/build/parser/satisfactory/types/property/special/PlayerSpecialProperties.js.map +1 -1
  70. package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.d.ts.map +1 -1
  71. package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.js.map +1 -1
  72. package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.d.ts.map +1 -1
  73. package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.js.map +1 -1
  74. package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts +2 -2
  75. package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts.map +1 -1
  76. package/build/parser/satisfactory/types/property/special/SpecialProperties.js.map +1 -1
  77. package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.d.ts.map +1 -1
  78. package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.js.map +1 -1
  79. package/build/parser/satisfactory/types/structs/VehiclePhysicsData.d.ts.map +1 -1
  80. package/build/parser/satisfactory/types/structs/VehiclePhysicsData.js.map +1 -1
  81. package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -1
  82. package/build/parser/stream/reworked/readable-stream-parser.js +12 -15
  83. package/build/parser/stream/reworked/readable-stream-parser.js.map +1 -1
  84. package/build/parser/stream/reworked/save-stream-json-stringifier.d.ts.map +1 -1
  85. package/build/parser/stream/reworked/save-stream-json-stringifier.js.map +1 -1
  86. package/build/parser/stream/reworked/save-stream-writer.class.d.ts.map +1 -1
  87. package/build/parser/stream/reworked/save-stream-writer.class.js.map +1 -1
  88. package/docs/assets/navigation.js +1 -1
  89. package/docs/assets/search.js +1 -1
  90. package/docs/classes/BlueprintConfigReader.html +4 -4
  91. package/docs/classes/BlueprintConfigWriter.html +4 -4
  92. package/docs/classes/BlueprintReader.html +4 -4
  93. package/docs/classes/BlueprintWriter.html +4 -4
  94. package/docs/classes/CompressionLibraryError.html +2 -2
  95. package/docs/classes/CorruptBlueprintError.html +2 -2
  96. package/docs/classes/CorruptSaveError.html +2 -2
  97. package/docs/classes/Parser.html +6 -6
  98. package/docs/classes/ParserError.html +2 -2
  99. package/docs/classes/ReadableStreamParser.html +2 -2
  100. package/docs/classes/SatisfactorySave.html +2 -2
  101. package/docs/classes/SaveComponent.html +2 -2
  102. package/docs/classes/SaveEntity.html +2 -2
  103. package/docs/classes/SaveObject.html +2 -2
  104. package/docs/classes/SaveReader.html +4 -4
  105. package/docs/classes/SaveStreamJsonStringifier.html +5 -4
  106. package/docs/classes/SaveStreamWriter.html +17 -16
  107. package/docs/classes/SaveWriter.html +4 -4
  108. package/docs/classes/TimeoutError.html +2 -2
  109. package/docs/classes/UnimplementedError.html +2 -2
  110. package/docs/classes/UnsupportedVersionError.html +2 -2
  111. package/docs/enums/BlueprintConfigVersion.html +2 -2
  112. package/docs/enums/CompressionAlgorithmCode.html +2 -2
  113. package/docs/enums/FactoryGameCustomVersion.html +2 -2
  114. package/docs/enums/RuntimeBuildableInstanceDataVersion.html +2 -2
  115. package/docs/enums/SaveCustomVersion.html +10 -10
  116. package/docs/enums/SaveHeaderType.html +2 -2
  117. package/docs/functions/AbstractBaseProperty.Create.html +1 -1
  118. package/docs/functions/ArrayProperty.CalcOverhead.html +1 -1
  119. package/docs/functions/ArrayProperty.Parse.html +1 -1
  120. package/docs/functions/ArrayProperty.Serialize.html +1 -1
  121. package/docs/functions/BlueprintConfig.Parse.html +1 -1
  122. package/docs/functions/BlueprintConfig.Serialize.html +1 -1
  123. package/docs/functions/BlueprintHeader.Parse.html +1 -1
  124. package/docs/functions/BlueprintHeader.Serialize.html +1 -1
  125. package/docs/functions/BoolArrayProperty.Parse.html +1 -1
  126. package/docs/functions/BoolArrayProperty.Serialize.html +1 -1
  127. package/docs/functions/BoolProperty.CalcOverhead.html +1 -1
  128. package/docs/functions/BoolProperty.Parse.html +1 -1
  129. package/docs/functions/BoolProperty.ReadValue.html +1 -1
  130. package/docs/functions/BoolProperty.Serialize.html +1 -1
  131. package/docs/functions/BoolProperty.SerializeValue.html +1 -1
  132. package/docs/functions/BuildableSubsystemSpecialProperties.Parse.html +1 -1
  133. package/docs/functions/BuildableSubsystemSpecialProperties.Serialize.html +1 -1
  134. package/docs/functions/BuildableTypeInstance.Parse.html +1 -1
  135. package/docs/functions/BuildableTypeInstance.Serialize.html +1 -1
  136. package/docs/functions/ByteArrayProperty.Parse.html +1 -1
  137. package/docs/functions/ByteArrayProperty.Serialize.html +1 -1
  138. package/docs/functions/ByteProperty.CalcOverhead.html +1 -1
  139. package/docs/functions/ByteProperty.Parse.html +1 -1
  140. package/docs/functions/ByteProperty.ReadValue.html +1 -1
  141. package/docs/functions/ByteProperty.Serialize.html +1 -1
  142. package/docs/functions/ByteProperty.SerializeValue.html +1 -1
  143. package/docs/functions/CircuitSpecialProperties.Parse.html +1 -1
  144. package/docs/functions/CircuitSpecialProperties.Serialize.html +1 -1
  145. package/docs/functions/ConveyorChainActorSpecialProperties.Parse.html +1 -1
  146. package/docs/functions/ConveyorChainActorSpecialProperties.Serialize.html +1 -1
  147. package/docs/functions/ConveyorSpecialProperties.Parse.html +1 -1
  148. package/docs/functions/ConveyorSpecialProperties.Serialize.html +1 -1
  149. package/docs/functions/DoubleArrayProperty.Parse.html +1 -1
  150. package/docs/functions/DoubleArrayProperty.Serialize.html +1 -1
  151. package/docs/functions/DoubleProperty.CalcOverhead.html +1 -1
  152. package/docs/functions/DoubleProperty.Parse.html +1 -1
  153. package/docs/functions/DoubleProperty.ReadValue.html +1 -1
  154. package/docs/functions/DoubleProperty.Serialize.html +1 -1
  155. package/docs/functions/DoubleProperty.SerializeValue.html +1 -1
  156. package/docs/functions/DynamicStructPropertyValue.read.html +1 -1
  157. package/docs/functions/DynamicStructPropertyValue.write.html +1 -1
  158. package/docs/functions/EmptySpecialProperties.Parse.html +1 -1
  159. package/docs/functions/EmptySpecialProperties.Serialize.html +1 -1
  160. package/docs/functions/EnumArrayProperty.Parse.html +1 -1
  161. package/docs/functions/EnumArrayProperty.Serialize.html +1 -1
  162. package/docs/functions/EnumProperty.CalcOverhead.html +1 -1
  163. package/docs/functions/EnumProperty.Parse.html +1 -1
  164. package/docs/functions/EnumProperty.ReadValue.html +1 -1
  165. package/docs/functions/EnumProperty.Serialize.html +1 -1
  166. package/docs/functions/EnumProperty.SerializeValue.html +1 -1
  167. package/docs/functions/FGDynamicStruct.Parse.html +1 -1
  168. package/docs/functions/FGDynamicStruct.Serialize.html +1 -1
  169. package/docs/functions/FICFrameRange.Parse.html +1 -1
  170. package/docs/functions/FICFrameRange.Serialize.html +1 -1
  171. package/docs/functions/FloatArrayProperty.Parse.html +1 -1
  172. package/docs/functions/FloatArrayProperty.Serialize.html +1 -1
  173. package/docs/functions/FloatProperty.CalcOverhead.html +1 -1
  174. package/docs/functions/FloatProperty.Parse.html +1 -1
  175. package/docs/functions/FloatProperty.ReadValue.html +1 -1
  176. package/docs/functions/FloatProperty.Serialize.html +1 -1
  177. package/docs/functions/FloatProperty.SerializeValue.html +1 -1
  178. package/docs/functions/GUID.read.html +1 -1
  179. package/docs/functions/GUID.write.html +1 -1
  180. package/docs/functions/GUIDInfo.read.html +1 -1
  181. package/docs/functions/GUIDInfo.write.html +1 -1
  182. package/docs/functions/Int32ArrayProperty.Parse.html +1 -1
  183. package/docs/functions/Int32ArrayProperty.Serialize.html +1 -1
  184. package/docs/functions/Int32Property.CalcOverhead.html +1 -1
  185. package/docs/functions/Int32Property.Parse.html +1 -1
  186. package/docs/functions/Int32Property.ReadValue.html +1 -1
  187. package/docs/functions/Int32Property.Serialize.html +1 -1
  188. package/docs/functions/Int32Property.SerializeValue.html +1 -1
  189. package/docs/functions/Int32SetProperty.Parse.html +1 -1
  190. package/docs/functions/Int32SetProperty.Serialize.html +1 -1
  191. package/docs/functions/Int64ArrayProperty.Parse.html +1 -1
  192. package/docs/functions/Int64ArrayProperty.Serialize.html +1 -1
  193. package/docs/functions/Int64Property.CalcOverhead.html +1 -1
  194. package/docs/functions/Int64Property.Parse.html +1 -1
  195. package/docs/functions/Int64Property.ReadValue.html +1 -1
  196. package/docs/functions/Int64Property.Serialize.html +1 -1
  197. package/docs/functions/Int64Property.SerializeValue.html +1 -1
  198. package/docs/functions/Int8Property.CalcOverhead.html +1 -1
  199. package/docs/functions/Int8Property.Parse.html +1 -1
  200. package/docs/functions/Int8Property.ReadValue.html +1 -1
  201. package/docs/functions/Int8Property.Serialize.html +1 -1
  202. package/docs/functions/Int8Property.SerializeValue.html +1 -1
  203. package/docs/functions/Level.ReadAllObjectContents.html +1 -1
  204. package/docs/functions/Level.ReadAllObjectHeaders.html +1 -1
  205. package/docs/functions/Level.ReadLevel.html +1 -1
  206. package/docs/functions/Level.ReadNObjectContents.html +1 -1
  207. package/docs/functions/Level.ReadNObjectHeaders.html +1 -1
  208. package/docs/functions/Level.SerializeAllObjectContents.html +1 -1
  209. package/docs/functions/Level.SerializeAllObjectHeaders.html +1 -1
  210. package/docs/functions/Level.SerializeLevel.html +1 -1
  211. package/docs/functions/LevelToDestroyedActorsMap.read.html +1 -0
  212. package/docs/functions/LevelToDestroyedActorsMap.write.html +1 -0
  213. package/docs/functions/MD5Hash.read.html +1 -1
  214. package/docs/functions/MD5Hash.write.html +1 -1
  215. package/docs/functions/MapProperty.CalcOverhead.html +1 -1
  216. package/docs/functions/MapProperty.Parse.html +1 -1
  217. package/docs/functions/MapProperty.Serialize.html +1 -1
  218. package/docs/functions/ObjectArrayProperty.Parse.html +1 -1
  219. package/docs/functions/ObjectArrayProperty.Serialize.html +1 -1
  220. package/docs/functions/ObjectProperty.CalcOverhead.html +1 -1
  221. package/docs/functions/ObjectProperty.Parse.html +1 -1
  222. package/docs/functions/ObjectProperty.ReadValue.html +1 -1
  223. package/docs/functions/ObjectProperty.Serialize.html +1 -1
  224. package/docs/functions/ObjectProperty.SerializeValue.html +1 -1
  225. package/docs/functions/ObjectReference.IsEqual.html +1 -1
  226. package/docs/functions/ObjectReference.read.html +1 -1
  227. package/docs/functions/ObjectReference.write.html +1 -1
  228. package/docs/functions/ObjectSetProperty.Parse.html +1 -1
  229. package/docs/functions/ObjectSetProperty.Serialize.html +1 -1
  230. package/docs/functions/ObjectsListSpecialProperties.Parse.html +1 -1
  231. package/docs/functions/ObjectsListSpecialProperties.Serialize.html +1 -1
  232. package/docs/functions/PlayerSpecialProperties.Parse.html +1 -1
  233. package/docs/functions/PlayerSpecialProperties.Serialize.html +1 -1
  234. package/docs/functions/PowerLineSpecialProperties.Parse.html +1 -1
  235. package/docs/functions/PowerLineSpecialProperties.Serialize.html +1 -1
  236. package/docs/functions/PropertiesList.ParseList.html +1 -1
  237. package/docs/functions/PropertiesList.ParseSingleProperty.html +1 -1
  238. package/docs/functions/PropertiesList.SerializeList.html +1 -1
  239. package/docs/functions/PropertiesList.SerializeSingleProperty.html +1 -1
  240. package/docs/functions/SatisfactorySaveHeader.Parse.html +1 -1
  241. package/docs/functions/SatisfactorySaveHeader.Serialize.html +1 -1
  242. package/docs/functions/SaveBodyChunks.CompressDataIntoChunks.html +1 -1
  243. package/docs/functions/SaveBodyChunks.DecompressChunks.html +1 -1
  244. package/docs/functions/SetProperty.CalcOverhead.html +1 -1
  245. package/docs/functions/SetProperty.Parse.html +1 -1
  246. package/docs/functions/SetProperty.Serialize.html +1 -1
  247. package/docs/functions/SoftObjectArrayProperty.Parse.html +1 -1
  248. package/docs/functions/SoftObjectArrayProperty.Serialize.html +1 -1
  249. package/docs/functions/SoftObjectReference.read.html +1 -1
  250. package/docs/functions/SoftObjectReference.write.html +1 -1
  251. package/docs/functions/SpecialDroneActionProperties.Parse.html +1 -1
  252. package/docs/functions/SpecialDroneActionProperties.Serialize.html +1 -1
  253. package/docs/functions/SpecialProperties.ParseClassSpecificSpecialProperties.html +1 -1
  254. package/docs/functions/SpecialProperties.SerializeClassSpecificSpecialProperties.html +1 -1
  255. package/docs/functions/StrArrayProperty.Parse.html +1 -1
  256. package/docs/functions/StrArrayProperty.Serialize.html +1 -1
  257. package/docs/functions/StrProperty.CalcOverhead.html +1 -1
  258. package/docs/functions/StrProperty.Parse.html +1 -1
  259. package/docs/functions/StrProperty.ReadValue.html +1 -1
  260. package/docs/functions/StrProperty.Serialize.html +1 -1
  261. package/docs/functions/StrProperty.SerializeValue.html +1 -1
  262. package/docs/functions/StrSetProperty.Parse.html +1 -1
  263. package/docs/functions/StrSetProperty.Serialize.html +1 -1
  264. package/docs/functions/StructArrayProperty.Parse.html +1 -1
  265. package/docs/functions/StructArrayProperty.Serialize.html +1 -1
  266. package/docs/functions/StructProperty.CalcOverhead.html +1 -1
  267. package/docs/functions/StructProperty.Parse.html +1 -1
  268. package/docs/functions/StructProperty.ParseValue.html +1 -1
  269. package/docs/functions/StructProperty.Serialize.html +1 -1
  270. package/docs/functions/StructProperty.SerializeValue.html +1 -1
  271. package/docs/functions/StructSetProperty.Parse.html +1 -1
  272. package/docs/functions/StructSetProperty.Serialize.html +1 -1
  273. package/docs/functions/TextArrayProperty.Parse.html +1 -1
  274. package/docs/functions/TextArrayProperty.Serialize.html +1 -1
  275. package/docs/functions/TextProperty.CalcOverhead.html +1 -1
  276. package/docs/functions/TextProperty.Parse.html +1 -1
  277. package/docs/functions/TextProperty.ReadValue.html +1 -1
  278. package/docs/functions/TextProperty.Serialize.html +1 -1
  279. package/docs/functions/TextProperty.SerializeValue.html +1 -1
  280. package/docs/functions/Transform.Parse.html +1 -1
  281. package/docs/functions/Transform.ParseF.html +1 -1
  282. package/docs/functions/Transform.Serialize.html +1 -1
  283. package/docs/functions/Transform.SerializeF.html +1 -1
  284. package/docs/functions/Uint32Property.CalcOverhead.html +1 -1
  285. package/docs/functions/Uint32Property.Parse.html +1 -1
  286. package/docs/functions/Uint32Property.ReadValue.html +1 -1
  287. package/docs/functions/Uint32Property.Serialize.html +1 -1
  288. package/docs/functions/Uint32Property.SerializeValue.html +1 -1
  289. package/docs/functions/Uint32SetProperty.Parse.html +1 -1
  290. package/docs/functions/Uint32SetProperty.Serialize.html +1 -1
  291. package/docs/functions/Uint64Property.CalcOverhead.html +1 -1
  292. package/docs/functions/Uint64Property.Parse.html +1 -1
  293. package/docs/functions/Uint64Property.ReadValue.html +1 -1
  294. package/docs/functions/Uint64Property.Serialize.html +1 -1
  295. package/docs/functions/Uint64Property.SerializeValue.html +1 -1
  296. package/docs/functions/Uint8Property.CalcOverhead.html +1 -1
  297. package/docs/functions/Uint8Property.Parse.html +1 -1
  298. package/docs/functions/Uint8Property.ReadValue.html +1 -1
  299. package/docs/functions/Uint8Property.Serialize.html +1 -1
  300. package/docs/functions/Uint8Property.SerializeValue.html +1 -1
  301. package/docs/functions/VehiclePhysicsData.Parse.html +1 -1
  302. package/docs/functions/VehiclePhysicsData.Serialize.html +1 -1
  303. package/docs/functions/VehicleSpecialProperties.Parse.html +1 -1
  304. package/docs/functions/VehicleSpecialProperties.Serialize.html +1 -1
  305. package/docs/functions/col4.ParseBGRA.html +1 -1
  306. package/docs/functions/col4.ParseRGBA.html +1 -1
  307. package/docs/functions/col4.SerializeBGRA.html +1 -1
  308. package/docs/functions/col4.SerializeRGBA.html +1 -1
  309. package/docs/functions/isArrayProperty.html +1 -1
  310. package/docs/functions/isBoolArrayProperty.html +1 -1
  311. package/docs/functions/isBoolProperty.html +1 -1
  312. package/docs/functions/isBuildableSubsystemSpecialProperties.html +1 -1
  313. package/docs/functions/isByteArrayProperty.html +1 -1
  314. package/docs/functions/isByteProperty.html +1 -1
  315. package/docs/functions/isCircuitSpecialProperties.html +1 -1
  316. package/docs/functions/isConveyorChainActorSpecialProperties.html +1 -1
  317. package/docs/functions/isConveyorSpecialProperties.html +1 -1
  318. package/docs/functions/isDoubleArrayProperty.html +1 -1
  319. package/docs/functions/isDoubleProperty.html +1 -1
  320. package/docs/functions/isEmptySpecialProperties.html +1 -1
  321. package/docs/functions/isEnumArrayProperty.html +1 -1
  322. package/docs/functions/isEnumProperty.html +1 -1
  323. package/docs/functions/isFloatArrayProperty.html +1 -1
  324. package/docs/functions/isFloatProperty.html +1 -1
  325. package/docs/functions/isInt32ArrayProperty.html +1 -1
  326. package/docs/functions/isInt32Property.html +1 -1
  327. package/docs/functions/isInt32SetProperty.html +1 -1
  328. package/docs/functions/isInt64ArrayProperty.html +1 -1
  329. package/docs/functions/isInt64Property.html +1 -1
  330. package/docs/functions/isInt8Property.html +1 -1
  331. package/docs/functions/isMapProperty.html +1 -1
  332. package/docs/functions/isObjectArrayProperty.html +1 -1
  333. package/docs/functions/isObjectProperty.html +1 -1
  334. package/docs/functions/isObjectSetProperty.html +1 -1
  335. package/docs/functions/isObjectsListSpecialProperties.html +1 -1
  336. package/docs/functions/isPlayerSpecialProperties.html +1 -1
  337. package/docs/functions/isPowerLineSpecialProperties.html +1 -1
  338. package/docs/functions/isSaveComponent.html +1 -1
  339. package/docs/functions/isSaveEntity.html +1 -1
  340. package/docs/functions/isSetProperty.html +1 -1
  341. package/docs/functions/isSoftObjectArrayProperty.html +1 -1
  342. package/docs/functions/isSpecialDroneActionProperties.html +1 -1
  343. package/docs/functions/isStrArrayProperty.html +1 -1
  344. package/docs/functions/isStrProperty.html +1 -1
  345. package/docs/functions/isStrSetProperty.html +1 -1
  346. package/docs/functions/isStructArrayProperty.html +1 -1
  347. package/docs/functions/isStructProperty.html +1 -1
  348. package/docs/functions/isStructSetProperty.html +1 -1
  349. package/docs/functions/isTextArrayProperty.html +1 -1
  350. package/docs/functions/isTextProperty.html +1 -1
  351. package/docs/functions/isUInt64Property.html +1 -1
  352. package/docs/functions/isUint32Property.html +1 -1
  353. package/docs/functions/isUint32SetProperty.html +1 -1
  354. package/docs/functions/isUint8Property.html +1 -1
  355. package/docs/functions/isVehicleSpecialProperties.html +1 -1
  356. package/docs/functions/vec2.Parse.html +1 -1
  357. package/docs/functions/vec2.ParseF.html +1 -1
  358. package/docs/functions/vec2.Serialize.html +1 -1
  359. package/docs/functions/vec2.SerializeF.html +1 -1
  360. package/docs/functions/vec3.Parse.html +1 -1
  361. package/docs/functions/vec3.ParseF.html +1 -1
  362. package/docs/functions/vec3.ParseInt.html +1 -1
  363. package/docs/functions/vec3.Serialize.html +1 -1
  364. package/docs/functions/vec3.SerializeF.html +1 -1
  365. package/docs/functions/vec3.SerializeInt.html +1 -1
  366. package/docs/functions/vec3.add.html +1 -1
  367. package/docs/functions/vec3.length.html +1 -1
  368. package/docs/functions/vec3.mult.html +1 -1
  369. package/docs/functions/vec3.norm.html +1 -1
  370. package/docs/functions/vec3.sub.html +1 -1
  371. package/docs/functions/vec4.Parse.html +1 -1
  372. package/docs/functions/vec4.ParseF.html +1 -1
  373. package/docs/functions/vec4.Serialize.html +1 -1
  374. package/docs/functions/vec4.SerializeF.html +1 -1
  375. package/docs/index.html +4 -4
  376. package/docs/interfaces/Blueprint.html +2 -2
  377. package/docs/interfaces/BlueprintConfig-1.html +2 -2
  378. package/docs/interfaces/SaveComponentHeader.html +2 -2
  379. package/docs/interfaces/SaveEntityHeader.html +2 -2
  380. package/docs/interfaces/SaveObjectHeader.html +2 -2
  381. package/docs/modules/AbstractBaseProperty.html +1 -1
  382. package/docs/modules/ArrayProperty.html +1 -1
  383. package/docs/modules/BlueprintConfig.html +1 -1
  384. package/docs/modules/BlueprintHeader.html +1 -1
  385. package/docs/modules/BoolArrayProperty.html +1 -1
  386. package/docs/modules/BoolProperty.html +1 -1
  387. package/docs/modules/BuildableSubsystemSpecialProperties.html +1 -1
  388. package/docs/modules/BuildableTypeInstance.html +1 -1
  389. package/docs/modules/ByteArrayProperty.html +1 -1
  390. package/docs/modules/ByteProperty.html +1 -1
  391. package/docs/modules/CircuitSpecialProperties.html +1 -1
  392. package/docs/modules/ConveyorChainActorSpecialProperties.html +1 -1
  393. package/docs/modules/ConveyorSpecialProperties.html +1 -1
  394. package/docs/modules/DoubleArrayProperty.html +1 -1
  395. package/docs/modules/DoubleProperty.html +1 -1
  396. package/docs/modules/DynamicStructPropertyValue.html +1 -1
  397. package/docs/modules/EmptySpecialProperties.html +1 -1
  398. package/docs/modules/EnumArrayProperty.html +1 -1
  399. package/docs/modules/EnumProperty.html +1 -1
  400. package/docs/modules/FGDynamicStruct.html +1 -1
  401. package/docs/modules/FICFrameRange.html +1 -1
  402. package/docs/modules/FloatArrayProperty.html +1 -1
  403. package/docs/modules/FloatProperty.html +1 -1
  404. package/docs/modules/GUID.html +1 -1
  405. package/docs/modules/GUIDInfo.html +1 -1
  406. package/docs/modules/Int32ArrayProperty.html +1 -1
  407. package/docs/modules/Int32Property.html +1 -1
  408. package/docs/modules/Int32SetProperty.html +1 -1
  409. package/docs/modules/Int64ArrayProperty.html +1 -1
  410. package/docs/modules/Int64Property.html +1 -1
  411. package/docs/modules/Int8Property.html +1 -1
  412. package/docs/modules/Level.html +1 -1
  413. package/docs/modules/LevelToDestroyedActorsMap.html +3 -0
  414. package/docs/modules/MD5Hash.html +1 -1
  415. package/docs/modules/MapProperty.html +1 -1
  416. package/docs/modules/ObjectArrayProperty.html +1 -1
  417. package/docs/modules/ObjectProperty.html +1 -1
  418. package/docs/modules/ObjectReference.html +1 -1
  419. package/docs/modules/ObjectSetProperty.html +1 -1
  420. package/docs/modules/ObjectsListSpecialProperties.html +1 -1
  421. package/docs/modules/PlayerSpecialProperties.html +1 -1
  422. package/docs/modules/PowerLineSpecialProperties.html +1 -1
  423. package/docs/modules/PropertiesList.html +1 -1
  424. package/docs/modules/SatisfactorySaveHeader.html +1 -1
  425. package/docs/modules/SaveBodyChunks.html +1 -1
  426. package/docs/modules/SetProperty.html +1 -1
  427. package/docs/modules/SoftObjectArrayProperty.html +1 -1
  428. package/docs/modules/SoftObjectReference.html +1 -1
  429. package/docs/modules/SpecialDroneActionProperties.html +1 -1
  430. package/docs/modules/SpecialProperties.html +1 -1
  431. package/docs/modules/StrArrayProperty.html +1 -1
  432. package/docs/modules/StrProperty.html +1 -1
  433. package/docs/modules/StrSetProperty.html +1 -1
  434. package/docs/modules/StructArrayProperty.html +1 -1
  435. package/docs/modules/StructProperty.html +1 -1
  436. package/docs/modules/StructSetProperty.html +1 -1
  437. package/docs/modules/TextArrayProperty.html +1 -1
  438. package/docs/modules/TextProperty.html +1 -1
  439. package/docs/modules/Transform.html +1 -1
  440. package/docs/modules/Uint32Property.html +1 -1
  441. package/docs/modules/Uint32SetProperty.html +1 -1
  442. package/docs/modules/Uint64Property.html +1 -1
  443. package/docs/modules/Uint8Property.html +1 -1
  444. package/docs/modules/VehiclePhysicsData.html +1 -1
  445. package/docs/modules/VehicleSpecialProperties.html +1 -1
  446. package/docs/modules/col4.html +1 -1
  447. package/docs/modules/vec2.html +1 -1
  448. package/docs/modules/vec3.html +1 -1
  449. package/docs/modules/vec4.html +1 -1
  450. package/docs/modules.html +4 -2
  451. package/docs/types/AbstractBaseProperty-1.html +1 -1
  452. package/docs/types/ArrayProperty.AvailableArrayPropertyTypes.html +1 -1
  453. package/docs/types/ArrayPropertyStructValueFields.html +1 -1
  454. package/docs/types/BasicMultipleStructPropertyValue.html +1 -1
  455. package/docs/types/BasicStructPropertyValue.html +1 -1
  456. package/docs/types/BlueprintHeader-1.html +1 -1
  457. package/docs/types/BoolArrayProperty-1.html +1 -1
  458. package/docs/types/BoolProperty-1.html +1 -1
  459. package/docs/types/BoxStructPropertyValue.html +1 -1
  460. package/docs/types/BuildableSubsystemSpecialProperties-1.html +1 -1
  461. package/docs/types/BuildableTypeInstance-1.html +1 -1
  462. package/docs/types/ByteArray4.html +1 -1
  463. package/docs/types/ByteArrayProperty-1.html +1 -1
  464. package/docs/types/ByteProperty-1.html +1 -1
  465. package/docs/types/BytePropertyValue.html +1 -1
  466. package/docs/types/ChunkCompressionInfo.html +1 -1
  467. package/docs/types/ChunkSummary.html +1 -1
  468. package/docs/types/CircuitSpecialProperties-1.html +1 -1
  469. package/docs/types/ClientIdentityInfo.html +1 -1
  470. package/docs/types/ConveyorChainActorSpecialProperties-1.html +1 -1
  471. package/docs/types/ConveyorChainSegmentSpecialProperties.html +1 -1
  472. package/docs/types/ConveyorItemSpecialProperties.html +1 -1
  473. package/docs/types/ConveyorSpecialProperties-1.html +1 -1
  474. package/docs/types/DoubleArrayProperty-1.html +1 -1
  475. package/docs/types/DoubleProperty-1.html +1 -1
  476. package/docs/types/DynamicStructPropertyValue-1.html +1 -1
  477. package/docs/types/EmptySpecialProperties-1.html +1 -1
  478. package/docs/types/EnumArrayProperty-1.html +1 -1
  479. package/docs/types/EnumProperty-1.html +1 -1
  480. package/docs/types/FGDynamicStruct-1.html +1 -1
  481. package/docs/types/FICFrameRange-1.html +1 -1
  482. package/docs/types/FICFrameRangeStructPropertyValue.html +1 -1
  483. package/docs/types/FloatArrayProperty-1.html +1 -1
  484. package/docs/types/FloatProperty-1.html +1 -1
  485. package/docs/types/GENERIC_MAP_KEY_TYPE.html +1 -1
  486. package/docs/types/GENERIC_MAP_VALUE_TYPE.html +1 -1
  487. package/docs/types/GENERIC_STRUCT_PROPERTY_VALUE.html +1 -1
  488. package/docs/types/GUID-1.html +1 -1
  489. package/docs/types/GUIDInfo-1.html +1 -1
  490. package/docs/types/Grids.html +1 -1
  491. package/docs/types/Int32ArrayProperty-1.html +1 -1
  492. package/docs/types/Int32Property-1.html +1 -1
  493. package/docs/types/Int32SetProperty-1.html +1 -1
  494. package/docs/types/Int64ArrayProperty-1.html +1 -1
  495. package/docs/types/Int64Property-1.html +1 -1
  496. package/docs/types/Int8Property-1.html +1 -1
  497. package/docs/types/InventoryItemStructPropertyValue.html +1 -1
  498. package/docs/types/Level-1.html +2 -2
  499. package/docs/types/LevelToDestroyedActorsMap-1.html +1 -0
  500. package/docs/types/Levels.html +1 -1
  501. package/docs/types/MAP_STRUCT_KEY_PROXY.html +1 -1
  502. package/docs/types/MD5Hash-1.html +1 -1
  503. package/docs/types/MapProperty-1.html +1 -1
  504. package/docs/types/ModData.html +1 -1
  505. package/docs/types/ObjectArrayProperty-1.html +1 -1
  506. package/docs/types/ObjectProperty-1.html +1 -1
  507. package/docs/types/ObjectReference-1.html +1 -1
  508. package/docs/types/ObjectSetProperty-1.html +1 -1
  509. package/docs/types/ObjectsListSpecialProperties-1.html +1 -1
  510. package/docs/types/PlayerSpecialProperties-1.html +1 -1
  511. package/docs/types/PowerLineSpecialProperties-1.html +1 -1
  512. package/docs/types/PropertiesMap.html +1 -1
  513. package/docs/types/RailroadTrackPositionStructPropertyValue.html +1 -1
  514. package/docs/types/RoughSaveVersion.html +1 -1
  515. package/docs/types/SatisfactoryModMetadata.html +1 -1
  516. package/docs/types/SatisfactorySaveHeader-1.html +1 -1
  517. package/docs/types/SaveBodyChunks-1.html +1 -1
  518. package/docs/types/SaveBodyValidation.html +1 -1
  519. package/docs/types/SetProperty.AvailableSetPropertyTypes.html +1 -1
  520. package/docs/types/SoftObjectArrayProperty-1.html +1 -1
  521. package/docs/types/SoftObjectReference-1.html +1 -1
  522. package/docs/types/SpecialDroneAction.html +1 -1
  523. package/docs/types/SpecialDroneActionProperties-1.html +1 -1
  524. package/docs/types/SpecialProperties.AvailableSpecialPropertiesTypes.html +1 -1
  525. package/docs/types/StrArrayProperty-1.html +1 -1
  526. package/docs/types/StrProperty-1.html +1 -1
  527. package/docs/types/StrSetProperty-1.html +1 -1
  528. package/docs/types/StructArrayProperty-1.html +1 -1
  529. package/docs/types/StructProperty-1.html +1 -1
  530. package/docs/types/StructSetProperty-1.html +1 -1
  531. package/docs/types/TextArrayProperty-1.html +1 -1
  532. package/docs/types/TextProperty-1.html +1 -1
  533. package/docs/types/TextPropertyValue.html +1 -1
  534. package/docs/types/Transform-1.html +1 -1
  535. package/docs/types/Uint32Property-1.html +1 -1
  536. package/docs/types/Uint32SetProperty-1.html +1 -1
  537. package/docs/types/Uint64Property-1.html +1 -1
  538. package/docs/types/Uint8Property-1.html +1 -1
  539. package/docs/types/VehiclePhysicsData-1.html +1 -1
  540. package/docs/types/VehicleSpecialProperties-1.html +1 -1
  541. package/docs/types/col4-1.html +1 -1
  542. package/docs/types/vec2-1.html +1 -1
  543. package/docs/types/vec3-1.html +1 -1
  544. package/docs/types/vec4-1.html +1 -1
  545. package/docs/variables/DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE.html +1 -1
  546. package/docs/variables/EDIT.html +1 -1
  547. package/docs/variables/SaveBodyChunks.HEADER_V1.html +1 -1
  548. package/docs/variables/SaveBodyChunks.HEADER_V2.html +1 -1
  549. package/jsr.json +6 -0
  550. package/package.json +1 -3
@@ -0,0 +1,9 @@
1
+ import { ContextReader } from '../../context/context-reader';
2
+ import { ContextWriter } from '../../context/context-writer';
3
+ import { ObjectReference } from '../types/structs/ObjectReference';
4
+ export type LevelToDestroyedActorsMap = Record<string, ObjectReference[]>;
5
+ export declare namespace LevelToDestroyedActorsMap {
6
+ const read: (reader: ContextReader) => LevelToDestroyedActorsMap;
7
+ const write: (writer: ContextWriter, map: LevelToDestroyedActorsMap) => void;
8
+ }
9
+ //# sourceMappingURL=level-to-destroyed-actors-map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"level-to-destroyed-actors-map.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level-to-destroyed-actors-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;AAE1E,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,IAAI,WAAY,aAAa,KAAG,yBAa5C,CAAA;IAEM,MAAM,KAAK,WAAY,aAAa,OAAO,yBAAyB,KAAG,IAU7E,CAAA;CACJ"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LevelToDestroyedActorsMap = void 0;
4
+ const ObjectReference_1 = require("../types/structs/ObjectReference");
5
+ var LevelToDestroyedActorsMap;
6
+ (function (LevelToDestroyedActorsMap) {
7
+ LevelToDestroyedActorsMap.read = (reader) => {
8
+ const count = reader.readInt32();
9
+ const map = {};
10
+ for (let i = 0; i < count; i++) {
11
+ const key = reader.readString();
12
+ const elements = [];
13
+ const elementCount = reader.readInt32();
14
+ for (let j = 0; j < elementCount; j++) {
15
+ elements.push(ObjectReference_1.ObjectReference.read(reader));
16
+ }
17
+ map[key] = elements;
18
+ }
19
+ return map;
20
+ };
21
+ LevelToDestroyedActorsMap.write = (writer, map) => {
22
+ writer.writeInt32(Object.keys(map).length);
23
+ for (const entry of Object.entries(map)) {
24
+ writer.writeString(entry[0]);
25
+ writer.writeInt32(Object.keys(entry[1]).length);
26
+ for (const actor of entry[1]) {
27
+ ObjectReference_1.ObjectReference.write(writer, actor);
28
+ }
29
+ }
30
+ };
31
+ })(LevelToDestroyedActorsMap || (exports.LevelToDestroyedActorsMap = LevelToDestroyedActorsMap = {}));
32
+ //# sourceMappingURL=level-to-destroyed-actors-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"level-to-destroyed-actors-map.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level-to-destroyed-actors-map.ts"],"names":[],"m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CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;IACL,CAAC,CAAA;AACL,CAAC,EA3BgB,yBAAyB,yCAAzB,yBAAyB,QA2BzC","sourcesContent":["import { ContextReader } from '../../context/context-reader';\nimport { ContextWriter } from '../../context/context-writer';\nimport { ObjectReference } from '../types/structs/ObjectReference';\n\nexport type LevelToDestroyedActorsMap = Record<string, ObjectReference[]>;\n\nexport namespace LevelToDestroyedActorsMap {\n export const read = (reader: ContextReader): LevelToDestroyedActorsMap => {\n const count = reader.readInt32();\n const map: Record<string, ObjectReference[]> = {};\n for (let i = 0; i < count; i++) {\n const key = reader.readString();\n const elements: ObjectReference[] = [];\n const elementCount = reader.readInt32();\n for (let j = 0; j < elementCount; j++) {\n elements.push(ObjectReference.read(reader));\n }\n map[key] = elements;\n }\n return map;\n }\n\n export const write = (writer: ContextWriter, map: LevelToDestroyedActorsMap): void => {\n writer.writeInt32(Object.keys(map).length);\n for (const entry of Object.entries(map)) {\n writer.writeString(entry[0]);\n\n writer.writeInt32(Object.keys(entry[1]).length);\n for (const actor of entry[1]) {\n ObjectReference.write(writer, actor);\n }\n }\n }\n}"]}
@@ -4,15 +4,14 @@ import { SaveComponent } from "../types/objects/SaveComponent";
4
4
  import { SaveEntity } from "../types/objects/SaveEntity";
5
5
  import { SaveObject } from "../types/objects/SaveObject";
6
6
  import { ObjectReference } from "../types/structs/ObjectReference";
7
+ import { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';
7
8
  import { SaveReader } from './save-reader';
8
9
  export type Level = {
9
10
  name: string;
10
11
  objects: (SaveEntity | SaveComponent)[];
11
12
  collectables: ObjectReference[];
12
13
  saveCustomVersion?: number;
13
- destroyedActorsMap?: {
14
- [levelName: string]: ObjectReference[];
15
- };
14
+ destroyedActorsMap?: LevelToDestroyedActorsMap;
16
15
  };
17
16
  export type Levels = {
18
17
  [levelName: string]: Level;
@@ -1 +1 @@
1
- {"version":3,"file":"level.class.d.ts","source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SAAS,WAAY,UAAU,aAAa,MAAM,KAAG,KAsEjE,CAAA;IAEM,MAAM,cAAc,WAAY,aAAa,SAAS,KAAK,SAsCjE,CAAA;IAEM,MAAM,qBAAqB,cAAe,MAAM,UAAU,aAAa,eAAe,UAAU,EAAE,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,KAAG,IAmBzK,CAAA;IAEM,MAAM,mBAAmB,WAAY,aAAa,SAAS,MAAM,WAAW,UAAU,EAAE,qBAAoB,MAAM,iBAAoB,MAAM,SAuBlJ,CAAA;IAEM,MAAM,0BAA0B,WAAY,aAAa,WAAW,CAAC,UAAU,GAAG,aAAa,CAAC,EAAE,aAAa,MAAM,KAAG,IA6B9H,CAAA;IAEM,MAAM,oBAAoB,WAAY,aAAa,eAAe,UAAU,EAAE,KAAG,IAUvF,CAAA;IAEM,MAAM,kBAAkB,WAAY,aAAa,SAAS,MAAM,KAAG,CAAC,UAAU,GAAG,aAAa,CAAC,EAsBrG,CAAA;IAEM,MAAM,yBAAyB,WAAY,aAAa,WAAW,CAAC,UAAU,GAAG,aAAa,CAAC,EAAE,KAAG,IAkB1G,CAAA;CACD"}
@@ -4,7 +4,7 @@ exports.Level = void 0;
4
4
  const parser_error_1 = require("../../error/parser.error");
5
5
  const SaveComponent_1 = require("../types/objects/SaveComponent");
6
6
  const SaveEntity_1 = require("../types/objects/SaveEntity");
7
- const ObjectReference_1 = require("../types/structs/ObjectReference");
7
+ const level_to_destroyed_actors_map_1 = require("./level-to-destroyed-actors-map");
8
8
  const object_references_list_1 = require("./object-references-list");
9
9
  const save_custom_version_1 = require("./save-custom-version");
10
10
  var Level;
@@ -23,13 +23,18 @@ var Level;
23
23
  Level.ReadAllObjectHeaders(reader, level.objects);
24
24
  let remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
25
25
  if (remainingSize > 0) {
26
- level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
26
+ if (levelName === reader.context.mapName) {
27
+ level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
28
+ }
29
+ else {
30
+ level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
31
+ }
27
32
  }
28
33
  else {
29
34
  }
30
35
  remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
31
36
  if (remainingSize !== 0) {
32
- console.warn('remaining size not 0. Save may be corrupt.', remainingSize, levelName);
37
+ console.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);
33
38
  }
34
39
  const objectContentsBinLen = reader.readInt32();
35
40
  if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
@@ -47,19 +52,9 @@ var Level;
47
52
  }
48
53
  }
49
54
  if (levelName === reader.context.mapName) {
50
- const entriesCount = reader.readInt32();
51
- level.destroyedActorsMap = {};
52
- for (let i = 0; i < entriesCount; i++) {
53
- const levelName = reader.readString();
54
- const destroyedActors = [];
55
- const destroyedActorsCount = reader.readInt32();
56
- for (let j = 0; j < destroyedActorsCount; j++) {
57
- destroyedActors.push(ObjectReference_1.ObjectReference.read(reader));
58
- }
59
- level.destroyedActorsMap[levelName] = destroyedActors;
60
- }
55
+ level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
61
56
  }
62
- if (levelName !== reader.context.mapName) {
57
+ else {
63
58
  level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
64
59
  }
65
60
  return level;
@@ -71,7 +66,10 @@ var Level;
71
66
  writer.writeInt32Zero();
72
67
  }
73
68
  Level.SerializeAllObjectHeaders(writer, level.objects);
74
- if (level.collectables.length > 0) {
69
+ if (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {
70
+ level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);
71
+ }
72
+ else if (level.name !== writer.context.mapName && level.collectables.length > 0) {
75
73
  object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
76
74
  }
77
75
  writer.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);
@@ -82,24 +80,16 @@ var Level;
82
80
  }
83
81
  }
84
82
  if (level.name === writer.context.mapName) {
85
- writer.writeInt32(Object.keys(level.destroyedActorsMap).length);
86
- level.destroyedActorsMap = {};
87
- for (const entry of Object.entries(level.destroyedActorsMap)) {
88
- writer.writeString(entry[0]);
89
- writer.writeInt32(Object.keys(entry[1]).length);
90
- for (const actor of entry[1]) {
91
- ObjectReference_1.ObjectReference.write(writer, actor);
92
- }
93
- }
83
+ level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});
94
84
  }
95
- if (level.name !== writer.context.mapName) {
85
+ else {
96
86
  object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
97
87
  }
98
88
  };
99
89
  Level.ReadAllObjectContents = (levelName, reader, objectsList, onProgressCallback) => {
100
90
  const countEntities = reader.readInt32();
101
91
  if (countEntities !== objectsList.length) {
102
- throw new Error(`possibly corrupt. entity content count ${countEntities} does not equal object count of ${objectsList.length}`);
92
+ throw new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);
103
93
  }
104
94
  const batchSize = 10000;
105
95
  let readObjectsCount = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"level.class.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.class.ts"],"names":[],"mappings":";;;AAGA,2DAAgF;AAChF,kEAAgF;AAChF,4DAAuE;AAEvE,sEAAmE;AACnE,qEAAgE;AAChE,+DAA0D;AAgB1D,IAAiB,KAAK,CAoQrB;AApQD,WAAiB,KAAK;IAER,eAAS,GAAG,CAAC,MAAkB,EAAE,SAAiB,EAAS,EAAE;QACzE,MAAM,KAAK,GAAU;YACpB,IAAI,EAAE,SAAS;YACf,O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AM,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,EApQgB,KAAK,qBAAL,KAAK,QAoQrB","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 { 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?: { [levelName: string]: ObjectReference[] }\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// collected, like slugs Only listed here since U8.\n\t\tlet remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize > 0) {\n\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t} else {\n\t\t\t// its perfectly possible for ported saves to have nothing here.\n\t\t}\n\n\t\tremainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize !== 0) {\n\t\t\tconsole.warn('remaining size not 0. Save may be corrupt.', remainingSize, levelName);\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// only in persistent level, we have LevelToDestroyedActorsMap\n\t\tif (levelName === reader.context.mapName) {\n\t\t\tconst entriesCount = reader.readInt32();\n\t\t\tlevel.destroyedActorsMap = {};\n\t\t\tfor (let i = 0; i < entriesCount; i++) {\n\t\t\t\tconst levelName = reader.readString();\n\t\t\t\tconst destroyedActors: ObjectReference[] = [];\n\t\t\t\tconst destroyedActorsCount = reader.readInt32();\n\t\t\t\tfor (let j = 0; j < destroyedActorsCount; j++) {\n\t\t\t\t\tdestroyedActors.push(ObjectReference.read(reader));\n\t\t\t\t}\n\t\t\t\tlevel.destroyedActorsMap[levelName] = destroyedActors;\n\t\t\t}\n\t\t}\n\n\t\t// only NOT in the persistent level, we have 2nd collectables.\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.collectables = ObjectReferencesList.ReadList(reader);\n\t\t}\n\n\t\treturn level;\n\t}\n\n\texport const SerializeLevel = (writer: ContextWriter, level: Level) => {\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.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// only in persistent level, we have LevelToDestroyedActorsMap\n\t\tif (level.name === writer.context.mapName) {\n\t\t\twriter.writeInt32(Object.keys(level.destroyedActorsMap!).length);\n\t\t\tlevel.destroyedActorsMap = {};\n\t\t\tfor (const entry of Object.entries(level.destroyedActorsMap)) {\n\t\t\t\twriter.writeString(entry[0]);\n\n\t\t\t\twriter.writeInt32(Object.keys(entry[1]).length);\n\t\t\t\tfor (const actor of entry[1]) {\n\t\t\t\t\tObjectReference.write(writer, actor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// only NOT in the persistent level, we have 2nd collectables.\n\t\tif (level.name !== writer.context.mapName) {\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 content 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, buildVersion: number = 0) => {\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.class.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.class.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,CAAC,aAAa,EAAE,CAAC;QACxB,CAAC;QAGD,MAAM,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACpD,MAAA,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAG5C,IAAI,aAAa,GAAG,aAAa,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,CAAC;QACpF,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;YAEvB,IAAI,SAAS,KAAK,MAAM,CAAC,OAAO,CAAC,O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AAE,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) => {\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, buildVersion: number = 0) => {\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}"]}
@@ -0,0 +1,29 @@
1
+ import { ContextReader } from '../../context/context-reader';
2
+ import { ContextWriter } from '../../context/context-writer';
3
+ import { SaveComponent } from "../types/objects/SaveComponent";
4
+ import { SaveEntity } from "../types/objects/SaveEntity";
5
+ import { SaveObject } from "../types/objects/SaveObject";
6
+ import { ObjectReference } from "../types/structs/ObjectReference";
7
+ import { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';
8
+ import { SaveReader } from './save-reader';
9
+ export type Level = {
10
+ name: string;
11
+ objects: (SaveEntity | SaveComponent)[];
12
+ collectables: ObjectReference[];
13
+ saveCustomVersion?: number;
14
+ destroyedActorsMap?: LevelToDestroyedActorsMap;
15
+ };
16
+ export type Levels = {
17
+ [levelName: string]: Level;
18
+ };
19
+ export declare namespace Level {
20
+ const ReadLevel: (reader: SaveReader, levelName: string) => Level;
21
+ const SerializeLevel: (writer: ContextWriter, level: Level) => void;
22
+ const ReadAllObjectContents: (levelName: string, reader: ContextReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void) => void;
23
+ const ReadNObjectContents: (reader: ContextReader, count: number, objects: SaveObject[], objectListOffset?: number) => void;
24
+ const SerializeAllObjectContents: (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[], levelName: string) => void;
25
+ const ReadAllObjectHeaders: (reader: ContextReader, objectsList: SaveObject[]) => void;
26
+ const ReadNObjectHeaders: (reader: ContextReader, count: number) => (SaveEntity | SaveComponent)[];
27
+ const SerializeAllObjectHeaders: (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[]) => void;
28
+ }
29
+ //# sourceMappingURL=level.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../../../src/par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C,UAAU,GAAG,aAAa,CAAC,EAAE,aAAa,MAAM,KAAG,IA6B9H,CAAA;IAEM,MAAM,oBAAoB,WAAY,aAAa,eAAe,UAAU,EAAE,KAAG,IAUvF,CAAA;IAEM,MAAM,kBAAkB,WAAY,aAAa,SAAS,MAAM,KAAG,CAAC,UAAU,GAAG,aAAa,CAAC,EAsBrG,CAAA;IAEM,MAAM,yBAAyB,WAAY,aAAa,WAAW,CAAC,UAAU,GAAG,aAAa,CAAC,EAAE,KAAG,IAkB1G,CAAA;CACD"}
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Level = void 0;
4
+ const parser_error_1 = require("../../error/parser.error");
5
+ const SaveComponent_1 = require("../types/objects/SaveComponent");
6
+ const SaveEntity_1 = require("../types/objects/SaveEntity");
7
+ const level_to_destroyed_actors_map_1 = require("./level-to-destroyed-actors-map");
8
+ const object_references_list_1 = require("./object-references-list");
9
+ const save_custom_version_1 = require("./save-custom-version");
10
+ var Level;
11
+ (function (Level) {
12
+ Level.ReadLevel = (reader, levelName) => {
13
+ const level = {
14
+ name: levelName,
15
+ objects: [],
16
+ collectables: []
17
+ };
18
+ const headersBinLen = reader.readInt32();
19
+ if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
20
+ reader.readInt32Zero();
21
+ }
22
+ const posBeforeHeaders = reader.getBufferPosition();
23
+ Level.ReadAllObjectHeaders(reader, level.objects);
24
+ let remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
25
+ if (remainingSize > 0) {
26
+ if (levelName === reader.context.mapName) {
27
+ level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
28
+ }
29
+ else {
30
+ level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
31
+ }
32
+ }
33
+ else {
34
+ }
35
+ remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
36
+ if (remainingSize !== 0) {
37
+ console.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);
38
+ }
39
+ const objectContentsBinLen = reader.readInt32();
40
+ if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
41
+ reader.readInt32Zero();
42
+ }
43
+ const posBeforeContents = reader.getBufferPosition();
44
+ Level.ReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);
45
+ const posAfterContents = reader.getBufferPosition();
46
+ if (posAfterContents - posBeforeContents !== objectContentsBinLen) {
47
+ console.warn('save seems corrupt.', level.name);
48
+ }
49
+ if (levelName !== reader.context.mapName) {
50
+ if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {
51
+ level.saveCustomVersion = reader.readInt32();
52
+ }
53
+ }
54
+ if (levelName === reader.context.mapName) {
55
+ level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
56
+ }
57
+ else {
58
+ level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
59
+ }
60
+ return level;
61
+ };
62
+ Level.SerializeLevel = (writer, level) => {
63
+ const lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();
64
+ writer.writeInt32(0);
65
+ if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
66
+ writer.writeInt32Zero();
67
+ }
68
+ Level.SerializeAllObjectHeaders(writer, level.objects);
69
+ if (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {
70
+ level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);
71
+ }
72
+ else if (level.name !== writer.context.mapName && level.collectables.length > 0) {
73
+ object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
74
+ }
75
+ writer.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);
76
+ Level.SerializeAllObjectContents(writer, level.objects, level.name);
77
+ if (level.name !== writer.context.mapName) {
78
+ if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {
79
+ writer.writeInt32(level.saveCustomVersion ?? save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion);
80
+ }
81
+ }
82
+ if (level.name === writer.context.mapName) {
83
+ level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});
84
+ }
85
+ else {
86
+ object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
87
+ }
88
+ };
89
+ Level.ReadAllObjectContents = (levelName, reader, objectsList, onProgressCallback) => {
90
+ const countEntities = reader.readInt32();
91
+ if (countEntities !== objectsList.length) {
92
+ throw new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);
93
+ }
94
+ const batchSize = 10000;
95
+ let readObjectsCount = 0;
96
+ let lastProgressReport = 0;
97
+ while (readObjectsCount < countEntities) {
98
+ Level.ReadNObjectContents(reader, Math.min(batchSize, countEntities - readObjectsCount), objectsList, readObjectsCount);
99
+ readObjectsCount += Math.min(batchSize, countEntities - readObjectsCount);
100
+ if (readObjectsCount - lastProgressReport > batchSize) {
101
+ onProgressCallback(reader.getBufferProgress(), `read object count [${(readObjectsCount)}/${(countEntities)}] in level ${levelName}`);
102
+ lastProgressReport = readObjectsCount;
103
+ }
104
+ }
105
+ };
106
+ Level.ReadNObjectContents = (reader, count, objects, objectListOffset = 0) => {
107
+ for (let i = 0; i < count; i++) {
108
+ if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
109
+ objects[i + objectListOffset].saveCustomVersion = reader.readInt32();
110
+ }
111
+ if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
112
+ objects[i + objectListOffset].shouldMigrateObjectRefsToPersistent = reader.readInt32() >= 1;
113
+ }
114
+ const binarySize = reader.readInt32();
115
+ 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.`);
125
+ }
126
+ }
127
+ };
128
+ Level.SerializeAllObjectContents = (writer, objects, levelName) => {
129
+ const lenIndicatorEntities = writer.getBufferPosition();
130
+ writer.writeInt32(0);
131
+ if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
132
+ writer.writeInt32Zero();
133
+ }
134
+ writer.writeInt32(objects.length);
135
+ for (const obj of objects) {
136
+ if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
137
+ writer.writeInt32(obj.saveCustomVersion);
138
+ }
139
+ if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
140
+ writer.writeInt32(obj.shouldMigrateObjectRefsToPersistent ? 1 : 0);
141
+ }
142
+ const lenReplacementPosition = writer.getBufferPosition();
143
+ writer.writeInt32(0);
144
+ if ((0, SaveEntity_1.isSaveEntity)(obj)) {
145
+ SaveEntity_1.SaveEntity.SerializeData(writer, obj);
146
+ }
147
+ else if ((0, SaveComponent_1.isSaveComponent)(obj)) {
148
+ SaveComponent_1.SaveComponent.SerializeData(writer, obj);
149
+ }
150
+ writer.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);
151
+ }
152
+ writer.writeBinarySizeFromPosition(lenIndicatorEntities, lenIndicatorEntities + 8);
153
+ };
154
+ Level.ReadAllObjectHeaders = (reader, objectsList) => {
155
+ let countObjectHeaders = reader.readInt32();
156
+ const batchSize = 10000;
157
+ let readObjectHeadersCount = 0;
158
+ while (readObjectHeadersCount < countObjectHeaders) {
159
+ objectsList.push(...Level.ReadNObjectHeaders(reader, Math.min(batchSize, countObjectHeaders - readObjectHeadersCount)));
160
+ readObjectHeadersCount += Math.min(batchSize, countObjectHeaders - readObjectHeadersCount);
161
+ }
162
+ };
163
+ Level.ReadNObjectHeaders = (reader, count) => {
164
+ let objects = [];
165
+ let objectsRead = 0;
166
+ for (; objectsRead < count; objectsRead++) {
167
+ let obj;
168
+ let objectType = reader.readInt32();
169
+ switch (objectType) {
170
+ case SaveEntity_1.SaveEntity.TypeID:
171
+ obj = new SaveEntity_1.SaveEntity('', '', '', '');
172
+ SaveEntity_1.SaveEntity.ParseHeader(reader, obj);
173
+ break;
174
+ case SaveComponent_1.SaveComponent.TypeID:
175
+ obj = new SaveComponent_1.SaveComponent('', '', '', '');
176
+ SaveComponent_1.SaveComponent.ParseHeader(reader, obj);
177
+ break;
178
+ default:
179
+ throw new parser_error_1.CorruptSaveError('Unknown object type' + objectType);
180
+ }
181
+ objects.push(obj);
182
+ }
183
+ return objects;
184
+ };
185
+ Level.SerializeAllObjectHeaders = (writer, objects) => {
186
+ writer.writeInt32(objects.length);
187
+ for (const obj of objects) {
188
+ switch (obj.type) {
189
+ case 'SaveEntity':
190
+ writer.writeInt32(SaveEntity_1.SaveEntity.TypeID);
191
+ SaveEntity_1.SaveEntity.SerializeHeader(writer, obj);
192
+ break;
193
+ case 'SaveComponent':
194
+ writer.writeInt32(SaveComponent_1.SaveComponent.TypeID);
195
+ SaveComponent_1.SaveComponent.SerializeHeader(writer, obj);
196
+ break;
197
+ default:
198
+ throw new parser_error_1.UnimplementedError(`Unknown object type ${obj.type}. Not implemented.`);
199
+ break;
200
+ }
201
+ }
202
+ };
203
+ })(Level || (exports.Level = Level = {}));
204
+ //# sourceMappingURL=level.js.map
@@ -0,0 +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,CAAC,aAAa,EAAE,CAAC;QACxB,CAAC;QAGD,MAAM,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACpD,MAAA,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAG5C,IAAI,aAAa,GAAG,aAAa,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,CAAC;QACpF,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;YAEvB,IAAI,SAAS,KAAK,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC1C,KAAK,CAAC,kBAAkB,GAAG,yDAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnE,CAAC;iBAAM,CAAC;gBACP,KAAK,CAAC,YAAY,GAAG,6CAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC5D,CAAC;QAEF,CAAC;aAAM,CAAC;QAER,CAAC;QAGD,aAAa,GAAG,aAAa,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,G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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 +1 @@
1
- {"version":3,"file":"satisfactory-save-header.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/satisfactory-save-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,MAAM,sBAAsB,GAAG;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAA;AAED,yBAAiB,sBAAsB,CAAC;IAC7B,MAAM,KAAK,WAAY,aAAa,KAAG,sBA2E7C,CAAA;IAEM,MAAM,SAAS,WAAY,aAAa,UAAU,sBAAsB,SAiD9E,CAAA;CACJ"}
1
+ {"version":3,"file":"satisfactory-save-header.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/satisfactory-save-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,MAAM,sBAAsB,GAAG;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAA;AAED,yBAAiB,sBAAsB,CAAC;IAC7B,MAAM,KAAK,WAAY,aAAa,KAAG,sBA2E7C,CAAA;IAEM,MAAM,SAAS,WAAY,aAAa,UAAU,sBAAsB,KAAG,IAiDjF,CAAA;CACJ"}