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.
- package/LICENSE +21 -0
- package/README.md +165 -0
- package/binding.gyp +149 -0
- package/deps/tiny-aes/.github/workflows/c-cpp.yml +27 -0
- package/deps/tiny-aes/CMakeLists.txt +17 -0
- package/deps/tiny-aes/Makefile +61 -0
- package/deps/tiny-aes/README.md +83 -0
- package/deps/tiny-aes/aes.c +572 -0
- package/deps/tiny-aes/aes.h +91 -0
- package/deps/tiny-aes/aes.hpp +12 -0
- package/deps/tiny-aes/conanfile.py +73 -0
- package/deps/tiny-aes/library.json +19 -0
- package/deps/tiny-aes/library.properties +11 -0
- package/deps/tiny-aes/test.c +316 -0
- package/deps/tiny-aes/test.cpp +2 -0
- package/deps/tiny-aes/test_package/CMakeLists.txt +11 -0
- package/deps/tiny-aes/test_package/conanfile.py +17 -0
- package/deps/tiny-aes/unlicense.txt +24 -0
- package/deps/zlib/.cmake-format.yaml +245 -0
- package/deps/zlib/.github/workflows/c-std.yml +268 -0
- package/deps/zlib/.github/workflows/cmake.yml +147 -0
- package/deps/zlib/.github/workflows/configure.yml +146 -0
- package/deps/zlib/.github/workflows/contribs.yml +64 -0
- package/deps/zlib/.github/workflows/fuzz.yml +25 -0
- package/deps/zlib/.github/workflows/msys-cygwin.yml +92 -0
- package/deps/zlib/.github/workflows/others.yml +153 -0
- package/deps/zlib/BUILD.bazel +134 -0
- package/deps/zlib/CMakeLists.txt +310 -0
- package/deps/zlib/ChangeLog +1669 -0
- package/deps/zlib/FAQ +371 -0
- package/deps/zlib/INDEX +67 -0
- package/deps/zlib/LICENSE +22 -0
- package/deps/zlib/MODULE.bazel +9 -0
- package/deps/zlib/Makefile.in +426 -0
- package/deps/zlib/README +115 -0
- package/deps/zlib/README-cmake.md +79 -0
- package/deps/zlib/adler32.c +164 -0
- package/deps/zlib/amiga/Makefile.pup +69 -0
- package/deps/zlib/amiga/Makefile.sas +68 -0
- package/deps/zlib/compress.c +99 -0
- package/deps/zlib/configure +1078 -0
- package/deps/zlib/contrib/CMakeLists.txt +61 -0
- package/deps/zlib/contrib/README.contrib +57 -0
- package/deps/zlib/contrib/ada/CMakeLists.txt +217 -0
- package/deps/zlib/contrib/ada/buffer_demo.adb +106 -0
- package/deps/zlib/contrib/ada/cmake/Modules/CMakeADACompiler.cmake.in +23 -0
- package/deps/zlib/contrib/ada/cmake/Modules/CMakeADAInformation.cmake +133 -0
- package/deps/zlib/contrib/ada/cmake/Modules/CMakeDetermineADACompiler.cmake +33 -0
- package/deps/zlib/contrib/ada/cmake/Modules/CMakeTestADACompiler.cmake +46 -0
- package/deps/zlib/contrib/ada/cmake/binder_helper.cmake +47 -0
- package/deps/zlib/contrib/ada/cmake/compile_helper.cmake +32 -0
- package/deps/zlib/contrib/ada/cmake/exe_link_helper.cmake +53 -0
- package/deps/zlib/contrib/ada/cmake/shared_link_helper.cmake +52 -0
- package/deps/zlib/contrib/ada/cmake/static_link_helper.cmake +25 -0
- package/deps/zlib/contrib/ada/mtest.adb +156 -0
- package/deps/zlib/contrib/ada/read.adb +156 -0
- package/deps/zlib/contrib/ada/readme.txt +65 -0
- package/deps/zlib/contrib/ada/test.adb +463 -0
- package/deps/zlib/contrib/ada/zlib-streams.adb +225 -0
- package/deps/zlib/contrib/ada/zlib-streams.ads +114 -0
- package/deps/zlib/contrib/ada/zlib-thin.adb +142 -0
- package/deps/zlib/contrib/ada/zlib-thin.ads +450 -0
- package/deps/zlib/contrib/ada/zlib.adb +701 -0
- package/deps/zlib/contrib/ada/zlib.ads +328 -0
- package/deps/zlib/contrib/ada/zlib.gpr +20 -0
- package/deps/zlib/contrib/blast/CMakeLists.txt +166 -0
- package/deps/zlib/contrib/blast/Makefile +14 -0
- package/deps/zlib/contrib/blast/README +4 -0
- package/deps/zlib/contrib/blast/blast-test.c +42 -0
- package/deps/zlib/contrib/blast/blast.c +422 -0
- package/deps/zlib/contrib/blast/blast.h +84 -0
- package/deps/zlib/contrib/blast/blastConfig.cmake.in +18 -0
- package/deps/zlib/contrib/blast/test/CMakeLists.txt +193 -0
- package/deps/zlib/contrib/blast/test/add_subdirectory_exclude_test.cmake.in +27 -0
- package/deps/zlib/contrib/blast/test/add_subdirectory_test.cmake.in +25 -0
- package/deps/zlib/contrib/blast/test/find_package_no_components_test.cmake.in +24 -0
- package/deps/zlib/contrib/blast/test/find_package_test.cmake.in +24 -0
- package/deps/zlib/contrib/blast/test/find_package_wrong_components_test.cmake.in +24 -0
- package/deps/zlib/contrib/blast/test.pk +0 -0
- package/deps/zlib/contrib/blast/test.txt +1 -0
- package/deps/zlib/contrib/blast/tester.cmake +28 -0
- package/deps/zlib/contrib/crc32vx/CMakeLists.txt +67 -0
- package/deps/zlib/contrib/crc32vx/README +9 -0
- package/deps/zlib/contrib/crc32vx/crc32_vx.c +254 -0
- package/deps/zlib/contrib/crc32vx/crc32_vx_hooks.h +9 -0
- package/deps/zlib/contrib/delphi/ZLib.pas +557 -0
- package/deps/zlib/contrib/delphi/ZLibConst.pas +11 -0
- package/deps/zlib/contrib/delphi/readme.txt +76 -0
- package/deps/zlib/contrib/delphi/zlibd32.mak +99 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +58 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +202 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +83 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +198 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/Deflater.cs +106 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +288 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +141 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +301 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/Inflater.cs +105 -0
- package/deps/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +274 -0
- package/deps/zlib/contrib/dotzlib/DotZLib.build +33 -0
- package/deps/zlib/contrib/dotzlib/DotZLib.chm +0 -0
- package/deps/zlib/contrib/dotzlib/DotZLib.sln +21 -0
- package/deps/zlib/contrib/dotzlib/LICENSE_1_0.txt +23 -0
- package/deps/zlib/contrib/dotzlib/readme.txt +58 -0
- package/deps/zlib/contrib/gcc_gvmat64/CMakeLists.txt +19 -0
- package/deps/zlib/contrib/gcc_gvmat64/gvmat64.S +570 -0
- package/deps/zlib/contrib/infback9/CMakeLists.txt +19 -0
- package/deps/zlib/contrib/infback9/README +1 -0
- package/deps/zlib/contrib/infback9/infback9.c +603 -0
- package/deps/zlib/contrib/infback9/infback9.h +37 -0
- package/deps/zlib/contrib/infback9/inffix9.h +107 -0
- package/deps/zlib/contrib/infback9/inflate9.h +47 -0
- package/deps/zlib/contrib/infback9/inftree9.c +319 -0
- package/deps/zlib/contrib/infback9/inftree9.h +61 -0
- package/deps/zlib/contrib/iostream/test.cpp +24 -0
- package/deps/zlib/contrib/iostream/zfstream.cpp +329 -0
- package/deps/zlib/contrib/iostream/zfstream.h +128 -0
- package/deps/zlib/contrib/iostream2/zstream.h +306 -0
- package/deps/zlib/contrib/iostream2/zstream_test.cpp +25 -0
- package/deps/zlib/contrib/iostream3/CMakeLists.txt +200 -0
- package/deps/zlib/contrib/iostream3/README +35 -0
- package/deps/zlib/contrib/iostream3/TODO +17 -0
- package/deps/zlib/contrib/iostream3/iostream3Config.cmake.in +23 -0
- package/deps/zlib/contrib/iostream3/test/CMakeLists.txt +191 -0
- package/deps/zlib/contrib/iostream3/test/add_subdirectory_exclude_test.cmake.in +27 -0
- package/deps/zlib/contrib/iostream3/test/add_subdirectory_test.cmake.in +25 -0
- package/deps/zlib/contrib/iostream3/test/find_package_no_components_test.cmake.in +24 -0
- package/deps/zlib/contrib/iostream3/test/find_package_test.cmake.in +24 -0
- package/deps/zlib/contrib/iostream3/test/find_package_wrong_components_test.cmake.in +24 -0
- package/deps/zlib/contrib/iostream3/test.cc +50 -0
- package/deps/zlib/contrib/iostream3/zfstream.cc +479 -0
- package/deps/zlib/contrib/iostream3/zfstream.h +466 -0
- package/deps/zlib/contrib/minizip/CMakeLists.txt +387 -0
- package/deps/zlib/contrib/minizip/LICENSE.Info-Zip +58 -0
- package/deps/zlib/contrib/minizip/Makefile +33 -0
- package/deps/zlib/contrib/minizip/Makefile.am +45 -0
- package/deps/zlib/contrib/minizip/MiniZip64_Changes.txt +6 -0
- package/deps/zlib/contrib/minizip/MiniZip64_info.txt +69 -0
- package/deps/zlib/contrib/minizip/configure.ac +32 -0
- package/deps/zlib/contrib/minizip/crypt.h +125 -0
- package/deps/zlib/contrib/minizip/ints.h +57 -0
- package/deps/zlib/contrib/minizip/ioapi.c +231 -0
- package/deps/zlib/contrib/minizip/ioapi.h +183 -0
- package/deps/zlib/contrib/minizip/iowin32.c +447 -0
- package/deps/zlib/contrib/minizip/iowin32.h +27 -0
- package/deps/zlib/contrib/minizip/make_vms.com +25 -0
- package/deps/zlib/contrib/minizip/miniunz.c +647 -0
- package/deps/zlib/contrib/minizip/miniunzip.1 +63 -0
- package/deps/zlib/contrib/minizip/minizip.1 +46 -0
- package/deps/zlib/contrib/minizip/minizip.c +511 -0
- package/deps/zlib/contrib/minizip/minizip.pc.in +13 -0
- package/deps/zlib/contrib/minizip/minizip.pc.txt +13 -0
- package/deps/zlib/contrib/minizip/minizipConfig.cmake.in +27 -0
- package/deps/zlib/contrib/minizip/mztools.c +294 -0
- package/deps/zlib/contrib/minizip/mztools.h +37 -0
- package/deps/zlib/contrib/minizip/skipset.h +366 -0
- package/deps/zlib/contrib/minizip/test/CMakeLists.txt +176 -0
- package/deps/zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in +29 -0
- package/deps/zlib/contrib/minizip/test/add_subdirectory_test.cmake.in +28 -0
- package/deps/zlib/contrib/minizip/test/find_package_no_components_test.cmake.in +26 -0
- package/deps/zlib/contrib/minizip/test/find_package_test.cmake.in +26 -0
- package/deps/zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in +26 -0
- package/deps/zlib/contrib/minizip/test/test_helper.cm +32 -0
- package/deps/zlib/contrib/minizip/unzip.c +1984 -0
- package/deps/zlib/contrib/minizip/unzip.h +442 -0
- package/deps/zlib/contrib/minizip/zip.c +2246 -0
- package/deps/zlib/contrib/minizip/zip.h +371 -0
- package/deps/zlib/contrib/nuget/nuget.csproj +45 -0
- package/deps/zlib/contrib/nuget/nuget.sln +22 -0
- package/deps/zlib/contrib/pascal/example.pas +599 -0
- package/deps/zlib/contrib/pascal/readme.txt +76 -0
- package/deps/zlib/contrib/pascal/zlibd32.mak +99 -0
- package/deps/zlib/contrib/pascal/zlibpas.pas +276 -0
- package/deps/zlib/contrib/puff/CMakeLists.txt +154 -0
- package/deps/zlib/contrib/puff/Makefile +42 -0
- package/deps/zlib/contrib/puff/README +63 -0
- package/deps/zlib/contrib/puff/bin-writer.c +26 -0
- package/deps/zlib/contrib/puff/puff.c +840 -0
- package/deps/zlib/contrib/puff/puff.h +35 -0
- package/deps/zlib/contrib/puff/puffConfig.cmake.in +18 -0
- package/deps/zlib/contrib/puff/pufftest.c +168 -0
- package/deps/zlib/contrib/puff/test/CMakeLists.txt +262 -0
- package/deps/zlib/contrib/puff/test/add_subdirectory_exclude_test.cmake.in +26 -0
- package/deps/zlib/contrib/puff/test/add_subdirectory_test.cmake.in +25 -0
- package/deps/zlib/contrib/puff/test/find_package_no_components_test.cmake.in +24 -0
- package/deps/zlib/contrib/puff/test/find_package_test.cmake.in +24 -0
- package/deps/zlib/contrib/puff/test/find_package_wrong_components_test.cmake.in +24 -0
- package/deps/zlib/contrib/puff/test/tester-cov.cmake +58 -0
- package/deps/zlib/contrib/puff/test/tester.cmake +16 -0
- package/deps/zlib/contrib/puff/zeros.raw +0 -0
- package/deps/zlib/contrib/testzlib/CMakeLists.txt +44 -0
- package/deps/zlib/contrib/testzlib/testzlib.c +275 -0
- package/deps/zlib/contrib/testzlib/testzlib.txt +10 -0
- package/deps/zlib/contrib/vstudio/readme.txt +22 -0
- package/deps/zlib/contrib/zlib1-dll/CMakeLists.txt +196 -0
- package/deps/zlib/contrib/zlib1-dll/readme.txt +21 -0
- package/deps/zlib/crc32.c +983 -0
- package/deps/zlib/crc32.h +9446 -0
- package/deps/zlib/deflate.c +2185 -0
- package/deps/zlib/deflate.h +383 -0
- package/deps/zlib/doc/algorithm.txt +209 -0
- package/deps/zlib/doc/crc-doc.1.0.pdf +0 -0
- package/deps/zlib/doc/rfc1950.txt +619 -0
- package/deps/zlib/doc/rfc1951.txt +955 -0
- package/deps/zlib/doc/rfc1952.txt +675 -0
- package/deps/zlib/doc/txtvsbin.txt +107 -0
- package/deps/zlib/examples/README.examples +54 -0
- package/deps/zlib/examples/enough.c +597 -0
- package/deps/zlib/examples/fitblk.c +233 -0
- package/deps/zlib/examples/gun.c +702 -0
- package/deps/zlib/examples/gzappend.c +504 -0
- package/deps/zlib/examples/gzjoin.c +449 -0
- package/deps/zlib/examples/gzlog.c +1061 -0
- package/deps/zlib/examples/gzlog.h +91 -0
- package/deps/zlib/examples/gznorm.c +474 -0
- package/deps/zlib/examples/zlib_how.html +550 -0
- package/deps/zlib/examples/zpipe.c +206 -0
- package/deps/zlib/examples/zran.c +546 -0
- package/deps/zlib/examples/zran.h +53 -0
- package/deps/zlib/gzclose.c +23 -0
- package/deps/zlib/gzguts.h +216 -0
- package/deps/zlib/gzlib.c +609 -0
- package/deps/zlib/gzread.c +668 -0
- package/deps/zlib/gzwrite.c +700 -0
- package/deps/zlib/infback.c +581 -0
- package/deps/zlib/inffast.c +321 -0
- package/deps/zlib/inffast.h +11 -0
- package/deps/zlib/inffixed.h +94 -0
- package/deps/zlib/inflate.c +1413 -0
- package/deps/zlib/inflate.h +126 -0
- package/deps/zlib/inftrees.c +424 -0
- package/deps/zlib/inftrees.h +64 -0
- package/deps/zlib/make_vms.com +867 -0
- package/deps/zlib/msdos/Makefile.bor +115 -0
- package/deps/zlib/msdos/Makefile.dj2 +104 -0
- package/deps/zlib/msdos/Makefile.emx +69 -0
- package/deps/zlib/msdos/Makefile.msc +112 -0
- package/deps/zlib/msdos/Makefile.tc +100 -0
- package/deps/zlib/os400/README400 +48 -0
- package/deps/zlib/os400/bndsrc +144 -0
- package/deps/zlib/os400/make.sh +383 -0
- package/deps/zlib/os400/zlibfixed.rpgle +578 -0
- package/deps/zlib/os400/zlibfree.rpgle +634 -0
- package/deps/zlib/qnx/package.qpg +141 -0
- package/deps/zlib/test/CMakeLists.txt +318 -0
- package/deps/zlib/test/add_subdirectory_exclude_test.cmake.in +29 -0
- package/deps/zlib/test/add_subdirectory_test.cmake.in +28 -0
- package/deps/zlib/test/example.c +552 -0
- package/deps/zlib/test/find_package_no_components_test.cmake.in +27 -0
- package/deps/zlib/test/find_package_test.cmake.in +27 -0
- package/deps/zlib/test/find_package_wrong_components_test.cmake.in +27 -0
- package/deps/zlib/test/infcover.c +672 -0
- package/deps/zlib/test/minigzip.c +592 -0
- package/deps/zlib/treebuild.xml +116 -0
- package/deps/zlib/trees.c +1119 -0
- package/deps/zlib/trees.h +128 -0
- package/deps/zlib/uncompr.c +101 -0
- package/deps/zlib/watcom/watcom_f.mak +43 -0
- package/deps/zlib/watcom/watcom_l.mak +43 -0
- package/deps/zlib/win32/DLL_FAQ.txt +381 -0
- package/deps/zlib/win32/Makefile.bor +109 -0
- package/deps/zlib/win32/Makefile.gcc +177 -0
- package/deps/zlib/win32/Makefile.msc +159 -0
- package/deps/zlib/win32/README-WIN32.txt +103 -0
- package/deps/zlib/win32/VisualC.txt +3 -0
- package/deps/zlib/win32/zlib.def +104 -0
- package/deps/zlib/win32/zlib1.rc +37 -0
- package/deps/zlib/zconf.h.in +551 -0
- package/deps/zlib/zlib.3 +149 -0
- package/deps/zlib/zlib.3.pdf +0 -0
- package/deps/zlib/zlib.h +2057 -0
- package/deps/zlib/zlib.map +116 -0
- package/deps/zlib/zlib.pc.cmakein +14 -0
- package/deps/zlib/zlib.pc.in +14 -0
- package/deps/zlib/zlibConfig.cmake.in +18 -0
- package/deps/zlib/zutil.c +313 -0
- package/deps/zlib/zutil.h +331 -0
- package/dist/index.d.ts +266 -0
- package/dist/index.js +1146 -0
- package/dist/libwz.js +5632 -0
- package/dist/libwz.wasm +0 -0
- package/include/wz/CRC32.h +182 -0
- package/include/wz/PngUtility.h +72 -0
- package/include/wz/PortalType.h +124 -0
- package/include/wz/Properties/WzBinaryProperty.h +70 -0
- package/include/wz/Properties/WzCanvasProperty.h +55 -0
- package/include/wz/Properties/WzConvexProperty.h +34 -0
- package/include/wz/Properties/WzDoubleProperty.h +32 -0
- package/include/wz/Properties/WzFloatProperty.h +30 -0
- package/include/wz/Properties/WzIntProperty.h +30 -0
- package/include/wz/Properties/WzLongProperty.h +30 -0
- package/include/wz/Properties/WzLuaProperty.h +31 -0
- package/include/wz/Properties/WzNullProperty.h +15 -0
- package/include/wz/Properties/WzPngProperty.h +53 -0
- package/include/wz/Properties/WzRawDataProperty.h +46 -0
- package/include/wz/Properties/WzShortProperty.h +31 -0
- package/include/wz/Properties/WzStringProperty.h +32 -0
- package/include/wz/Properties/WzSubProperty.h +35 -0
- package/include/wz/Properties/WzUOLProperty.h +44 -0
- package/include/wz/Properties/WzVectorProperty.h +40 -0
- package/include/wz/Properties/WzVideoProperty.h +43 -0
- package/include/wz/Result.h +58 -0
- package/include/wz/Util/Defines.h +16 -0
- package/include/wz/Util/ListFileParser.h +20 -0
- package/include/wz/Util/WzBinaryReader.h +95 -0
- package/include/wz/Util/WzBinaryWriter.h +72 -0
- package/include/wz/Util/WzBlobDataSource.h +30 -0
- package/include/wz/Util/WzDataSource.h +49 -0
- package/include/wz/Util/WzKeyGenerator.h +28 -0
- package/include/wz/Util/WzMutableKey.h +39 -0
- package/include/wz/Util/WzPath.h +37 -0
- package/include/wz/Util/WzStream.h +86 -0
- package/include/wz/Util/WzTool.h +42 -0
- package/include/wz/WzAESConstant.h +17 -0
- package/include/wz/WzDirectory.h +97 -0
- package/include/wz/WzEnums.h +76 -0
- package/include/wz/WzFile.h +99 -0
- package/include/wz/WzHeader.h +47 -0
- package/include/wz/WzImage.h +97 -0
- package/include/wz/WzImageProperty.h +92 -0
- package/include/wz/WzObject.h +55 -0
- package/include/wz/WzPropertyCollection.h +115 -0
- package/include/wz/wz.h +41 -0
- package/include/wz/wz_api.h +432 -0
- package/package.json +93 -0
- package/src/PngUtility.cpp +328 -0
- package/src/Properties/WzBinaryProperty.cpp +183 -0
- package/src/Properties/WzCanvasProperty.cpp +262 -0
- package/src/Properties/WzConvexProperty.cpp +159 -0
- package/src/Properties/WzDoubleProperty.cpp +12 -0
- package/src/Properties/WzFloatProperty.cpp +17 -0
- package/src/Properties/WzIntProperty.cpp +12 -0
- package/src/Properties/WzLongProperty.cpp +12 -0
- package/src/Properties/WzLuaProperty.cpp +37 -0
- package/src/Properties/WzNullProperty.cpp +11 -0
- package/src/Properties/WzPngProperty.cpp +637 -0
- package/src/Properties/WzRawDataProperty.cpp +116 -0
- package/src/Properties/WzShortProperty.cpp +12 -0
- package/src/Properties/WzStringProperty.cpp +44 -0
- package/src/Properties/WzSubProperty.cpp +129 -0
- package/src/Properties/WzUOLProperty.cpp +136 -0
- package/src/Properties/WzVectorProperty.cpp +22 -0
- package/src/Properties/WzVideoProperty.cpp +115 -0
- package/src/Util/ListFileParser.cpp +48 -0
- package/src/Util/WzBinaryReader.cpp +368 -0
- package/src/Util/WzBinaryWriter.cpp +305 -0
- package/src/Util/WzBlobDataSource.cpp +47 -0
- package/src/Util/WzDataSource.cpp +61 -0
- package/src/Util/WzKeyGenerator.cpp +43 -0
- package/src/Util/WzMutableKey.cpp +59 -0
- package/src/Util/WzStream.cpp +196 -0
- package/src/Util/WzTool.cpp +266 -0
- package/src/WzAESConstant.cpp +12 -0
- package/src/WzDirectory.cpp +669 -0
- package/src/WzEnums.cpp +20 -0
- package/src/WzFile.cpp +450 -0
- package/src/WzImage.cpp +350 -0
- package/src/WzImageProperty.cpp +469 -0
- package/src/WzObject.cpp +174 -0
- package/src/WzPropertyCollection.cpp +84 -0
- package/src/capi/wz_api.cpp +1996 -0
- package/src/node/binding.cpp +1776 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZLUAPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZLUAPROPERTY_H_
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <vector>
|
|
6
|
+
#include "wz/Util/WzMutableKey.h"
|
|
7
|
+
#include "wz/WzImageProperty.h"
|
|
8
|
+
|
|
9
|
+
namespace wz {
|
|
10
|
+
class WzLuaProperty : public WzImageProperty {
|
|
11
|
+
public:
|
|
12
|
+
WzLuaProperty(const std::string& name,
|
|
13
|
+
const std::vector<uint8_t>& encryptedBytes);
|
|
14
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzLuaProperty)
|
|
15
|
+
WzPropertyType PropertyType() const override { return WzPropertyType::Lua; }
|
|
16
|
+
const std::vector<uint8_t>& Value() const { return encryptedBytes_; }
|
|
17
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
18
|
+
void SetValue(const std::vector<uint8_t>& value) override {
|
|
19
|
+
if (encryptedBytes_ == value) return;
|
|
20
|
+
encryptedBytes_ = value;
|
|
21
|
+
MarkParentImageChanged();
|
|
22
|
+
}
|
|
23
|
+
std::string GetString() const override;
|
|
24
|
+
std::vector<uint8_t> EncodeDecode(const std::vector<uint8_t>& input) const;
|
|
25
|
+
|
|
26
|
+
private:
|
|
27
|
+
std::vector<uint8_t> encryptedBytes_;
|
|
28
|
+
WzMutableKey wzKey_;
|
|
29
|
+
};
|
|
30
|
+
} // namespace wz
|
|
31
|
+
#endif // WZ_PROPERTIES_WZLUAPROPERTY_H_
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZNULLPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZNULLPROPERTY_H_
|
|
3
|
+
#include "wz/WzImageProperty.h"
|
|
4
|
+
|
|
5
|
+
namespace wz {
|
|
6
|
+
class WzNullProperty : public WzImageProperty {
|
|
7
|
+
public:
|
|
8
|
+
WzNullProperty() = default;
|
|
9
|
+
explicit WzNullProperty(const std::string& name) { SetName(name); }
|
|
10
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzNullProperty)
|
|
11
|
+
WzPropertyType PropertyType() const override { return WzPropertyType::Null; }
|
|
12
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
13
|
+
};
|
|
14
|
+
} // namespace wz
|
|
15
|
+
#endif // WZ_PROPERTIES_WZNULLPROPERTY_H_
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZPNGPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZPNGPROPERTY_H_
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <vector>
|
|
7
|
+
#include "wz/Result.h"
|
|
8
|
+
#include "wz/WzEnums.h"
|
|
9
|
+
#include "wz/WzImageProperty.h"
|
|
10
|
+
|
|
11
|
+
namespace wz {
|
|
12
|
+
class WzBinaryReader;
|
|
13
|
+
class WzPngProperty : public WzImageProperty {
|
|
14
|
+
public:
|
|
15
|
+
WzPngProperty();
|
|
16
|
+
WzPngProperty(WzBinaryReader* reader, bool parseNow);
|
|
17
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzPngProperty)
|
|
18
|
+
|
|
19
|
+
static Result<std::unique_ptr<WzPngProperty>> FromPngFile(
|
|
20
|
+
const std::string& filePath);
|
|
21
|
+
|
|
22
|
+
WzPropertyType PropertyType() const override { return WzPropertyType::PNG; }
|
|
23
|
+
std::string Name() const override { return "PNG"; }
|
|
24
|
+
void SetName(const std::string&) override {}
|
|
25
|
+
|
|
26
|
+
int Width() const { return width_; }
|
|
27
|
+
int Height() const { return height_; }
|
|
28
|
+
WzPngFormat Format() const { return format_; }
|
|
29
|
+
bool ListWzUsed() const { return listWzUsed_; }
|
|
30
|
+
|
|
31
|
+
Result<std::vector<uint8_t>> GetImage(bool saveInMemory);
|
|
32
|
+
Result<std::vector<uint8_t>> GetCompressedBytes(bool saveInMemory);
|
|
33
|
+
Result<std::vector<uint8_t>> GetCompressedBytesForExtraction(
|
|
34
|
+
bool saveInMemory);
|
|
35
|
+
Result<std::vector<uint8_t>> GetRawImage(bool saveInMemory);
|
|
36
|
+
Result<void> ParsePng(bool saveInMemory);
|
|
37
|
+
Result<void> SaveToFile(const std::string& filePath);
|
|
38
|
+
|
|
39
|
+
WzBinaryReader* Reader() const { return wzReader_; }
|
|
40
|
+
|
|
41
|
+
private:
|
|
42
|
+
int width_ = 0, height_ = 0;
|
|
43
|
+
WzPngFormat format_ = WzPngFormat::Format1;
|
|
44
|
+
std::vector<uint8_t> compressedImageBytes_;
|
|
45
|
+
std::vector<uint8_t> pngData_;
|
|
46
|
+
bool listWzUsed_ = false;
|
|
47
|
+
WzBinaryReader* wzReader_ = nullptr;
|
|
48
|
+
int64_t offs_ = 0;
|
|
49
|
+
|
|
50
|
+
int GetUncompressedSize() const;
|
|
51
|
+
};
|
|
52
|
+
} // namespace wz
|
|
53
|
+
#endif // WZ_PROPERTIES_WZPNGPROPERTY_H_
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZRAWDATAPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZRAWDATAPROPERTY_H_
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <vector>
|
|
5
|
+
#include "wz/Result.h"
|
|
6
|
+
#include "wz/WzImageProperty.h"
|
|
7
|
+
#include "wz/WzPropertyCollection.h"
|
|
8
|
+
|
|
9
|
+
namespace wz {
|
|
10
|
+
class WzBinaryReader;
|
|
11
|
+
class WzRawDataProperty : public WzImageProperty, public IPropertyContainer {
|
|
12
|
+
public:
|
|
13
|
+
static constexpr const char* RAW_DATA_HEADER = "RawData";
|
|
14
|
+
WzRawDataProperty(const std::string& name,
|
|
15
|
+
WzBinaryReader* reader,
|
|
16
|
+
uint8_t type);
|
|
17
|
+
~WzRawDataProperty() override;
|
|
18
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzRawDataProperty)
|
|
19
|
+
|
|
20
|
+
WzPropertyType PropertyType() const override { return WzPropertyType::Raw; }
|
|
21
|
+
bool IsRawDataProperty() const override { return true; }
|
|
22
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
23
|
+
WzPropertyCollection* WzProperties() override { return &properties_; }
|
|
24
|
+
using IPropertyContainer::AddProperty;
|
|
25
|
+
Result<void> AddProperty(WzImageProperty* prop) override;
|
|
26
|
+
Result<void> AddProperty(std::unique_ptr<WzImageProperty> prop) override;
|
|
27
|
+
Result<std::unique_ptr<WzImageProperty>> RemoveProperty(
|
|
28
|
+
const std::string& propertyName) override;
|
|
29
|
+
Result<std::unique_ptr<WzImageProperty>> RemoveProperty(
|
|
30
|
+
WzImageProperty* prop) override;
|
|
31
|
+
Result<void> ClearProperties() override;
|
|
32
|
+
Result<std::vector<uint8_t>> GetBytes() override;
|
|
33
|
+
Result<std::vector<uint8_t>> GetBytes(bool saveInMemory);
|
|
34
|
+
void Parse(bool parseNow);
|
|
35
|
+
uint8_t Type() const { return type_; }
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
WzBinaryReader* wzReader_ = nullptr;
|
|
39
|
+
uint8_t type_ = 0;
|
|
40
|
+
int64_t rawDataOffset_ = 0;
|
|
41
|
+
int length_ = 0;
|
|
42
|
+
std::vector<uint8_t> bytes_;
|
|
43
|
+
WzPropertyCollection properties_;
|
|
44
|
+
};
|
|
45
|
+
} // namespace wz
|
|
46
|
+
#endif // WZ_PROPERTIES_WZRAWDATAPROPERTY_H_
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZSHORTPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZSHORTPROPERTY_H_
|
|
3
|
+
#include "wz/WzImageProperty.h"
|
|
4
|
+
namespace wz {
|
|
5
|
+
class WzShortProperty : public WzImageProperty {
|
|
6
|
+
public:
|
|
7
|
+
WzShortProperty() = default;
|
|
8
|
+
WzShortProperty(const std::string& name, int16_t value) : value_(value) {
|
|
9
|
+
SetName(name);
|
|
10
|
+
}
|
|
11
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzShortProperty)
|
|
12
|
+
WzPropertyType PropertyType() const override { return WzPropertyType::Short; }
|
|
13
|
+
int16_t Value() const { return value_; }
|
|
14
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
15
|
+
void SetValue(int32_t value) override {
|
|
16
|
+
auto next = static_cast<int16_t>(value);
|
|
17
|
+
if (value_ == next) return;
|
|
18
|
+
value_ = next;
|
|
19
|
+
MarkParentImageChanged();
|
|
20
|
+
}
|
|
21
|
+
int32_t GetInt() const override { return value_; }
|
|
22
|
+
int16_t GetShort() const override { return value_; }
|
|
23
|
+
int64_t GetLong() const override { return value_; }
|
|
24
|
+
float GetFloat() const override { return static_cast<float>(value_); }
|
|
25
|
+
double GetDouble() const override { return static_cast<double>(value_); }
|
|
26
|
+
|
|
27
|
+
private:
|
|
28
|
+
int16_t value_ = 0;
|
|
29
|
+
};
|
|
30
|
+
} // namespace wz
|
|
31
|
+
#endif // WZ_PROPERTIES_WZSHORTPROPERTY_H_
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZSTRINGPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZSTRINGPROPERTY_H_
|
|
3
|
+
#include "wz/WzImageProperty.h"
|
|
4
|
+
namespace wz {
|
|
5
|
+
class WzStringProperty : public WzImageProperty {
|
|
6
|
+
public:
|
|
7
|
+
WzStringProperty() = default;
|
|
8
|
+
WzStringProperty(const std::string& name, const std::string& value)
|
|
9
|
+
: value_(value) {
|
|
10
|
+
SetName(name);
|
|
11
|
+
}
|
|
12
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzStringProperty)
|
|
13
|
+
WzPropertyType PropertyType() const override {
|
|
14
|
+
return WzPropertyType::String;
|
|
15
|
+
}
|
|
16
|
+
const std::string& Value() const { return value_; }
|
|
17
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
18
|
+
void SetValue(const std::string& value) override {
|
|
19
|
+
if (value_ == value) return;
|
|
20
|
+
value_ = value;
|
|
21
|
+
MarkParentImageChanged();
|
|
22
|
+
}
|
|
23
|
+
std::string GetString() const override { return value_; }
|
|
24
|
+
int32_t GetInt() const override;
|
|
25
|
+
int16_t GetShort() const override;
|
|
26
|
+
int64_t GetLong() const override;
|
|
27
|
+
|
|
28
|
+
private:
|
|
29
|
+
std::string value_;
|
|
30
|
+
};
|
|
31
|
+
} // namespace wz
|
|
32
|
+
#endif // WZ_PROPERTIES_WZSTRINGPROPERTY_H_
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZSUBPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZSUBPROPERTY_H_
|
|
3
|
+
#include <string>
|
|
4
|
+
#include "wz/WzImageProperty.h"
|
|
5
|
+
#include "wz/WzPropertyCollection.h"
|
|
6
|
+
|
|
7
|
+
namespace wz {
|
|
8
|
+
class WzSubProperty : public WzImageProperty, public IPropertyContainer {
|
|
9
|
+
public:
|
|
10
|
+
WzSubProperty();
|
|
11
|
+
explicit WzSubProperty(const std::string& name);
|
|
12
|
+
~WzSubProperty() override;
|
|
13
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzSubProperty)
|
|
14
|
+
|
|
15
|
+
WzPropertyType PropertyType() const override {
|
|
16
|
+
return WzPropertyType::SubProperty;
|
|
17
|
+
}
|
|
18
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
19
|
+
WzPropertyCollection* WzProperties() override { return &properties_; }
|
|
20
|
+
using IPropertyContainer::AddProperty;
|
|
21
|
+
Result<void> AddProperty(WzImageProperty* prop) override;
|
|
22
|
+
Result<void> AddProperty(std::unique_ptr<WzImageProperty> prop) override;
|
|
23
|
+
Result<std::unique_ptr<WzImageProperty>> RemoveProperty(
|
|
24
|
+
const std::string& propertyName) override;
|
|
25
|
+
Result<std::unique_ptr<WzImageProperty>> RemoveProperty(
|
|
26
|
+
WzImageProperty* prop) override;
|
|
27
|
+
Result<void> ClearProperties() override;
|
|
28
|
+
WzImageProperty* operator[](const std::string& name) override;
|
|
29
|
+
WzImageProperty* GetFromPath(const std::string& path) override;
|
|
30
|
+
|
|
31
|
+
private:
|
|
32
|
+
WzPropertyCollection properties_;
|
|
33
|
+
};
|
|
34
|
+
} // namespace wz
|
|
35
|
+
#endif // WZ_PROPERTIES_WZSUBPROPERTY_H_
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZUOLPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZUOLPROPERTY_H_
|
|
3
|
+
#include <string>
|
|
4
|
+
#include <vector>
|
|
5
|
+
#include "wz/Result.h"
|
|
6
|
+
#include "wz/WzImageProperty.h"
|
|
7
|
+
|
|
8
|
+
namespace wz {
|
|
9
|
+
class WzUOLProperty : public WzImageProperty {
|
|
10
|
+
public:
|
|
11
|
+
WzUOLProperty() = default;
|
|
12
|
+
WzUOLProperty(const std::string& name, const std::string& value);
|
|
13
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzUOLProperty)
|
|
14
|
+
WzPropertyType PropertyType() const override { return WzPropertyType::UOL; }
|
|
15
|
+
const std::string& Value() const { return val_; }
|
|
16
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
17
|
+
void SetValue(const std::string& value) override {
|
|
18
|
+
if (val_ == value) return;
|
|
19
|
+
val_ = value;
|
|
20
|
+
linkVal_ = nullptr;
|
|
21
|
+
MarkParentImageChanged();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// All accessors delegate to the resolved LinkValue (matches C# UOLRES path)
|
|
25
|
+
WzPropertyCollection* WzProperties() override;
|
|
26
|
+
WzImageProperty* operator[](const std::string& name) override;
|
|
27
|
+
WzImageProperty* GetFromPath(const std::string& path) override;
|
|
28
|
+
|
|
29
|
+
int32_t GetInt() const override;
|
|
30
|
+
int16_t GetShort() const override;
|
|
31
|
+
int64_t GetLong() const override;
|
|
32
|
+
float GetFloat() const override;
|
|
33
|
+
double GetDouble() const override;
|
|
34
|
+
std::string GetString() const override;
|
|
35
|
+
Result<std::vector<uint8_t>> GetBytes() override;
|
|
36
|
+
|
|
37
|
+
WzObject* LinkValue() const;
|
|
38
|
+
|
|
39
|
+
private:
|
|
40
|
+
std::string val_;
|
|
41
|
+
mutable WzObject* linkVal_ = nullptr;
|
|
42
|
+
};
|
|
43
|
+
} // namespace wz
|
|
44
|
+
#endif // WZ_PROPERTIES_WZUOLPROPERTY_H_
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZVECTORPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZVECTORPROPERTY_H_
|
|
3
|
+
#include <memory>
|
|
4
|
+
#include "wz/Properties/WzIntProperty.h"
|
|
5
|
+
#include "wz/WzImageProperty.h"
|
|
6
|
+
|
|
7
|
+
namespace wz {
|
|
8
|
+
class WzVectorProperty : public WzImageProperty {
|
|
9
|
+
public:
|
|
10
|
+
WzVectorProperty() = default;
|
|
11
|
+
~WzVectorProperty() override;
|
|
12
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzVectorProperty)
|
|
13
|
+
explicit WzVectorProperty(const std::string& name) { SetName(name); }
|
|
14
|
+
WzVectorProperty(const std::string& name,
|
|
15
|
+
std::unique_ptr<WzIntProperty> x,
|
|
16
|
+
std::unique_ptr<WzIntProperty> y)
|
|
17
|
+
: X(std::move(x)), Y(std::move(y)) {
|
|
18
|
+
SetName(name);
|
|
19
|
+
}
|
|
20
|
+
WzVectorProperty(const std::string& name, int32_t x, int32_t y)
|
|
21
|
+
: X(std::make_unique<WzIntProperty>("", x)),
|
|
22
|
+
Y(std::make_unique<WzIntProperty>("", y)) {
|
|
23
|
+
SetName(name);
|
|
24
|
+
}
|
|
25
|
+
WzVectorProperty(const std::string& name, float x, float y)
|
|
26
|
+
: X(std::make_unique<WzIntProperty>("", static_cast<int32_t>(x))),
|
|
27
|
+
Y(std::make_unique<WzIntProperty>("", static_cast<int32_t>(y))) {
|
|
28
|
+
SetName(name);
|
|
29
|
+
}
|
|
30
|
+
WzPropertyType PropertyType() const override {
|
|
31
|
+
return WzPropertyType::Vector;
|
|
32
|
+
}
|
|
33
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
34
|
+
std::unique_ptr<WzIntProperty> X;
|
|
35
|
+
std::unique_ptr<WzIntProperty> Y;
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
};
|
|
39
|
+
} // namespace wz
|
|
40
|
+
#endif // WZ_PROPERTIES_WZVECTORPROPERTY_H_
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#ifndef WZ_PROPERTIES_WZVIDEOPROPERTY_H_
|
|
2
|
+
#define WZ_PROPERTIES_WZVIDEOPROPERTY_H_
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <vector>
|
|
5
|
+
#include "wz/Result.h"
|
|
6
|
+
#include "wz/WzImageProperty.h"
|
|
7
|
+
#include "wz/WzPropertyCollection.h"
|
|
8
|
+
|
|
9
|
+
namespace wz {
|
|
10
|
+
class WzBinaryReader;
|
|
11
|
+
class WzVideoProperty : public WzImageProperty, public IPropertyContainer {
|
|
12
|
+
public:
|
|
13
|
+
static constexpr const char* CANVAS_VIDEO_HEADER = "Canvas#Video";
|
|
14
|
+
WzVideoProperty(const std::string& name, WzBinaryReader* reader);
|
|
15
|
+
~WzVideoProperty() override;
|
|
16
|
+
WZ_DISALLOW_COPY_AND_MOVE(WzVideoProperty)
|
|
17
|
+
|
|
18
|
+
WzPropertyType PropertyType() const override { return WzPropertyType::Raw; }
|
|
19
|
+
bool IsVideoProperty() const override { return true; }
|
|
20
|
+
Result<void> WriteValue(WzBinaryWriter* writer) const override;
|
|
21
|
+
WzPropertyCollection* WzProperties() override { return &properties_; }
|
|
22
|
+
using IPropertyContainer::AddProperty;
|
|
23
|
+
Result<void> AddProperty(WzImageProperty* prop) override;
|
|
24
|
+
Result<void> AddProperty(std::unique_ptr<WzImageProperty> prop) override;
|
|
25
|
+
Result<std::unique_ptr<WzImageProperty>> RemoveProperty(
|
|
26
|
+
const std::string& propertyName) override;
|
|
27
|
+
Result<std::unique_ptr<WzImageProperty>> RemoveProperty(
|
|
28
|
+
WzImageProperty* prop) override;
|
|
29
|
+
Result<void> ClearProperties() override;
|
|
30
|
+
Result<std::vector<uint8_t>> GetBytes() override;
|
|
31
|
+
Result<std::vector<uint8_t>> GetBytes(bool saveInMemory);
|
|
32
|
+
void Parse(bool parseNow);
|
|
33
|
+
|
|
34
|
+
private:
|
|
35
|
+
WzBinaryReader* wzReader_ = nullptr;
|
|
36
|
+
int64_t offset_ = 0;
|
|
37
|
+
int length_ = 0;
|
|
38
|
+
int type_ = 0;
|
|
39
|
+
std::vector<uint8_t> bytes_;
|
|
40
|
+
WzPropertyCollection properties_;
|
|
41
|
+
};
|
|
42
|
+
} // namespace wz
|
|
43
|
+
#endif // WZ_PROPERTIES_WZVIDEOPROPERTY_H_
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#ifndef WZ_RESULT_H_
|
|
2
|
+
#define WZ_RESULT_H_
|
|
3
|
+
#include <expected>
|
|
4
|
+
#include <string>
|
|
5
|
+
#include <utility>
|
|
6
|
+
|
|
7
|
+
namespace wz {
|
|
8
|
+
|
|
9
|
+
enum class ErrorCode {
|
|
10
|
+
Ok = 0,
|
|
11
|
+
NotImplemented,
|
|
12
|
+
InvalidArgument,
|
|
13
|
+
ParseError,
|
|
14
|
+
IoError,
|
|
15
|
+
DataError,
|
|
16
|
+
NotFound,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
class Error {
|
|
20
|
+
public:
|
|
21
|
+
// NOLINTNEXTLINE(runtime/explicit)
|
|
22
|
+
Error(ErrorCode code, std::string message = {})
|
|
23
|
+
: code_(code), message_(std::move(message)) {}
|
|
24
|
+
|
|
25
|
+
ErrorCode code() const { return code_; }
|
|
26
|
+
const std::string& message() const { return message_; }
|
|
27
|
+
|
|
28
|
+
static Error NotImplemented(const std::string& msg = "Not implemented") {
|
|
29
|
+
return {ErrorCode::NotImplemented, msg};
|
|
30
|
+
}
|
|
31
|
+
static Error InvalidArgument(const std::string& msg) {
|
|
32
|
+
return {ErrorCode::InvalidArgument, msg};
|
|
33
|
+
}
|
|
34
|
+
static Error ParseError(const std::string& msg) {
|
|
35
|
+
return {ErrorCode::ParseError, msg};
|
|
36
|
+
}
|
|
37
|
+
static Error IoError(const std::string& msg) {
|
|
38
|
+
return {ErrorCode::IoError, msg};
|
|
39
|
+
}
|
|
40
|
+
static Error DataError(const std::string& msg) {
|
|
41
|
+
return {ErrorCode::DataError, msg};
|
|
42
|
+
}
|
|
43
|
+
static Error NotFound(const std::string& msg) {
|
|
44
|
+
return {ErrorCode::NotFound, msg};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
explicit operator bool() const { return code_ == ErrorCode::Ok; }
|
|
48
|
+
|
|
49
|
+
private:
|
|
50
|
+
ErrorCode code_;
|
|
51
|
+
std::string message_;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
template <typename T, typename E = Error>
|
|
55
|
+
using Result = std::expected<T, E>;
|
|
56
|
+
|
|
57
|
+
} // namespace wz
|
|
58
|
+
#endif // WZ_RESULT_H_
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef WZ_UTIL_DEFINES_H_
|
|
2
|
+
#define WZ_UTIL_DEFINES_H_
|
|
3
|
+
|
|
4
|
+
#define WZ_DISALLOW_COPY(TypeName) \
|
|
5
|
+
TypeName(const TypeName&) = delete; \
|
|
6
|
+
TypeName& operator=(const TypeName&) = delete;
|
|
7
|
+
|
|
8
|
+
#define WZ_DISALLOW_MOVE(TypeName) \
|
|
9
|
+
TypeName(TypeName&&) = delete; \
|
|
10
|
+
TypeName& operator=(TypeName&&) = delete;
|
|
11
|
+
|
|
12
|
+
#define WZ_DISALLOW_COPY_AND_MOVE(TypeName) \
|
|
13
|
+
WZ_DISALLOW_COPY(TypeName) \
|
|
14
|
+
WZ_DISALLOW_MOVE(TypeName)
|
|
15
|
+
|
|
16
|
+
#endif // WZ_UTIL_DEFINES_H_
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#ifndef WZ_UTIL_LISTFILEPARSER_H_
|
|
2
|
+
#define WZ_UTIL_LISTFILEPARSER_H_
|
|
3
|
+
#include <array>
|
|
4
|
+
#include <cstdint>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <vector>
|
|
7
|
+
#include "wz/WzEnums.h"
|
|
8
|
+
|
|
9
|
+
namespace wz {
|
|
10
|
+
|
|
11
|
+
class ListFileParser {
|
|
12
|
+
public:
|
|
13
|
+
static std::vector<std::string> ParseListFile(const std::string& filePath,
|
|
14
|
+
WzMapleVersion version);
|
|
15
|
+
static std::vector<std::string> ParseListFile(
|
|
16
|
+
const std::string& filePath, const std::array<uint8_t, 4>& WzIv);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
} // namespace wz
|
|
20
|
+
#endif // WZ_UTIL_LISTFILEPARSER_H_
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#ifndef WZ_UTIL_WZBINARYREADER_H_
|
|
2
|
+
#define WZ_UTIL_WZBINARYREADER_H_
|
|
3
|
+
#include <cstdint>
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include <mutex>
|
|
6
|
+
#include <string>
|
|
7
|
+
#include <vector>
|
|
8
|
+
#include "wz/Result.h"
|
|
9
|
+
#include "wz/Util/Defines.h"
|
|
10
|
+
#include "wz/Util/WzDataSource.h"
|
|
11
|
+
#include "wz/Util/WzKeyGenerator.h"
|
|
12
|
+
#include "wz/Util/WzMutableKey.h"
|
|
13
|
+
#include "wz/WzEnums.h"
|
|
14
|
+
#include "wz/WzHeader.h"
|
|
15
|
+
|
|
16
|
+
namespace wz {
|
|
17
|
+
|
|
18
|
+
class WzBinaryReader {
|
|
19
|
+
public:
|
|
20
|
+
WzBinaryReader(std::shared_ptr<WzDataSource> source,
|
|
21
|
+
const std::array<uint8_t, 4>& wzIv,
|
|
22
|
+
int64_t startOffset = 0);
|
|
23
|
+
~WzBinaryReader();
|
|
24
|
+
WZ_DISALLOW_COPY(WzBinaryReader)
|
|
25
|
+
WzBinaryReader(WzBinaryReader&& other) noexcept;
|
|
26
|
+
WzBinaryReader& operator=(WzBinaryReader&& other) noexcept;
|
|
27
|
+
|
|
28
|
+
WzMutableKey& GetWzKey() { return wzKey_; }
|
|
29
|
+
std::recursive_mutex& Mutex() const { return mutex_; }
|
|
30
|
+
uint32_t Hash() const { return hash_; }
|
|
31
|
+
void SetHash(uint32_t h) { hash_ = h; }
|
|
32
|
+
WzHeader* GetHeader() { return header_; }
|
|
33
|
+
void SetHeader(WzHeader* h) { header_ = h; }
|
|
34
|
+
int64_t StartOffset() const { return startOffset_; }
|
|
35
|
+
|
|
36
|
+
void SetOffsetFromFStartToPosition(int offset);
|
|
37
|
+
Result<void> RollbackStreamPosition(int byOffset);
|
|
38
|
+
|
|
39
|
+
std::string ReadString();
|
|
40
|
+
std::string ReadString(size_t length);
|
|
41
|
+
std::string ReadNullTerminatedString();
|
|
42
|
+
int32_t ReadCompressedInt();
|
|
43
|
+
int64_t ReadLong();
|
|
44
|
+
int64_t Available();
|
|
45
|
+
uint64_t SourceSize() const;
|
|
46
|
+
int64_t ReadOffset();
|
|
47
|
+
|
|
48
|
+
std::string ReadStringAtOffset(int64_t offset, bool readByte = false);
|
|
49
|
+
std::string DecryptString(const std::u16string& stringToDecrypt);
|
|
50
|
+
std::string DecryptNonUnicodeString(const std::u16string& stringToDecrypt);
|
|
51
|
+
std::string ReadStringBlock(int64_t offset);
|
|
52
|
+
|
|
53
|
+
// Base stream wrappers
|
|
54
|
+
uint8_t ReadByte();
|
|
55
|
+
int16_t ReadInt16();
|
|
56
|
+
int32_t ReadInt32();
|
|
57
|
+
int64_t ReadInt64();
|
|
58
|
+
uint16_t ReadUInt16();
|
|
59
|
+
uint32_t ReadUInt32();
|
|
60
|
+
uint64_t ReadUInt64();
|
|
61
|
+
float ReadSingle();
|
|
62
|
+
double ReadDouble();
|
|
63
|
+
std::vector<uint8_t> ReadBytes(size_t count);
|
|
64
|
+
int8_t ReadSByte();
|
|
65
|
+
|
|
66
|
+
int64_t Position();
|
|
67
|
+
void SetPosition(int64_t pos);
|
|
68
|
+
void PrintHexBytes(int numberOfBytes);
|
|
69
|
+
void Close();
|
|
70
|
+
|
|
71
|
+
// Note: WzKey must be accessed via GetWzKey() which returns non-const
|
|
72
|
+
// reference
|
|
73
|
+
|
|
74
|
+
private:
|
|
75
|
+
static constexpr size_t kCacheSize = 256 * 1024;
|
|
76
|
+
|
|
77
|
+
std::shared_ptr<WzDataSource> source_;
|
|
78
|
+
int64_t position_ = 0;
|
|
79
|
+
std::vector<uint8_t> cache_;
|
|
80
|
+
uint64_t cacheOffset_ = 0;
|
|
81
|
+
size_t cacheSize_ = 0;
|
|
82
|
+
WzMutableKey wzKey_;
|
|
83
|
+
uint32_t hash_ = 0;
|
|
84
|
+
WzHeader* header_ = nullptr;
|
|
85
|
+
int64_t startOffset_ = 0;
|
|
86
|
+
mutable std::recursive_mutex mutex_;
|
|
87
|
+
|
|
88
|
+
std::string DecodeUnicode(int length);
|
|
89
|
+
std::string DecodeAscii(int length);
|
|
90
|
+
bool ReadExact(void* destination, size_t count);
|
|
91
|
+
bool FillCache();
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
} // namespace wz
|
|
95
|
+
#endif // WZ_UTIL_WZBINARYREADER_H_
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#ifndef WZ_UTIL_WZBINARYWRITER_H_
|
|
2
|
+
#define WZ_UTIL_WZBINARYWRITER_H_
|
|
3
|
+
#include <array>
|
|
4
|
+
#include <cstdint>
|
|
5
|
+
#include <string>
|
|
6
|
+
#include <unordered_map>
|
|
7
|
+
#include "wz/Util/Defines.h"
|
|
8
|
+
#include "wz/Util/WzKeyGenerator.h"
|
|
9
|
+
#include "wz/Util/WzMutableKey.h"
|
|
10
|
+
#include "wz/Util/WzStream.h"
|
|
11
|
+
#include "wz/WzEnums.h"
|
|
12
|
+
#include "wz/WzHeader.h"
|
|
13
|
+
|
|
14
|
+
namespace wz {
|
|
15
|
+
|
|
16
|
+
class WzBinaryWriter {
|
|
17
|
+
public:
|
|
18
|
+
WzBinaryWriter(WzStream& output, const std::array<uint8_t, 4>& WzIv);
|
|
19
|
+
WzBinaryWriter(WzStream& output,
|
|
20
|
+
const std::array<uint8_t, 4>& WzIv,
|
|
21
|
+
uint32_t hash);
|
|
22
|
+
~WzBinaryWriter() = default;
|
|
23
|
+
WZ_DISALLOW_COPY(WzBinaryWriter)
|
|
24
|
+
WzBinaryWriter(WzBinaryWriter&& other) noexcept;
|
|
25
|
+
WzBinaryWriter& operator=(WzBinaryWriter&& other) noexcept;
|
|
26
|
+
|
|
27
|
+
WzMutableKey& GetWzKey() { return wzKey_; }
|
|
28
|
+
uint32_t Hash() const { return hash_; }
|
|
29
|
+
void SetHash(uint32_t h) { hash_ = h; }
|
|
30
|
+
WzHeader* GetHeader() { return &header_; }
|
|
31
|
+
void SetHeader(const WzHeader& h) { header_ = h; }
|
|
32
|
+
WzStream& BaseStream() { return *output_; }
|
|
33
|
+
void ClearStringCache();
|
|
34
|
+
|
|
35
|
+
int64_t Position();
|
|
36
|
+
|
|
37
|
+
void WriteByte(uint8_t value);
|
|
38
|
+
void WriteSByte(int8_t value);
|
|
39
|
+
void WriteInt16(int16_t value);
|
|
40
|
+
void WriteInt32(int32_t value);
|
|
41
|
+
void WriteInt64(int64_t value);
|
|
42
|
+
void WriteUInt16(uint16_t value);
|
|
43
|
+
void WriteUInt32(uint32_t value);
|
|
44
|
+
void WriteUInt64(uint64_t value);
|
|
45
|
+
void WriteSingle(float value);
|
|
46
|
+
void WriteDouble(double value);
|
|
47
|
+
void WriteString(const std::string& value);
|
|
48
|
+
void WriteNullTerminatedString(const std::string& value);
|
|
49
|
+
void WriteStringValue(const std::string& value,
|
|
50
|
+
uint8_t withoutOffset,
|
|
51
|
+
uint8_t withOffset);
|
|
52
|
+
bool WriteWzObjectValue(const std::string& value, WzDirectoryType type);
|
|
53
|
+
void WriteCompressedInt(int32_t value);
|
|
54
|
+
void WriteCompressedLong(int64_t value);
|
|
55
|
+
void WriteOffset(int64_t value);
|
|
56
|
+
|
|
57
|
+
private:
|
|
58
|
+
WzStream* output_ = nullptr;
|
|
59
|
+
WzMutableKey wzKey_;
|
|
60
|
+
uint32_t hash_ = 0;
|
|
61
|
+
WzHeader header_ = WzHeader::GetDefault();
|
|
62
|
+
std::unordered_map<std::string, int32_t> stringCache_;
|
|
63
|
+
|
|
64
|
+
template <typename T>
|
|
65
|
+
void WriteLittleEndian(T value);
|
|
66
|
+
bool WriteRawByte(uint8_t value);
|
|
67
|
+
void WriteAsciiString(const std::string& value);
|
|
68
|
+
void WriteUnicodeString(const std::u16string& value);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
} // namespace wz
|
|
72
|
+
#endif // WZ_UTIL_WZBINARYWRITER_H_
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#ifndef WZ_UTIL_WZBLOBDATASOURCE_H_
|
|
2
|
+
#define WZ_UTIL_WZBLOBDATASOURCE_H_
|
|
3
|
+
|
|
4
|
+
#include <cstdint>
|
|
5
|
+
#include <functional>
|
|
6
|
+
#include <span>
|
|
7
|
+
|
|
8
|
+
#include "wz/Util/WzDataSource.h"
|
|
9
|
+
|
|
10
|
+
namespace wz {
|
|
11
|
+
|
|
12
|
+
class WzBlobDataSource final : public WzDataSource {
|
|
13
|
+
public:
|
|
14
|
+
using ReadCallback =
|
|
15
|
+
std::function<Result<size_t>(uint64_t, std::span<uint8_t>)>;
|
|
16
|
+
|
|
17
|
+
WzBlobDataSource(uint64_t size, ReadCallback read_callback);
|
|
18
|
+
|
|
19
|
+
Result<size_t> ReadAt(uint64_t offset,
|
|
20
|
+
std::span<uint8_t> destination) override;
|
|
21
|
+
uint64_t Size() const override;
|
|
22
|
+
|
|
23
|
+
private:
|
|
24
|
+
uint64_t size_;
|
|
25
|
+
ReadCallback read_callback_;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
} // namespace wz
|
|
29
|
+
|
|
30
|
+
#endif // WZ_UTIL_WZBLOBDATASOURCE_H_
|