@etothepii/satisfactory-file-parser 2.1.3 → 3.0.2

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 (800) hide show
  1. package/CHANGELOG.md +128 -103
  2. package/LICENCE.md +1 -1
  3. package/README.md +39 -21
  4. package/build/index.d.ts +13 -1
  5. package/build/index.d.ts.map +1 -1
  6. package/build/index.js +14 -3
  7. package/build/index.js.map +1 -1
  8. package/build/parser/byte/byte-reader.class.d.ts +7 -5
  9. package/build/parser/byte/byte-reader.class.d.ts.map +1 -1
  10. package/build/parser/byte/byte-reader.class.js +6 -4
  11. package/build/parser/byte/byte-reader.class.js.map +1 -1
  12. package/build/parser/byte/byte-writer.class.d.ts +1 -0
  13. package/build/parser/byte/byte-writer.class.d.ts.map +1 -1
  14. package/build/parser/byte/byte-writer.class.js +3 -0
  15. package/build/parser/byte/byte-writer.class.js.map +1 -1
  16. package/build/parser/context/context-reader.d.ts +6 -0
  17. package/build/parser/context/context-reader.d.ts.map +1 -0
  18. package/build/parser/context/context-reader.js +13 -0
  19. package/build/parser/context/context-reader.js.map +1 -0
  20. package/build/parser/context/context-writer.d.ts +6 -0
  21. package/build/parser/context/context-writer.d.ts.map +1 -0
  22. package/build/parser/context/context-writer.js +13 -0
  23. package/build/parser/context/context-writer.js.map +1 -0
  24. package/build/parser/context/context.d.ts +16 -0
  25. package/build/parser/context/context.d.ts.map +1 -0
  26. package/build/parser/context/context.js +3 -0
  27. package/build/parser/context/context.js.map +1 -0
  28. package/build/parser/error/parser.error.d.ts +3 -0
  29. package/build/parser/error/parser.error.d.ts.map +1 -1
  30. package/build/parser/error/parser.error.js +7 -1
  31. package/build/parser/error/parser.error.js.map +1 -1
  32. package/build/parser/parser.d.ts +5 -5
  33. package/build/parser/parser.d.ts.map +1 -1
  34. package/build/parser/parser.js +50 -22
  35. package/build/parser/parser.js.map +1 -1
  36. package/build/parser/satisfactory/blueprint/blueprint-config-version.d.ts +10 -0
  37. package/build/parser/satisfactory/blueprint/blueprint-config-version.d.ts.map +1 -0
  38. package/build/parser/satisfactory/blueprint/blueprint-config-version.js +14 -0
  39. package/build/parser/satisfactory/blueprint/blueprint-config-version.js.map +1 -0
  40. package/build/parser/satisfactory/blueprint/blueprint-config.d.ts +21 -0
  41. package/build/parser/satisfactory/blueprint/blueprint-config.d.ts.map +1 -0
  42. package/build/parser/satisfactory/blueprint/blueprint-config.js +56 -0
  43. package/build/parser/satisfactory/blueprint/blueprint-config.js.map +1 -0
  44. package/build/parser/satisfactory/blueprint/blueprint-header.d.ts +24 -0
  45. package/build/parser/satisfactory/blueprint/blueprint-header.d.ts.map +1 -0
  46. package/build/parser/satisfactory/blueprint/blueprint-header.js +61 -0
  47. package/build/parser/satisfactory/blueprint/blueprint-header.js.map +1 -0
  48. package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts +11 -14
  49. package/build/parser/satisfactory/blueprint/blueprint-reader.d.ts.map +1 -1
  50. package/build/parser/satisfactory/blueprint/blueprint-reader.js +15 -99
  51. package/build/parser/satisfactory/blueprint/blueprint-reader.js.map +1 -1
  52. package/build/parser/satisfactory/blueprint/blueprint-writer.d.ts +6 -9
  53. package/build/parser/satisfactory/blueprint/blueprint-writer.d.ts.map +1 -1
  54. package/build/parser/satisfactory/blueprint/blueprint-writer.js +7 -39
  55. package/build/parser/satisfactory/blueprint/blueprint-writer.js.map +1 -1
  56. package/build/parser/satisfactory/blueprint/blueprint.types.d.ts +3 -16
  57. package/build/parser/satisfactory/blueprint/blueprint.types.d.ts.map +1 -1
  58. package/build/parser/satisfactory/blueprint/blueprint.types.js.map +1 -1
  59. package/build/parser/satisfactory/edit/edit-constants.d.ts +80 -0
  60. package/build/parser/satisfactory/edit/edit-constants.d.ts.map +1 -1
  61. package/build/parser/satisfactory/edit/edit-constants.js +80 -0
  62. package/build/parser/satisfactory/edit/edit-constants.js.map +1 -1
  63. package/build/parser/satisfactory/save/factory-game-custom-version.d.ts +34 -0
  64. package/build/parser/satisfactory/save/factory-game-custom-version.d.ts.map +1 -0
  65. package/build/parser/satisfactory/save/factory-game-custom-version.js +39 -0
  66. package/build/parser/satisfactory/save/factory-game-custom-version.js.map +1 -0
  67. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.d.ts +9 -0
  68. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.d.ts.map +1 -0
  69. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.js +32 -0
  70. package/build/parser/satisfactory/save/level-to-destroyed-actors-map.js.map +1 -0
  71. package/build/parser/satisfactory/save/level.class.d.ts +16 -10
  72. package/build/parser/satisfactory/save/level.class.d.ts.map +1 -1
  73. package/build/parser/satisfactory/save/level.class.js +70 -24
  74. package/build/parser/satisfactory/save/level.class.js.map +1 -1
  75. package/build/parser/satisfactory/save/object-references-list.d.ts +4 -4
  76. package/build/parser/satisfactory/save/object-references-list.d.ts.map +1 -1
  77. package/build/parser/satisfactory/save/object-references-list.js.map +1 -1
  78. package/build/parser/satisfactory/save/satisfactory-save-header.d.ts +29 -0
  79. package/build/parser/satisfactory/save/satisfactory-save-header.d.ts.map +1 -0
  80. package/build/parser/satisfactory/save/satisfactory-save-header.js +111 -0
  81. package/build/parser/satisfactory/save/satisfactory-save-header.js.map +1 -0
  82. package/build/parser/satisfactory/save/satisfactory-save.d.ts +6 -4
  83. package/build/parser/satisfactory/save/satisfactory-save.d.ts.map +1 -1
  84. package/build/parser/satisfactory/save/satisfactory-save.js +4 -1
  85. package/build/parser/satisfactory/save/satisfactory-save.js.map +1 -1
  86. package/build/parser/satisfactory/save/save-body-chunks.d.ts +25 -0
  87. package/build/parser/satisfactory/save/save-body-chunks.d.ts.map +1 -0
  88. package/build/parser/satisfactory/save/save-body-chunks.js +118 -0
  89. package/build/parser/satisfactory/save/save-body-chunks.js.map +1 -0
  90. package/build/parser/satisfactory/save/save-custom-version.d.ts +57 -0
  91. package/build/parser/satisfactory/save/save-custom-version.d.ts.map +1 -0
  92. package/build/parser/satisfactory/save/save-custom-version.js +62 -0
  93. package/build/parser/satisfactory/save/save-custom-version.js.map +1 -0
  94. package/build/parser/satisfactory/save/save-header-type.d.ts +18 -0
  95. package/build/parser/satisfactory/save/save-header-type.d.ts.map +1 -0
  96. package/build/parser/satisfactory/save/save-header-type.js +22 -0
  97. package/build/parser/satisfactory/save/save-header-type.js.map +1 -0
  98. package/build/parser/satisfactory/save/save-reader.d.ts +14 -12
  99. package/build/parser/satisfactory/save/save-reader.d.ts.map +1 -1
  100. package/build/parser/satisfactory/save/save-reader.js +32 -134
  101. package/build/parser/satisfactory/save/save-reader.js.map +1 -1
  102. package/build/parser/satisfactory/save/save-writer.d.ts +7 -9
  103. package/build/parser/satisfactory/save/save-writer.d.ts.map +1 -1
  104. package/build/parser/satisfactory/save/save-writer.js +8 -95
  105. package/build/parser/satisfactory/save/save-writer.js.map +1 -1
  106. package/build/parser/satisfactory/save/save.types.d.ts +5 -25
  107. package/build/parser/satisfactory/save/save.types.d.ts.map +1 -1
  108. package/build/parser/satisfactory/save/save.types.js.map +1 -1
  109. package/build/parser/satisfactory/types/objects/SaveComponent.d.ts +6 -5
  110. package/build/parser/satisfactory/types/objects/SaveComponent.d.ts.map +1 -1
  111. package/build/parser/satisfactory/types/objects/SaveComponent.js +2 -2
  112. package/build/parser/satisfactory/types/objects/SaveComponent.js.map +1 -1
  113. package/build/parser/satisfactory/types/objects/SaveEntity.d.ts +7 -8
  114. package/build/parser/satisfactory/types/objects/SaveEntity.d.ts.map +1 -1
  115. package/build/parser/satisfactory/types/objects/SaveEntity.js +7 -10
  116. package/build/parser/satisfactory/types/objects/SaveEntity.js.map +1 -1
  117. package/build/parser/satisfactory/types/objects/SaveObject.d.ts +11 -9
  118. package/build/parser/satisfactory/types/objects/SaveObject.d.ts.map +1 -1
  119. package/build/parser/satisfactory/types/objects/SaveObject.js +17 -9
  120. package/build/parser/satisfactory/types/objects/SaveObject.js.map +1 -1
  121. package/build/parser/satisfactory/types/property/PropertiesList.d.ts +6 -6
  122. package/build/parser/satisfactory/types/property/PropertiesList.d.ts.map +1 -1
  123. package/build/parser/satisfactory/types/property/PropertiesList.js +7 -7
  124. package/build/parser/satisfactory/types/property/PropertiesList.js.map +1 -1
  125. package/build/parser/satisfactory/types/property/generic/AbstractBaseProperty.js.map +1 -1
  126. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts +4 -4
  127. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts.map +1 -1
  128. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.js.map +1 -1
  129. package/build/parser/satisfactory/types/property/generic/ArrayProperty/BoolArrayProperty.d.ts +4 -4
  130. package/build/parser/satisfactory/types/property/generic/ArrayProperty/BoolArrayProperty.d.ts.map +1 -1
  131. package/build/parser/satisfactory/types/property/generic/ArrayProperty/BoolArrayProperty.js.map +1 -1
  132. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ByteArrayProperty.d.ts +4 -4
  133. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ByteArrayProperty.d.ts.map +1 -1
  134. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ByteArrayProperty.js.map +1 -1
  135. package/build/parser/satisfactory/types/property/generic/ArrayProperty/DoubleArrayProperty.d.ts +4 -4
  136. package/build/parser/satisfactory/types/property/generic/ArrayProperty/DoubleArrayProperty.d.ts.map +1 -1
  137. package/build/parser/satisfactory/types/property/generic/ArrayProperty/DoubleArrayProperty.js.map +1 -1
  138. package/build/parser/satisfactory/types/property/generic/ArrayProperty/EnumArrayProperty.d.ts +4 -4
  139. package/build/parser/satisfactory/types/property/generic/ArrayProperty/EnumArrayProperty.d.ts.map +1 -1
  140. package/build/parser/satisfactory/types/property/generic/ArrayProperty/EnumArrayProperty.js.map +1 -1
  141. package/build/parser/satisfactory/types/property/generic/ArrayProperty/FloatArrayProperty.d.ts +4 -4
  142. package/build/parser/satisfactory/types/property/generic/ArrayProperty/FloatArrayProperty.d.ts.map +1 -1
  143. package/build/parser/satisfactory/types/property/generic/ArrayProperty/FloatArrayProperty.js.map +1 -1
  144. package/build/parser/satisfactory/types/property/generic/ArrayProperty/Int32ArrayProperty.d.ts +4 -4
  145. package/build/parser/satisfactory/types/property/generic/ArrayProperty/Int32ArrayProperty.d.ts.map +1 -1
  146. package/build/parser/satisfactory/types/property/generic/ArrayProperty/Int32ArrayProperty.js.map +1 -1
  147. package/build/parser/satisfactory/types/property/generic/ArrayProperty/Int64ArrayProperty.d.ts +4 -4
  148. package/build/parser/satisfactory/types/property/generic/ArrayProperty/Int64ArrayProperty.d.ts.map +1 -1
  149. package/build/parser/satisfactory/types/property/generic/ArrayProperty/Int64ArrayProperty.js.map +1 -1
  150. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ObjectArrayProperty.d.ts +4 -4
  151. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ObjectArrayProperty.d.ts.map +1 -1
  152. package/build/parser/satisfactory/types/property/generic/ArrayProperty/ObjectArrayProperty.js.map +1 -1
  153. package/build/parser/satisfactory/types/property/generic/ArrayProperty/SoftObjectArrayProperty.d.ts +4 -4
  154. package/build/parser/satisfactory/types/property/generic/ArrayProperty/SoftObjectArrayProperty.d.ts.map +1 -1
  155. package/build/parser/satisfactory/types/property/generic/ArrayProperty/SoftObjectArrayProperty.js.map +1 -1
  156. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StrArrayProperty.d.ts +4 -4
  157. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StrArrayProperty.d.ts.map +1 -1
  158. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StrArrayProperty.js.map +1 -1
  159. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty.d.ts +4 -4
  160. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty.d.ts.map +1 -1
  161. package/build/parser/satisfactory/types/property/generic/ArrayProperty/StructArrayProperty.js.map +1 -1
  162. package/build/parser/satisfactory/types/property/generic/ArrayProperty/TextArrayProperty.d.ts +4 -4
  163. package/build/parser/satisfactory/types/property/generic/ArrayProperty/TextArrayProperty.d.ts.map +1 -1
  164. package/build/parser/satisfactory/types/property/generic/ArrayProperty/TextArrayProperty.js.map +1 -1
  165. package/build/parser/satisfactory/types/property/generic/BoolProperty.d.ts +6 -6
  166. package/build/parser/satisfactory/types/property/generic/BoolProperty.d.ts.map +1 -1
  167. package/build/parser/satisfactory/types/property/generic/BoolProperty.js.map +1 -1
  168. package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts +6 -6
  169. package/build/parser/satisfactory/types/property/generic/ByteProperty.d.ts.map +1 -1
  170. package/build/parser/satisfactory/types/property/generic/ByteProperty.js.map +1 -1
  171. package/build/parser/satisfactory/types/property/generic/DoubleProperty.d.ts +6 -6
  172. package/build/parser/satisfactory/types/property/generic/DoubleProperty.d.ts.map +1 -1
  173. package/build/parser/satisfactory/types/property/generic/DoubleProperty.js.map +1 -1
  174. package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts +6 -6
  175. package/build/parser/satisfactory/types/property/generic/EnumProperty.d.ts.map +1 -1
  176. package/build/parser/satisfactory/types/property/generic/EnumProperty.js.map +1 -1
  177. package/build/parser/satisfactory/types/property/generic/FloatProperty.d.ts +6 -6
  178. package/build/parser/satisfactory/types/property/generic/FloatProperty.d.ts.map +1 -1
  179. package/build/parser/satisfactory/types/property/generic/FloatProperty.js.map +1 -1
  180. package/build/parser/satisfactory/types/property/generic/Int32Property.d.ts +6 -6
  181. package/build/parser/satisfactory/types/property/generic/Int32Property.d.ts.map +1 -1
  182. package/build/parser/satisfactory/types/property/generic/Int32Property.js.map +1 -1
  183. package/build/parser/satisfactory/types/property/generic/Int64Property.d.ts +6 -6
  184. package/build/parser/satisfactory/types/property/generic/Int64Property.d.ts.map +1 -1
  185. package/build/parser/satisfactory/types/property/generic/Int64Property.js.map +1 -1
  186. package/build/parser/satisfactory/types/property/generic/Int8Property.d.ts +6 -6
  187. package/build/parser/satisfactory/types/property/generic/Int8Property.d.ts.map +1 -1
  188. package/build/parser/satisfactory/types/property/generic/Int8Property.js.map +1 -1
  189. package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts +4 -4
  190. package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts.map +1 -1
  191. package/build/parser/satisfactory/types/property/generic/MapProperty.js +5 -5
  192. package/build/parser/satisfactory/types/property/generic/MapProperty.js.map +1 -1
  193. package/build/parser/satisfactory/types/property/generic/ObjectProperty.d.ts +6 -6
  194. package/build/parser/satisfactory/types/property/generic/ObjectProperty.d.ts.map +1 -1
  195. package/build/parser/satisfactory/types/property/generic/ObjectProperty.js.map +1 -1
  196. package/build/parser/satisfactory/types/property/generic/SetProperty/Int32SetProperty.d.ts +4 -4
  197. package/build/parser/satisfactory/types/property/generic/SetProperty/Int32SetProperty.d.ts.map +1 -1
  198. package/build/parser/satisfactory/types/property/generic/SetProperty/Int32SetProperty.js.map +1 -1
  199. package/build/parser/satisfactory/types/property/generic/SetProperty/ObjectSetProperty.d.ts +4 -4
  200. package/build/parser/satisfactory/types/property/generic/SetProperty/ObjectSetProperty.d.ts.map +1 -1
  201. package/build/parser/satisfactory/types/property/generic/SetProperty/ObjectSetProperty.js.map +1 -1
  202. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts +4 -4
  203. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts.map +1 -1
  204. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js +4 -1
  205. package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js.map +1 -1
  206. package/build/parser/satisfactory/types/property/generic/SetProperty/StrSetProperty.d.ts +4 -4
  207. package/build/parser/satisfactory/types/property/generic/SetProperty/StrSetProperty.d.ts.map +1 -1
  208. package/build/parser/satisfactory/types/property/generic/SetProperty/StrSetProperty.js.map +1 -1
  209. package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.d.ts +4 -4
  210. package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.d.ts.map +1 -1
  211. package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.js +1 -2
  212. package/build/parser/satisfactory/types/property/generic/SetProperty/StructSetProperty.js.map +1 -1
  213. package/build/parser/satisfactory/types/property/generic/SetProperty/Uint32SetProperty.d.ts +4 -4
  214. package/build/parser/satisfactory/types/property/generic/SetProperty/Uint32SetProperty.d.ts.map +1 -1
  215. package/build/parser/satisfactory/types/property/generic/SetProperty/Uint32SetProperty.js.map +1 -1
  216. package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.d.ts +6 -6
  217. package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.d.ts.map +1 -1
  218. package/build/parser/satisfactory/types/property/generic/SoftObjectProperty.js.map +1 -1
  219. package/build/parser/satisfactory/types/property/generic/StrProperty.d.ts +6 -6
  220. package/build/parser/satisfactory/types/property/generic/StrProperty.d.ts.map +1 -1
  221. package/build/parser/satisfactory/types/property/generic/StrProperty.js.map +1 -1
  222. package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts +11 -15
  223. package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts.map +1 -1
  224. package/build/parser/satisfactory/types/property/generic/StructProperty.js +32 -36
  225. package/build/parser/satisfactory/types/property/generic/StructProperty.js.map +1 -1
  226. package/build/parser/satisfactory/types/property/generic/TextProperty.d.ts +6 -6
  227. package/build/parser/satisfactory/types/property/generic/TextProperty.d.ts.map +1 -1
  228. package/build/parser/satisfactory/types/property/generic/TextProperty.js.map +1 -1
  229. package/build/parser/satisfactory/types/property/generic/Uint32Property.d.ts +6 -6
  230. package/build/parser/satisfactory/types/property/generic/Uint32Property.d.ts.map +1 -1
  231. package/build/parser/satisfactory/types/property/generic/Uint32Property.js.map +1 -1
  232. package/build/parser/satisfactory/types/property/generic/Uint64Property.d.ts +6 -6
  233. package/build/parser/satisfactory/types/property/generic/Uint64Property.d.ts.map +1 -1
  234. package/build/parser/satisfactory/types/property/generic/Uint64Property.js.map +1 -1
  235. package/build/parser/satisfactory/types/property/generic/Uint8Property.d.ts +6 -6
  236. package/build/parser/satisfactory/types/property/generic/Uint8Property.d.ts.map +1 -1
  237. package/build/parser/satisfactory/types/property/generic/Uint8Property.js.map +1 -1
  238. package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.d.ts +25 -5
  239. package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.d.ts.map +1 -1
  240. package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.js +70 -44
  241. package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.js.map +1 -1
  242. package/build/parser/satisfactory/types/property/special/CircuitSpecialProperties.d.ts +4 -4
  243. package/build/parser/satisfactory/types/property/special/CircuitSpecialProperties.d.ts.map +1 -1
  244. package/build/parser/satisfactory/types/property/special/CircuitSpecialProperties.js.map +1 -1
  245. package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.d.ts +4 -4
  246. package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.d.ts.map +1 -1
  247. package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.js.map +1 -1
  248. package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.d.ts +4 -4
  249. package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.d.ts.map +1 -1
  250. package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.js +2 -2
  251. package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.js.map +1 -1
  252. package/build/parser/satisfactory/types/property/special/EmptySpecialProperties.d.ts +4 -4
  253. package/build/parser/satisfactory/types/property/special/EmptySpecialProperties.d.ts.map +1 -1
  254. package/build/parser/satisfactory/types/property/special/EmptySpecialProperties.js.map +1 -1
  255. package/build/parser/satisfactory/types/property/special/ObjectsListSpecialProperties.d.ts +4 -4
  256. package/build/parser/satisfactory/types/property/special/ObjectsListSpecialProperties.d.ts.map +1 -1
  257. package/build/parser/satisfactory/types/property/special/ObjectsListSpecialProperties.js.map +1 -1
  258. package/build/parser/satisfactory/types/property/special/PlayerSpecialProperties.d.ts +4 -4
  259. package/build/parser/satisfactory/types/property/special/PlayerSpecialProperties.d.ts.map +1 -1
  260. package/build/parser/satisfactory/types/property/special/PlayerSpecialProperties.js.map +1 -1
  261. package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.d.ts +4 -4
  262. package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.d.ts.map +1 -1
  263. package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.js +12 -3
  264. package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.js.map +1 -1
  265. package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.d.ts +4 -4
  266. package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.d.ts.map +1 -1
  267. package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.js +4 -4
  268. package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.js.map +1 -1
  269. package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts +4 -4
  270. package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts.map +1 -1
  271. package/build/parser/satisfactory/types/property/special/SpecialProperties.js.map +1 -1
  272. package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.d.ts +6 -9
  273. package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.d.ts.map +1 -1
  274. package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.js +3 -8
  275. package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.js.map +1 -1
  276. package/build/parser/satisfactory/types/property/special/runtime-buildable-instance-data-version.d.ts +8 -0
  277. package/build/parser/satisfactory/types/property/special/runtime-buildable-instance-data-version.d.ts.map +1 -0
  278. package/build/parser/satisfactory/types/property/special/runtime-buildable-instance-data-version.js +12 -0
  279. package/build/parser/satisfactory/types/property/special/runtime-buildable-instance-data-version.js.map +1 -0
  280. package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.d.ts +4 -4
  281. package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.d.ts.map +1 -1
  282. package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.js +4 -4
  283. package/build/parser/satisfactory/types/structs/DynamicStructPropertyValue.js.map +1 -1
  284. package/build/parser/satisfactory/types/structs/FGDynamicStruct.d.ts +14 -0
  285. package/build/parser/satisfactory/types/structs/FGDynamicStruct.d.ts.map +1 -0
  286. package/build/parser/satisfactory/types/structs/FGDynamicStruct.js +34 -0
  287. package/build/parser/satisfactory/types/structs/FGDynamicStruct.js.map +1 -0
  288. package/build/parser/satisfactory/types/structs/GUID.d.ts +4 -4
  289. package/build/parser/satisfactory/types/structs/GUID.d.ts.map +1 -1
  290. package/build/parser/satisfactory/types/structs/GUID.js.map +1 -1
  291. package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts +4 -4
  292. package/build/parser/satisfactory/types/structs/GUIDInfo.d.ts.map +1 -1
  293. package/build/parser/satisfactory/types/structs/GUIDInfo.js.map +1 -1
  294. package/build/parser/satisfactory/types/structs/MD5Hash.d.ts +4 -4
  295. package/build/parser/satisfactory/types/structs/MD5Hash.d.ts.map +1 -1
  296. package/build/parser/satisfactory/types/structs/MD5Hash.js.map +1 -1
  297. package/build/parser/satisfactory/types/structs/ObjectReference.d.ts +5 -4
  298. package/build/parser/satisfactory/types/structs/ObjectReference.d.ts.map +1 -1
  299. package/build/parser/satisfactory/types/structs/ObjectReference.js +1 -0
  300. package/build/parser/satisfactory/types/structs/ObjectReference.js.map +1 -1
  301. package/build/parser/satisfactory/types/structs/SoftObjectReference.d.ts +4 -4
  302. package/build/parser/satisfactory/types/structs/SoftObjectReference.d.ts.map +1 -1
  303. package/build/parser/satisfactory/types/structs/SoftObjectReference.js.map +1 -1
  304. package/build/parser/satisfactory/types/structs/Transform.d.ts +6 -6
  305. package/build/parser/satisfactory/types/structs/Transform.d.ts.map +1 -1
  306. package/build/parser/satisfactory/types/structs/Transform.js.map +1 -1
  307. package/build/parser/satisfactory/types/structs/VehiclePhysicsData.d.ts +17 -0
  308. package/build/parser/satisfactory/types/structs/VehiclePhysicsData.d.ts.map +1 -0
  309. package/build/parser/satisfactory/types/structs/VehiclePhysicsData.js +26 -0
  310. package/build/parser/satisfactory/types/structs/VehiclePhysicsData.js.map +1 -0
  311. package/build/parser/satisfactory/types/structs/col4.d.ts +6 -6
  312. package/build/parser/satisfactory/types/structs/col4.d.ts.map +1 -1
  313. package/build/parser/satisfactory/types/structs/col4.js.map +1 -1
  314. package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts +4 -4
  315. package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.d.ts.map +1 -1
  316. package/build/parser/satisfactory/types/structs/mods/FicsItCam/FICFrameRange.js.map +1 -1
  317. package/build/parser/satisfactory/types/structs/vec2.d.ts +6 -6
  318. package/build/parser/satisfactory/types/structs/vec2.d.ts.map +1 -1
  319. package/build/parser/satisfactory/types/structs/vec2.js.map +1 -1
  320. package/build/parser/satisfactory/types/structs/vec3.d.ts +8 -8
  321. package/build/parser/satisfactory/types/structs/vec3.d.ts.map +1 -1
  322. package/build/parser/satisfactory/types/structs/vec3.js.map +1 -1
  323. package/build/parser/satisfactory/types/structs/vec4.d.ts +6 -6
  324. package/build/parser/satisfactory/types/structs/vec4.d.ts.map +1 -1
  325. package/build/parser/satisfactory/types/structs/vec4.js.map +1 -1
  326. package/build/parser/stream/reworked/readable-stream-parser.d.ts +2 -2
  327. package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -1
  328. package/build/parser/stream/reworked/readable-stream-parser.js +59 -20
  329. package/build/parser/stream/reworked/readable-stream-parser.js.map +1 -1
  330. package/build/parser/stream/reworked/save-stream-json-stringifier.js +1 -1
  331. package/build/parser/stream/reworked/save-stream-json-stringifier.js.map +1 -1
  332. package/build/parser/stream/reworked/save-stream-writer.class.d.ts +2 -2
  333. package/build/parser/stream/reworked/save-stream-writer.class.d.ts.map +1 -1
  334. package/build/parser/stream/reworked/save-stream-writer.class.js.map +1 -1
  335. package/docs/assets/highlight.css +4 -4
  336. package/docs/assets/navigation.js +1 -1
  337. package/docs/assets/search.js +1 -1
  338. package/docs/classes/BlueprintConfigReader.html +7 -6
  339. package/docs/classes/BlueprintConfigWriter.html +6 -4
  340. package/docs/classes/BlueprintReader.html +7 -5
  341. package/docs/classes/BlueprintWriter.html +6 -4
  342. package/docs/classes/CompressionLibraryError.html +2 -2
  343. package/docs/classes/CorruptBlueprintError.html +11 -0
  344. package/docs/classes/CorruptSaveError.html +2 -2
  345. package/docs/classes/Parser.html +13 -13
  346. package/docs/classes/ParserError.html +2 -2
  347. package/docs/classes/ReadableStreamParser.html +4 -4
  348. package/docs/classes/SatisfactorySave.html +3 -2
  349. package/docs/classes/SaveComponent.html +6 -5
  350. package/docs/classes/SaveEntity.html +6 -6
  351. package/docs/classes/SaveObject.html +6 -5
  352. package/docs/classes/SaveReader.html +11 -7
  353. package/docs/classes/SaveStreamJsonStringifier.html +2 -2
  354. package/docs/classes/SaveStreamWriter.html +2 -2
  355. package/docs/classes/SaveWriter.html +6 -4
  356. package/docs/classes/TimeoutError.html +2 -2
  357. package/docs/classes/UnimplementedError.html +2 -2
  358. package/docs/classes/UnsupportedVersionError.html +2 -2
  359. package/docs/enums/BlueprintConfigVersion.html +9 -0
  360. package/docs/enums/CompressionAlgorithmCode.html +2 -0
  361. package/docs/enums/FactoryGameCustomVersion.html +33 -0
  362. package/docs/enums/RuntimeBuildableInstanceDataVersion.html +7 -0
  363. package/docs/enums/SaveCustomVersion.html +64 -0
  364. package/docs/enums/SaveHeaderType.html +17 -0
  365. package/docs/functions/AbstractBaseProperty.Create.html +1 -1
  366. package/docs/functions/ArrayProperty.CalcOverhead.html +1 -1
  367. package/docs/functions/ArrayProperty.Parse.html +1 -1
  368. package/docs/functions/ArrayProperty.Serialize.html +1 -1
  369. package/docs/functions/BlueprintConfig.Parse.html +1 -0
  370. package/docs/functions/BlueprintConfig.Serialize.html +1 -0
  371. package/docs/functions/BlueprintHeader.Parse.html +1 -0
  372. package/docs/functions/BlueprintHeader.Serialize.html +1 -0
  373. package/docs/functions/BoolArrayProperty.Parse.html +1 -1
  374. package/docs/functions/BoolArrayProperty.Serialize.html +1 -1
  375. package/docs/functions/BoolProperty.CalcOverhead.html +1 -1
  376. package/docs/functions/BoolProperty.Parse.html +1 -1
  377. package/docs/functions/BoolProperty.ReadValue.html +1 -1
  378. package/docs/functions/BoolProperty.Serialize.html +1 -1
  379. package/docs/functions/BoolProperty.SerializeValue.html +1 -1
  380. package/docs/functions/BuildableSubsystemSpecialProperties.Parse.html +1 -1
  381. package/docs/functions/BuildableSubsystemSpecialProperties.Serialize.html +1 -1
  382. package/docs/functions/BuildableTypeInstance.Parse.html +1 -0
  383. package/docs/functions/BuildableTypeInstance.Serialize.html +1 -0
  384. package/docs/functions/ByteArrayProperty.Parse.html +1 -1
  385. package/docs/functions/ByteArrayProperty.Serialize.html +1 -1
  386. package/docs/functions/ByteProperty.CalcOverhead.html +1 -1
  387. package/docs/functions/ByteProperty.Parse.html +1 -1
  388. package/docs/functions/ByteProperty.ReadValue.html +1 -1
  389. package/docs/functions/ByteProperty.Serialize.html +1 -1
  390. package/docs/functions/ByteProperty.SerializeValue.html +1 -1
  391. package/docs/functions/CircuitSpecialProperties.Parse.html +1 -1
  392. package/docs/functions/CircuitSpecialProperties.Serialize.html +1 -1
  393. package/docs/functions/ConveyorChainActorSpecialProperties.Parse.html +1 -1
  394. package/docs/functions/ConveyorChainActorSpecialProperties.Serialize.html +1 -1
  395. package/docs/functions/ConveyorSpecialProperties.Parse.html +1 -1
  396. package/docs/functions/ConveyorSpecialProperties.Serialize.html +1 -1
  397. package/docs/functions/DoubleArrayProperty.Parse.html +1 -1
  398. package/docs/functions/DoubleArrayProperty.Serialize.html +1 -1
  399. package/docs/functions/DoubleProperty.CalcOverhead.html +1 -1
  400. package/docs/functions/DoubleProperty.Parse.html +1 -1
  401. package/docs/functions/DoubleProperty.ReadValue.html +1 -1
  402. package/docs/functions/DoubleProperty.Serialize.html +1 -1
  403. package/docs/functions/DoubleProperty.SerializeValue.html +1 -1
  404. package/docs/functions/DynamicStructPropertyValue.read.html +1 -1
  405. package/docs/functions/DynamicStructPropertyValue.write.html +1 -1
  406. package/docs/functions/EmptySpecialProperties.Parse.html +1 -1
  407. package/docs/functions/EmptySpecialProperties.Serialize.html +1 -1
  408. package/docs/functions/EnumArrayProperty.Parse.html +1 -1
  409. package/docs/functions/EnumArrayProperty.Serialize.html +1 -1
  410. package/docs/functions/EnumProperty.CalcOverhead.html +1 -1
  411. package/docs/functions/EnumProperty.Parse.html +1 -1
  412. package/docs/functions/EnumProperty.ReadValue.html +1 -1
  413. package/docs/functions/EnumProperty.Serialize.html +1 -1
  414. package/docs/functions/EnumProperty.SerializeValue.html +1 -1
  415. package/docs/functions/FGDynamicStruct.Parse.html +1 -0
  416. package/docs/functions/FGDynamicStruct.Serialize.html +1 -0
  417. package/docs/functions/FICFrameRange.Parse.html +1 -1
  418. package/docs/functions/FICFrameRange.Serialize.html +1 -1
  419. package/docs/functions/FloatArrayProperty.Parse.html +1 -1
  420. package/docs/functions/FloatArrayProperty.Serialize.html +1 -1
  421. package/docs/functions/FloatProperty.CalcOverhead.html +1 -1
  422. package/docs/functions/FloatProperty.Parse.html +1 -1
  423. package/docs/functions/FloatProperty.ReadValue.html +1 -1
  424. package/docs/functions/FloatProperty.Serialize.html +1 -1
  425. package/docs/functions/FloatProperty.SerializeValue.html +1 -1
  426. package/docs/functions/GUID.read.html +1 -1
  427. package/docs/functions/GUID.write.html +1 -1
  428. package/docs/functions/GUIDInfo.read.html +1 -1
  429. package/docs/functions/GUIDInfo.write.html +1 -1
  430. package/docs/functions/Int32ArrayProperty.Parse.html +1 -1
  431. package/docs/functions/Int32ArrayProperty.Serialize.html +1 -1
  432. package/docs/functions/Int32Property.CalcOverhead.html +1 -1
  433. package/docs/functions/Int32Property.Parse.html +1 -1
  434. package/docs/functions/Int32Property.ReadValue.html +1 -1
  435. package/docs/functions/Int32Property.Serialize.html +1 -1
  436. package/docs/functions/Int32Property.SerializeValue.html +1 -1
  437. package/docs/functions/Int32SetProperty.Parse.html +1 -1
  438. package/docs/functions/Int32SetProperty.Serialize.html +1 -1
  439. package/docs/functions/Int64ArrayProperty.Parse.html +1 -1
  440. package/docs/functions/Int64ArrayProperty.Serialize.html +1 -1
  441. package/docs/functions/Int64Property.CalcOverhead.html +1 -1
  442. package/docs/functions/Int64Property.Parse.html +1 -1
  443. package/docs/functions/Int64Property.ReadValue.html +1 -1
  444. package/docs/functions/Int64Property.Serialize.html +1 -1
  445. package/docs/functions/Int64Property.SerializeValue.html +1 -1
  446. package/docs/functions/Int8Property.CalcOverhead.html +1 -1
  447. package/docs/functions/Int8Property.Parse.html +1 -1
  448. package/docs/functions/Int8Property.ReadValue.html +1 -1
  449. package/docs/functions/Int8Property.Serialize.html +1 -1
  450. package/docs/functions/Int8Property.SerializeValue.html +1 -1
  451. package/docs/functions/Level.ReadAllObjectContents.html +1 -1
  452. package/docs/functions/Level.ReadAllObjectHeaders.html +1 -1
  453. package/docs/functions/Level.ReadLevel.html +1 -1
  454. package/docs/functions/Level.ReadNObjectContents.html +1 -1
  455. package/docs/functions/Level.ReadNObjectHeaders.html +1 -1
  456. package/docs/functions/Level.SerializeAllObjectContents.html +1 -1
  457. package/docs/functions/Level.SerializeAllObjectHeaders.html +1 -1
  458. package/docs/functions/Level.SerializeLevel.html +1 -1
  459. package/docs/functions/MD5Hash.read.html +1 -1
  460. package/docs/functions/MD5Hash.write.html +1 -1
  461. package/docs/functions/MapProperty.CalcOverhead.html +1 -1
  462. package/docs/functions/MapProperty.Parse.html +1 -1
  463. package/docs/functions/MapProperty.Serialize.html +1 -1
  464. package/docs/functions/ObjectArrayProperty.Parse.html +1 -1
  465. package/docs/functions/ObjectArrayProperty.Serialize.html +1 -1
  466. package/docs/functions/ObjectProperty.CalcOverhead.html +1 -1
  467. package/docs/functions/ObjectProperty.Parse.html +1 -1
  468. package/docs/functions/ObjectProperty.ReadValue.html +1 -1
  469. package/docs/functions/ObjectProperty.Serialize.html +1 -1
  470. package/docs/functions/ObjectProperty.SerializeValue.html +1 -1
  471. package/docs/functions/ObjectReference.IsEqual.html +1 -0
  472. package/docs/functions/ObjectReference.read.html +1 -1
  473. package/docs/functions/ObjectReference.write.html +1 -1
  474. package/docs/functions/ObjectSetProperty.Parse.html +1 -1
  475. package/docs/functions/ObjectSetProperty.Serialize.html +1 -1
  476. package/docs/functions/ObjectsListSpecialProperties.Parse.html +1 -1
  477. package/docs/functions/ObjectsListSpecialProperties.Serialize.html +1 -1
  478. package/docs/functions/PlayerSpecialProperties.Parse.html +1 -1
  479. package/docs/functions/PlayerSpecialProperties.Serialize.html +1 -1
  480. package/docs/functions/PowerLineSpecialProperties.Parse.html +1 -1
  481. package/docs/functions/PowerLineSpecialProperties.Serialize.html +1 -1
  482. package/docs/functions/PropertiesList.ParseList.html +1 -1
  483. package/docs/functions/PropertiesList.ParseSingleProperty.html +1 -1
  484. package/docs/functions/PropertiesList.SerializeList.html +1 -1
  485. package/docs/functions/PropertiesList.SerializeSingleProperty.html +1 -1
  486. package/docs/functions/SatisfactorySaveHeader.Parse.html +1 -0
  487. package/docs/functions/SatisfactorySaveHeader.Serialize.html +1 -0
  488. package/docs/functions/SaveBodyChunks.CompressDataIntoChunks.html +1 -0
  489. package/docs/functions/SaveBodyChunks.DecompressChunks.html +1 -0
  490. package/docs/functions/SetProperty.CalcOverhead.html +1 -1
  491. package/docs/functions/SetProperty.Parse.html +1 -1
  492. package/docs/functions/SetProperty.Serialize.html +1 -1
  493. package/docs/functions/SoftObjectArrayProperty.Parse.html +1 -1
  494. package/docs/functions/SoftObjectArrayProperty.Serialize.html +1 -1
  495. package/docs/functions/SoftObjectReference.read.html +1 -1
  496. package/docs/functions/SoftObjectReference.write.html +1 -1
  497. package/docs/functions/SpecialDroneActionProperties.Parse.html +1 -1
  498. package/docs/functions/SpecialDroneActionProperties.Serialize.html +1 -1
  499. package/docs/functions/SpecialProperties.ParseClassSpecificSpecialProperties.html +1 -1
  500. package/docs/functions/SpecialProperties.SerializeClassSpecificSpecialProperties.html +1 -1
  501. package/docs/functions/StrArrayProperty.Parse.html +1 -1
  502. package/docs/functions/StrArrayProperty.Serialize.html +1 -1
  503. package/docs/functions/StrProperty.CalcOverhead.html +1 -1
  504. package/docs/functions/StrProperty.Parse.html +1 -1
  505. package/docs/functions/StrProperty.ReadValue.html +1 -1
  506. package/docs/functions/StrProperty.Serialize.html +1 -1
  507. package/docs/functions/StrProperty.SerializeValue.html +1 -1
  508. package/docs/functions/StrSetProperty.Parse.html +1 -1
  509. package/docs/functions/StrSetProperty.Serialize.html +1 -1
  510. package/docs/functions/StructArrayProperty.Parse.html +1 -1
  511. package/docs/functions/StructArrayProperty.Serialize.html +1 -1
  512. package/docs/functions/StructProperty.CalcOverhead.html +1 -1
  513. package/docs/functions/StructProperty.Parse.html +1 -1
  514. package/docs/functions/StructProperty.ParseValue.html +1 -1
  515. package/docs/functions/StructProperty.Serialize.html +1 -1
  516. package/docs/functions/StructProperty.SerializeValue.html +1 -1
  517. package/docs/functions/StructSetProperty.Parse.html +1 -1
  518. package/docs/functions/StructSetProperty.Serialize.html +1 -1
  519. package/docs/functions/TextArrayProperty.Parse.html +1 -1
  520. package/docs/functions/TextArrayProperty.Serialize.html +1 -1
  521. package/docs/functions/TextProperty.CalcOverhead.html +1 -1
  522. package/docs/functions/TextProperty.Parse.html +1 -1
  523. package/docs/functions/TextProperty.ReadValue.html +1 -1
  524. package/docs/functions/TextProperty.Serialize.html +1 -1
  525. package/docs/functions/TextProperty.SerializeValue.html +1 -1
  526. package/docs/functions/Transform.Parse.html +1 -1
  527. package/docs/functions/Transform.ParseF.html +1 -1
  528. package/docs/functions/Transform.Serialize.html +1 -1
  529. package/docs/functions/Transform.SerializeF.html +1 -1
  530. package/docs/functions/Uint32Property.CalcOverhead.html +1 -1
  531. package/docs/functions/Uint32Property.Parse.html +1 -1
  532. package/docs/functions/Uint32Property.ReadValue.html +1 -1
  533. package/docs/functions/Uint32Property.Serialize.html +1 -1
  534. package/docs/functions/Uint32Property.SerializeValue.html +1 -1
  535. package/docs/functions/Uint32SetProperty.Parse.html +1 -1
  536. package/docs/functions/Uint32SetProperty.Serialize.html +1 -1
  537. package/docs/functions/Uint64Property.CalcOverhead.html +1 -1
  538. package/docs/functions/Uint64Property.Parse.html +1 -1
  539. package/docs/functions/Uint64Property.ReadValue.html +1 -1
  540. package/docs/functions/Uint64Property.Serialize.html +1 -1
  541. package/docs/functions/Uint64Property.SerializeValue.html +1 -1
  542. package/docs/functions/Uint8Property.CalcOverhead.html +1 -1
  543. package/docs/functions/Uint8Property.Parse.html +1 -1
  544. package/docs/functions/Uint8Property.ReadValue.html +1 -1
  545. package/docs/functions/Uint8Property.Serialize.html +1 -1
  546. package/docs/functions/Uint8Property.SerializeValue.html +1 -1
  547. package/docs/functions/VehiclePhysicsData.Parse.html +1 -0
  548. package/docs/functions/VehiclePhysicsData.Serialize.html +1 -0
  549. package/docs/functions/VehicleSpecialProperties.Parse.html +1 -1
  550. package/docs/functions/VehicleSpecialProperties.Serialize.html +1 -1
  551. package/docs/functions/col4.ParseBGRA.html +1 -1
  552. package/docs/functions/col4.ParseRGBA.html +1 -1
  553. package/docs/functions/col4.SerializeBGRA.html +1 -1
  554. package/docs/functions/col4.SerializeRGBA.html +1 -1
  555. package/docs/functions/isArrayProperty.html +1 -1
  556. package/docs/functions/isBoolArrayProperty.html +1 -1
  557. package/docs/functions/isBoolProperty.html +1 -1
  558. package/docs/functions/isBuildableSubsystemSpecialProperties.html +1 -1
  559. package/docs/functions/isByteArrayProperty.html +1 -1
  560. package/docs/functions/isByteProperty.html +1 -1
  561. package/docs/functions/isCircuitSpecialProperties.html +1 -1
  562. package/docs/functions/isConveyorChainActorSpecialProperties.html +1 -1
  563. package/docs/functions/isConveyorSpecialProperties.html +1 -1
  564. package/docs/functions/isDoubleArrayProperty.html +1 -1
  565. package/docs/functions/isDoubleProperty.html +1 -1
  566. package/docs/functions/isEmptySpecialProperties.html +1 -1
  567. package/docs/functions/isEnumArrayProperty.html +1 -1
  568. package/docs/functions/isEnumProperty.html +1 -1
  569. package/docs/functions/isFloatArrayProperty.html +1 -1
  570. package/docs/functions/isFloatProperty.html +1 -1
  571. package/docs/functions/isInt32ArrayProperty.html +1 -1
  572. package/docs/functions/isInt32Property.html +1 -1
  573. package/docs/functions/isInt32SetProperty.html +1 -1
  574. package/docs/functions/isInt64ArrayProperty.html +1 -1
  575. package/docs/functions/isInt64Property.html +1 -1
  576. package/docs/functions/isInt8Property.html +1 -1
  577. package/docs/functions/isMapProperty.html +1 -1
  578. package/docs/functions/isObjectArrayProperty.html +1 -1
  579. package/docs/functions/isObjectProperty.html +1 -1
  580. package/docs/functions/isObjectSetProperty.html +1 -1
  581. package/docs/functions/isObjectsListSpecialProperties.html +1 -1
  582. package/docs/functions/isPlayerSpecialProperties.html +1 -1
  583. package/docs/functions/isPowerLineSpecialProperties.html +1 -1
  584. package/docs/functions/isSaveComponent.html +1 -1
  585. package/docs/functions/isSaveEntity.html +1 -1
  586. package/docs/functions/isSetProperty.html +1 -1
  587. package/docs/functions/isSoftObjectArrayProperty.html +1 -1
  588. package/docs/functions/isSpecialDroneActionProperties.html +1 -1
  589. package/docs/functions/isStrArrayProperty.html +1 -1
  590. package/docs/functions/isStrProperty.html +1 -1
  591. package/docs/functions/isStrSetProperty.html +1 -1
  592. package/docs/functions/isStructArrayProperty.html +1 -1
  593. package/docs/functions/isStructProperty.html +1 -1
  594. package/docs/functions/isStructSetProperty.html +1 -1
  595. package/docs/functions/isTextArrayProperty.html +1 -1
  596. package/docs/functions/isTextProperty.html +1 -1
  597. package/docs/functions/isUInt64Property.html +1 -1
  598. package/docs/functions/isUint32Property.html +1 -1
  599. package/docs/functions/isUint32SetProperty.html +1 -1
  600. package/docs/functions/isUint8Property.html +1 -1
  601. package/docs/functions/isVehicleSpecialProperties.html +1 -1
  602. package/docs/functions/vec2.Parse.html +1 -1
  603. package/docs/functions/vec2.ParseF.html +1 -1
  604. package/docs/functions/vec2.Serialize.html +1 -1
  605. package/docs/functions/vec2.SerializeF.html +1 -1
  606. package/docs/functions/vec3.Parse.html +1 -1
  607. package/docs/functions/vec3.ParseF.html +1 -1
  608. package/docs/functions/vec3.ParseInt.html +1 -1
  609. package/docs/functions/vec3.Serialize.html +1 -1
  610. package/docs/functions/vec3.SerializeF.html +1 -1
  611. package/docs/functions/vec3.SerializeInt.html +1 -1
  612. package/docs/functions/vec3.add.html +1 -1
  613. package/docs/functions/vec3.length.html +1 -1
  614. package/docs/functions/vec3.mult.html +1 -1
  615. package/docs/functions/vec3.norm.html +1 -1
  616. package/docs/functions/vec3.sub.html +1 -1
  617. package/docs/functions/vec4.Parse.html +1 -1
  618. package/docs/functions/vec4.ParseF.html +1 -1
  619. package/docs/functions/vec4.Serialize.html +1 -1
  620. package/docs/functions/vec4.SerializeF.html +1 -1
  621. package/docs/hierarchy.html +1 -1
  622. package/docs/index.html +34 -21
  623. package/docs/interfaces/Blueprint.html +2 -2
  624. package/docs/interfaces/BlueprintConfig-1.html +8 -0
  625. package/docs/interfaces/SaveComponentHeader.html +3 -2
  626. package/docs/interfaces/SaveEntityHeader.html +3 -2
  627. package/docs/interfaces/SaveObjectHeader.html +3 -2
  628. package/docs/modules/AbstractBaseProperty.html +1 -1
  629. package/docs/modules/ArrayProperty.html +1 -1
  630. package/docs/modules/BlueprintConfig.html +3 -0
  631. package/docs/modules/BlueprintHeader.html +3 -0
  632. package/docs/modules/BoolArrayProperty.html +1 -1
  633. package/docs/modules/BoolProperty.html +1 -1
  634. package/docs/modules/BuildableSubsystemSpecialProperties.html +1 -1
  635. package/docs/modules/BuildableTypeInstance.html +3 -0
  636. package/docs/modules/ByteArrayProperty.html +1 -1
  637. package/docs/modules/ByteProperty.html +1 -1
  638. package/docs/modules/CircuitSpecialProperties.html +1 -1
  639. package/docs/modules/ConveyorChainActorSpecialProperties.html +1 -1
  640. package/docs/modules/ConveyorSpecialProperties.html +1 -1
  641. package/docs/modules/DoubleArrayProperty.html +1 -1
  642. package/docs/modules/DoubleProperty.html +1 -1
  643. package/docs/modules/DynamicStructPropertyValue.html +1 -1
  644. package/docs/modules/EmptySpecialProperties.html +1 -1
  645. package/docs/modules/EnumArrayProperty.html +1 -1
  646. package/docs/modules/EnumProperty.html +1 -1
  647. package/docs/modules/FGDynamicStruct.html +3 -0
  648. package/docs/modules/FICFrameRange.html +1 -1
  649. package/docs/modules/FloatArrayProperty.html +1 -1
  650. package/docs/modules/FloatProperty.html +1 -1
  651. package/docs/modules/GUID.html +1 -1
  652. package/docs/modules/GUIDInfo.html +1 -1
  653. package/docs/modules/Int32ArrayProperty.html +1 -1
  654. package/docs/modules/Int32Property.html +1 -1
  655. package/docs/modules/Int32SetProperty.html +1 -1
  656. package/docs/modules/Int64ArrayProperty.html +1 -1
  657. package/docs/modules/Int64Property.html +1 -1
  658. package/docs/modules/Int8Property.html +1 -1
  659. package/docs/modules/Level.html +1 -1
  660. package/docs/modules/MD5Hash.html +1 -1
  661. package/docs/modules/MapProperty.html +1 -1
  662. package/docs/modules/ObjectArrayProperty.html +1 -1
  663. package/docs/modules/ObjectProperty.html +1 -1
  664. package/docs/modules/ObjectReference.html +2 -1
  665. package/docs/modules/ObjectSetProperty.html +1 -1
  666. package/docs/modules/ObjectsListSpecialProperties.html +1 -1
  667. package/docs/modules/PlayerSpecialProperties.html +1 -1
  668. package/docs/modules/PowerLineSpecialProperties.html +1 -1
  669. package/docs/modules/PropertiesList.html +1 -1
  670. package/docs/modules/SatisfactorySaveHeader.html +3 -0
  671. package/docs/modules/SaveBodyChunks.html +5 -0
  672. package/docs/modules/SetProperty.html +1 -1
  673. package/docs/modules/SoftObjectArrayProperty.html +1 -1
  674. package/docs/modules/SoftObjectReference.html +1 -1
  675. package/docs/modules/SpecialDroneActionProperties.html +1 -1
  676. package/docs/modules/SpecialProperties.html +1 -1
  677. package/docs/modules/StrArrayProperty.html +1 -1
  678. package/docs/modules/StrProperty.html +1 -1
  679. package/docs/modules/StrSetProperty.html +1 -1
  680. package/docs/modules/StructArrayProperty.html +1 -1
  681. package/docs/modules/StructProperty.html +1 -1
  682. package/docs/modules/StructSetProperty.html +1 -1
  683. package/docs/modules/TextArrayProperty.html +1 -1
  684. package/docs/modules/TextProperty.html +1 -1
  685. package/docs/modules/Transform.html +1 -1
  686. package/docs/modules/Uint32Property.html +1 -1
  687. package/docs/modules/Uint32SetProperty.html +1 -1
  688. package/docs/modules/Uint64Property.html +1 -1
  689. package/docs/modules/Uint8Property.html +1 -1
  690. package/docs/modules/VehiclePhysicsData.html +3 -0
  691. package/docs/modules/VehicleSpecialProperties.html +1 -1
  692. package/docs/modules/col4.html +1 -1
  693. package/docs/modules/vec2.html +1 -1
  694. package/docs/modules/vec3.html +1 -1
  695. package/docs/modules/vec4.html +1 -1
  696. package/docs/modules.html +31 -7
  697. package/docs/types/AbstractBaseProperty-1.html +1 -1
  698. package/docs/types/ArrayProperty.AvailableArrayPropertyTypes.html +1 -1
  699. package/docs/types/ArrayPropertyStructValueFields.html +1 -1
  700. package/docs/types/BasicMultipleStructPropertyValue.html +1 -1
  701. package/docs/types/BasicStructPropertyValue.html +1 -1
  702. package/docs/types/BlueprintHeader-1.html +1 -0
  703. package/docs/types/BoolArrayProperty-1.html +1 -1
  704. package/docs/types/BoolProperty-1.html +1 -1
  705. package/docs/types/BoxStructPropertyValue.html +1 -1
  706. package/docs/types/BuildableSubsystemSpecialProperties-1.html +1 -1
  707. package/docs/types/BuildableTypeInstance-1.html +1 -0
  708. package/docs/types/ByteArray4.html +1 -0
  709. package/docs/types/ByteArrayProperty-1.html +1 -1
  710. package/docs/types/ByteProperty-1.html +1 -1
  711. package/docs/types/BytePropertyValue.html +1 -1
  712. package/docs/types/ChunkCompressionInfo.html +1 -0
  713. package/docs/types/ChunkSummary.html +1 -0
  714. package/docs/types/CircuitSpecialProperties-1.html +1 -1
  715. package/docs/types/ClientIdentityInfo.html +1 -1
  716. package/docs/types/ConveyorChainActorSpecialProperties-1.html +1 -1
  717. package/docs/types/ConveyorChainSegmentSpecialProperties.html +1 -1
  718. package/docs/types/ConveyorItemSpecialProperties.html +1 -1
  719. package/docs/types/ConveyorSpecialProperties-1.html +1 -1
  720. package/docs/types/DoubleArrayProperty-1.html +1 -1
  721. package/docs/types/DoubleProperty-1.html +1 -1
  722. package/docs/types/DynamicStructPropertyValue-1.html +1 -1
  723. package/docs/types/EmptySpecialProperties-1.html +1 -1
  724. package/docs/types/EnumArrayProperty-1.html +1 -1
  725. package/docs/types/EnumProperty-1.html +1 -1
  726. package/docs/types/FGDynamicStruct-1.html +1 -0
  727. package/docs/types/FICFrameRange-1.html +1 -1
  728. package/docs/types/FICFrameRangeStructPropertyValue.html +1 -1
  729. package/docs/types/FloatArrayProperty-1.html +1 -1
  730. package/docs/types/FloatProperty-1.html +1 -1
  731. package/docs/types/GENERIC_MAP_KEY_TYPE.html +1 -1
  732. package/docs/types/GENERIC_MAP_VALUE_TYPE.html +1 -1
  733. package/docs/types/GENERIC_STRUCT_PROPERTY_VALUE.html +1 -1
  734. package/docs/types/GUID-1.html +1 -1
  735. package/docs/types/GUIDInfo-1.html +1 -1
  736. package/docs/types/Grids.html +1 -0
  737. package/docs/types/Int32ArrayProperty-1.html +1 -1
  738. package/docs/types/Int32Property-1.html +1 -1
  739. package/docs/types/Int32SetProperty-1.html +1 -1
  740. package/docs/types/Int64ArrayProperty-1.html +1 -1
  741. package/docs/types/Int64Property-1.html +1 -1
  742. package/docs/types/Int8Property-1.html +1 -1
  743. package/docs/types/InventoryItemStructPropertyValue.html +1 -1
  744. package/docs/types/Level-1.html +3 -1
  745. package/docs/types/Levels.html +1 -0
  746. package/docs/types/MAP_STRUCT_KEY_PROXY.html +1 -1
  747. package/docs/types/MD5Hash-1.html +1 -1
  748. package/docs/types/MapProperty-1.html +1 -1
  749. package/docs/types/ModData.html +1 -0
  750. package/docs/types/ObjectArrayProperty-1.html +1 -1
  751. package/docs/types/ObjectProperty-1.html +1 -1
  752. package/docs/types/ObjectReference-1.html +1 -1
  753. package/docs/types/ObjectSetProperty-1.html +1 -1
  754. package/docs/types/ObjectsListSpecialProperties-1.html +1 -1
  755. package/docs/types/PlayerSpecialProperties-1.html +1 -1
  756. package/docs/types/PowerLineSpecialProperties-1.html +1 -1
  757. package/docs/types/PropertiesMap.html +1 -1
  758. package/docs/types/RailroadTrackPositionStructPropertyValue.html +1 -1
  759. package/docs/types/RoughSaveVersion.html +1 -1
  760. package/docs/types/SatisfactoryModMetadata.html +1 -0
  761. package/docs/types/SatisfactorySaveHeader-1.html +1 -0
  762. package/docs/types/SaveBodyChunks-1.html +1 -0
  763. package/docs/types/SaveBodyValidation.html +1 -0
  764. package/docs/types/SetProperty.AvailableSetPropertyTypes.html +1 -1
  765. package/docs/types/SoftObjectArrayProperty-1.html +1 -1
  766. package/docs/types/SoftObjectReference-1.html +1 -1
  767. package/docs/types/SpecialDroneAction.html +1 -1
  768. package/docs/types/SpecialDroneActionProperties-1.html +1 -1
  769. package/docs/types/SpecialProperties.AvailableSpecialPropertiesTypes.html +1 -1
  770. package/docs/types/StrArrayProperty-1.html +1 -1
  771. package/docs/types/StrProperty-1.html +1 -1
  772. package/docs/types/StrSetProperty-1.html +1 -1
  773. package/docs/types/StructArrayProperty-1.html +1 -1
  774. package/docs/types/StructProperty-1.html +1 -1
  775. package/docs/types/StructSetProperty-1.html +1 -1
  776. package/docs/types/TextArrayProperty-1.html +1 -1
  777. package/docs/types/TextProperty-1.html +1 -1
  778. package/docs/types/TextPropertyValue.html +1 -1
  779. package/docs/types/Transform-1.html +1 -1
  780. package/docs/types/Uint32Property-1.html +1 -1
  781. package/docs/types/Uint32SetProperty-1.html +1 -1
  782. package/docs/types/Uint64Property-1.html +1 -1
  783. package/docs/types/Uint8Property-1.html +1 -1
  784. package/docs/types/VehiclePhysicsData-1.html +1 -0
  785. package/docs/types/VehicleSpecialProperties-1.html +1 -1
  786. package/docs/types/col4-1.html +1 -1
  787. package/docs/types/vec2-1.html +1 -1
  788. package/docs/types/vec3-1.html +1 -1
  789. package/docs/types/vec4-1.html +1 -1
  790. package/docs/variables/DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE.html +1 -0
  791. package/docs/variables/EDIT.html +1 -1
  792. package/docs/variables/SaveBodyChunks.HEADER_V1.html +1 -0
  793. package/docs/variables/SaveBodyChunks.HEADER_V2.html +1 -0
  794. package/package.json +3 -1
  795. package/docs/interfaces/BlueprintConfig.html +0 -6
  796. package/docs/interfaces/ModData.html +0 -4
  797. package/docs/interfaces/SatisfactoryModMetadata.html +0 -4
  798. package/docs/interfaces/SatisfactorySaveHeader.html +0 -18
  799. package/docs/types/BlueprintHeader.html +0 -1
  800. package/docs/types/BuildableTypeInstance.html +0 -1
@@ -1,7 +1,7 @@
1
- import { ByteReader } from "../../byte/byte-reader.class";
2
- import { ChunkCompressionInfo } from "../../file.types";
1
+ import { ContextReader } from '../../context/context-reader';
3
2
  import { Level } from './level.class';
4
- import { RoughSaveVersion, SatisfactorySaveHeader } from "./save.types";
3
+ import { ChunkCompressionInfo } from './save-body-chunks';
4
+ import { RoughSaveVersion } from './save.types';
5
5
  export declare const DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;
6
6
  export type ByteArray4 = [number, number, number, number];
7
7
  export type SaveBodyValidation = {
@@ -18,21 +18,23 @@ export type Grids = {
18
18
  };
19
19
  };
20
20
  };
21
- export declare class SaveReader extends ByteReader {
21
+ export declare class SaveReader extends ContextReader {
22
22
  onProgressCallback: (progress: number, msg?: string) => void;
23
- header: SatisfactorySaveHeader | undefined;
24
- compressionInfo: ChunkCompressionInfo;
25
23
  static readonly EPOCH_TICKS = 621355968000000000n;
26
- constructor(fileBuffer: ArrayBuffer, onProgressCallback?: (progress: number, msg?: string) => void);
24
+ constructor(fileBuffer: ArrayBufferLike, onProgressCallback?: (progress: number, msg?: string) => void);
27
25
  expect: (value: any, expected: any) => void;
28
- readHeader(): SatisfactorySaveHeader;
29
- static GetRoughSaveVersion: (saveVersion: number, headerTypeVersion: number) => RoughSaveVersion;
26
+ static GetRoughSaveVersion: (saveVersion: number) => RoughSaveVersion;
27
+ static IsGameVersionAtLeast_U1_1: (saveVersion: number) => boolean;
28
+ static IsGameVersionAtLeast_U1: (saveVersion: number) => boolean;
29
+ static IsGameVersionAtLeast_U8: (saveVersion: number) => boolean;
30
+ static IsGameVersionAtLeast_U6_U7: (saveVersion: number) => boolean;
30
31
  inflateChunks(): {
31
- concatenatedChunkLength: number;
32
- numChunks: number;
32
+ compressionInfo: ChunkCompressionInfo;
33
33
  };
34
34
  readSaveBodyHash: () => SaveBodyValidation;
35
35
  readGrids: () => Grids;
36
- readLevels(): Level[];
36
+ readLevels(): {
37
+ [levelName: string]: Level;
38
+ };
37
39
  }
38
40
  //# sourceMappingURL=save-reader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"save-reader.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save-reader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAExE,eAAO,MAAM,sCAAsC,KAAK,CAAC;AAEzD,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IACnB,CAAC,UAAU,EAAE,MAAM,GAAG;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE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D,MAAM,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;CAClB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IACnB,CAAC,UAAU,EAAE,MAAM,GAAG;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE;YACT,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;SACvB,CAAA;KACD,CAAA;CACD,CAAC;AACF,qBAAa,UAAW,SAAQ,aAAa;IAKI,kBAAkB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI;IAF5G,gBAAuB,WAAW,uBAAuB;gBAE7C,UAAU,EAAE,eAAe,EAAS,kBAAkB,GAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,IAAgB;IAIjH,MAAM,UAAW,GAAG,YAAY,GAAG,UAIxC;IAEF,OAAc,mBAAmB,gBAAiB,MAAM,KAAG,gBAAgB,CAYzE;IACF,OAAc,yBAAyB,gBAAiB,MAAM,aAA4E;IAC1I,OAAc,uBAAuB,gBAAiB,MAAM,aAA+C;IAC3G,OAAc,uBAAuB,gBAAiB,MAAM,aAAoD;IAChH,OAAc,0BAA0B,gBAAiB,MAAM,aAA6D;IAErH,aAAa,IAAI;QAAE,eAAe,EAAE,oBAAoB,CAAA;KAAE;IAoB1D,gBAAgB,QAAO,kBAAkB,CAsB9C;IAEK,SAAS,QAAO,KAAK,CAiC1B;IAEK,UAAU,IAAI;QAAE,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC;KAAE;CA2BpD"}
@@ -1,25 +1,17 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.SaveReader = exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = void 0;
7
- const pako_1 = __importDefault(require("pako"));
8
4
  const alignment_enum_1 = require("../../byte/alignment.enum");
9
- const byte_reader_class_1 = require("../../byte/byte-reader.class");
5
+ const context_reader_1 = require("../../context/context-reader");
10
6
  const parser_error_1 = require("../../error/parser.error");
11
- const MD5Hash_1 = require("../types/structs/MD5Hash");
12
7
  const level_class_1 = require("./level.class");
8
+ const save_body_chunks_1 = require("./save-body-chunks");
9
+ const save_custom_version_1 = require("./save-custom-version");
13
10
  exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;
14
- class SaveReader extends byte_reader_class_1.ByteReader {
11
+ class SaveReader extends context_reader_1.ContextReader {
15
12
  constructor(fileBuffer, onProgressCallback = () => { }) {
16
13
  super(fileBuffer, alignment_enum_1.Alignment.LITTLE_ENDIAN);
17
14
  this.onProgressCallback = onProgressCallback;
18
- this.compressionInfo = {
19
- packageFileTag: 0,
20
- maxUncompressedChunkContentSize: 0,
21
- chunkHeaderSize: exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE
22
- };
23
15
  this.expect = (value, expected) => {
24
16
  if (value !== expected) {
25
17
  console.warn(`Read a value that's usually ${expected}, but this time ${value}. Meaning unclear. Raise an issue or contact me if you want.`);
@@ -50,8 +42,8 @@ class SaveReader extends byte_reader_class_1.ByteReader {
50
42
  const childrenCount = this.readUint32();
51
43
  for (let i = 0; i < childrenCount; i++) {
52
44
  const levelInstanceName = this.readString();
53
- const cellBinHex = this.readUint32();
54
- grids[gridName].children[levelInstanceName] = cellBinHex;
45
+ const cellHash = this.readUint32();
46
+ grids[gridName].children[levelInstanceName] = cellHash;
55
47
  }
56
48
  };
57
49
  readGrid();
@@ -62,156 +54,62 @@ class SaveReader extends byte_reader_class_1.ByteReader {
62
54
  return grids;
63
55
  };
64
56
  }
65
- readHeader() {
66
- this.header = {
67
- saveHeaderType: 0,
68
- saveVersion: 0,
69
- buildVersion: 0,
70
- mapName: "DEFAULT",
71
- mapOptions: "",
72
- sessionName: "",
73
- playDurationSeconds: 0,
74
- saveDateTime: "0",
75
- sessionVisibility: 0
76
- };
77
- this.header.saveHeaderType = this.readInt32();
78
- this.header.saveVersion = this.readInt32();
79
- this.header.buildVersion = this.readInt32();
80
- this.header.mapName = this.readString();
81
- this.header.mapOptions = this.readString();
82
- this.header.sessionName = this.readString();
83
- this.header.playDurationSeconds = this.readInt32();
84
- const rawSaveDateTimeInTicks = this.readLong();
85
- const unixMilliseconds = (rawSaveDateTimeInTicks - SaveReader.EPOCH_TICKS) / 10000n;
86
- this.header.saveDateTime = unixMilliseconds.toString();
87
- this.header.sessionVisibility = this.readByte();
88
- if (this.header.saveHeaderType >= 7) {
89
- this.header.fEditorObjectVersion = this.readInt32();
90
- }
91
- if (this.header.saveHeaderType >= 8) {
92
- this.header.rawModMetadataString = this.readString();
93
- try {
94
- this.header.modMetadata = JSON.parse(this.header.rawModMetadataString);
95
- }
96
- catch (error) {
97
- }
98
- this.header.isModdedSave = this.readInt32();
99
- }
100
- if (this.header.saveHeaderType >= 10) {
101
- this.header.saveIdentifier = this.readString();
102
- }
103
- if (this.header.saveHeaderType >= 11) {
104
- this.header.partitionEnabledFlag = this.readInt32() === 1;
105
- }
106
- if (this.header.saveHeaderType >= 12) {
107
- this.header.consistencyHashBytes = MD5Hash_1.MD5Hash.read(this);
108
- }
109
- if (this.header.saveHeaderType >= 13) {
110
- this.header.creativeModeEnabled = this.readInt32() == 1;
111
- }
112
- if (this.header.saveVersion >= 21) {
113
- }
114
- else {
115
- throw new parser_error_1.UnsupportedVersionError("The save version is too old to support encoding currently. Save in newer game version.");
116
- }
117
- return this.header;
118
- }
119
57
  inflateChunks() {
120
- this.fileBuffer = this.fileBuffer.slice(this.currentByte);
121
- this.handledByte = 0;
58
+ const result = save_body_chunks_1.SaveBodyChunks.DecompressChunks(this.fileBuffer.slice(this.currentByte), this.alignment);
122
59
  this.currentByte = 0;
60
+ this.fileBuffer = result.uncompressedData.buffer;
123
61
  this.maxByte = this.fileBuffer.byteLength;
124
- let currentChunks = [];
125
- let totalUncompressedBodySize = 0;
126
- while (this.handledByte < this.maxByte) {
127
- let chunkHeader = new DataView(this.fileBuffer.slice(0, this.compressionInfo.chunkHeaderSize));
128
- this.currentByte = this.compressionInfo.chunkHeaderSize;
129
- this.handledByte += this.compressionInfo.chunkHeaderSize;
130
- if (this.compressionInfo.packageFileTag <= 0) {
131
- this.compressionInfo.packageFileTag = chunkHeader.getUint32(0, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
132
- }
133
- if (this.compressionInfo.maxUncompressedChunkContentSize <= 0) {
134
- this.compressionInfo.maxUncompressedChunkContentSize = chunkHeader.getInt32(8, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
135
- }
136
- const chunkCompressedLength = chunkHeader.getInt32(33, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
137
- const chunkUncompressedLength = chunkHeader.getInt32(25, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
138
- totalUncompressedBodySize += chunkUncompressedLength;
139
- const currentChunkSize = chunkCompressedLength;
140
- let currentChunk = this.fileBuffer.slice(this.currentByte, this.currentByte + currentChunkSize);
141
- this.handledByte += currentChunkSize;
142
- this.currentByte += currentChunkSize;
143
- this.fileBuffer = this.fileBuffer.slice(this.currentByte);
144
- this.currentByte = 0;
145
- try {
146
- let currentInflatedChunk = null;
147
- currentInflatedChunk = pako_1.default.inflate(currentChunk);
148
- currentChunks.push(currentInflatedChunk);
149
- }
150
- catch (err) {
151
- throw new parser_error_1.CompressionLibraryError("Failed to inflate compressed save data. " + err);
152
- }
153
- }
154
- let newChunkLength = currentChunks.map(cc => cc.length).reduce((prev, cur) => prev + cur);
155
- const bigWholeChunk = new Uint8Array(newChunkLength);
156
- let currentLength = 0;
157
- for (let i = 0; i < currentChunks.length; i++) {
158
- bigWholeChunk.set(currentChunks[i], currentLength);
159
- currentLength += currentChunks[i].length;
160
- }
161
- this.currentByte = 0;
162
- this.maxByte = bigWholeChunk.buffer.byteLength;
163
- this.bufferView = new DataView(bigWholeChunk.buffer);
164
- const dataLength = this.readInt32();
165
- if (totalUncompressedBodySize !== dataLength + 8) {
166
- throw new parser_error_1.CorruptSaveError(`Possibly corrupt. Indicated size of total save body (${dataLength + 8}) does not match the uncompressed real size of ${totalUncompressedBodySize}.`);
62
+ this.bufferView = new DataView(this.fileBuffer);
63
+ const totalBodyRestSize = this.readInt32();
64
+ if (result.uncompressedData.byteLength !== (totalBodyRestSize + (this.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5 ? 8 : 4))) {
65
+ throw new parser_error_1.CorruptSaveError(`Possibly corrupt. Indicated size of total save body (${totalBodyRestSize + 8}) does not match the uncompressed real size of ${result.uncompressedData.byteLength}.`);
167
66
  }
168
67
  return {
169
- concatenatedChunkLength: newChunkLength,
170
- numChunks: currentChunks.length
68
+ compressionInfo: result.compressionInfo
171
69
  };
172
70
  }
173
71
  readLevels() {
174
- if (!this.header) {
175
- throw new parser_error_1.ParserError('ParserError', 'Header must be set before objects can be read.');
72
+ if (!this.context.saveVersion || !this.context.saveHeaderType) {
73
+ throw new parser_error_1.ParserError('ParserError', 'Header and its context must be set before objects can be read.');
176
74
  }
177
- const roughSaveVersion = SaveReader.GetRoughSaveVersion(this.header.saveVersion, this.header.saveHeaderType);
75
+ const roughSaveVersion = SaveReader.GetRoughSaveVersion(this.context.saveVersion);
178
76
  if (roughSaveVersion === '<U6') {
179
- throw new parser_error_1.UnsupportedVersionError('Game Version < U6 is not supported.');
77
+ throw new parser_error_1.UnsupportedVersionError('Game Version < U6 is not supported in the parser. Please save the file in a newer game version.');
180
78
  }
181
- else if (roughSaveVersion === 'U6/U7') {
182
- throw new parser_error_1.UnsupportedVersionError('Game Version U6/U7 is not supported in this package version. Consider downgrading to the latest package version supporting it, which is 0.0.34');
183
- }
184
- else if (roughSaveVersion === 'U8') {
185
- throw new parser_error_1.UnsupportedVersionError('Game Version U8 is not supported in this package version. Consider downgrading to the latest package version supporting it, which is 0.3.7');
186
- }
187
- const levels = [];
79
+ const levels = {};
188
80
  const levelCount = this.readInt32();
189
81
  this.onProgressCallback(this.getBufferProgress(), `reading pack of ${levelCount + 1} levels.`);
190
82
  for (let i = 0; i <= levelCount; i++) {
191
- let levelSingleName = i === levelCount ? this.header.mapName : this.readString();
83
+ let levelSingleName = i === levelCount ? this.context.mapName : this.readString();
192
84
  if (i % 500 === 0) {
193
85
  this.onProgressCallback(this.getBufferProgress(), `reading level [${(i + 1)}/${(levelCount + 1)}] ${levelSingleName}`);
194
86
  }
195
- levels.push(level_class_1.Level.ReadLevel(this, levelSingleName, this.header.buildVersion));
87
+ levels[levelSingleName] = level_class_1.Level.ReadLevel(this, levelSingleName);
196
88
  }
197
- this.onProgressCallback(this.getBufferProgress(), 'finished parsing.');
198
89
  return levels;
199
90
  }
200
91
  }
201
92
  exports.SaveReader = SaveReader;
202
93
  SaveReader.EPOCH_TICKS = 621355968000000000n;
203
- SaveReader.GetRoughSaveVersion = (saveVersion, headerTypeVersion) => {
204
- if (saveVersion >= 46) {
205
- return 'U1.0+';
94
+ SaveReader.GetRoughSaveVersion = (saveVersion) => {
95
+ if (SaveReader.IsGameVersionAtLeast_U1_1(saveVersion)) {
96
+ return 'U1.1+';
97
+ }
98
+ else if (SaveReader.IsGameVersionAtLeast_U1(saveVersion)) {
99
+ return 'U1.0';
206
100
  }
207
- else if (headerTypeVersion >= 13) {
101
+ else if (SaveReader.IsGameVersionAtLeast_U8(saveVersion)) {
208
102
  return 'U8';
209
103
  }
210
- else if (saveVersion >= 29) {
104
+ else if (SaveReader.IsGameVersionAtLeast_U6_U7(saveVersion)) {
211
105
  return 'U6/U7';
212
106
  }
213
107
  else {
214
108
  return '<U6';
215
109
  }
216
110
  };
111
+ SaveReader.IsGameVersionAtLeast_U1_1 = (saveVersion) => saveVersion >= save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion;
112
+ SaveReader.IsGameVersionAtLeast_U1 = (saveVersion) => saveVersion >= save_custom_version_1.SaveCustomVersion.Version1;
113
+ SaveReader.IsGameVersionAtLeast_U8 = (saveVersion) => saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5;
114
+ SaveReader.IsGameVersionAtLeast_U6_U7 = (saveVersion) => saveVersion >= save_custom_version_1.SaveCustomVersion.AddedSublevelStreaming;
217
115
  //# sourceMappingURL=save-reader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"save-reader.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save-reader.ts"],"names":[],"mappings":";;;;;;AACA,gDAAwB;AACxB,8DAAsD;AACtD,oEAA0D;AAC1D,2DAA2H;AAE3H,sDAAmD;AACnD,+CAAsC;AAGzB,QAAA,sCAAsC,GAAG,EAAE,CAAC;AAoBzD,MAAa,UAAW,SAAQ,8BAAU;IAYzC,YAAY,UAAuB,EAAS,qBAA+D,GAAG,EAAE,GAAG,CAAC;QACnH,KAAK,CAAC,UAAU,EAAE,0BAAS,CAAC,aAAa,CAAC,CAAC;QADA,uBAAkB,GAAlB,kBAAkB,CAAsD;QAT7G,oBAAe,GAAyB;YAC9C,cAAc,EAAE,CAAC;YACjB,+BAA+B,EAAE,CAAC;YAClC,eAAe,EAAE,8CAAsC;SACvD,CAAC;QASK,WAAM,GAAG,CAAC,KAAU,EAAE,QAAa,EAAE,EAAE;YAC7C,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACxB,OAAO,CAAC,IAAI,CAAC,+BAA+B,QAAQ,mBAAmB,KAAK,8DAA8D,CAAC,CAAC;YAC7I,CAAC;QACF,CAAC,CAAC;QAkKK,qBAAgB,GAAG,GAAuB,EAAE;YAElD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;YAEjC,MAAM,yBAAyB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;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B,EAAE,EAAE,mBAAmB,CAAC,CAAC;QAEvE,OAAO,MAAM,CAAC;IACf,CAAC;;AAlRF,gCAmRC;AAzQuB,sBAAW,GAAG,mBAAmB,AAAtB,CAAuB;AA8E3C,8BAAmB,GAAG,CAAC,WAAmB,EAAE,iBAAyB,EAAoB,EAAE;IACxG,IAAI,WAAW,IAAI,EAAE,EAAE,CAAC;QACvB,OAAO,OAAO,CAAC;IAChB,CAAC;SAAM,IAAI,iBAAiB,IAAI,EAAE,EAAE,CAAC;QACpC,OAAO,IAAI,CAAC;IACb,CAAC;SAAM,IAAI,WAAW,IAAI,EAAE,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC;IAChB,CAAC;SAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,AAVgC,CAUhC","sourcesContent":["\nimport Pako from \"pako\";\nimport { Alignment } from \"../../byte/alignment.enum\";\nimport { ByteReader } from \"../../byte/byte-reader.class\";\nimport { CompressionLibraryError, CorruptSaveError, ParserError, UnsupportedVersionError } from \"../../error/parser.error\";\nimport { ChunkCompressionInfo } from \"../../file.types\";\nimport { MD5Hash } from '../types/structs/MD5Hash';\nimport { Level } from './level.class';\nimport { RoughSaveVersion, SatisfactorySaveHeader } from \"./save.types\";\n\nexport const DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;\n\nexport type ByteArray4 = [number, number, number, number];\n\nexport type SaveBodyValidation = {\n\tversion: number;\n\thash1: ByteArray4;\n\thash2: ByteArray4;\n}\n\nexport type Grids = {\n\t[parentName: string]: {\n\t\tcellSize: number;\n\t\tgridHash: number;\n\t\tchildren: {\n\t\t\t[name: string]: number;\t// children object contains names and their binary size.\n\t\t}\n\t}\n};\n\nexport class SaveReader extends ByteReader {\n\n\tpublic header: SatisfactorySaveHeader | undefined;\n\tpublic compressionInfo: ChunkCompressionInfo = {\n\t\tpackageFileTag: 0,\n\t\tmaxUncompressedChunkContentSize: 0,\n\t\tchunkHeaderSize: DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE\n\t};\n\n\t// the number of .net ticks at the unix epoch\n\tpublic static readonly EPOCH_TICKS = 621355968000000000n;\n\n\tconstructor(fileBuffer: ArrayBuffer, public onProgressCallback: (progress: number, msg?: string) => void = () => { }) {\n\t\tsuper(fileBuffer, Alignment.LITTLE_ENDIAN);\n\t}\n\n\tpublic expect = (value: any, expected: any) => {\n\t\tif (value !== expected) {\n\t\t\tconsole.warn(`Read a value that's usually ${expected}, but this time ${value}. Meaning unclear. Raise an issue or contact me if you want.`);\n\t\t}\n\t};\n\n\tpublic readHeader(): SatisfactorySaveHeader {\n\t\tthis.header = {\n\t\t\tsaveHeaderType: 0,\n\t\t\tsaveVersion: 0,\n\t\t\tbuildVersion: 0,\n\t\t\tmapName: \"DEFAULT\",\n\t\t\tmapOptions: \"\",\n\t\t\tsessionName: \"\",\n\t\t\tplayDurationSeconds: 0,\n\t\t\tsaveDateTime: \"0\",\n\t\t\tsessionVisibility: 0\n\t\t} as SatisfactorySaveHeader;\n\n\t\tthis.header.saveHeaderType = this.readInt32();\n\t\tthis.header.saveVersion = this.readInt32();\n\t\tthis.header.buildVersion = this.readInt32();\n\t\tthis.header.mapName = this.readString();\n\t\tthis.header.mapOptions = this.readString();\n\t\tthis.header.sessionName = this.readString();\n\t\tthis.header.playDurationSeconds = this.readInt32();\n\t\tconst rawSaveDateTimeInTicks = this.readLong();\t// in UTC it seems.\n\t\tconst unixMilliseconds = (rawSaveDateTimeInTicks - SaveReader.EPOCH_TICKS) / 10000n;\n\t\tthis.header.saveDateTime = unixMilliseconds.toString();\n\t\tthis.header.sessionVisibility = this.readByte();\n\n\t\tif (this.header.saveHeaderType >= 7) {\n\t\t\tthis.header.fEditorObjectVersion = this.readInt32();\n\t\t}\n\t\tif (this.header.saveHeaderType >= 8) {\n\t\t\tthis.header.rawModMetadataString = this.readString();\n\t\t\ttry {\n\t\t\t\tthis.header.modMetadata = JSON.parse(this.header.rawModMetadataString);\n\t\t\t} catch (error) {\n\t\t\t\t// ignore.\n\t\t\t}\n\t\t\tthis.header.isModdedSave = this.readInt32();\n\t\t}\n\n\t\t//10 is U7\n\t\tif (this.header.saveHeaderType >= 10) {\n\t\t\tthis.header.saveIdentifier = this.readString();\n\t\t}\n\n\t\t// U8 jumped directly to 13.\n\t\tif (this.header.saveHeaderType >= 11) {\n\t\t\tthis.header.partitionEnabledFlag = this.readInt32() === 1;\n\t\t}\n\n\t\tif (this.header.saveHeaderType >= 12) {\n\t\t\tthis.header.consistencyHashBytes = MD5Hash.read(this);\n\t\t}\n\n\t\t// 13 is U8 Experimental, Also First 1.0 Release\n\t\tif (this.header.saveHeaderType >= 13) {\n\t\t\tthis.header.creativeModeEnabled = this.readInt32() == 1;\n\t\t}\n\n\t\tif (this.header.saveVersion >= 21) {\n\t\t\t// all good, ready to read chunks now.\n\t\t} else {\n\t\t\tthrow new UnsupportedVersionError(\"The save version is too old to support encoding currently. Save in newer game version.\");\n\t\t}\n\n\t\treturn this.header;\n\t}\n\n\tpublic static GetRoughSaveVersion = (saveVersion: number, headerTypeVersion: number): RoughSaveVersion => {\n\t\tif (saveVersion >= 46) {\n\t\t\treturn 'U1.0+';\n\t\t} else if (headerTypeVersion >= 13) {\n\t\t\treturn 'U8';\n\t\t} else if (saveVersion >= 29) {\n\t\t\treturn 'U6/U7';\n\t\t} else {\n\t\t\treturn '<U6';\n\t\t}\n\t}\n\n\tpublic inflateChunks(): { concatenatedChunkLength: number, numChunks: number } {\n\n\t\t// free memory\n\t\tthis.fileBuffer = this.fileBuffer.slice(this.currentByte);\n\n\t\tthis.handledByte = 0;\n\t\tthis.currentByte = 0;\n\t\tthis.maxByte = this.fileBuffer.byteLength;\n\n\n\t\tlet currentChunks = [];\n\t\tlet totalUncompressedBodySize = 0;\n\n\t\t// read while we can handle\n\t\twhile (this.handledByte < this.maxByte) {\n\n\t\t\t// Read chunk info size...\n\t\t\tlet chunkHeader = new DataView(this.fileBuffer.slice(0, this.compressionInfo.chunkHeaderSize));\n\t\t\tthis.currentByte = this.compressionInfo.chunkHeaderSize;\n\t\t\tthis.handledByte += this.compressionInfo.chunkHeaderSize;\n\n\n\t\t\tif (this.compressionInfo.packageFileTag <= 0) {\n\t\t\t\t// Should always be 0xC1832A9E in LE\n\t\t\t\tthis.compressionInfo.packageFileTag = chunkHeader.getUint32(0, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\t\t}\n\t\t\tif (this.compressionInfo.maxUncompressedChunkContentSize <= 0) {\n\t\t\t\t// should always be 0x00000200 in LE\n\t\t\t\tthis.compressionInfo.maxUncompressedChunkContentSize = chunkHeader.getInt32(8, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\t\t}\n\n\t\t\tconst chunkCompressedLength = chunkHeader.getInt32(33, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tconst chunkUncompressedLength = chunkHeader.getInt32(25, this.alignment === Alignment.LITTLE_ENDIAN);\n\t\t\ttotalUncompressedBodySize += chunkUncompressedLength;\n\n\t\t\tconst currentChunkSize = chunkCompressedLength;\n\t\t\tlet currentChunk = this.fileBuffer.slice(this.currentByte, this.currentByte + currentChunkSize);\n\t\t\tthis.handledByte += currentChunkSize;\n\t\t\tthis.currentByte += currentChunkSize;\n\n\n\t\t\t// Free memory from previous chunk...\n\t\t\tthis.fileBuffer = this.fileBuffer.slice(this.currentByte);\n\t\t\tthis.currentByte = 0;\n\n\t\t\t// unzip current chunk\n\t\t\ttry {\n\t\t\t\tlet currentInflatedChunk = null;\n\t\t\t\tcurrentInflatedChunk = Pako.inflate(currentChunk);\n\t\t\t\tcurrentChunks.push(currentInflatedChunk);\n\t\t\t}\n\t\t\tcatch (err: any) {\n\t\t\t\tthrow new CompressionLibraryError(\"Failed to inflate compressed save data. \" + err);\n\t\t\t}\n\t\t}\n\n\t\t//TODO we can get rid of file buffer here.\n\n\t\t// Create one big chunk out of the little chunks\n\t\tlet newChunkLength = currentChunks.map<number>(cc => cc.length).reduce((prev, cur) => prev + cur);\n\t\tconst bigWholeChunk = new Uint8Array(newChunkLength);\n\t\tlet currentLength = 0;\n\t\tfor (let i = 0; i < currentChunks.length; i++) {\n\t\t\tbigWholeChunk.set(currentChunks[i], currentLength);\n\t\t\tcurrentLength += currentChunks[i].length;\n\t\t}\n\n\t\tthis.currentByte = 0;\n\t\tthis.maxByte = bigWholeChunk.buffer.byteLength;\n\t\tthis.bufferView = new DataView(bigWholeChunk.buffer);\n\n\t\tconst dataLength = this.readInt32();\n\t\tif (totalUncompressedBodySize !== dataLength + 8) {\n\t\t\tthrow new CorruptSaveError(`Possibly corrupt. Indicated size of total save body (${dataLength + 8}) does not match the uncompressed real size of ${totalUncompressedBodySize}.`);\n\t\t}\n\n\t\treturn {\n\t\t\tconcatenatedChunkLength: newChunkLength,\n\t\t\tnumChunks: currentChunks.length\n\t\t};\n\t}\n\n\tpublic readSaveBodyHash = (): SaveBodyValidation => {\n\n\t\tthis.expect(this.readInt32(), 0);\n\n\t\tconst saveBodyValidationVersion = this.readInt32();\t// seems constant, always 06 00 00 00\n\n\t\tthis.expect(this.readString(), 'None');\n\t\tthis.expect(this.readInt32(), 0);\n\n\t\t// binary len maybe? But its not binary length of just grids, must be grids + levels?\n\t\tconst hash1 = Array.from(this.readBytes(4)) as ByteArray4;\t// some weird binary hash - 67 21 E7 F7 / DC 7E 81 48 / 59 E4 1E 1B -- changes not when collecting a slug or dismantling an object. Grids havent changed. So it must depend on grid-related things.\n\n\t\tthis.expect(this.readInt32(), 1);\n\t\tthis.expect(this.readString(), 'None');\n\n\t\t// TODO: check\n\t\tconst hash2 = Array.from(this.readBytes(4)) as ByteArray4;\t// no idea, changes somehow when level content changes. So we save it for now. -- 8B 08 EB 00\n\n\t\treturn {\n\t\t\tversion: saveBodyValidationVersion,\n\t\t\thash1,\n\t\t\thash2\n\t\t} satisfies SaveBodyValidation;\n\t}\n\n\tpublic readGrids = (): Grids => {\n\t\tconst grids: Grids = {};\n\n\t\tconst readGrid = () => {\n\t\t\tconst gridName = this.readString();\n\t\t\tconst cellSize = this.readInt32();\n\t\t\tconst gridHash = this.readUint32();\n\t\t\tgrids[gridName] = { children: {}, cellSize, gridHash };\n\n\t\t\tconst childrenCount = this.readUint32();\n\t\t\tfor (let i = 0; i < childrenCount; i++) {\n\t\t\t\tconst levelInstanceName = this.readString();\n\t\t\t\tconst cellBinHex = this.readUint32();\n\t\t\t\tgrids[gridName].children[levelInstanceName] = cellBinHex;\n\t\t\t}\n\t\t};\n\n\t\t// main grid\n\t\treadGrid();\n\n\t\t// landscape grid\n\t\treadGrid();\n\n\t\t// exploration grid\n\t\treadGrid();\n\n\t\t// foliage grid\n\t\treadGrid();\n\n\t\t// hlod0\n\t\treadGrid();\n\n\t\treturn grids;\n\t}\n\n\tpublic readLevels(): Level[] {\n\n\t\tif (!this.header) {\n\t\t\tthrow new ParserError('ParserError', 'Header must be set before objects can be read.');\n\t\t}\n\n\t\t// guard save version\n\t\tconst roughSaveVersion = SaveReader.GetRoughSaveVersion(this.header.saveVersion, this.header.saveHeaderType);\n\t\tif (roughSaveVersion === '<U6') {\n\t\t\tthrow new UnsupportedVersionError('Game Version < U6 is not supported.');\n\t\t} else if (roughSaveVersion === 'U6/U7') {\n\t\t\tthrow new UnsupportedVersionError('Game Version U6/U7 is not supported in this package version. Consider downgrading to the latest package version supporting it, which is 0.0.34');\n\t\t} else if (roughSaveVersion === 'U8') {\n\t\t\tthrow new UnsupportedVersionError('Game Version U8 is not supported in this package version. Consider downgrading to the latest package version supporting it, which is 0.3.7');\n\t\t}\n\n\t\tconst levels: Level[] = [];\n\t\tconst levelCount = this.readInt32();\n\t\tthis.onProgressCallback(this.getBufferProgress(), `reading pack of ${levelCount + 1} levels.`);\n\n\t\tfor (let i = 0; i <= levelCount; i++) {\n\t\t\tlet levelSingleName = i === levelCount ? this.header.mapName : this.readString();\n\t\t\tif (i % 500 === 0) {\n\t\t\t\tthis.onProgressCallback(this.getBufferProgress(), `reading level [${(i + 1)}/${(levelCount + 1)}] ${levelSingleName}`);\n\t\t\t}\n\n\t\t\tlevels.push(Level.ReadLevel(this, levelSingleName, this.header.buildVersion));\n\t\t}\n\n\t\tthis.onProgressCallback(this.getBufferProgress(), 'finished parsing.');\n\n\t\treturn levels;\n\t}\n}\n\n\n\n"]}
1
+ {"version":3,"file":"save-reader.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save-reader.ts"],"names":[],"mappings":";;;AAAA,8DAAsD;AACtD,iEAA6D;AAC7D,2DAAkG;AAClG,+CAAsC;AACtC,yDAA0E;AAC1E,+DAA0D;AAI7C,QAAA,sCAAsC,GAAG,EAAE,CAAC;AAmBzD,MAAa,UAAW,SAAQ,8BAAa;IAK5C,YAAY,UAA2B,EAAS,qBAA+D,GAAG,EAAE,GAAG,CAAC;QACvH,KAAK,CAAC,UAAU,EAAE,0BAAS,CAAC,aAAa,CAAC,CAAC;QADI,uBAAkB,GAAlB,kBAAkB,CAAsD;QAIjH,WAAM,GAAG,CAAC,KAAU,EAAE,QAAa,EAAE,EAAE;YAC7C,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACxB,OAAO,CAAC,IAAI,CAAC,+BAA+B,QAAQ,mBAAmB,KAAK,8DAA8D,CAAC,CAAC;YAC7I,CAAC;QACF,CAAC,CAAC;QAwCK,qBAAgB,GAAG,GAAuB,EAAE;YAElD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;YAEjC,MAAM,yBAAyB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAEnD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC;YACvC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC;YAEjC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAe,CAAC;YAE1D,IAAI,CAAC,MAAM,CAAC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,CAAC,EAAE,CAAC;QAC5D,OAAO,IAAI,CAAC;IACb,CAAC;SAAM,IAAI,UAAU,CAAC,0BAA0B,CAAC,WAAW,CAAC,EAAE,CAAC;QAC/D,OAAO,OAAO,CAAC;IAChB,CAAC;SAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,AAZgC,CAY/B;AACY,oCAAyB,GAAG,CAAC,WAAmB,EAAE,EAAE,CAAC,WAAW,IAAI,uCAAiB,CAAC,qCAAqC,AAAlG,CAAmG;AAC5H,kCAAuB,GAAG,CAAC,WAAmB,EAAE,EAAE,CAAC,WAAW,IAAI,uCAAiB,CAAC,QAAQ,AAArE,CAAsE;AAC7F,kCAAuB,GAAG,CAAC,WAAmB,EAAE,EAAE,CAAC,WAAW,IAAI,uCAAiB,CAAC,aAAa,AAA1E,CAA2E;AAClG,qCAA0B,GAAG,CAAC,WAAmB,EAAE,EAAE,CAAC,WAAW,IAAI,uCAAiB,CAAC,sBAAsB,AAAnF,CAAoF","sourcesContent":["import { Alignment } from '../../byte/alignment.enum';\nimport { ContextReader } from '../../context/context-reader';\nimport { CorruptSaveError, ParserError, UnsupportedVersionError } from '../../error/parser.error';\nimport { Level } from './level.class';\nimport { ChunkCompressionInfo, SaveBodyChunks } from './save-body-chunks';\nimport { SaveCustomVersion } from './save-custom-version';\nimport { RoughSaveVersion } from './save.types';\n\n\nexport const DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 49;\n\nexport type ByteArray4 = [number, number, number, number];\n\nexport type SaveBodyValidation = {\n\tversion: number;\n\thash1: ByteArray4;\n\thash2: ByteArray4;\n}\n\nexport type Grids = {\n\t[parentName: string]: {\n\t\tcellSize: number;\n\t\tgridHash: number;\n\t\tchildren: {\n\t\t\t[name: string]: number;\t// children object contains names and their binary size.\n\t\t}\n\t}\n};\nexport class SaveReader extends ContextReader {\n\n\t// the number of .net ticks at the unix epoch\n\tpublic static readonly EPOCH_TICKS = 621355968000000000n;\n\n\tconstructor(fileBuffer: ArrayBufferLike, public onProgressCallback: (progress: number, msg?: string) => void = () => { }) {\n\t\tsuper(fileBuffer, Alignment.LITTLE_ENDIAN);\n\t}\n\n\tpublic expect = (value: any, expected: any) => {\n\t\tif (value !== expected) {\n\t\t\tconsole.warn(`Read a value that's usually ${expected}, but this time ${value}. Meaning unclear. Raise an issue or contact me if you want.`);\n\t\t}\n\t};\n\n\tpublic static GetRoughSaveVersion = (saveVersion: number): RoughSaveVersion => {\n\t\tif (SaveReader.IsGameVersionAtLeast_U1_1(saveVersion)) {\n\t\t\treturn 'U1.1+';\n\t\t} else if (SaveReader.IsGameVersionAtLeast_U1(saveVersion)) {\n\t\t\treturn 'U1.0';\n\t\t} else if (SaveReader.IsGameVersionAtLeast_U8(saveVersion)) {\n\t\t\treturn 'U8';\n\t\t} else if (SaveReader.IsGameVersionAtLeast_U6_U7(saveVersion)) {\n\t\t\treturn 'U6/U7';\n\t\t} else {\n\t\t\treturn '<U6';\n\t\t}\n\t};\n\tpublic static IsGameVersionAtLeast_U1_1 = (saveVersion: number) => saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion;\n\tpublic static IsGameVersionAtLeast_U1 = (saveVersion: number) => saveVersion >= SaveCustomVersion.Version1;\n\tpublic static IsGameVersionAtLeast_U8 = (saveVersion: number) => saveVersion >= SaveCustomVersion.UnrealEngine5;\t// Could be anywhere from UnrealEngine5 (37) to ResetBrokenBlueprintSplinnes (42)\n\tpublic static IsGameVersionAtLeast_U6_U7 = (saveVersion: number) => saveVersion >= SaveCustomVersion.AddedSublevelStreaming;\n\n\tpublic inflateChunks(): { compressionInfo: ChunkCompressionInfo } {\n\n\t\tconst result = SaveBodyChunks.DecompressChunks(this.fileBuffer.slice(this.currentByte), this.alignment);\n\n\t\t// reset on decompressed data.\n\t\tthis.currentByte = 0;\n\t\tthis.fileBuffer = result.uncompressedData.buffer;\n\t\tthis.maxByte = this.fileBuffer.byteLength;\n\t\tthis.bufferView = new DataView(this.fileBuffer);\n\n\t\tconst totalBodyRestSize = this.readInt32();\n\t\tif (result.uncompressedData.byteLength !== (totalBodyRestSize + (this.context.saveVersion >= SaveCustomVersion.UnrealEngine5 ? 8 : 4))) {\n\t\t\tthrow new CorruptSaveError(`Possibly corrupt. Indicated size of total save body (${totalBodyRestSize + 8}) does not match the uncompressed real size of ${result.uncompressedData.byteLength}.`);\n\t\t}\n\n\t\treturn {\n\t\t\tcompressionInfo: result.compressionInfo\n\t\t};\n\t}\n\n\tpublic readSaveBodyHash = (): SaveBodyValidation => {\n\n\t\tthis.expect(this.readInt32(), 0);\n\n\t\tconst saveBodyValidationVersion = this.readInt32(); // seems constant, always 06 00 00 00\n\n\t\tthis.expect(this.readString(), 'None');\n\t\tthis.expect(this.readInt32(), 0);\n\n\t\tconst hash1 = Array.from(this.readBytes(4)) as ByteArray4; // some weird binary hash - 67 21 E7 F7 / DC 7E 81 48 / 59 E4 1E 1B -- changes not when collecting a slug or dismantling an object. Grids havent changed. So it must depend on grid-related things.\n\n\t\tthis.expect(this.readInt32(), 1);\n\t\tthis.expect(this.readString(), 'None');\n\n\t\t// TODO: check\n\t\tconst hash2 = Array.from(this.readBytes(4)) as ByteArray4; // no idea, changes somehow when level content changes. So we save it for now. -- 8B 08 EB 00\n\n\t\treturn {\n\t\t\tversion: saveBodyValidationVersion,\n\t\t\thash1,\n\t\t\thash2\n\t\t} satisfies SaveBodyValidation;\n\t};\n\n\tpublic readGrids = (): Grids => {\n\t\tconst grids: Grids = {};\n\n\t\tconst readGrid = () => {\n\t\t\tconst gridName = this.readString();\n\t\t\tconst cellSize = this.readInt32();\n\t\t\tconst gridHash = this.readUint32();\n\t\t\tgrids[gridName] = { children: {}, cellSize, gridHash };\n\n\t\t\tconst childrenCount = this.readUint32();\n\t\t\tfor (let i = 0; i < childrenCount; i++) {\n\t\t\t\tconst levelInstanceName = this.readString();\n\t\t\t\tconst cellHash = this.readUint32();\n\t\t\t\tgrids[gridName].children[levelInstanceName] = cellHash;\n\t\t\t}\n\t\t};\n\n\t\t// main grid\n\t\treadGrid();\n\n\t\t// landscape grid\n\t\treadGrid();\n\n\t\t// exploration grid\n\t\treadGrid();\n\n\t\t// foliage grid\n\t\treadGrid();\n\n\t\t// hlod0\n\t\treadGrid();\n\n\t\treturn grids;\n\t};\n\n\tpublic readLevels(): { [levelName: string]: Level; } {\n\n\t\tif (!this.context.saveVersion || !this.context.saveHeaderType) {\n\t\t\tthrow new ParserError('ParserError', 'Header and its context must be set before objects can be read.');\n\t\t}\n\n\t\t// guard save version\n\t\tconst roughSaveVersion = SaveReader.GetRoughSaveVersion(this.context.saveVersion);\n\t\tif (roughSaveVersion === '<U6') {\n\t\t\tthrow new UnsupportedVersionError('Game Version < U6 is not supported in the parser. Please save the file in a newer game version.');\n\t\t}\n\n\t\tconst levels: { [levelName: string]: Level; } = {};\n\t\tconst levelCount = this.readInt32();\n\t\tthis.onProgressCallback(this.getBufferProgress(), `reading pack of ${levelCount + 1} levels.`);\n\n\t\tfor (let i = 0; i <= levelCount; i++) {\n\t\t\tlet levelSingleName = i === levelCount ? this.context.mapName! : this.readString();\n\t\t\tif (i % 500 === 0) {\n\t\t\t\tthis.onProgressCallback(this.getBufferProgress(), `reading level [${(i + 1)}/${(levelCount + 1)}] ${levelSingleName}`);\n\t\t\t}\n\n\t\t\tlevels[levelSingleName] = Level.ReadLevel(this, levelSingleName);\n\t\t}\n\n\t\treturn levels;\n\t}\n}\n\n\n"]}
@@ -1,15 +1,13 @@
1
1
  import { Alignment } from "../../byte/alignment.enum";
2
- import { ByteWriter } from "../../byte/byte-writer.class";
3
- import { ChunkCompressionInfo, ChunkSummary } from "../../file.types";
2
+ import { ContextWriter } from '../../context/context-writer';
4
3
  import { SatisfactorySave } from "./satisfactory-save";
5
- import { Grids, SaveBodyValidation } from "./save-reader";
6
- import { SatisfactorySaveHeader } from "./save.types";
7
- export declare class SaveWriter extends ByteWriter {
4
+ import { ChunkCompressionInfo, ChunkSummary } from "./save-body-chunks";
5
+ import { Grids, SaveBodyValidation } from './save-reader';
6
+ export declare class SaveWriter extends ContextWriter {
8
7
  constructor();
9
- static WriteHeader(writer: ByteWriter, header: SatisfactorySaveHeader): void;
10
- static WriteSaveBodyHash: (writer: ByteWriter, saveBodyValidation: SaveBodyValidation) => void;
11
- static WriteGrids: (writer: ByteWriter, grids: Grids) => void;
12
- static WriteLevels(writer: ByteWriter, save: SatisfactorySave, buildVersion: number): void;
8
+ static WriteSaveBodyHash: (writer: ContextWriter, saveBodyValidation: SaveBodyValidation) => void;
9
+ static WriteGrids: (writer: ContextWriter, grids: Grids) => void;
10
+ static WriteLevels(writer: ContextWriter, save: SatisfactorySave): void;
13
11
  static GenerateCompressedChunksFromData(bufferArray: ArrayBuffer, compressionInfo: ChunkCompressionInfo, onBinaryBeforeCompressing: (binary: ArrayBuffer) => void, onChunk: (chunk: Uint8Array) => void, alignment?: Alignment): ChunkSummary[];
14
12
  generateChunks(compressionInfo: ChunkCompressionInfo, posAfterHeader: number, onBinaryBeforeCompressing: (binary: ArrayBuffer) => void, onHeader: (header: Uint8Array) => void, onChunk: (chunk: Uint8Array) => void): ChunkSummary[];
15
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"save-writer.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save-writer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAA4B,MAAM,kBAAkB,CAAC;AAGhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAc,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGtD,qBAAa,UAAW,SAAQ,UAAU;;WAM3B,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EA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Y,aAAa,SAAS,KAAK,KAAG,IAAI,CAYpE;WAEY,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI;WAUhE,gCAAgC,CAC7C,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,oBAAoB,EACrC,yBAAyB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,EACxD,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACpC,SAAS,GAAE,SAAmC,GAC5C,YAAY,EAAE;IAKV,cAAc,CACpB,eAAe,EAAE,oBAAoB,EACrC,cAAc,EAAE,MAAM,EAEtB,yBAAyB,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,EACxD,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,EACtC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,GAClC,YAAY,EAAE;CAgBjB"}
@@ -1,113 +1,26 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.SaveWriter = void 0;
7
- const pako_1 = __importDefault(require("pako"));
8
4
  const alignment_enum_1 = require("../../byte/alignment.enum");
9
- const byte_writer_class_1 = require("../../byte/byte-writer.class");
5
+ const context_writer_1 = require("../../context/context-writer");
10
6
  const parser_error_1 = require("../../error/parser.error");
11
- const file_types_1 = require("../../file.types");
12
- const MD5Hash_1 = require("../types/structs/MD5Hash");
13
7
  const level_class_1 = require("./level.class");
14
- const save_reader_1 = require("./save-reader");
15
- class SaveWriter extends byte_writer_class_1.ByteWriter {
8
+ const save_body_chunks_1 = require("./save-body-chunks");
9
+ class SaveWriter extends context_writer_1.ContextWriter {
16
10
  constructor() {
17
11
  super(alignment_enum_1.Alignment.LITTLE_ENDIAN);
18
12
  }
19
- static WriteHeader(writer, header) {
20
- writer.writeInt32(header.saveHeaderType);
21
- writer.writeInt32(header.saveVersion);
22
- writer.writeInt32(header.buildVersion);
23
- writer.writeString(header.mapName);
24
- writer.writeString(header.mapOptions);
25
- writer.writeString(header.sessionName);
26
- writer.writeInt32(header.playDurationSeconds);
27
- writer.writeInt64(BigInt(header.saveDateTime) * 10000n + save_reader_1.SaveReader.EPOCH_TICKS);
28
- writer.writeByte(header.sessionVisibility);
29
- if (header.saveHeaderType >= 7) {
30
- writer.writeInt32(header.fEditorObjectVersion);
31
- }
32
- if (header.saveHeaderType >= 8) {
33
- if (header.modMetadata) {
34
- writer.writeString(JSON.stringify(header.modMetadata));
35
- }
36
- else {
37
- writer.writeString(header.rawModMetadataString);
38
- }
39
- writer.writeInt32(header.isModdedSave);
40
- }
41
- if (header.saveHeaderType >= 10) {
42
- writer.writeString(header.saveIdentifier);
43
- }
44
- if (header.saveHeaderType >= 11) {
45
- writer.writeInt32(header.partitionEnabledFlag ? 1 : 0);
46
- }
47
- if (header.saveHeaderType >= 12) {
48
- MD5Hash_1.MD5Hash.write(writer, header.consistencyHashBytes);
49
- }
50
- if (header.saveHeaderType >= 13) {
51
- writer.writeInt32(header.creativeModeEnabled ? 1 : 0);
52
- }
53
- if (header.saveVersion >= 21) {
54
- }
55
- else {
56
- throw new parser_error_1.UnsupportedVersionError("The save version is too old to be supported currently.");
57
- }
58
- }
59
- static WriteLevels(writer, save, buildVersion) {
60
- writer.writeInt32(save.levels.length - 1);
61
- for (const level of save.levels) {
13
+ static WriteLevels(writer, save) {
14
+ writer.writeInt32(Object.keys(save.levels).length - 1);
15
+ for (const level of Object.values(save.levels)) {
62
16
  if (level.name !== save.header.mapName) {
63
17
  writer.writeString(level.name);
64
18
  }
65
- level_class_1.Level.SerializeLevel(writer, level, buildVersion);
19
+ level_class_1.Level.SerializeLevel(writer, level);
66
20
  }
67
21
  }
68
22
  static GenerateCompressedChunksFromData(bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, alignment = alignment_enum_1.Alignment.LITTLE_ENDIAN) {
69
- const totalUncompressedSize = bufferArray.byteLength;
70
- const saveBody = new Uint8Array(bufferArray.byteLength + 8);
71
- saveBody.set(new Uint8Array(bufferArray), 4);
72
- const miniView = new DataView(saveBody.buffer);
73
- miniView.setInt32(0, totalUncompressedSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
74
- onBinaryBeforeCompressing(saveBody.buffer);
75
- let handledByte = 0;
76
- const chunkSummary = [];
77
- while (handledByte < saveBody.byteLength) {
78
- const uncompressedContentSize = Math.min(compressionInfo.maxUncompressedChunkContentSize, saveBody.byteLength - handledByte);
79
- const uncompressedChunk = saveBody.buffer.slice(handledByte, handledByte + uncompressedContentSize);
80
- let compressedChunk = new Uint8Array(0);
81
- try {
82
- compressedChunk = pako_1.default.deflate(uncompressedChunk);
83
- }
84
- catch (err) {
85
- throw new parser_error_1.CompressionLibraryError("Could not compress save data. " + err);
86
- }
87
- const chunk = new Uint8Array(compressionInfo.chunkHeaderSize + compressedChunk.byteLength);
88
- chunk.set(compressedChunk, compressionInfo.chunkHeaderSize);
89
- const view = new DataView(chunk.buffer);
90
- view.setInt32(0, compressionInfo.packageFileTag, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
91
- view.setInt32(4, 0x22222222, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
92
- view.setInt32(8, compressionInfo.maxUncompressedChunkContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
93
- view.setInt32(12, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
94
- view.setUint8(16, file_types_1.CompressionAlgorithmCode.ZLIB);
95
- view.setInt32(17, compressedChunk.byteLength, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
96
- view.setInt32(21, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
97
- view.setInt32(25, uncompressedContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
98
- view.setInt32(29, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
99
- view.setInt32(33, compressedChunk.byteLength, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
100
- view.setInt32(37, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
101
- view.setInt32(41, uncompressedContentSize, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
102
- view.setInt32(45, 0, alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN);
103
- onChunk(chunk);
104
- chunkSummary.push({
105
- uncompressedSize: uncompressedContentSize + compressionInfo.chunkHeaderSize,
106
- compressedSize: compressedChunk.byteLength + compressionInfo.chunkHeaderSize
107
- });
108
- handledByte += uncompressedContentSize;
109
- }
110
- return chunkSummary;
23
+ return save_body_chunks_1.SaveBodyChunks.CompressDataIntoChunks(bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, alignment);
111
24
  }
112
25
  generateChunks(compressionInfo, posAfterHeader, onBinaryBeforeCompressing, onHeader, onChunk) {
113
26
  if (posAfterHeader <= 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"save-writer.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save-writer.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,8DAAsD;AACtD,oEAA0D;AAC1D,2DAAyG;AACzG,iDAAgG;AAChG,sDAAmD;AACnD,+CAAsC;AAEtC,+CAAsE;AAItE,MAAa,UAAW,SAAQ,8BAAU;IAEzC;QACC,KAAK,CAAC,0BAAS,CAAC,aAAa,CAAC,CAAC;IAChC,CAAC;IAEM,MAAM,CAAC,WAAW,CAAC,MAAkB,EAAE,MAA8B;QAE3E,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACzC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACtC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAA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AAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,MAAM,CAAC,eAAe,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC,CAAA;AAEa,qBAAU,GAAG,CAAC,MAAkB,EAAE,KAAY,EAAQ,EAAE;IACrE,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QACzC,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAE1C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;QAChE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import Pako from \"pako\";\nimport { Alignment } from \"../../byte/alignment.enum\";\nimport { ByteWriter } from \"../../byte/byte-writer.class\";\nimport { CompressionLibraryError, ParserError, UnsupportedVersionError } from \"../../error/parser.error\";\nimport { ChunkCompressionInfo, ChunkSummary, CompressionAlgorithmCode } from \"../../file.types\";\nimport { MD5Hash } from '../types/structs/MD5Hash';\nimport { Level } from './level.class';\nimport { SatisfactorySave } from \"./satisfactory-save\";\nimport { Grids, SaveBodyValidation, SaveReader } from \"./save-reader\";\nimport { SatisfactorySaveHeader } from \"./save.types\";\n\n\nexport class SaveWriter extends ByteWriter {\n\n\tconstructor() {\n\t\tsuper(Alignment.LITTLE_ENDIAN);\n\t}\n\n\tpublic static WriteHeader(writer: ByteWriter, header: SatisfactorySaveHeader): void {\n\n\t\twriter.writeInt32(header.saveHeaderType);\n\t\twriter.writeInt32(header.saveVersion);\n\t\twriter.writeInt32(header.buildVersion);\n\t\twriter.writeString(header.mapName);\n\t\twriter.writeString(header.mapOptions);\n\t\twriter.writeString(header.sessionName);\n\t\twriter.writeInt32(header.playDurationSeconds);\n\t\twriter.writeInt64(BigInt(header.saveDateTime) * 10000n + SaveReader.EPOCH_TICKS);\n\t\twriter.writeByte(header.sessionVisibility);\n\n\t\tif (header.saveHeaderType >= 7) {\n\t\t\twriter.writeInt32(header.fEditorObjectVersion!);\n\t\t}\n\t\tif (header.saveHeaderType >= 8) {\n\t\t\tif (header.modMetadata) {\n\t\t\t\twriter.writeString(JSON.stringify(header.modMetadata));\n\t\t\t} else {\n\t\t\t\twriter.writeString(header.rawModMetadataString!);\n\t\t\t}\n\t\t\twriter.writeInt32(header.isModdedSave!);\n\t\t}\n\t\tif (header.saveHeaderType >= 10) {\n\t\t\twriter.writeString(header.saveIdentifier!);\n\t\t}\n\n\t\t// U8 jumped directly to 13.\n\t\tif (header.saveHeaderType >= 11) {\n\t\t\twriter.writeInt32(header.partitionEnabledFlag ? 1 : 0);\n\t\t}\n\n\t\tif (header.saveHeaderType >= 12) {\n\t\t\tMD5Hash.write(writer, header.consistencyHashBytes!);\n\t\t}\n\n\t\t// 13 is U8 Experimental First Release\n\t\tif (header.saveHeaderType >= 13) {\n\t\t\twriter.writeInt32(header.creativeModeEnabled ? 1 : 0);\n\t\t}\n\n\t\tif (header.saveVersion >= 21) {\n\t\t\t// ready to write levels now.\n\t\t} else {\n\t\t\tthrow new UnsupportedVersionError(\"The save version is too old to be supported currently.\");\n\t\t}\n\t}\n\n\tpublic static WriteSaveBodyHash = (writer: ByteWriter, saveBodyValidation: SaveBodyValidation): void => {\n\t\twriter.writeInt32(0);\n\t\twriter.writeInt32(saveBodyValidation.version);\n\t\twriter.writeString('None');\n\t\twriter.writeInt32(0);\n\t\twriter.writeBytesArray(saveBodyValidation.hash1);\n\t\twriter.writeInt32(1);\n\t\twriter.writeString('None');\n\t\twriter.writeBytesArray(saveBodyValidation.hash2);\n\t}\n\n\tpublic static WriteGrids = (writer: ByteWriter, grids: Grids): void => {\n\t\tfor (const gridEntry of Object.entries(grids)) {\n\t\t\twriter.writeString(gridEntry[0]);\n\t\t\twriter.writeInt32(gridEntry[1].cellSize);\n\t\t\twriter.writeUint32(gridEntry[1].gridHash);\n\n\t\t\twriter.writeUint32(Object.values(gridEntry[1].children).length);\n\t\t\tfor (const child of Object.entries(gridEntry[1].children)) {\n\t\t\t\twriter.writeString(child[0]);\n\t\t\t\twriter.writeUint32(child[1]);\n\t\t\t}\n\t\t}\n\t};\n\n\tpublic static WriteLevels(writer: ByteWriter, save: SatisfactorySave, buildVersion: number): void {\n\t\twriter.writeInt32(save.levels.length - 1);\n\t\tfor (const level of save.levels) {\n\t\t\tif (level.name !== save.header.mapName) {\n\t\t\t\twriter.writeString(level.name);\n\t\t\t}\n\t\t\tLevel.SerializeLevel(writer, level, buildVersion);\n\t\t}\n\t}\n\n\tpublic static GenerateCompressedChunksFromData(\n\t\tbufferArray: ArrayBuffer,\n\t\tcompressionInfo: ChunkCompressionInfo,\n\t\tonBinaryBeforeCompressing: (binary: ArrayBuffer) => void,\n\t\tonChunk: (chunk: Uint8Array) => void,\n\t\talignment: Alignment = Alignment.LITTLE_ENDIAN\n\t): ChunkSummary[] {\n\n\t\tconst totalUncompressedSize = bufferArray.byteLength;\n\n\t\tconst saveBody = new Uint8Array(bufferArray.byteLength + 8);\n\t\tsaveBody.set(new Uint8Array(bufferArray), 4);\n\t\tconst miniView = new DataView(saveBody.buffer);\n\t\tminiView.setInt32(0, totalUncompressedSize, alignment === Alignment.LITTLE_ENDIAN);\n\t\tonBinaryBeforeCompressing(saveBody.buffer);\n\n\t\t// collect slices of chunks with help of compression info for max chunk size\n\t\tlet handledByte = 0;\n\t\tconst chunkSummary: {\n\t\t\tuncompressedSize: number,\n\t\t\tcompressedSize: number\n\t\t}[] = [];\n\t\twhile (handledByte < saveBody.byteLength) {\n\n\t\t\t// create uncompressed chunk.\n\t\t\tconst uncompressedContentSize = Math.min(compressionInfo.maxUncompressedChunkContentSize, saveBody.byteLength - handledByte);\n\t\t\tconst uncompressedChunk = saveBody.buffer.slice(handledByte, handledByte + uncompressedContentSize);\n\n\t\t\t// deflate chunk while we're at it.\n\t\t\tlet compressedChunk: Uint8Array = new Uint8Array(0);\n\t\t\ttry {\n\t\t\t\tcompressedChunk = Pako.deflate(uncompressedChunk);\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tthrow new CompressionLibraryError(\"Could not compress save data. \" + err);\n\t\t\t}\n\n\t\t\tconst chunk = new Uint8Array(compressionInfo.chunkHeaderSize + compressedChunk.byteLength);\n\t\t\tchunk.set(compressedChunk, compressionInfo.chunkHeaderSize);\n\n\t\t\t// write header\n\t\t\tconst view = new DataView(chunk.buffer);\n\t\t\tview.setInt32(0, compressionInfo.packageFileTag, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(4, 0x22222222, alignment === Alignment.LITTLE_ENDIAN);\t\t//v1 header is 0x00000000, v2 is 0x22222222\n\t\t\tview.setInt32(8, compressionInfo.maxUncompressedChunkContentSize, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(12, 0, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setUint8(16, CompressionAlgorithmCode.ZLIB);\t// compression algo, came with U8, only present if header v2. Which means the header is actually 48 bytes long if header is not v2\n\t\t\tview.setInt32(17, compressedChunk.byteLength, alignment === Alignment.LITTLE_ENDIAN); // E0 3A 00 00 / 03 78 64 00\n\t\t\tview.setInt32(21, 0, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(25, uncompressedContentSize, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(29, 0, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(33, compressedChunk.byteLength, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(37, 0, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(41, uncompressedContentSize, alignment === Alignment.LITTLE_ENDIAN);\n\t\t\tview.setInt32(45, 0, alignment === Alignment.LITTLE_ENDIAN);\n\n\t\t\tonChunk(chunk);\n\t\t\tchunkSummary.push({\n\t\t\t\tuncompressedSize: uncompressedContentSize + compressionInfo.chunkHeaderSize,\n\t\t\t\tcompressedSize: compressedChunk.byteLength + compressionInfo.chunkHeaderSize\n\t\t\t});\n\t\t\thandledByte += uncompressedContentSize;\n\t\t}\n\n\t\treturn chunkSummary;\n\t}\n\n\tpublic generateChunks(\n\t\tcompressionInfo: ChunkCompressionInfo,\n\t\tposAfterHeader: number,\n\n\t\tonBinaryBeforeCompressing: (binary: ArrayBuffer) => void,\n\t\tonHeader: (header: Uint8Array) => void,\n\t\tonChunk: (chunk: Uint8Array) => void\n\t): ChunkSummary[] {\n\n\t\tif (posAfterHeader <= 0) {\n\t\t\tthrow new ParserError('ParserError', 'Seems like this buffer has no header. Please write the header first before you can generate chunks.');\n\t\t}\n\n\t\t// send plain header first.\n\t\tconst header = new Uint8Array(this.bufferArray.slice(0, posAfterHeader));\n\t\tonHeader(header);\n\n\t\t// create save body\n\t\tthis.bufferArray = this.bufferArray.slice(posAfterHeader);\n\t\tconst chunkSummary = SaveWriter.GenerateCompressedChunksFromData(this.bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, this.alignment);\n\n\t\treturn chunkSummary;\n\t}\n}\n"]}
1
+ {"version":3,"file":"save-writer.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save-writer.ts"],"names":[],"mappings":";;;AAAA,8DAAsD;AACtD,iEAA6D;AAC7D,2DAAuD;AACvD,+CAAsC;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,CAAC,CAAC;QAChE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7B,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import { Alignment } from \"../../byte/alignment.enum\";\nimport { ContextWriter } from '../../context/context-writer';\nimport { ParserError } from \"../../error/parser.error\";\nimport { Level } from './level.class';\nimport { SatisfactorySave } from \"./satisfactory-save\";\nimport { ChunkCompressionInfo, ChunkSummary, SaveBodyChunks } from \"./save-body-chunks\";\nimport { Grids, SaveBodyValidation } from './save-reader';\n\n\nexport class SaveWriter extends ContextWriter {\n\n\tconstructor() {\n\t\tsuper(Alignment.LITTLE_ENDIAN);\n\t}\n\n\tpublic static WriteSaveBodyHash = (writer: ContextWriter, saveBodyValidation: SaveBodyValidation): void => {\n\t\twriter.writeInt32(0);\n\t\twriter.writeInt32(saveBodyValidation.version);\n\t\twriter.writeString('None');\n\t\twriter.writeInt32(0);\n\t\twriter.writeBytesArray(saveBodyValidation.hash1);\n\t\twriter.writeInt32(1);\n\t\twriter.writeString('None');\n\t\twriter.writeBytesArray(saveBodyValidation.hash2);\n\t}\n\n\tpublic static WriteGrids = (writer: ContextWriter, grids: Grids): void => {\n\t\tfor (const gridEntry of Object.entries(grids)) {\n\t\t\twriter.writeString(gridEntry[0]);\n\t\t\twriter.writeInt32(gridEntry[1].cellSize);\n\t\t\twriter.writeUint32(gridEntry[1].gridHash);\n\n\t\t\twriter.writeUint32(Object.values(gridEntry[1].children).length);\n\t\t\tfor (const child of Object.entries(gridEntry[1].children)) {\n\t\t\t\twriter.writeString(child[0]);\n\t\t\t\twriter.writeUint32(child[1]);\n\t\t\t}\n\t\t}\n\t};\n\n\tpublic static WriteLevels(writer: ContextWriter, save: SatisfactorySave): void {\n\t\twriter.writeInt32(Object.keys(save.levels).length - 1);\n\t\tfor (const level of Object.values(save.levels)) {\n\t\t\tif (level.name !== save.header.mapName) {\n\t\t\t\twriter.writeString(level.name);\n\t\t\t}\n\t\t\tLevel.SerializeLevel(writer, level);\n\t\t}\n\t}\n\n\tpublic static GenerateCompressedChunksFromData(\n\t\tbufferArray: ArrayBuffer,\n\t\tcompressionInfo: ChunkCompressionInfo,\n\t\tonBinaryBeforeCompressing: (binary: ArrayBuffer) => void,\n\t\tonChunk: (chunk: Uint8Array) => void,\n\t\talignment: Alignment = Alignment.LITTLE_ENDIAN\n\t): ChunkSummary[] {\n\n\t\treturn SaveBodyChunks.CompressDataIntoChunks(bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, alignment);\n\t}\n\n\tpublic generateChunks(\n\t\tcompressionInfo: ChunkCompressionInfo,\n\t\tposAfterHeader: number,\n\n\t\tonBinaryBeforeCompressing: (binary: ArrayBuffer) => void,\n\t\tonHeader: (header: Uint8Array) => void,\n\t\tonChunk: (chunk: Uint8Array) => void\n\t): ChunkSummary[] {\n\n\t\tif (posAfterHeader <= 0) {\n\t\t\tthrow new ParserError('ParserError', 'Seems like this buffer has no header. Please write the header first before you can generate chunks.');\n\t\t}\n\n\t\t// send plain header first.\n\t\tconst header = new Uint8Array(this.bufferArray.slice(0, posAfterHeader));\n\t\tonHeader(header);\n\n\t\t// create save body\n\t\tthis.bufferArray = this.bufferArray.slice(posAfterHeader);\n\t\tconst chunkSummary = SaveWriter.GenerateCompressedChunksFromData(this.bufferArray, compressionInfo, onBinaryBeforeCompressing, onChunk, this.alignment);\n\n\t\treturn chunkSummary;\n\t}\n}\n"]}
@@ -1,32 +1,12 @@
1
- import { MD5Hash } from '../types/structs/MD5Hash';
2
- export interface ModData {
1
+ export type ModData = {
3
2
  Reference: string;
4
3
  Name: string;
5
4
  Version: string;
6
- }
7
- export interface SatisfactoryModMetadata {
5
+ };
6
+ export type SatisfactoryModMetadata = {
8
7
  Version: number;
9
8
  FullMapName: string;
10
9
  Mods: ModData[];
11
- }
12
- export interface SatisfactorySaveHeader {
13
- saveHeaderType: number;
14
- saveVersion: number;
15
- buildVersion: number;
16
- mapName: string;
17
- mapOptions: string;
18
- sessionName: string;
19
- playDurationSeconds: number;
20
- saveDateTime: string;
21
- sessionVisibility: number;
22
- rawModMetadataString?: string;
23
- modMetadata?: SatisfactoryModMetadata;
24
- isModdedSave?: number;
25
- saveIdentifier?: string;
26
- fEditorObjectVersion?: number;
27
- partitionEnabledFlag?: boolean;
28
- consistencyHashBytes?: MD5Hash;
29
- creativeModeEnabled?: boolean;
30
- }
31
- export type RoughSaveVersion = '<U6' | 'U6/U7' | 'U8' | 'U1.0+';
10
+ };
11
+ export type RoughSaveVersion = '<U6' | 'U6/U7' | 'U8' | 'U1.0' | 'U1.1+';
32
12
  //# sourceMappingURL=save.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"save.types.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,MAAM,WAAW,OAAO;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,EAAE,CAAC;CACnB;AAGD,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,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;AAGD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,CAAC"}
1
+ {"version":3,"file":"save.types.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save.types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAGD,MAAM,MAAM,uBAAuB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,EAAE,CAAC;CACnB,CAAA;AAGD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,OAAO,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"save.types.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MD5Hash } from '../types/structs/MD5Hash';\n\n/** @public */\nexport interface ModData {\n Reference: string;\n Name: string;\n Version: string;\n}\n\n/** @public */\nexport interface SatisfactoryModMetadata {\n Version: number;\n FullMapName: string;\n Mods: ModData[];\n}\n\n/** @public */\nexport interface SatisfactorySaveHeader {\n saveHeaderType: number;\n saveVersion: number;\n buildVersion: number;\n mapName: string;\n mapOptions: string;\n sessionName: string;\n playDurationSeconds: number;\n saveDateTime: string;\n sessionVisibility: number;\n rawModMetadataString?: string;\n modMetadata?: SatisfactoryModMetadata;\n isModdedSave?: number;\n saveIdentifier?: string;\n fEditorObjectVersion?: number;\n partitionEnabledFlag?: boolean;\n consistencyHashBytes?: MD5Hash;\n creativeModeEnabled?: boolean;\n}\n\n/** @public */\nexport type RoughSaveVersion = '<U6' | 'U6/U7' | 'U8' | 'U1.0+';"]}
1
+ {"version":3,"file":"save.types.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/save.types.ts"],"names":[],"mappings":"","sourcesContent":["\n/** @public */\nexport type ModData = {\n Reference: string;\n Name: string;\n Version: string;\n}\n\n/** @public */\nexport type SatisfactoryModMetadata = {\n Version: number;\n FullMapName: string;\n Mods: ModData[];\n}\n\n/** @public */\nexport type RoughSaveVersion = '<U6' | 'U6/U7' | 'U8' | 'U1.0' | 'U1.1+';"]}