libwz 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +165 -0
  3. package/binding.gyp +149 -0
  4. package/deps/tiny-aes/.github/workflows/c-cpp.yml +27 -0
  5. package/deps/tiny-aes/CMakeLists.txt +17 -0
  6. package/deps/tiny-aes/Makefile +61 -0
  7. package/deps/tiny-aes/README.md +83 -0
  8. package/deps/tiny-aes/aes.c +572 -0
  9. package/deps/tiny-aes/aes.h +91 -0
  10. package/deps/tiny-aes/aes.hpp +12 -0
  11. package/deps/tiny-aes/conanfile.py +73 -0
  12. package/deps/tiny-aes/library.json +19 -0
  13. package/deps/tiny-aes/library.properties +11 -0
  14. package/deps/tiny-aes/test.c +316 -0
  15. package/deps/tiny-aes/test.cpp +2 -0
  16. package/deps/tiny-aes/test_package/CMakeLists.txt +11 -0
  17. package/deps/tiny-aes/test_package/conanfile.py +17 -0
  18. package/deps/tiny-aes/unlicense.txt +24 -0
  19. package/deps/zlib/.cmake-format.yaml +245 -0
  20. package/deps/zlib/.github/workflows/c-std.yml +268 -0
  21. package/deps/zlib/.github/workflows/cmake.yml +147 -0
  22. package/deps/zlib/.github/workflows/configure.yml +146 -0
  23. package/deps/zlib/.github/workflows/contribs.yml +64 -0
  24. package/deps/zlib/.github/workflows/fuzz.yml +25 -0
  25. package/deps/zlib/.github/workflows/msys-cygwin.yml +92 -0
  26. package/deps/zlib/.github/workflows/others.yml +153 -0
  27. package/deps/zlib/BUILD.bazel +134 -0
  28. package/deps/zlib/CMakeLists.txt +310 -0
  29. package/deps/zlib/ChangeLog +1669 -0
  30. package/deps/zlib/FAQ +371 -0
  31. package/deps/zlib/INDEX +67 -0
  32. package/deps/zlib/LICENSE +22 -0
  33. package/deps/zlib/MODULE.bazel +9 -0
  34. package/deps/zlib/Makefile.in +426 -0
  35. package/deps/zlib/README +115 -0
  36. package/deps/zlib/README-cmake.md +79 -0
  37. package/deps/zlib/adler32.c +164 -0
  38. package/deps/zlib/amiga/Makefile.pup +69 -0
  39. package/deps/zlib/amiga/Makefile.sas +68 -0
  40. package/deps/zlib/compress.c +99 -0
  41. package/deps/zlib/configure +1078 -0
  42. package/deps/zlib/contrib/CMakeLists.txt +61 -0
  43. package/deps/zlib/contrib/README.contrib +57 -0
  44. package/deps/zlib/contrib/ada/CMakeLists.txt +217 -0
  45. package/deps/zlib/contrib/ada/buffer_demo.adb +106 -0
  46. package/deps/zlib/contrib/ada/cmake/Modules/CMakeADACompiler.cmake.in +23 -0
  47. package/deps/zlib/contrib/ada/cmake/Modules/CMakeADAInformation.cmake +133 -0
  48. package/deps/zlib/contrib/ada/cmake/Modules/CMakeDetermineADACompiler.cmake +33 -0
  49. package/deps/zlib/contrib/ada/cmake/Modules/CMakeTestADACompiler.cmake +46 -0
  50. package/deps/zlib/contrib/ada/cmake/binder_helper.cmake +47 -0
  51. package/deps/zlib/contrib/ada/cmake/compile_helper.cmake +32 -0
  52. package/deps/zlib/contrib/ada/cmake/exe_link_helper.cmake +53 -0
  53. package/deps/zlib/contrib/ada/cmake/shared_link_helper.cmake +52 -0
  54. package/deps/zlib/contrib/ada/cmake/static_link_helper.cmake +25 -0
  55. package/deps/zlib/contrib/ada/mtest.adb +156 -0
  56. package/deps/zlib/contrib/ada/read.adb +156 -0
  57. package/deps/zlib/contrib/ada/readme.txt +65 -0
  58. package/deps/zlib/contrib/ada/test.adb +463 -0
  59. package/deps/zlib/contrib/ada/zlib-streams.adb +225 -0
  60. package/deps/zlib/contrib/ada/zlib-streams.ads +114 -0
  61. package/deps/zlib/contrib/ada/zlib-thin.adb +142 -0
  62. package/deps/zlib/contrib/ada/zlib-thin.ads +450 -0
  63. package/deps/zlib/contrib/ada/zlib.adb +701 -0
  64. package/deps/zlib/contrib/ada/zlib.ads +328 -0
  65. package/deps/zlib/contrib/ada/zlib.gpr +20 -0
  66. package/deps/zlib/contrib/blast/CMakeLists.txt +166 -0
  67. package/deps/zlib/contrib/blast/Makefile +14 -0
  68. package/deps/zlib/contrib/blast/README +4 -0
  69. package/deps/zlib/contrib/blast/blast-test.c +42 -0
  70. package/deps/zlib/contrib/blast/blast.c +422 -0
  71. package/deps/zlib/contrib/blast/blast.h +84 -0
  72. package/deps/zlib/contrib/blast/blastConfig.cmake.in +18 -0
  73. package/deps/zlib/contrib/blast/test/CMakeLists.txt +193 -0
  74. package/deps/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in +27 -0
  75. package/deps/zlib/contrib/blast/test/add_subdirectory_test.cmake.in +25 -0
  76. package/deps/zlib/contrib/blast/test/find_package_no_components_test.cmake.in +24 -0
  77. package/deps/zlib/contrib/blast/test/find_package_test.cmake.in +24 -0
  78. package/deps/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in +24 -0
  79. package/deps/zlib/contrib/blast/test.pk +0 -0
  80. package/deps/zlib/contrib/blast/test.txt +1 -0
  81. package/deps/zlib/contrib/blast/tester.cmake +28 -0
  82. package/deps/zlib/contrib/crc32vx/CMakeLists.txt +67 -0
  83. package/deps/zlib/contrib/crc32vx/README +9 -0
  84. package/deps/zlib/contrib/crc32vx/crc32_vx.c +254 -0
  85. package/deps/zlib/contrib/crc32vx/crc32_vx_hooks.h +9 -0
  86. package/deps/zlib/contrib/delphi/ZLib.pas +557 -0
  87. package/deps/zlib/contrib/delphi/ZLibConst.pas +11 -0
  88. package/deps/zlib/contrib/delphi/readme.txt +76 -0
  89. package/deps/zlib/contrib/delphi/zlibd32.mak +99 -0
  90. package/deps/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
  91. package/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
  92. package/deps/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
  93. package/deps/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
  94. package/deps/zlib/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
  95. package/deps/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
  96. package/deps/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
  97. package/deps/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
  98. package/deps/zlib/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
  99. package/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
  100. package/deps/zlib/contrib/dotzlib/DotZLib.build +33 -0
  101. package/deps/zlib/contrib/dotzlib/DotZLib.chm +0 -0
  102. package/deps/zlib/contrib/dotzlib/DotZLib.sln +21 -0
  103. package/deps/zlib/contrib/dotzlib/LICENSE_1_0.txt +23 -0
  104. package/deps/zlib/contrib/dotzlib/readme.txt +58 -0
  105. package/deps/zlib/contrib/gcc_gvmat64/CMakeLists.txt +19 -0
  106. package/deps/zlib/contrib/gcc_gvmat64/gvmat64.S +570 -0
  107. package/deps/zlib/contrib/infback9/CMakeLists.txt +19 -0
  108. package/deps/zlib/contrib/infback9/README +1 -0
  109. package/deps/zlib/contrib/infback9/infback9.c +603 -0
  110. package/deps/zlib/contrib/infback9/infback9.h +37 -0
  111. package/deps/zlib/contrib/infback9/inffix9.h +107 -0
  112. package/deps/zlib/contrib/infback9/inflate9.h +47 -0
  113. package/deps/zlib/contrib/infback9/inftree9.c +319 -0
  114. package/deps/zlib/contrib/infback9/inftree9.h +61 -0
  115. package/deps/zlib/contrib/iostream/test.cpp +24 -0
  116. package/deps/zlib/contrib/iostream/zfstream.cpp +329 -0
  117. package/deps/zlib/contrib/iostream/zfstream.h +128 -0
  118. package/deps/zlib/contrib/iostream2/zstream.h +306 -0
  119. package/deps/zlib/contrib/iostream2/zstream_test.cpp +25 -0
  120. package/deps/zlib/contrib/iostream3/CMakeLists.txt +200 -0
  121. package/deps/zlib/contrib/iostream3/README +35 -0
  122. package/deps/zlib/contrib/iostream3/TODO +17 -0
  123. package/deps/zlib/contrib/iostream3/iostream3Config.cmake.in +23 -0
  124. package/deps/zlib/contrib/iostream3/test/CMakeLists.txt +191 -0
  125. package/deps/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in +27 -0
  126. package/deps/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in +25 -0
  127. package/deps/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in +24 -0
  128. package/deps/zlib/contrib/iostream3/test/find_package_test.cmake.in +24 -0
  129. package/deps/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in +24 -0
  130. package/deps/zlib/contrib/iostream3/test.cc +50 -0
  131. package/deps/zlib/contrib/iostream3/zfstream.cc +479 -0
  132. package/deps/zlib/contrib/iostream3/zfstream.h +466 -0
  133. package/deps/zlib/contrib/minizip/CMakeLists.txt +387 -0
  134. package/deps/zlib/contrib/minizip/LICENSE.Info-Zip +58 -0
  135. package/deps/zlib/contrib/minizip/Makefile +33 -0
  136. package/deps/zlib/contrib/minizip/Makefile.am +45 -0
  137. package/deps/zlib/contrib/minizip/MiniZip64_Changes.txt +6 -0
  138. package/deps/zlib/contrib/minizip/MiniZip64_info.txt +69 -0
  139. package/deps/zlib/contrib/minizip/configure.ac +32 -0
  140. package/deps/zlib/contrib/minizip/crypt.h +125 -0
  141. package/deps/zlib/contrib/minizip/ints.h +57 -0
  142. package/deps/zlib/contrib/minizip/ioapi.c +231 -0
  143. package/deps/zlib/contrib/minizip/ioapi.h +183 -0
  144. package/deps/zlib/contrib/minizip/iowin32.c +447 -0
  145. package/deps/zlib/contrib/minizip/iowin32.h +27 -0
  146. package/deps/zlib/contrib/minizip/make_vms.com +25 -0
  147. package/deps/zlib/contrib/minizip/miniunz.c +647 -0
  148. package/deps/zlib/contrib/minizip/miniunzip.1 +63 -0
  149. package/deps/zlib/contrib/minizip/minizip.1 +46 -0
  150. package/deps/zlib/contrib/minizip/minizip.c +511 -0
  151. package/deps/zlib/contrib/minizip/minizip.pc.in +13 -0
  152. package/deps/zlib/contrib/minizip/minizip.pc.txt +13 -0
  153. package/deps/zlib/contrib/minizip/minizipConfig.cmake.in +27 -0
  154. package/deps/zlib/contrib/minizip/mztools.c +294 -0
  155. package/deps/zlib/contrib/minizip/mztools.h +37 -0
  156. package/deps/zlib/contrib/minizip/skipset.h +366 -0
  157. package/deps/zlib/contrib/minizip/test/CMakeLists.txt +176 -0
  158. package/deps/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in +29 -0
  159. package/deps/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in +28 -0
  160. package/deps/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in +26 -0
  161. package/deps/zlib/contrib/minizip/test/find_package_test.cmake.in +26 -0
  162. package/deps/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in +26 -0
  163. package/deps/zlib/contrib/minizip/test/test_helper.cm +32 -0
  164. package/deps/zlib/contrib/minizip/unzip.c +1984 -0
  165. package/deps/zlib/contrib/minizip/unzip.h +442 -0
  166. package/deps/zlib/contrib/minizip/zip.c +2246 -0
  167. package/deps/zlib/contrib/minizip/zip.h +371 -0
  168. package/deps/zlib/contrib/nuget/nuget.csproj +45 -0
  169. package/deps/zlib/contrib/nuget/nuget.sln +22 -0
  170. package/deps/zlib/contrib/pascal/example.pas +599 -0
  171. package/deps/zlib/contrib/pascal/readme.txt +76 -0
  172. package/deps/zlib/contrib/pascal/zlibd32.mak +99 -0
  173. package/deps/zlib/contrib/pascal/zlibpas.pas +276 -0
  174. package/deps/zlib/contrib/puff/CMakeLists.txt +154 -0
  175. package/deps/zlib/contrib/puff/Makefile +42 -0
  176. package/deps/zlib/contrib/puff/README +63 -0
  177. package/deps/zlib/contrib/puff/bin-writer.c +26 -0
  178. package/deps/zlib/contrib/puff/puff.c +840 -0
  179. package/deps/zlib/contrib/puff/puff.h +35 -0
  180. package/deps/zlib/contrib/puff/puffConfig.cmake.in +18 -0
  181. package/deps/zlib/contrib/puff/pufftest.c +168 -0
  182. package/deps/zlib/contrib/puff/test/CMakeLists.txt +262 -0
  183. package/deps/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in +26 -0
  184. package/deps/zlib/contrib/puff/test/add_subdirectory_test.cmake.in +25 -0
  185. package/deps/zlib/contrib/puff/test/find_package_no_components_test.cmake.in +24 -0
  186. package/deps/zlib/contrib/puff/test/find_package_test.cmake.in +24 -0
  187. package/deps/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in +24 -0
  188. package/deps/zlib/contrib/puff/test/tester-cov.cmake +58 -0
  189. package/deps/zlib/contrib/puff/test/tester.cmake +16 -0
  190. package/deps/zlib/contrib/puff/zeros.raw +0 -0
  191. package/deps/zlib/contrib/testzlib/CMakeLists.txt +44 -0
  192. package/deps/zlib/contrib/testzlib/testzlib.c +275 -0
  193. package/deps/zlib/contrib/testzlib/testzlib.txt +10 -0
  194. package/deps/zlib/contrib/vstudio/readme.txt +22 -0
  195. package/deps/zlib/contrib/zlib1-dll/CMakeLists.txt +196 -0
  196. package/deps/zlib/contrib/zlib1-dll/readme.txt +21 -0
  197. package/deps/zlib/crc32.c +983 -0
  198. package/deps/zlib/crc32.h +9446 -0
  199. package/deps/zlib/deflate.c +2185 -0
  200. package/deps/zlib/deflate.h +383 -0
  201. package/deps/zlib/doc/algorithm.txt +209 -0
  202. package/deps/zlib/doc/crc-doc.1.0.pdf +0 -0
  203. package/deps/zlib/doc/rfc1950.txt +619 -0
  204. package/deps/zlib/doc/rfc1951.txt +955 -0
  205. package/deps/zlib/doc/rfc1952.txt +675 -0
  206. package/deps/zlib/doc/txtvsbin.txt +107 -0
  207. package/deps/zlib/examples/README.examples +54 -0
  208. package/deps/zlib/examples/enough.c +597 -0
  209. package/deps/zlib/examples/fitblk.c +233 -0
  210. package/deps/zlib/examples/gun.c +702 -0
  211. package/deps/zlib/examples/gzappend.c +504 -0
  212. package/deps/zlib/examples/gzjoin.c +449 -0
  213. package/deps/zlib/examples/gzlog.c +1061 -0
  214. package/deps/zlib/examples/gzlog.h +91 -0
  215. package/deps/zlib/examples/gznorm.c +474 -0
  216. package/deps/zlib/examples/zlib_how.html +550 -0
  217. package/deps/zlib/examples/zpipe.c +206 -0
  218. package/deps/zlib/examples/zran.c +546 -0
  219. package/deps/zlib/examples/zran.h +53 -0
  220. package/deps/zlib/gzclose.c +23 -0
  221. package/deps/zlib/gzguts.h +216 -0
  222. package/deps/zlib/gzlib.c +609 -0
  223. package/deps/zlib/gzread.c +668 -0
  224. package/deps/zlib/gzwrite.c +700 -0
  225. package/deps/zlib/infback.c +581 -0
  226. package/deps/zlib/inffast.c +321 -0
  227. package/deps/zlib/inffast.h +11 -0
  228. package/deps/zlib/inffixed.h +94 -0
  229. package/deps/zlib/inflate.c +1413 -0
  230. package/deps/zlib/inflate.h +126 -0
  231. package/deps/zlib/inftrees.c +424 -0
  232. package/deps/zlib/inftrees.h +64 -0
  233. package/deps/zlib/make_vms.com +867 -0
  234. package/deps/zlib/msdos/Makefile.bor +115 -0
  235. package/deps/zlib/msdos/Makefile.dj2 +104 -0
  236. package/deps/zlib/msdos/Makefile.emx +69 -0
  237. package/deps/zlib/msdos/Makefile.msc +112 -0
  238. package/deps/zlib/msdos/Makefile.tc +100 -0
  239. package/deps/zlib/os400/README400 +48 -0
  240. package/deps/zlib/os400/bndsrc +144 -0
  241. package/deps/zlib/os400/make.sh +383 -0
  242. package/deps/zlib/os400/zlibfixed.rpgle +578 -0
  243. package/deps/zlib/os400/zlibfree.rpgle +634 -0
  244. package/deps/zlib/qnx/package.qpg +141 -0
  245. package/deps/zlib/test/CMakeLists.txt +318 -0
  246. package/deps/zlib/test/add_subdirectory_exclude_test.cmake.in +29 -0
  247. package/deps/zlib/test/add_subdirectory_test.cmake.in +28 -0
  248. package/deps/zlib/test/example.c +552 -0
  249. package/deps/zlib/test/find_package_no_components_test.cmake.in +27 -0
  250. package/deps/zlib/test/find_package_test.cmake.in +27 -0
  251. package/deps/zlib/test/find_package_wrong_components_test.cmake.in +27 -0
  252. package/deps/zlib/test/infcover.c +672 -0
  253. package/deps/zlib/test/minigzip.c +592 -0
  254. package/deps/zlib/treebuild.xml +116 -0
  255. package/deps/zlib/trees.c +1119 -0
  256. package/deps/zlib/trees.h +128 -0
  257. package/deps/zlib/uncompr.c +101 -0
  258. package/deps/zlib/watcom/watcom_f.mak +43 -0
  259. package/deps/zlib/watcom/watcom_l.mak +43 -0
  260. package/deps/zlib/win32/DLL_FAQ.txt +381 -0
  261. package/deps/zlib/win32/Makefile.bor +109 -0
  262. package/deps/zlib/win32/Makefile.gcc +177 -0
  263. package/deps/zlib/win32/Makefile.msc +159 -0
  264. package/deps/zlib/win32/README-WIN32.txt +103 -0
  265. package/deps/zlib/win32/VisualC.txt +3 -0
  266. package/deps/zlib/win32/zlib.def +104 -0
  267. package/deps/zlib/win32/zlib1.rc +37 -0
  268. package/deps/zlib/zconf.h.in +551 -0
  269. package/deps/zlib/zlib.3 +149 -0
  270. package/deps/zlib/zlib.3.pdf +0 -0
  271. package/deps/zlib/zlib.h +2057 -0
  272. package/deps/zlib/zlib.map +116 -0
  273. package/deps/zlib/zlib.pc.cmakein +14 -0
  274. package/deps/zlib/zlib.pc.in +14 -0
  275. package/deps/zlib/zlibConfig.cmake.in +18 -0
  276. package/deps/zlib/zutil.c +313 -0
  277. package/deps/zlib/zutil.h +331 -0
  278. package/dist/index.d.ts +266 -0
  279. package/dist/index.js +1146 -0
  280. package/dist/libwz.js +5632 -0
  281. package/dist/libwz.wasm +0 -0
  282. package/include/wz/CRC32.h +182 -0
  283. package/include/wz/PngUtility.h +72 -0
  284. package/include/wz/PortalType.h +124 -0
  285. package/include/wz/Properties/WzBinaryProperty.h +70 -0
  286. package/include/wz/Properties/WzCanvasProperty.h +55 -0
  287. package/include/wz/Properties/WzConvexProperty.h +34 -0
  288. package/include/wz/Properties/WzDoubleProperty.h +32 -0
  289. package/include/wz/Properties/WzFloatProperty.h +30 -0
  290. package/include/wz/Properties/WzIntProperty.h +30 -0
  291. package/include/wz/Properties/WzLongProperty.h +30 -0
  292. package/include/wz/Properties/WzLuaProperty.h +31 -0
  293. package/include/wz/Properties/WzNullProperty.h +15 -0
  294. package/include/wz/Properties/WzPngProperty.h +53 -0
  295. package/include/wz/Properties/WzRawDataProperty.h +46 -0
  296. package/include/wz/Properties/WzShortProperty.h +31 -0
  297. package/include/wz/Properties/WzStringProperty.h +32 -0
  298. package/include/wz/Properties/WzSubProperty.h +35 -0
  299. package/include/wz/Properties/WzUOLProperty.h +44 -0
  300. package/include/wz/Properties/WzVectorProperty.h +40 -0
  301. package/include/wz/Properties/WzVideoProperty.h +43 -0
  302. package/include/wz/Result.h +58 -0
  303. package/include/wz/Util/Defines.h +16 -0
  304. package/include/wz/Util/ListFileParser.h +20 -0
  305. package/include/wz/Util/WzBinaryReader.h +95 -0
  306. package/include/wz/Util/WzBinaryWriter.h +72 -0
  307. package/include/wz/Util/WzBlobDataSource.h +30 -0
  308. package/include/wz/Util/WzDataSource.h +49 -0
  309. package/include/wz/Util/WzKeyGenerator.h +28 -0
  310. package/include/wz/Util/WzMutableKey.h +39 -0
  311. package/include/wz/Util/WzPath.h +37 -0
  312. package/include/wz/Util/WzStream.h +86 -0
  313. package/include/wz/Util/WzTool.h +42 -0
  314. package/include/wz/WzAESConstant.h +17 -0
  315. package/include/wz/WzDirectory.h +97 -0
  316. package/include/wz/WzEnums.h +76 -0
  317. package/include/wz/WzFile.h +99 -0
  318. package/include/wz/WzHeader.h +47 -0
  319. package/include/wz/WzImage.h +97 -0
  320. package/include/wz/WzImageProperty.h +92 -0
  321. package/include/wz/WzObject.h +55 -0
  322. package/include/wz/WzPropertyCollection.h +115 -0
  323. package/include/wz/wz.h +41 -0
  324. package/include/wz/wz_api.h +432 -0
  325. package/package.json +93 -0
  326. package/src/PngUtility.cpp +328 -0
  327. package/src/Properties/WzBinaryProperty.cpp +183 -0
  328. package/src/Properties/WzCanvasProperty.cpp +262 -0
  329. package/src/Properties/WzConvexProperty.cpp +159 -0
  330. package/src/Properties/WzDoubleProperty.cpp +12 -0
  331. package/src/Properties/WzFloatProperty.cpp +17 -0
  332. package/src/Properties/WzIntProperty.cpp +12 -0
  333. package/src/Properties/WzLongProperty.cpp +12 -0
  334. package/src/Properties/WzLuaProperty.cpp +37 -0
  335. package/src/Properties/WzNullProperty.cpp +11 -0
  336. package/src/Properties/WzPngProperty.cpp +637 -0
  337. package/src/Properties/WzRawDataProperty.cpp +116 -0
  338. package/src/Properties/WzShortProperty.cpp +12 -0
  339. package/src/Properties/WzStringProperty.cpp +44 -0
  340. package/src/Properties/WzSubProperty.cpp +129 -0
  341. package/src/Properties/WzUOLProperty.cpp +136 -0
  342. package/src/Properties/WzVectorProperty.cpp +22 -0
  343. package/src/Properties/WzVideoProperty.cpp +115 -0
  344. package/src/Util/ListFileParser.cpp +48 -0
  345. package/src/Util/WzBinaryReader.cpp +368 -0
  346. package/src/Util/WzBinaryWriter.cpp +305 -0
  347. package/src/Util/WzBlobDataSource.cpp +47 -0
  348. package/src/Util/WzDataSource.cpp +61 -0
  349. package/src/Util/WzKeyGenerator.cpp +43 -0
  350. package/src/Util/WzMutableKey.cpp +59 -0
  351. package/src/Util/WzStream.cpp +196 -0
  352. package/src/Util/WzTool.cpp +266 -0
  353. package/src/WzAESConstant.cpp +12 -0
  354. package/src/WzDirectory.cpp +669 -0
  355. package/src/WzEnums.cpp +20 -0
  356. package/src/WzFile.cpp +450 -0
  357. package/src/WzImage.cpp +350 -0
  358. package/src/WzImageProperty.cpp +469 -0
  359. package/src/WzObject.cpp +174 -0
  360. package/src/WzPropertyCollection.cpp +84 -0
  361. package/src/capi/wz_api.cpp +1996 -0
  362. package/src/node/binding.cpp +1776 -0
@@ -0,0 +1,49 @@
1
+ #ifndef WZ_UTIL_WZDATASOURCE_H_
2
+ #define WZ_UTIL_WZDATASOURCE_H_
3
+
4
+ #include <cstddef>
5
+ #include <cstdint>
6
+ #include <span>
7
+ #include <vector>
8
+
9
+ #include "wz/Result.h"
10
+ #include "wz/Util/WzStream.h"
11
+
12
+ namespace wz {
13
+
14
+ class WzDataSource {
15
+ public:
16
+ virtual ~WzDataSource() = default;
17
+ virtual Result<size_t> ReadAt(uint64_t offset,
18
+ std::span<uint8_t> destination) = 0;
19
+ virtual uint64_t Size() const = 0;
20
+ };
21
+
22
+ class WzFileDataSource final : public WzDataSource {
23
+ public:
24
+ explicit WzFileDataSource(WzFileStream* input);
25
+
26
+ Result<size_t> ReadAt(uint64_t offset,
27
+ std::span<uint8_t> destination) override;
28
+ uint64_t Size() const override;
29
+
30
+ private:
31
+ WzFileStream* input_ = nullptr;
32
+ uint64_t size_;
33
+ };
34
+
35
+ class WzMemoryDataSource final : public WzDataSource {
36
+ public:
37
+ explicit WzMemoryDataSource(std::vector<uint8_t> data);
38
+
39
+ Result<size_t> ReadAt(uint64_t offset,
40
+ std::span<uint8_t> destination) override;
41
+ uint64_t Size() const override;
42
+
43
+ private:
44
+ std::vector<uint8_t> data_;
45
+ };
46
+
47
+ } // namespace wz
48
+
49
+ #endif // WZ_UTIL_WZDATASOURCE_H_
@@ -0,0 +1,28 @@
1
+ #ifndef WZ_UTIL_WZKEYGENERATOR_H_
2
+ #define WZ_UTIL_WZKEYGENERATOR_H_
3
+ #include <array>
4
+ #include <cstdint>
5
+ #include <memory>
6
+ #include <vector>
7
+ #include "wz/Util/WzMutableKey.h"
8
+
9
+ namespace wz {
10
+
11
+ // MapleCryptoConstants - default user key (128 bytes as 32 DWORDs)
12
+ extern const std::array<uint8_t, 128> MAPLESTORY_USERKEY_DEFAULT;
13
+
14
+ // Trimmed user key: takes 128-byte key, extracts 32 bytes (every 16th byte =
15
+ // first byte of each DWORD)
16
+ std::array<uint8_t, 32> GetTrimmedUserKey(
17
+ const std::array<uint8_t, 128>& userKey);
18
+
19
+ class WzKeyGenerator {
20
+ public:
21
+ static WzMutableKey GenerateWzKey(const std::array<uint8_t, 4>& WzIv);
22
+ static WzMutableKey GenerateLuaWzKey();
23
+ static WzMutableKey GenerateWzKey(const std::array<uint8_t, 4>& WzIv,
24
+ const std::array<uint8_t, 128>& AesUserKey);
25
+ };
26
+
27
+ } // namespace wz
28
+ #endif // WZ_UTIL_WZKEYGENERATOR_H_
@@ -0,0 +1,39 @@
1
+ #ifndef WZ_UTIL_WZMUTABLEKEY_H_
2
+ #define WZ_UTIL_WZMUTABLEKEY_H_
3
+ #include <array>
4
+ #include <cstdint>
5
+ #include <vector>
6
+ #include "wz/Util/Defines.h"
7
+
8
+ namespace wz {
9
+
10
+ class WzMutableKey {
11
+ public:
12
+ static constexpr int BatchSize = 4096;
13
+
14
+ WzMutableKey(const std::array<uint8_t, 4>& iv,
15
+ const std::array<uint8_t, 32>& aesKey);
16
+ WZ_DISALLOW_COPY(WzMutableKey)
17
+ WzMutableKey(WzMutableKey&&) = default;
18
+ WzMutableKey& operator=(WzMutableKey&&) = default;
19
+
20
+ uint8_t operator[](size_t index) const;
21
+ std::vector<uint8_t> GetKeys()
22
+ const; // returns a copy of the first 4 bytes of the key (the IV key)
23
+
24
+ void EnsureKeySize(size_t size);
25
+
26
+ const std::array<uint8_t, 4>& Iv() const { return iv_; }
27
+ const std::array<uint8_t, 32>& AesKey() const { return aesKey_; }
28
+
29
+ bool operator==(const WzMutableKey& other) const;
30
+ bool operator!=(const WzMutableKey& other) const { return !(*this == other); }
31
+
32
+ private:
33
+ std::array<uint8_t, 4> iv_;
34
+ std::array<uint8_t, 32> aesKey_;
35
+ mutable std::vector<uint8_t> keys_;
36
+ };
37
+
38
+ } // namespace wz
39
+ #endif // WZ_UTIL_WZMUTABLEKEY_H_
@@ -0,0 +1,37 @@
1
+ #ifndef WZ_UTIL_WZPATH_H_
2
+ #define WZ_UTIL_WZPATH_H_
3
+
4
+ #include <filesystem>
5
+ #include <string>
6
+ #include "wz/Util/WzTool.h"
7
+
8
+ namespace wz {
9
+
10
+ // Converts a UTF-8 path string to std::filesystem::path.
11
+ // On Windows: MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS) first.
12
+ // - If valid UTF-8 → convert to wstring → fs::path(wstring).
13
+ // - If not valid UTF-8 (e.g. GBK on CJK Windows) → fall back to
14
+ // fs::path(string) which uses the system ANSI code page (CP_ACP).
15
+ // On non-Windows: fs::path(string) — natively UTF-8, no conversion needed.
16
+ inline std::filesystem::path to_path(const std::string& utf8_path) {
17
+ #ifdef _WIN32
18
+ return WzTool::ToPath(utf8_path);
19
+ #else
20
+ return std::filesystem::path(utf8_path);
21
+ #endif
22
+ }
23
+
24
+ inline std::filesystem::path to_path(std::string&& utf8_path) {
25
+ #ifdef _WIN32
26
+ return to_path(static_cast<const std::string&>(utf8_path));
27
+ #else
28
+ return std::filesystem::path(std::move(utf8_path));
29
+ #endif
30
+ }
31
+
32
+ inline std::filesystem::path to_path(const char* utf8_path) {
33
+ return to_path(std::string(utf8_path ? utf8_path : ""));
34
+ }
35
+
36
+ } // namespace wz
37
+ #endif // WZ_UTIL_WZPATH_H_
@@ -0,0 +1,86 @@
1
+ #ifndef WZ_UTIL_WZSTREAM_H_
2
+ #define WZ_UTIL_WZSTREAM_H_
3
+
4
+ #include <cstddef>
5
+ #include <cstdint>
6
+ #include <cstdio>
7
+ #include <filesystem>
8
+ #include <vector>
9
+
10
+ #include "wz/Util/Defines.h"
11
+
12
+ namespace wz {
13
+
14
+ enum class WzSeekOrigin {
15
+ Begin,
16
+ Current,
17
+ End,
18
+ };
19
+
20
+ class WzStream {
21
+ public:
22
+ virtual ~WzStream() = default;
23
+ virtual size_t Read(void* destination, size_t count) = 0;
24
+ virtual bool Write(const void* data, size_t count) = 0;
25
+ virtual bool Seek(int64_t offset, WzSeekOrigin origin) = 0;
26
+ virtual int64_t Position() const = 0;
27
+ virtual int64_t Size() const = 0;
28
+ virtual bool Flush() = 0;
29
+ virtual void Close() = 0;
30
+ virtual bool IsOpen() const = 0;
31
+
32
+ bool WriteByte(uint8_t value);
33
+ };
34
+
35
+ class WzFileStream final : public WzStream {
36
+ public:
37
+ WzFileStream() = default;
38
+ WzFileStream(const std::filesystem::path& path, const char* mode);
39
+ ~WzFileStream() override;
40
+
41
+ WZ_DISALLOW_COPY(WzFileStream)
42
+ WzFileStream(WzFileStream&& other) noexcept;
43
+ WzFileStream& operator=(WzFileStream&& other) noexcept;
44
+
45
+ bool Open(const std::filesystem::path& path, const char* mode);
46
+ void Close() override;
47
+ bool IsOpen() const override { return file_ != nullptr; }
48
+
49
+ size_t Read(void* destination, size_t count) override;
50
+ bool Write(const void* data, size_t count) override;
51
+ bool Seek(int64_t offset, WzSeekOrigin origin) override;
52
+ int64_t Position() const override;
53
+ int64_t Size() const override { return size_; }
54
+ bool Flush() override;
55
+
56
+ private:
57
+ FILE* file_ = nullptr;
58
+ int64_t size_ = 0;
59
+
60
+ bool RefreshSize();
61
+ };
62
+
63
+ class WzMemoryStream final : public WzStream {
64
+ public:
65
+ WzMemoryStream() = default;
66
+ explicit WzMemoryStream(std::vector<uint8_t> data);
67
+
68
+ size_t Read(void* destination, size_t count) override;
69
+ bool Write(const void* data, size_t count) override;
70
+ bool Seek(int64_t offset, WzSeekOrigin origin) override;
71
+ int64_t Position() const override { return position_; }
72
+ int64_t Size() const override { return static_cast<int64_t>(buffer_.size()); }
73
+ bool Flush() override { return true; }
74
+ void Close() override;
75
+ bool IsOpen() const override { return true; }
76
+ const std::vector<uint8_t>& Buffer() const { return buffer_; }
77
+ std::vector<uint8_t>& Buffer() { return buffer_; }
78
+
79
+ private:
80
+ std::vector<uint8_t> buffer_;
81
+ int64_t position_ = 0;
82
+ };
83
+
84
+ } // namespace wz
85
+
86
+ #endif // WZ_UTIL_WZSTREAM_H_
@@ -0,0 +1,42 @@
1
+ #ifndef WZ_UTIL_WZTOOL_H_
2
+ #define WZ_UTIL_WZTOOL_H_
3
+ #include <array>
4
+ #include <cstdint>
5
+
6
+ #ifdef _WIN32
7
+ #include <filesystem>
8
+ #endif
9
+
10
+ #include <string>
11
+ #include "wz/WzEnums.h"
12
+
13
+ namespace wz {
14
+
15
+ class WzTool {
16
+ public:
17
+ static constexpr int32_t WZ_HEADER = 0x31474B50;
18
+
19
+ #ifdef _WIN32
20
+ static std::filesystem::path ToPath(const std::string& utf8_path);
21
+ #endif
22
+ static uint32_t RotateLeft(uint32_t x, uint8_t n);
23
+ static uint32_t RotateRight(uint32_t x, uint8_t n);
24
+ static int GetCompressedIntLength(int i);
25
+ static int GetEncodedStringLength(const std::string& s);
26
+ static int GetWzObjectValueLength(const std::string& s, uint8_t type);
27
+ static void ClearWzObjectValueLengthCache();
28
+ static std::array<uint8_t, 4> GetIvByMapleVersion(WzMapleVersion ver);
29
+ static WzMapleVersion DetectMapleVersion(const std::string& wzFilePath,
30
+ int16_t* fileVersion);
31
+ static bool IsListFile(const std::string& path);
32
+ static bool IsDataWzHotfixFile(const std::string& path);
33
+
34
+ private:
35
+ static int GetRecognizedCharacters(const std::string& source);
36
+ static double GetDecryptionSuccessRate(const std::string& wzPath,
37
+ WzMapleVersion encVersion,
38
+ int16_t* version);
39
+ };
40
+
41
+ } // namespace wz
42
+ #endif // WZ_UTIL_WZTOOL_H_
@@ -0,0 +1,17 @@
1
+ #ifndef WZ_WZAESCONSTANT_H_
2
+ #define WZ_WZAESCONSTANT_H_
3
+ #include <array>
4
+ #include <cstdint>
5
+
6
+ namespace wz {
7
+
8
+ class WzAESConstant {
9
+ public:
10
+ static const std::array<uint8_t, 4> WZ_GMSIV;
11
+ static const std::array<uint8_t, 4> WZ_MSEAIV;
12
+ static const std::array<uint8_t, 4> WZ_BMSCLASSIC;
13
+ static const uint32_t WZ_OffsetConstant;
14
+ };
15
+
16
+ } // namespace wz
17
+ #endif // WZ_WZAESCONSTANT_H_
@@ -0,0 +1,97 @@
1
+ #ifndef WZ_WZDIRECTORY_H_
2
+ #define WZ_WZDIRECTORY_H_
3
+ #include <array>
4
+ #include <memory>
5
+ #include <string>
6
+ #include <vector>
7
+ #include "wz/Result.h"
8
+ #include "wz/Util/Defines.h"
9
+ #include "wz/Util/WzStream.h"
10
+ #include "wz/WzEnums.h"
11
+ #include "wz/WzObject.h"
12
+
13
+ namespace wz {
14
+
15
+ class WzBinaryReader;
16
+ class WzBinaryWriter;
17
+ class WzFile;
18
+ class WzImage;
19
+ class WzImageProperty;
20
+
21
+ class WzDirectory final : public WzObject {
22
+ public:
23
+ WzDirectory();
24
+ explicit WzDirectory(const std::string& dirName);
25
+ WzDirectory(WzBinaryReader* reader,
26
+ const std::string& dirName,
27
+ uint32_t verHash,
28
+ const std::array<uint8_t, 4>& wzIv,
29
+ WzFile* wzFile);
30
+ ~WzDirectory() override;
31
+
32
+ WZ_DISALLOW_COPY_AND_MOVE(WzDirectory)
33
+
34
+ WzObjectType ObjectType() const override { return WzObjectType::Directory; }
35
+ WzFile* WzFileParent() const override { return wzFile_; }
36
+ Result<std::unique_ptr<WzObject>> Remove() override;
37
+
38
+ int BlockSize() const { return size_; }
39
+ void SetBlockSize(int v) { size_ = v; }
40
+ int Checksum() const { return checksum_; }
41
+ void SetChecksum(int v) { checksum_ = v; }
42
+ int64_t Offset() const { return offset_; }
43
+ void SetOffset(int64_t v) { offset_ = v; }
44
+
45
+ std::vector<WzImage*> WzImages() const;
46
+ std::vector<WzDirectory*> WzDirectories() const;
47
+
48
+ WzBinaryReader* Reader() const { return reader_; }
49
+ void SetWzFile(WzFile* f) { wzFile_ = f; }
50
+
51
+ Result<void> ParseDirectory();
52
+ Result<void> ParseImages();
53
+
54
+ Result<void> AddImage(WzImage* img);
55
+ Result<void> AddImage(std::unique_ptr<WzImage> img);
56
+ Result<void> AddDirectory(WzDirectory* dir);
57
+ Result<void> AddDirectory(std::unique_ptr<WzDirectory> dir);
58
+ Result<WzDirectory*> CreateDirectory(const std::string& name);
59
+ Result<WzImage*> CreateImage(const std::string& name);
60
+ Result<std::unique_ptr<WzImage>> RemoveImage(WzImage* image);
61
+ Result<std::unique_ptr<WzDirectory>> RemoveDirectory(WzDirectory* dir);
62
+ void ClearImages();
63
+ void ClearDirectories();
64
+ WzImage* GetImageByName(const std::string& name);
65
+ WzDirectory* GetDirectoryByName(const std::string& name);
66
+ int CountImages() const;
67
+
68
+ WzObject* operator[](const std::string& name) const;
69
+
70
+ const std::array<uint8_t, 4>& WzIv() const { return wz_iv_; }
71
+ void SetWzIv(const std::array<uint8_t, 4>& iv);
72
+ uint32_t Hash() const { return hash_; }
73
+ void SetHash(uint32_t h);
74
+
75
+ Result<int> GenerateDataFile(const std::array<uint8_t, 4>* useIv,
76
+ bool isDefaultUserKey,
77
+ WzMemoryStream* tempStream);
78
+ Result<void> SaveDirectory(WzBinaryWriter* writer);
79
+ Result<void> SaveImages(WzBinaryWriter* writer, WzMemoryStream* tempStream);
80
+ Result<uint32_t> GetOffsets(uint32_t currentOffset);
81
+ Result<uint32_t> GetImgOffsets(uint32_t currentOffset);
82
+
83
+ private:
84
+ std::vector<std::unique_ptr<WzImage>> images_;
85
+ std::vector<std::unique_ptr<WzDirectory>> subDirs_;
86
+ WzBinaryReader* reader_ = nullptr;
87
+ int64_t offset_ = 0;
88
+ uint32_t hash_ = 0;
89
+ int size_ = 0;
90
+ int offsetSize_ = 0;
91
+ int checksum_ = 0;
92
+ std::array<uint8_t, 4> wz_iv_ = {};
93
+ WzFile* wzFile_ = nullptr;
94
+ };
95
+
96
+ } // namespace wz
97
+ #endif // WZ_WZDIRECTORY_H_
@@ -0,0 +1,76 @@
1
+ #ifndef WZ_WZENUMS_H_
2
+ #define WZ_WZENUMS_H_
3
+ #include <cstdint>
4
+ #include <string>
5
+
6
+ namespace wz {
7
+
8
+ enum class WzObjectType : int {
9
+ File = 0,
10
+ Image = 1,
11
+ Directory = 2,
12
+ Property = 3,
13
+ List = 4
14
+ };
15
+
16
+ enum class WzPropertyType : int {
17
+ Null = 0,
18
+ Short = 1,
19
+ Int = 2,
20
+ Long = 3,
21
+ Float = 4,
22
+ Double = 5,
23
+ String = 6,
24
+ SubProperty = 7,
25
+ Canvas = 8,
26
+ Vector = 9,
27
+ Convex = 10,
28
+ Sound = 11,
29
+ Raw = 12,
30
+ UOL = 13,
31
+ Lua = 14,
32
+ PNG = 15
33
+ };
34
+
35
+ enum class WzMapleVersion : int {
36
+ GMS = 0,
37
+ EMS = 1,
38
+ BMS = 2,
39
+ CLASSIC = 3,
40
+ GENERATE = 4,
41
+ GETFROMZLZ = 5,
42
+ CUSTOM = 6,
43
+ UNKNOWN = 99
44
+ };
45
+
46
+ enum class WzPngFormat : int {
47
+ Format1 = 1,
48
+ Format2 = 2,
49
+ Format3 = 3,
50
+ Format257 = 257,
51
+ Format513 = 513,
52
+ Format517 = 517,
53
+ Format1026 = 1026,
54
+ Format2050 = 2050
55
+ };
56
+
57
+ enum class WzDirectoryType : uint8_t {
58
+ UnknownType_1 = 1,
59
+ RetrieveStringFromOffset_2 = 2,
60
+ WzDirectory_3 = 3,
61
+ WzImage_4 = 4
62
+ };
63
+
64
+ enum class WzFileParseStatus : int {
65
+ Path_Is_Null = -1,
66
+ Error_Game_Ver_Hash = -2,
67
+ Failed_Unknown = 0,
68
+ Success = 1
69
+ };
70
+
71
+ enum class WzBinaryPropertyType : int { Raw = 0, MP3 = 1, WAV = 2 };
72
+
73
+ std::string GetErrorDescription(WzFileParseStatus status);
74
+
75
+ } // namespace wz
76
+ #endif // WZ_WZENUMS_H_
@@ -0,0 +1,99 @@
1
+ #ifndef WZ_WZFILE_H_
2
+ #define WZ_WZFILE_H_
3
+ #include <array>
4
+ #include <memory>
5
+ #include <optional>
6
+ #include <string>
7
+ #include <unordered_map>
8
+ #include <vector>
9
+ #include "wz/Util/Defines.h"
10
+ #include "wz/Util/WzBinaryReader.h"
11
+ #include "wz/Util/WzDataSource.h"
12
+ #include "wz/Util/WzStream.h"
13
+ #include "wz/WzDirectory.h"
14
+ #include "wz/WzEnums.h"
15
+ #include "wz/WzHeader.h"
16
+ #include "wz/WzObject.h"
17
+
18
+ namespace wz {
19
+
20
+ class IPropertyContainer;
21
+
22
+ class WzFile final : public WzObject {
23
+ public:
24
+ WzFile(short gameVersion, WzMapleVersion version);
25
+ WzFile(const std::string& filePath, WzMapleVersion version);
26
+ WzFile(const std::string& filePath,
27
+ short gameVersion,
28
+ WzMapleVersion version);
29
+ WzFile(const std::string& fileName,
30
+ std::shared_ptr<WzDataSource> source,
31
+ short gameVersion,
32
+ WzMapleVersion version);
33
+ WzFile(const std::string& filePath, const std::array<uint8_t, 4>& wzIv);
34
+ WzFile(const std::string& fileName,
35
+ std::shared_ptr<WzDataSource> source,
36
+ const std::array<uint8_t, 4>& wzIv);
37
+ ~WzFile() override;
38
+
39
+ WZ_DISALLOW_COPY_AND_MOVE(WzFile)
40
+
41
+ WzObjectType ObjectType() const override { return WzObjectType::File; }
42
+ WzObject* Parent() const override { return nullptr; }
43
+ void SetParent(WzObject*) override {}
44
+ WzFile* WzFileParent() const override { return const_cast<WzFile*>(this); }
45
+
46
+ WzDirectory* GetWzDirectory() const { return wzDir_.get(); }
47
+ void SetWzDirectory(std::unique_ptr<WzDirectory> dir) {
48
+ wzDir_ = std::move(dir);
49
+ }
50
+
51
+ WzHeader* Header() { return &header_; }
52
+ short Version() const { return mapleStoryPatchVersion_; }
53
+ std::string FilePath() const { return path_; }
54
+ WzMapleVersion MapleVersion() const { return maplepLocalVersion_; }
55
+ bool Is64BitWzFile() const { return !wz_withEncryptVersionHeader_; }
56
+ bool IsUnloaded() const { return isUnloaded_; }
57
+
58
+ const std::array<uint8_t, 4>& WzIv() const { return wz_iv_; }
59
+ uint32_t VersionHash() const { return versionHash_; }
60
+
61
+ WzFileParseStatus ParseWzFile();
62
+ WzObject* GetObjectFromPath(const std::string& path,
63
+ bool checkFirstDirectoryName = true);
64
+ Result<void> SaveToDisk(
65
+ const std::string& path,
66
+ std::optional<bool> saveAs64Bit = std::nullopt,
67
+ WzMapleVersion preferredVersion = WzMapleVersion::UNKNOWN);
68
+
69
+ private:
70
+ static WzObject* TraverseComponent(WzObject* curObj,
71
+ const std::string& component);
72
+ static constexpr uint16_t wzVersionHeader64bit_start = 770;
73
+ void CreateWZVersionHash();
74
+
75
+ std::string path_;
76
+ std::shared_ptr<WzDataSource> source_;
77
+ std::unique_ptr<WzDirectory> wzDir_;
78
+ WzFileStream fileStream_;
79
+ std::optional<WzBinaryReader> fileReader_;
80
+ WzHeader header_;
81
+ uint16_t wzVersionHeader_ = 0;
82
+ uint32_t versionHash_ = 0;
83
+ short mapleStoryPatchVersion_ = 0;
84
+ WzMapleVersion maplepLocalVersion_ = WzMapleVersion::UNKNOWN;
85
+ bool wz_withEncryptVersionHeader_ = true;
86
+ std::array<uint8_t, 4> wz_iv_ = {};
87
+ bool isUnloaded_ = false;
88
+
89
+ WzFileParseStatus ParseMainWzDirectory();
90
+ void Check64BitClient(WzBinaryReader* reader);
91
+ bool TryDecodeWithWZVersionNumber(WzBinaryReader* reader,
92
+ int useWzVersionHeader,
93
+ int useMapleStoryPatchVersion);
94
+ static uint32_t CheckAndGetVersionHash(int wzVersionHeader,
95
+ int maplestoryPatchVersion);
96
+ };
97
+
98
+ } // namespace wz
99
+ #endif // WZ_WZFILE_H_
@@ -0,0 +1,47 @@
1
+ #ifndef WZ_WZHEADER_H_
2
+ #define WZ_WZHEADER_H_
3
+ #include <cstdint>
4
+ #include <string>
5
+
6
+ namespace wz {
7
+
8
+ class WzHeader {
9
+ public:
10
+ static constexpr const char* DEFAULT_WZ_HEADER_COPYRIGHT =
11
+ "Package file v1.0 Copyright 2002 Wizet, ZMS";
12
+
13
+ std::string Ident() const { return ident_; }
14
+ void SetIdent(const std::string& v) { ident_ = v; }
15
+
16
+ std::string Copyright() const { return copyright_; }
17
+ void SetCopyright(const std::string& v) { copyright_ = v; }
18
+
19
+ uint64_t FSize() const { return fsize_; }
20
+ void SetFSize(uint64_t v) { fsize_ = v; }
21
+
22
+ uint32_t FStart() const { return fstart_; }
23
+ void SetFStart(uint32_t v) { fstart_ = v; }
24
+
25
+ void RecalculateFileStart() {
26
+ fstart_ = static_cast<uint32_t>(ident_.length() + sizeof(uint64_t) +
27
+ sizeof(uint32_t) + copyright_.length() + 1);
28
+ }
29
+
30
+ static WzHeader GetDefault() {
31
+ WzHeader h;
32
+ h.ident_ = "PKG1";
33
+ h.copyright_ = DEFAULT_WZ_HEADER_COPYRIGHT;
34
+ h.fstart_ = 60;
35
+ h.fsize_ = 0;
36
+ return h;
37
+ }
38
+
39
+ private:
40
+ std::string ident_ = "PKG1";
41
+ std::string copyright_ = DEFAULT_WZ_HEADER_COPYRIGHT;
42
+ uint64_t fsize_ = 0;
43
+ uint32_t fstart_ = 60;
44
+ };
45
+
46
+ } // namespace wz
47
+ #endif // WZ_WZHEADER_H_