From 0e0bf9b357151aac068ad89f01cf74c84071c72a Mon Sep 17 00:00:00 2001 From: atdunbg Date: Sat, 20 Jun 2026 18:03:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E9=A1=B9=E7=9B=AE=EF=BC=8C?= =?UTF-8?q?=E7=8E=B0=E6=94=AF=E6=8C=81=E5=A4=9A=E7=BA=BF=E7=A8=8B=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 + CMakeLists.txt | 30 +- README.md | 33 +- expkg/CMakeLists.txt | 46 -- expkg/src/BinaryOPT/BinaryReader.cpp | 105 ---- expkg/src/BinaryOPT/BinaryReader.h | 50 -- expkg/src/BinaryOPT/BinaryWriter.cpp | 47 -- expkg/src/BinaryOPT/BinaryWriter.h | 38 -- expkg/src/BinaryOPT/ImageReader.cpp | 265 --------- expkg/src/BinaryOPT/ImageReader.h | 32 -- expkg/src/Core.cpp | 5 - expkg/src/Core.h | 23 - expkg/src/DXT/DXT.cpp | 230 -------- expkg/src/DXT/DXT.h | 38 -- expkg/src/EXPKG/EXPKG.cpp | 544 ------------------ expkg/src/EXPKG/EXPKG.h | 48 -- expkg/src/Entry.cpp | 5 - expkg/src/Entry.h | 427 -------------- expkg/src/Tex/Tex.cpp | 5 - expkg/src/Tex/Tex.h | 30 - expkg/src/Tex/TexFrameInfoContainer.cpp | 5 - expkg/src/Tex/TexFrameInfoContainer.h | 39 -- expkg/src/Tex/TexImage.cpp | 88 --- expkg/src/Tex/TexImage.h | 37 -- expkg/src/Tex/TexImageContainer.cpp | 6 - expkg/src/Tex/TexImageContainer.h | 32 -- expkg/src/expkg.h | 14 - expkg/vendor/lz4/build/.gitignore | 18 - expkg/vendor/lz4/build/README.md | 44 -- expkg/vendor/lz4/build/VS2022/_build.bat | 39 -- expkg/vendor/lz4/build/VS2022/_setup.bat | 35 -- expkg/vendor/lz4/build/VS2022/_test.bat | 38 -- .../VS2022/build-and-test-win32-debug.bat | 26 - .../VS2022/build-and-test-win32-release.bat | 26 - .../build/VS2022/build-and-test-x64-debug.bat | 26 - .../VS2022/build-and-test-x64-release.bat | 26 - .../lz4/build/VS2022/datagen/datagen.vcxproj | 177 ------ .../build/VS2022/frametest/frametest.vcxproj | 180 ------ .../fullbench-dll/fullbench-dll.vcxproj | 184 ------ .../build/VS2022/fullbench/fullbench.vcxproj | 180 ------ .../lz4/build/VS2022/fuzzer/fuzzer.vcxproj | 177 ------ .../lz4/build/VS2022/liblz4-dll/liblz4-dll.rc | 51 -- .../VS2022/liblz4-dll/liblz4-dll.vcxproj | 183 ------ .../lz4/build/VS2022/liblz4/liblz4.vcxproj | 179 ------ expkg/vendor/lz4/build/VS2022/lz4.sln | 106 ---- expkg/vendor/lz4/build/VS2022/lz4/lz4.rc | 51 -- expkg/vendor/lz4/build/VS2022/lz4/lz4.vcxproj | 189 ------ expkg/vendor/lz4/build/cmake/.gitignore | 10 - expkg/vendor/lz4/build/cmake/CMakeLists.txt | 362 ------------ .../vendor/lz4/build/cmake/lz4Config.cmake.in | 10 - expkg/vendor/lz4/build/make/README.md | 69 --- expkg/vendor/lz4/build/make/lz4defs.make | 115 ---- expkg/vendor/lz4/build/make/multiconf.make | 258 --------- .../lz4/build/meson/GetLz4LibraryVersion.py | 39 -- expkg/vendor/lz4/build/meson/README.md | 34 -- expkg/vendor/lz4/build/meson/meson.build | 30 - .../meson/contrib/gen_manual/meson.build | 42 -- .../lz4/build/meson/meson/contrib/meson.build | 11 - .../build/meson/meson/examples/meson.build | 32 -- .../lz4/build/meson/meson/lib/meson.build | 87 --- .../vendor/lz4/build/meson/meson/meson.build | 135 ----- .../lz4/build/meson/meson/ossfuzz/meson.build | 37 -- .../build/meson/meson/programs/meson.build | 91 --- .../lz4/build/meson/meson/tests/meson.build | 162 ------ .../vendor/lz4/build/meson/meson_options.txt | 44 -- expkg/vendor/lz4/build/visual/README.md | 5 - .../lz4/build/visual/generate_solution.cmd | 55 -- .../lz4/build/visual/generate_vs2015.cmd | 3 - .../lz4/build/visual/generate_vs2017.cmd | 3 - .../lz4/build/visual/generate_vs2019.cmd | 3 - .../lz4/build/visual/generate_vs2022.cmd | 3 - src/Core/Config.h | 15 + src/Core/ExtractStats.h | 51 ++ src/Core/Logger.cpp | 33 ++ src/Core/Logger.h | 32 ++ src/Core/ProcessInfo.cpp | 59 ++ src/Core/ProcessInfo.h | 23 + src/Core/ProgressBar.cpp | 262 +++++++++ src/Core/ProgressBar.h | 73 +++ src/Core/Result.h | 77 +++ src/Core/Types.h | 223 +++++++ src/Decoder/DxtDecoder.cpp | 142 +++++ src/Decoder/DxtDecoder.h | 18 + src/Decoder/ImageReader.cpp | 264 +++++++++ src/Decoder/ImageReader.h | 22 + src/Decoder/PkgExtractor.cpp | 67 +++ src/Decoder/PkgExtractor.h | 19 + src/Decoder/TexDecoder.cpp | 75 +++ src/Decoder/TexDecoder.h | 20 + src/Encoder/ImageEncoder.cpp | 223 +++++++ src/Encoder/ImageEncoder.h | 24 + src/IO/StreamReader.cpp | 125 ++++ src/IO/StreamReader.h | 57 ++ src/IO/StreamWriter.cpp | 46 ++ src/IO/StreamWriter.h | 34 ++ src/Pipeline/ExtractPipeline.cpp | 528 +++++++++++++++++ src/Pipeline/ExtractPipeline.h | 64 +++ src/Pipeline/TaskScheduler.cpp | 109 ++++ src/Pipeline/TaskScheduler.h | 94 +++ src/expkg.h | 20 + src/main.cpp | 87 +++ testApp/CMakeLists.txt | 7 - testApp/src/main.cpp | 10 - {expkg/vendor => vendor}/gif-h/LICENSE | 0 {expkg/vendor => vendor}/gif-h/gif.h | 0 {expkg/vendor => vendor}/lz4/.cirrus.yml | 0 {expkg/vendor => vendor}/lz4/.clang-format | 0 {expkg/vendor => vendor}/lz4/.gitattributes | 0 {expkg/vendor => vendor}/lz4/.gitignore | 0 {expkg/vendor => vendor}/lz4/CODING_STYLE | 0 {expkg/vendor => vendor}/lz4/INSTALL | 0 {expkg/vendor => vendor}/lz4/LICENSE | 0 {expkg/vendor => vendor}/lz4/Makefile | 0 {expkg/vendor => vendor}/lz4/NEWS | 0 {expkg/vendor => vendor}/lz4/README.md | 0 {expkg/vendor => vendor}/lz4/SECURITY.md | 0 {expkg/vendor => vendor}/lz4/appveyor.yml | 0 .../lz4/contrib/debian/changelog | 0 .../lz4/contrib/debian/compat | 0 .../lz4/contrib/debian/control | 0 .../lz4/contrib/debian/copyright | 0 .../vendor => vendor}/lz4/contrib/debian/dirs | 0 .../vendor => vendor}/lz4/contrib/debian/docs | 0 .../lz4/contrib/debian/liblz4-dev.install | 0 .../lz4/contrib/debian/liblz4.install | 0 .../lz4/contrib/debian/rules | 0 .../lz4/contrib/djgpp/LICENSE | 0 .../lz4/contrib/djgpp/Makefile | 0 .../lz4/contrib/djgpp/README.MD | 0 .../lz4/contrib/gen_manual/.gitignore | 0 .../lz4/contrib/gen_manual/Makefile | 0 .../lz4/contrib/gen_manual/README.md | 0 .../lz4/contrib/gen_manual/gen-lz4-manual.sh | 0 .../lz4/contrib/gen_manual/gen_manual.cpp | 0 .../lz4/contrib/snap/README.md | 0 .../lz4/contrib/snap/snapcraft.yaml | 0 .../lz4/doc/lz4_Block_format.md | 0 .../lz4/doc/lz4_Frame_format.md | 0 .../vendor => vendor}/lz4/doc/lz4_manual.html | 0 .../lz4/doc/lz4frame_manual.html | 0 .../vendor => vendor}/lz4/examples/.gitignore | 0 {expkg/vendor => vendor}/lz4/examples/COPYING | 0 .../vendor => vendor}/lz4/examples/Makefile | 0 .../vendor => vendor}/lz4/examples/README.md | 0 .../lz4/examples/bench_functions.c | 0 .../examples/blockStreaming_doubleBuffer.c | 0 .../examples/blockStreaming_doubleBuffer.md | 0 .../lz4/examples/blockStreaming_lineByLine.c | 0 .../lz4/examples/blockStreaming_lineByLine.md | 0 .../lz4/examples/blockStreaming_ringBuffer.c | 0 .../lz4/examples/dictionaryRandomAccess.c | 0 .../lz4/examples/dictionaryRandomAccess.md | 0 .../lz4/examples/fileCompress.c | 0 .../lz4/examples/frameCompress.c | 0 .../lz4/examples/print_version.c | 0 .../lz4/examples/simple_buffer.c | 0 .../lz4/examples/streamingHC_ringBuffer.c | 0 .../lz4/examples/streaming_api_basics.md | 0 {expkg/vendor => vendor}/lz4/lib/.gitignore | 0 {expkg/vendor => vendor}/lz4/lib/LICENSE | 0 {expkg/vendor => vendor}/lz4/lib/Makefile | 0 {expkg/vendor => vendor}/lz4/lib/README.md | 0 .../lz4/lib/dll/example/Makefile | 0 .../lz4/lib/dll/example/README.md | 0 .../lz4/lib/dll/example/fullbench-dll.sln | 0 .../lz4/lib/dll/example/fullbench-dll.vcxproj | 0 .../lz4/lib/liblz4-dll.rc.in | 0 {expkg/vendor => vendor}/lz4/lib/liblz4.pc.in | 0 {expkg/vendor => vendor}/lz4/lib/lz4.c | 0 {expkg/vendor => vendor}/lz4/lib/lz4.h | 0 {expkg/vendor => vendor}/lz4/lib/lz4file.c | 0 {expkg/vendor => vendor}/lz4/lib/lz4file.h | 0 {expkg/vendor => vendor}/lz4/lib/lz4frame.c | 0 {expkg/vendor => vendor}/lz4/lib/lz4frame.h | 0 .../lz4/lib/lz4frame_static.h | 0 {expkg/vendor => vendor}/lz4/lib/lz4hc.c | 0 {expkg/vendor => vendor}/lz4/lib/lz4hc.h | 0 {expkg/vendor => vendor}/lz4/lib/xxhash.c | 0 {expkg/vendor => vendor}/lz4/lib/xxhash.h | 0 .../vendor => vendor}/lz4/ossfuzz/.gitignore | 0 {expkg/vendor => vendor}/lz4/ossfuzz/Makefile | 0 .../lz4/ossfuzz/compress_frame_fuzzer.c | 0 .../lz4/ossfuzz/compress_fuzzer.c | 0 .../lz4/ossfuzz/compress_hc_fuzzer.c | 0 .../lz4/ossfuzz/decompress_frame_fuzzer.c | 0 .../lz4/ossfuzz/decompress_fuzzer.c | 0 {expkg/vendor => vendor}/lz4/ossfuzz/fuzz.h | 0 .../lz4/ossfuzz/fuzz_data_producer.c | 0 .../lz4/ossfuzz/fuzz_data_producer.h | 0 .../lz4/ossfuzz/fuzz_helpers.h | 0 .../lz4/ossfuzz/lz4_helpers.c | 0 .../lz4/ossfuzz/lz4_helpers.h | 0 .../vendor => vendor}/lz4/ossfuzz/ossfuzz.sh | 0 .../lz4/ossfuzz/round_trip_frame_fuzzer.c | 0 .../round_trip_frame_uncompressed_fuzzer.c | 0 .../lz4/ossfuzz/round_trip_fuzzer.c | 0 .../lz4/ossfuzz/round_trip_hc_fuzzer.c | 0 .../lz4/ossfuzz/round_trip_stream_fuzzer.c | 0 .../lz4/ossfuzz/standaloneengine.c | 0 .../lz4/ossfuzz/travisoss.sh | 0 .../vendor => vendor}/lz4/programs/.gitignore | 0 {expkg/vendor => vendor}/lz4/programs/COPYING | 0 .../vendor => vendor}/lz4/programs/Makefile | 0 .../vendor => vendor}/lz4/programs/README.md | 0 {expkg/vendor => vendor}/lz4/programs/bench.c | 0 {expkg/vendor => vendor}/lz4/programs/bench.h | 0 {expkg/vendor => vendor}/lz4/programs/lorem.c | 0 {expkg/vendor => vendor}/lz4/programs/lorem.h | 0 .../lz4/programs/lz4-exe.rc.in | 0 {expkg/vendor => vendor}/lz4/programs/lz4.1 | 0 .../vendor => vendor}/lz4/programs/lz4.1.md | 0 .../vendor => vendor}/lz4/programs/lz4cli.c | 0 .../vendor => vendor}/lz4/programs/lz4conf.h | 0 {expkg/vendor => vendor}/lz4/programs/lz4io.c | 0 {expkg/vendor => vendor}/lz4/programs/lz4io.h | 0 .../vendor => vendor}/lz4/programs/platform.h | 0 .../lz4/programs/threadpool.c | 0 .../lz4/programs/threadpool.h | 0 .../vendor => vendor}/lz4/programs/timefn.c | 0 .../vendor => vendor}/lz4/programs/timefn.h | 0 {expkg/vendor => vendor}/lz4/programs/util.c | 0 {expkg/vendor => vendor}/lz4/programs/util.h | 0 {expkg/vendor => vendor}/lz4/tests/.gitignore | 0 {expkg/vendor => vendor}/lz4/tests/COPYING | 0 {expkg/vendor => vendor}/lz4/tests/Makefile | 0 {expkg/vendor => vendor}/lz4/tests/README.md | 0 {expkg/vendor => vendor}/lz4/tests/abiTest.c | 0 .../vendor => vendor}/lz4/tests/checkFrame.c | 0 {expkg/vendor => vendor}/lz4/tests/checkTag.c | 0 .../lz4/tests/check_liblz4_version.sh | 0 .../lz4/tests/check_stdvars.sh | 0 .../lz4/tests/cmake/CMakeLists.txt | 0 {expkg/vendor => vendor}/lz4/tests/datagen.c | 0 {expkg/vendor => vendor}/lz4/tests/datagen.h | 0 .../vendor => vendor}/lz4/tests/datagencli.c | 0 .../lz4/tests/decompress-partial-usingDict.c | 0 .../lz4/tests/decompress-partial.c | 0 .../vendor => vendor}/lz4/tests/frametest.c | 0 .../lz4/tests/freestanding.c | 0 .../vendor => vendor}/lz4/tests/fullbench.c | 0 {expkg/vendor => vendor}/lz4/tests/fuzzer.c | 0 .../lz4/tests/goldenSamples/skip.bin | Bin {expkg/vendor => vendor}/lz4/tests/loremOut.c | 0 {expkg/vendor => vendor}/lz4/tests/loremOut.h | 0 .../lz4/tests/roundTripTest.c | 0 .../lz4/tests/test-lz4-abi.py | 0 .../lz4/tests/test-lz4-basic.sh | 0 .../lz4/tests/test-lz4-contentSize.sh | 0 .../lz4/tests/test-lz4-dict.sh | 0 .../lz4/tests/test-lz4-fast-hugefile.sh | 0 .../lz4/tests/test-lz4-frame-concatenation.sh | 0 .../lz4/tests/test-lz4-list.py | 0 .../lz4/tests/test-lz4-multiple-legacy.sh | 0 .../lz4/tests/test-lz4-multiple.sh | 0 .../lz4/tests/test-lz4-opt-parser.sh | 0 .../lz4/tests/test-lz4-skippable.sh | 0 .../lz4/tests/test-lz4-sparse.sh | 0 .../lz4/tests/test-lz4-speed.py | 0 .../lz4/tests/test-lz4-testmode.sh | 0 .../lz4/tests/test-lz4-versions.py | 0 .../lz4/tests/test-lz4hc-hugefile.sh | 0 .../lz4/tests/test_custom_block_sizes.sh | 0 .../lz4/tests/test_install.sh | 0 .../lz4/tests/unicode_lint.sh | 0 .../vendor => vendor}/stb/stb_image_write.cpp | 0 .../vendor => vendor}/stb/stb_image_write.h | 0 266 files changed, 2919 insertions(+), 5783 deletions(-) delete mode 100644 expkg/CMakeLists.txt delete mode 100644 expkg/src/BinaryOPT/BinaryReader.cpp delete mode 100644 expkg/src/BinaryOPT/BinaryReader.h delete mode 100644 expkg/src/BinaryOPT/BinaryWriter.cpp delete mode 100644 expkg/src/BinaryOPT/BinaryWriter.h delete mode 100644 expkg/src/BinaryOPT/ImageReader.cpp delete mode 100644 expkg/src/BinaryOPT/ImageReader.h delete mode 100644 expkg/src/Core.cpp delete mode 100644 expkg/src/Core.h delete mode 100644 expkg/src/DXT/DXT.cpp delete mode 100644 expkg/src/DXT/DXT.h delete mode 100644 expkg/src/EXPKG/EXPKG.cpp delete mode 100644 expkg/src/EXPKG/EXPKG.h delete mode 100644 expkg/src/Entry.cpp delete mode 100644 expkg/src/Entry.h delete mode 100644 expkg/src/Tex/Tex.cpp delete mode 100644 expkg/src/Tex/Tex.h delete mode 100644 expkg/src/Tex/TexFrameInfoContainer.cpp delete mode 100644 expkg/src/Tex/TexFrameInfoContainer.h delete mode 100644 expkg/src/Tex/TexImage.cpp delete mode 100644 expkg/src/Tex/TexImage.h delete mode 100644 expkg/src/Tex/TexImageContainer.cpp delete mode 100644 expkg/src/Tex/TexImageContainer.h delete mode 100644 expkg/src/expkg.h delete mode 100644 expkg/vendor/lz4/build/.gitignore delete mode 100644 expkg/vendor/lz4/build/README.md delete mode 100644 expkg/vendor/lz4/build/VS2022/_build.bat delete mode 100644 expkg/vendor/lz4/build/VS2022/_setup.bat delete mode 100644 expkg/vendor/lz4/build/VS2022/_test.bat delete mode 100644 expkg/vendor/lz4/build/VS2022/build-and-test-win32-debug.bat delete mode 100644 expkg/vendor/lz4/build/VS2022/build-and-test-win32-release.bat delete mode 100644 expkg/vendor/lz4/build/VS2022/build-and-test-x64-debug.bat delete mode 100644 expkg/vendor/lz4/build/VS2022/build-and-test-x64-release.bat delete mode 100644 expkg/vendor/lz4/build/VS2022/datagen/datagen.vcxproj delete mode 100644 expkg/vendor/lz4/build/VS2022/frametest/frametest.vcxproj delete mode 100644 expkg/vendor/lz4/build/VS2022/fullbench-dll/fullbench-dll.vcxproj delete mode 100644 expkg/vendor/lz4/build/VS2022/fullbench/fullbench.vcxproj delete mode 100644 expkg/vendor/lz4/build/VS2022/fuzzer/fuzzer.vcxproj delete mode 100644 expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.rc delete mode 100644 expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.vcxproj delete mode 100644 expkg/vendor/lz4/build/VS2022/liblz4/liblz4.vcxproj delete mode 100644 expkg/vendor/lz4/build/VS2022/lz4.sln delete mode 100644 expkg/vendor/lz4/build/VS2022/lz4/lz4.rc delete mode 100644 expkg/vendor/lz4/build/VS2022/lz4/lz4.vcxproj delete mode 100644 expkg/vendor/lz4/build/cmake/.gitignore delete mode 100644 expkg/vendor/lz4/build/cmake/CMakeLists.txt delete mode 100644 expkg/vendor/lz4/build/cmake/lz4Config.cmake.in delete mode 100644 expkg/vendor/lz4/build/make/README.md delete mode 100644 expkg/vendor/lz4/build/make/lz4defs.make delete mode 100644 expkg/vendor/lz4/build/make/multiconf.make delete mode 100644 expkg/vendor/lz4/build/meson/GetLz4LibraryVersion.py delete mode 100644 expkg/vendor/lz4/build/meson/README.md delete mode 100644 expkg/vendor/lz4/build/meson/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/contrib/gen_manual/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/contrib/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/examples/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/lib/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/ossfuzz/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/programs/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson/tests/meson.build delete mode 100644 expkg/vendor/lz4/build/meson/meson_options.txt delete mode 100644 expkg/vendor/lz4/build/visual/README.md delete mode 100644 expkg/vendor/lz4/build/visual/generate_solution.cmd delete mode 100644 expkg/vendor/lz4/build/visual/generate_vs2015.cmd delete mode 100644 expkg/vendor/lz4/build/visual/generate_vs2017.cmd delete mode 100644 expkg/vendor/lz4/build/visual/generate_vs2019.cmd delete mode 100644 expkg/vendor/lz4/build/visual/generate_vs2022.cmd create mode 100644 src/Core/Config.h create mode 100644 src/Core/ExtractStats.h create mode 100644 src/Core/Logger.cpp create mode 100644 src/Core/Logger.h create mode 100644 src/Core/ProcessInfo.cpp create mode 100644 src/Core/ProcessInfo.h create mode 100644 src/Core/ProgressBar.cpp create mode 100644 src/Core/ProgressBar.h create mode 100644 src/Core/Result.h create mode 100644 src/Core/Types.h create mode 100644 src/Decoder/DxtDecoder.cpp create mode 100644 src/Decoder/DxtDecoder.h create mode 100644 src/Decoder/ImageReader.cpp create mode 100644 src/Decoder/ImageReader.h create mode 100644 src/Decoder/PkgExtractor.cpp create mode 100644 src/Decoder/PkgExtractor.h create mode 100644 src/Decoder/TexDecoder.cpp create mode 100644 src/Decoder/TexDecoder.h create mode 100644 src/Encoder/ImageEncoder.cpp create mode 100644 src/Encoder/ImageEncoder.h create mode 100644 src/IO/StreamReader.cpp create mode 100644 src/IO/StreamReader.h create mode 100644 src/IO/StreamWriter.cpp create mode 100644 src/IO/StreamWriter.h create mode 100644 src/Pipeline/ExtractPipeline.cpp create mode 100644 src/Pipeline/ExtractPipeline.h create mode 100644 src/Pipeline/TaskScheduler.cpp create mode 100644 src/Pipeline/TaskScheduler.h create mode 100644 src/expkg.h create mode 100644 src/main.cpp delete mode 100644 testApp/CMakeLists.txt delete mode 100644 testApp/src/main.cpp rename {expkg/vendor => vendor}/gif-h/LICENSE (100%) rename {expkg/vendor => vendor}/gif-h/gif.h (100%) rename {expkg/vendor => vendor}/lz4/.cirrus.yml (100%) rename {expkg/vendor => vendor}/lz4/.clang-format (100%) rename {expkg/vendor => vendor}/lz4/.gitattributes (100%) rename {expkg/vendor => vendor}/lz4/.gitignore (100%) rename {expkg/vendor => vendor}/lz4/CODING_STYLE (100%) rename {expkg/vendor => vendor}/lz4/INSTALL (100%) rename {expkg/vendor => vendor}/lz4/LICENSE (100%) rename {expkg/vendor => vendor}/lz4/Makefile (100%) rename {expkg/vendor => vendor}/lz4/NEWS (100%) rename {expkg/vendor => vendor}/lz4/README.md (100%) rename {expkg/vendor => vendor}/lz4/SECURITY.md (100%) rename {expkg/vendor => vendor}/lz4/appveyor.yml (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/changelog (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/compat (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/control (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/copyright (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/dirs (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/docs (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/liblz4-dev.install (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/liblz4.install (100%) rename {expkg/vendor => vendor}/lz4/contrib/debian/rules (100%) rename {expkg/vendor => vendor}/lz4/contrib/djgpp/LICENSE (100%) rename {expkg/vendor => vendor}/lz4/contrib/djgpp/Makefile (100%) rename {expkg/vendor => vendor}/lz4/contrib/djgpp/README.MD (100%) rename {expkg/vendor => vendor}/lz4/contrib/gen_manual/.gitignore (100%) rename {expkg/vendor => vendor}/lz4/contrib/gen_manual/Makefile (100%) rename {expkg/vendor => vendor}/lz4/contrib/gen_manual/README.md (100%) rename {expkg/vendor => vendor}/lz4/contrib/gen_manual/gen-lz4-manual.sh (100%) rename {expkg/vendor => vendor}/lz4/contrib/gen_manual/gen_manual.cpp (100%) rename {expkg/vendor => vendor}/lz4/contrib/snap/README.md (100%) rename {expkg/vendor => vendor}/lz4/contrib/snap/snapcraft.yaml (100%) rename {expkg/vendor => vendor}/lz4/doc/lz4_Block_format.md (100%) rename {expkg/vendor => vendor}/lz4/doc/lz4_Frame_format.md (100%) rename {expkg/vendor => vendor}/lz4/doc/lz4_manual.html (100%) rename {expkg/vendor => vendor}/lz4/doc/lz4frame_manual.html (100%) rename {expkg/vendor => vendor}/lz4/examples/.gitignore (100%) rename {expkg/vendor => vendor}/lz4/examples/COPYING (100%) rename {expkg/vendor => vendor}/lz4/examples/Makefile (100%) rename {expkg/vendor => vendor}/lz4/examples/README.md (100%) rename {expkg/vendor => vendor}/lz4/examples/bench_functions.c (100%) rename {expkg/vendor => vendor}/lz4/examples/blockStreaming_doubleBuffer.c (100%) rename {expkg/vendor => vendor}/lz4/examples/blockStreaming_doubleBuffer.md (100%) rename {expkg/vendor => vendor}/lz4/examples/blockStreaming_lineByLine.c (100%) rename {expkg/vendor => vendor}/lz4/examples/blockStreaming_lineByLine.md (100%) rename {expkg/vendor => vendor}/lz4/examples/blockStreaming_ringBuffer.c (100%) rename {expkg/vendor => vendor}/lz4/examples/dictionaryRandomAccess.c (100%) rename {expkg/vendor => vendor}/lz4/examples/dictionaryRandomAccess.md (100%) rename {expkg/vendor => vendor}/lz4/examples/fileCompress.c (100%) rename {expkg/vendor => vendor}/lz4/examples/frameCompress.c (100%) rename {expkg/vendor => vendor}/lz4/examples/print_version.c (100%) rename {expkg/vendor => vendor}/lz4/examples/simple_buffer.c (100%) rename {expkg/vendor => vendor}/lz4/examples/streamingHC_ringBuffer.c (100%) rename {expkg/vendor => vendor}/lz4/examples/streaming_api_basics.md (100%) rename {expkg/vendor => vendor}/lz4/lib/.gitignore (100%) rename {expkg/vendor => vendor}/lz4/lib/LICENSE (100%) rename {expkg/vendor => vendor}/lz4/lib/Makefile (100%) rename {expkg/vendor => vendor}/lz4/lib/README.md (100%) rename {expkg/vendor => vendor}/lz4/lib/dll/example/Makefile (100%) rename {expkg/vendor => vendor}/lz4/lib/dll/example/README.md (100%) rename {expkg/vendor => vendor}/lz4/lib/dll/example/fullbench-dll.sln (100%) rename {expkg/vendor => vendor}/lz4/lib/dll/example/fullbench-dll.vcxproj (100%) rename {expkg/vendor => vendor}/lz4/lib/liblz4-dll.rc.in (100%) rename {expkg/vendor => vendor}/lz4/lib/liblz4.pc.in (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4.c (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4.h (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4file.c (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4file.h (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4frame.c (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4frame.h (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4frame_static.h (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4hc.c (100%) rename {expkg/vendor => vendor}/lz4/lib/lz4hc.h (100%) rename {expkg/vendor => vendor}/lz4/lib/xxhash.c (100%) rename {expkg/vendor => vendor}/lz4/lib/xxhash.h (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/.gitignore (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/Makefile (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/compress_frame_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/compress_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/compress_hc_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/decompress_frame_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/decompress_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/fuzz.h (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/fuzz_data_producer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/fuzz_data_producer.h (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/fuzz_helpers.h (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/lz4_helpers.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/lz4_helpers.h (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/ossfuzz.sh (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/round_trip_frame_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/round_trip_frame_uncompressed_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/round_trip_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/round_trip_hc_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/round_trip_stream_fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/standaloneengine.c (100%) rename {expkg/vendor => vendor}/lz4/ossfuzz/travisoss.sh (100%) rename {expkg/vendor => vendor}/lz4/programs/.gitignore (100%) rename {expkg/vendor => vendor}/lz4/programs/COPYING (100%) rename {expkg/vendor => vendor}/lz4/programs/Makefile (100%) rename {expkg/vendor => vendor}/lz4/programs/README.md (100%) rename {expkg/vendor => vendor}/lz4/programs/bench.c (100%) rename {expkg/vendor => vendor}/lz4/programs/bench.h (100%) rename {expkg/vendor => vendor}/lz4/programs/lorem.c (100%) rename {expkg/vendor => vendor}/lz4/programs/lorem.h (100%) rename {expkg/vendor => vendor}/lz4/programs/lz4-exe.rc.in (100%) rename {expkg/vendor => vendor}/lz4/programs/lz4.1 (100%) rename {expkg/vendor => vendor}/lz4/programs/lz4.1.md (100%) rename {expkg/vendor => vendor}/lz4/programs/lz4cli.c (100%) rename {expkg/vendor => vendor}/lz4/programs/lz4conf.h (100%) rename {expkg/vendor => vendor}/lz4/programs/lz4io.c (100%) rename {expkg/vendor => vendor}/lz4/programs/lz4io.h (100%) rename {expkg/vendor => vendor}/lz4/programs/platform.h (100%) rename {expkg/vendor => vendor}/lz4/programs/threadpool.c (100%) rename {expkg/vendor => vendor}/lz4/programs/threadpool.h (100%) rename {expkg/vendor => vendor}/lz4/programs/timefn.c (100%) rename {expkg/vendor => vendor}/lz4/programs/timefn.h (100%) rename {expkg/vendor => vendor}/lz4/programs/util.c (100%) rename {expkg/vendor => vendor}/lz4/programs/util.h (100%) rename {expkg/vendor => vendor}/lz4/tests/.gitignore (100%) rename {expkg/vendor => vendor}/lz4/tests/COPYING (100%) rename {expkg/vendor => vendor}/lz4/tests/Makefile (100%) rename {expkg/vendor => vendor}/lz4/tests/README.md (100%) rename {expkg/vendor => vendor}/lz4/tests/abiTest.c (100%) rename {expkg/vendor => vendor}/lz4/tests/checkFrame.c (100%) rename {expkg/vendor => vendor}/lz4/tests/checkTag.c (100%) rename {expkg/vendor => vendor}/lz4/tests/check_liblz4_version.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/check_stdvars.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/cmake/CMakeLists.txt (100%) rename {expkg/vendor => vendor}/lz4/tests/datagen.c (100%) rename {expkg/vendor => vendor}/lz4/tests/datagen.h (100%) rename {expkg/vendor => vendor}/lz4/tests/datagencli.c (100%) rename {expkg/vendor => vendor}/lz4/tests/decompress-partial-usingDict.c (100%) rename {expkg/vendor => vendor}/lz4/tests/decompress-partial.c (100%) rename {expkg/vendor => vendor}/lz4/tests/frametest.c (100%) rename {expkg/vendor => vendor}/lz4/tests/freestanding.c (100%) rename {expkg/vendor => vendor}/lz4/tests/fullbench.c (100%) rename {expkg/vendor => vendor}/lz4/tests/fuzzer.c (100%) rename {expkg/vendor => vendor}/lz4/tests/goldenSamples/skip.bin (100%) rename {expkg/vendor => vendor}/lz4/tests/loremOut.c (100%) rename {expkg/vendor => vendor}/lz4/tests/loremOut.h (100%) rename {expkg/vendor => vendor}/lz4/tests/roundTripTest.c (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-abi.py (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-basic.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-contentSize.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-dict.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-fast-hugefile.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-frame-concatenation.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-list.py (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-multiple-legacy.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-multiple.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-opt-parser.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-skippable.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-sparse.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-speed.py (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-testmode.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4-versions.py (100%) rename {expkg/vendor => vendor}/lz4/tests/test-lz4hc-hugefile.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test_custom_block_sizes.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/test_install.sh (100%) rename {expkg/vendor => vendor}/lz4/tests/unicode_lint.sh (100%) rename {expkg/vendor => vendor}/stb/stb_image_write.cpp (100%) rename {expkg/vendor => vendor}/stb/stb_image_write.h (100%) diff --git a/.gitignore b/.gitignore index 2c81960..3ba16f7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ cmake-build-*/ # build build/ +compile_commands.json + # vs .vs/ .vscode/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 2002af5..5b8fb1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,31 @@ cmake_minimum_required(VERSION 3.31) project(expkg) -# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -add_subdirectory(expkg) -add_subdirectory(testApp) \ No newline at end of file +# 默认 Release 构建(Debug 模式下 GIF/PNG 编码慢 3-5 倍) +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE) +endif() + +# 第三方依赖 +add_subdirectory(vendor/lz4/build/cmake) + +# 源文件(CONFIGURE_DEPENDS: 文件增删时自动重新配置) +file(GLOB_RECURSE SRC_SOURCE CONFIGURE_DEPENDS src/*.cpp) +file(GLOB STB_SOURCE CONFIGURE_DEPENDS vendor/stb/*.cpp) + +# 可执行文件 +add_executable(${PROJECT_NAME} ${SRC_SOURCE} ${STB_SOURCE}) + +# MSVC 默认编码设为 UTF-8 +if(MSVC) + target_compile_options(${PROJECT_NAME} PRIVATE /utf-8) +endif() + +# 依赖与头文件路径 +target_link_libraries(${PROJECT_NAME} PRIVATE lz4) +target_include_directories(${PROJECT_NAME} + PRIVATE vendor/stb vendor/gif-h src +) diff --git a/README.md b/README.md index 30c5fea..90509ff 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,12 @@ # exPKG ## useage -> ```c++ -> #include "EXPKG/EXPKG.h" -> -> int main(int argc, char** argv) { -> CommandArgs args{ argc, argv}; -> -> PKG::EXPKG decompress(args); -> PKG::EXPKG decompress("path/to/file"); -> PKG::EXPKG decompress("path/to/file", "path/to/output/directory"); -> -> return 0; -> } +> ```bash +> expkg /path/to/file.pkg|file.mpkg [output/path] >``` -## Cmake -> -> use as subdirectory -> -> ```cmake -> add_subdirectory(path/to/expkg) -> ->add_executable(${TARGET} ${SRC_SOURCE}) ->target_link_libraries(${TARGET} expkg-static) -> -> # or use dll by -> # target_link_libraries(${TARGET} expkg-shared) ->``` -> then -> ```bash +build +```bash > cmake -B build > cmake --build build --config Release -j8 ->``` \ No newline at end of file +>``` diff --git a/expkg/CMakeLists.txt b/expkg/CMakeLists.txt deleted file mode 100644 index ca41b0f..0000000 --- a/expkg/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -set(TARGET expkg) -project(${TARGET}) - -add_subdirectory(vendor/lz4/build/cmake) - -file(GLOB_RECURSE SRC_SOURCE src/**.cpp vendor/gif-h/gif.h) - -file(GLOB STB_SOURCE vendor/stb/*.cpp) - -if(MSVC) - add_compile_options(/utf-8) -endif() - - -# static -add_library(expkg-static STATIC - ${SRC_SOURCE} - ${STB_SOURCE} -) - -target_link_libraries(expkg-static PRIVATE lz4) - -target_include_directories(expkg-static PRIVATE vendor/stb vendor/gif-h) - -target_include_directories(expkg-static PUBLIC src) - - -# shared -add_library(expkg-shared SHARED - ${SRC_SOURCE} - ${STB_SOURCE} -) - -set_target_properties(expkg-shared PROPERTIES - OUTPUT_NAME "expkg" - PREFIX "" -) - -target_link_libraries(expkg-shared PRIVATE lz4) -target_compile_definitions(expkg-shared PRIVATE -DPKG_SHARED -DPKG_BUILD_DLL) - -target_include_directories(expkg-shared PRIVATE vendor/stb vendor/gif-h) - -target_include_directories(expkg-shared PUBLIC src) - - diff --git a/expkg/src/BinaryOPT/BinaryReader.cpp b/expkg/src/BinaryOPT/BinaryReader.cpp deleted file mode 100644 index 09c2c33..0000000 --- a/expkg/src/BinaryOPT/BinaryReader.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#include "BinaryReader.h" - -#include -#include - -namespace PKG -{ - BinaryReader::BinaryReader(const std::filesystem::path& fileName) - { - m_FilePath = fileName.string(); - - m_File.open(m_FilePath, std::ios::in | std::ios::binary); - if (!m_File.is_open()) - { - std::cerr << "Failed to open file " << m_FilePath << std::endl; - system("pause"); - exit(0); - } - } - - BinaryReader::~BinaryReader() - { - if (m_File.is_open()) - m_File.close(); - } - - - int32_t BinaryReader::ReadInt32() - { - int32_t result = 0; - m_File.read(reinterpret_cast(&result), sizeof(int32_t)); - return result; - } - - uint32_t BinaryReader::ReadUInt32() - { - uint32_t result = 0; - m_File.read(reinterpret_cast(&result), sizeof(uint32_t)); - return result; - } - - float BinaryReader::ReadSingle() - { - float result = 0; - m_File.read(reinterpret_cast(&result), sizeof(float)); - return result; - } - - char BinaryReader::ReadChar() - { - char result; - m_File.read(&result, sizeof(char)); - return result; - } - - void BinaryReader::ReadData(std::string& data, const uint32_t length) - { - data.resize(length); - m_File.read(data.data(), length); - } - - void BinaryReader::ReadData(std::vector& data, uint32_t length) - { - data.resize(length); - m_File.read(reinterpret_cast(data.data()), length); - } - - std::string BinaryReader::ReadString(const uint32_t length) - { - std::vector result; - result.resize(length); - - m_File.read(reinterpret_cast(result.data()), length); - return std::filesystem::u8path(std::string(reinterpret_cast(result.data()), length)).string(); - } - - std::string BinaryReader::ReadStringFileData(const uint32_t length) - { - std::vector result; - result.resize(length); - - m_File.read(reinterpret_cast(result.data()), length); - return std::string(reinterpret_cast(result.data()), length); - } - - std::string BinaryReader::ReadNString(const int32_t maxLength) - { - std::vector result; - result.resize(0); - int count = maxLength <= 0 ? 16 : maxLength; - - char chr = ReadChar(); - while (chr != '\0' && (maxLength == -1 || count <= maxLength)) - { - result.push_back(chr); - chr = ReadChar(); - } - - return std::string(reinterpret_cast(result.data()), result.size()); - } -} diff --git a/expkg/src/BinaryOPT/BinaryReader.h b/expkg/src/BinaryOPT/BinaryReader.h deleted file mode 100644 index 4246111..0000000 --- a/expkg/src/BinaryOPT/BinaryReader.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#ifndef BINARYREADER_H -#define BINARYREADER_H - -#include -#include -#include - -#include "Core.h" - - -namespace PKG -{ - using pos_type = long long; - - class PKG_API BinaryReader - { - public: - BinaryReader() = delete; - explicit BinaryReader(const std::filesystem::path& fileName); - ~BinaryReader(); - - int32_t ReadInt32(); - uint32_t ReadUInt32(); - float ReadSingle(); - char ReadChar(); - std::string ReadString(uint32_t length); - std::string ReadNString(int32_t maxLength = -1); - std::string ReadStringFileData(uint32_t length); - void ReadData(std::string& data, uint32_t length); - void ReadData(std::vector& data, uint32_t length); - - void seekg(const pos_type pos) { m_File.seekg(pos); } - pos_type tellg() { return m_File.tellg(); } - - std::string GetFilePath() const { return m_FilePath; } - std::string GetFileName() const { return m_FilePath.substr(m_FilePath.find_last_of("\\/") + 1); } - - private: - std::ifstream m_File; - - std::string m_FilePath; - }; -} - - -#endif //BINARYREADER_H diff --git a/expkg/src/BinaryOPT/BinaryWriter.cpp b/expkg/src/BinaryOPT/BinaryWriter.cpp deleted file mode 100644 index b1e4dda..0000000 --- a/expkg/src/BinaryOPT/BinaryWriter.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#include "BinaryWriter.h" - -#include -#include - -namespace PKG -{ - BinaryWriter::BinaryWriter(const std::filesystem::path& fileName, const std::ios_base::openmode optMode) - { - m_FilePath = fileName.string(); - const std::filesystem::path path(fileName.parent_path()); - - m_File.open(m_FilePath, optMode); - if (!m_File.is_open() && !std::filesystem::exists(path)) - { - std::filesystem::create_directories(path); - m_File.open(m_FilePath, optMode); - if (!m_File.is_open()) - std::cerr << "cound not create file: " << m_FilePath << std::endl; - } - } - - BinaryWriter::~BinaryWriter() - { - close(); - } - - void BinaryWriter::WriteBytes(const char* data, const uint32_t size) - { - m_File.write(data, size); - } - - void BinaryWriter::WriteString(const std::string& str) - { - m_File.write(str.c_str(), str.size()); - } - - void BinaryWriter::close() - { - if (!m_File.is_open()) - m_File.close(); - } -} diff --git a/expkg/src/BinaryOPT/BinaryWriter.h b/expkg/src/BinaryOPT/BinaryWriter.h deleted file mode 100644 index f6ddb8c..0000000 --- a/expkg/src/BinaryOPT/BinaryWriter.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#ifndef BINARYWRITER_H -#define BINARYWRITER_H - -#include -#include - -#include "Core.h" - -namespace PKG -{ - class PKG_API BinaryWriter - { - public: - BinaryWriter() = delete; - explicit BinaryWriter(const std::filesystem::path& fileName, std::ios_base::openmode optMode = std::ios::out); - ~BinaryWriter(); - - void WriteBytes(const char* data, uint32_t size); - void WriteString(const std::string& str); - - std::string GetFilePath() const { return m_FilePath; } - std::string GetFileName() const { return m_FilePath.substr(m_FilePath.find_last_of("\\/") + 1); } - - void close(); - - private: - std::ofstream m_File; - std::string m_FilePath; - }; - -} - - -#endif //BINARYWRITER_H diff --git a/expkg/src/BinaryOPT/ImageReader.cpp b/expkg/src/BinaryOPT/ImageReader.cpp deleted file mode 100644 index 9704343..0000000 --- a/expkg/src/BinaryOPT/ImageReader.cpp +++ /dev/null @@ -1,265 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#include "ImageReader.h" - -#include - -#include "lz4.h" - - -namespace PKG -{ - - -#include - - std::vector Lz4Decompress(const unsigned char* compressedData, - size_t compressedSize, - size_t decompressedSize) - { - // 准备输出缓冲区 - std::vector output(decompressedSize); - - // 执行解压缩 - int result = LZ4_decompress_safe( - reinterpret_cast(compressedData), - reinterpret_cast(output.data()), - static_cast(compressedSize), - static_cast(decompressedSize) - ); - - // 检查解压结果 - if (result < 0 || static_cast(result) != decompressedSize) { - throw std::runtime_error("LZ4 decompression failed"); - } - - return output; - } - - TexImage ImageReader::ReadFrom(BinaryReader& reader, const TexImageContainer& container, const TexFormat format) - { - int mipMapCount = reader.ReadInt32(); - - auto aFormat = GetFormatFromTex(container.ImageFormat, format); - - TexImage image{}; - - for (int i = 0; i < mipMapCount; i++) - { - - TexMipMap mipmap; - - switch (container.imageContainerVersion) - { - case ImageContainerVersion::VERSION1: - mipmap = ReadMipMapV1(reader); break; - case ImageContainerVersion::VERSION2: - case ImageContainerVersion::VERSION3: - mipmap = ReadMipMapV2AndV3(reader); break; - case ImageContainerVersion::VERSION4: - mipmap = ReadMipMapV4(reader); break; - } - - mipmap.Format = aFormat; - if (mipmap.IsZ4Compressed) - { - mipmap.Data = Lz4Decompress(mipmap.Data.data(), mipmap.Data.size(), mipmap.DecompressedDataCount); - mipmap.IsZ4Compressed = false; - } - - - image.Mipmaps.push_back(mipmap); - } - - return image; - } - - TexImageContainer ImageReader::ImageContainerReaderReadFrom(BinaryReader& reader, TexFormat texFormat) - { - TexImageContainer container; - - container.Magic = reader.ReadNString(); - - int imageCount = reader.ReadInt32(); - - if (container.Magic == "TEXB0001") - { - } - else if (container.Magic == "TEXB0002") - { - } - else if (container.Magic == "TEXB0003") - { - container.ImageFormat = (FreeImageFormat)reader.ReadInt32(); - } - else if (container.Magic == "TEXB0004") - { - auto format = (FreeImageFormat)reader.ReadInt32(); - - bool isVideoMp4 = reader.ReadInt32(); - if (format == FreeImageFormat::FIF_UNKNOWN) - { - if (isVideoMp4) - format = FreeImageFormat::FIF_MP4; - } - container.ImageFormat = format; - } - else - { - std::cerr << "bad image format" << std::endl; - } - - - int version = std::stoi(container.Magic.substr(4, 4)); - - container.imageContainerVersion = (ImageContainerVersion)version; - - if (container.imageContainerVersion == ImageContainerVersion::VERSION4 && container.ImageFormat != FreeImageFormat::FIF_MP4) - { - container.imageContainerVersion = ImageContainerVersion::VERSION3; - } - - for (int i = 0; i < imageCount; i++) - { - container.Images.push_back(ReadFrom(reader, container, texFormat)); - } - - return container; - } - - TexMipMap ImageReader::ReadMipMapV1(BinaryReader& reader) - { - TexMipMap mipmap{}; - mipmap.Width = reader.ReadInt32(); - mipmap.Height = reader.ReadInt32(); - mipmap.Data = ReadBytes(reader); - - return mipmap; - } - - TexMipMap ImageReader::ReadMipMapV2AndV3(BinaryReader& reader) - { - TexMipMap mipmap{}; - - mipmap.Width = reader.ReadInt32(); - mipmap.Height = reader.ReadInt32(); - mipmap.IsZ4Compressed = reader.ReadInt32() == 1; - mipmap.DecompressedDataCount = reader.ReadInt32(); - mipmap.Data = ReadBytes(reader); - - return mipmap; - } - - TexMipMap ImageReader::ReadMipMapV4(BinaryReader& reader) - { - int param1 = reader.ReadInt32(); - if (param1 != 1) - { - std::cerr << "ReadMipmapV4 unknow param1: " << param1 << std::endl; - } - - int param2 = reader.ReadInt32(); - if (param2 != 2) - { - std::cerr << "ReadMipmapV4 unknow param2: " << param1 << std::endl; - } - - std::string condition = reader.ReadNString(); - - int param3 = reader.ReadInt32(); - if (param3 != 1) - { - std::cerr << "ReadMipmapV4 unknow param3: " << param1 << std::endl; - } - - TexMipMap mipmap{}; - mipmap.Width = reader.ReadInt32(); - mipmap.Height = reader.ReadInt32(); - mipmap.IsZ4Compressed = reader.ReadInt32() == 1; - mipmap.DecompressedDataCount = reader.ReadInt32(); - mipmap.Data = ReadBytes(reader); - - return mipmap; - } - - std::vector ImageReader::ReadBytes(BinaryReader& reader) - { - int count = reader.ReadInt32(); - - std::vector bytes; - - reader.ReadData(bytes, count); - - return bytes; - } - - MipmapFormat ImageReader::GetFormatFromTex(FreeImageFormat imageFormat, TexFormat format) - { - if (imageFormat != FreeImageFormat::FIF_UNKNOWN) - { - return FreeImageFormatToMipmapFormat(imageFormat); - } - - switch (format) - { - case TexFormat::RGBA8888: return MipmapFormat::RGBA8888; - case TexFormat::DXT5: return MipmapFormat::CompressedDXT5; - case TexFormat::DXT3: return MipmapFormat::CompressedDXT3; - case TexFormat::DXT1: return MipmapFormat::CompressedDXT1; - case TexFormat::RG88: return MipmapFormat::RG88; - case TexFormat::R8: return MipmapFormat::R8; - } - - std::cerr << "unknow format" << std::endl; - - return MipmapFormat::Invalid; - } - - MipmapFormat ImageReader::FreeImageFormatToMipmapFormat(FreeImageFormat imageFormat) - { - switch (imageFormat) - { - case FreeImageFormat::FIF_BMP: return MipmapFormat::ImageBMP; - case FreeImageFormat::FIF_ICO: return MipmapFormat::ImageICO; - case FreeImageFormat::FIF_JPEG: return MipmapFormat::ImageJPEG; - case FreeImageFormat::FIF_JNG: return MipmapFormat::ImageJNG; - case FreeImageFormat::FIF_KOALA: return MipmapFormat::ImageKOALA; - case FreeImageFormat::FIF_LBM: return MipmapFormat::ImageLBM; - case FreeImageFormat::FIF_MNG: return MipmapFormat::ImageMNG; - case FreeImageFormat::FIF_PBM: return MipmapFormat::ImagePBM; - case FreeImageFormat::FIF_PBMRAW: return MipmapFormat::ImagePBMRAW; - case FreeImageFormat::FIF_PCD: return MipmapFormat::ImagePCD; - case FreeImageFormat::FIF_PCX: return MipmapFormat::ImagePCX; - case FreeImageFormat::FIF_PGM: return MipmapFormat::ImagePGM; - case FreeImageFormat::FIF_PGMRAW: return MipmapFormat::ImagePGMRAW; - case FreeImageFormat::FIF_PNG: return MipmapFormat::ImagePNG; - case FreeImageFormat::FIF_PPM: return MipmapFormat::ImagePPM; - case FreeImageFormat::FIF_PPMRAW: return MipmapFormat::ImagePPMRAW; - case FreeImageFormat::FIF_RAS: return MipmapFormat::ImageRAS; - case FreeImageFormat::FIF_TARGA: return MipmapFormat::ImageTARGA; - case FreeImageFormat::FIF_TIFF: return MipmapFormat::ImageTIFF; - case FreeImageFormat::FIF_WBMP: return MipmapFormat::ImageWBMP; - case FreeImageFormat::FIF_PSD: return MipmapFormat::ImagePSD; - case FreeImageFormat::FIF_CUT: return MipmapFormat::ImageCUT; - case FreeImageFormat::FIF_XBM: return MipmapFormat::ImageXBM; - case FreeImageFormat::FIF_XPM: return MipmapFormat::ImageXPM; - case FreeImageFormat::FIF_DDS: return MipmapFormat::ImageDDS; - case FreeImageFormat::FIF_GIF: return MipmapFormat::ImageGIF; - case FreeImageFormat::FIF_HDR: return MipmapFormat::ImageHDR; - case FreeImageFormat::FIF_FAXG3: return MipmapFormat::ImageFAXG3; - case FreeImageFormat::FIF_SGI: return MipmapFormat::ImageSGI; - case FreeImageFormat::FIF_EXR: return MipmapFormat::ImageEXR; - case FreeImageFormat::FIF_J2K: return MipmapFormat::ImageJ2K; - case FreeImageFormat::FIF_JP2: return MipmapFormat::ImageJP2; - case FreeImageFormat::FIF_PFM: return MipmapFormat::ImagePFM; - case FreeImageFormat::FIF_PICT: return MipmapFormat::ImagePICT; - case FreeImageFormat::FIF_RAW: return MipmapFormat::ImageRAW; - case FreeImageFormat::FIF_MP4: return MipmapFormat::VideoMp4; - } - - std::cerr << "unknown format" << std::endl; - return MipmapFormat::Invalid; - } -} diff --git a/expkg/src/BinaryOPT/ImageReader.h b/expkg/src/BinaryOPT/ImageReader.h deleted file mode 100644 index 87ba0b3..0000000 --- a/expkg/src/BinaryOPT/ImageReader.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#ifndef IMAGEREADER_H -#define IMAGEREADER_H -#include "BinaryOPT/BinaryReader.h" -#include "Tex/TexImageContainer.h" - -namespace PKG -{ - class PKG_API ImageReader - { - public: - static TexImage ReadFrom(BinaryReader& reader, const TexImageContainer& container, TexFormat format); - - static TexImageContainer ImageContainerReaderReadFrom(BinaryReader& reader, TexFormat texFormat); - - private: - static TexMipMap ReadMipMapV1(BinaryReader& reader); - static TexMipMap ReadMipMapV2AndV3(BinaryReader& reader); - static TexMipMap ReadMipMapV4(BinaryReader& reader); - - static std::vector ReadBytes(BinaryReader& reader); - - static MipmapFormat GetFormatFromTex(FreeImageFormat imageFormat, TexFormat format); - static MipmapFormat FreeImageFormatToMipmapFormat(FreeImageFormat imageFormat); - }; -} - - -#endif //IMAGEREADER_H diff --git a/expkg/src/Core.cpp b/expkg/src/Core.cpp deleted file mode 100644 index 56fb379..0000000 --- a/expkg/src/Core.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#include "Core.h" diff --git a/expkg/src/Core.h b/expkg/src/Core.h deleted file mode 100644 index d605110..0000000 --- a/expkg/src/Core.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#ifndef CORE_H -#define CORE_H - -#ifdef PKG_SHARED - #ifdef __WIN32__ - #ifdef PKG_BUILD_DLL - #define PKG_API __declspec(dllexport) - #else - #define PKG_API __declspec(dllimport) - #endif - #else - #define PKG_API - #endif -#else - #define PKG_API -#endif - -#endif //CORE_H - diff --git a/expkg/src/DXT/DXT.cpp b/expkg/src/DXT/DXT.cpp deleted file mode 100644 index 10fa2c6..0000000 --- a/expkg/src/DXT/DXT.cpp +++ /dev/null @@ -1,230 +0,0 @@ -// -// Created by sfd on 25-9-21. -// - -#include "DXT.h" - - -namespace PKG -{ - void DXT::DecompressImage(int width, int height, std::vector& data, const DXTFlags flags) - { - std::vector rgba(width * height * 4); - // uint8_t rgba[width * height * 4]; - - // init the block pos - int sourceBlockPos = 0; - int bytesPerBlock = flags == DXTFlags::DXT1 ? 8 : 16; - std::vector targetRGBA(4 * 16); - - // loop over blocks - for (int y = 0; y < height; y += 4) - { - for (int x = 0; x < width; x += 4) - { - // decompress the block - uint8_t targetRGBA_pos = 0; - - if (data.size() == sourceBlockPos) - continue; - - Decompress(targetRGBA, data, sourceBlockPos, flags); - - // Write the decompressed pixels to the correct image locations - for (int py = 0; py < 4; py++) - { - for (int px = 0; px < 4; px++) - { - const int sx = x + px; - const int sy = y + py; - if (sx < width && sy < height) - { - const int targetPixel = 4 * (width * sy + sx); - - rgba[targetPixel + 0] = targetRGBA[targetRGBA_pos + 0]; - rgba[targetPixel + 1] = targetRGBA[targetRGBA_pos + 1]; - rgba[targetPixel + 2] = targetRGBA[targetRGBA_pos + 2]; - rgba[targetPixel + 3] = targetRGBA[targetRGBA_pos + 3]; - - targetRGBA_pos += 4; - } - else - { - // Ignore that pixel - targetRGBA_pos += 4; - } - } - } - sourceBlockPos += bytesPerBlock; - } - } - - data = rgba; - } - - void DXT::Decompress(std::vector& rgba, std::vector& block, const int blockIndex, const DXTFlags flags) - { - // get block locations - int colorBlockIndex = blockIndex; - - if (flags == DXTFlags::DXT3 | flags == DXTFlags::DXT5) - colorBlockIndex += 8; - - DecompressColor(rgba, block, colorBlockIndex, flags == DXTFlags::DXT1); - - - // decompress alpha separately is necessary - if (flags == DXTFlags::DXT3) - DecompressAlphaDxt3(rgba, block, blockIndex); - else if (flags == DXTFlags::DXT5) - DecompressAlphaDxt5(rgba, block, blockIndex); - } - - void DXT::DecompressColor(std::vector& rgba, std::vector& block, const int blockIndex, const bool isDxt1) - { - // unpack end points - std::vector codes(16); - const int a = UnPack565(block, blockIndex, 0, codes, 0); - const int b = UnPack565(block, blockIndex, 2, codes, 4); - - - // generate Midpoints - for (int i = 0; i < 3; i++) - { - const int c = codes[i]; - const int d = codes[4 + i]; - - if (isDxt1 && a <= b) - { - codes[8 + i] = (uint8_t)((c + d) / 2); - codes[12 + i] = 0; - } - else - { - codes[8 + i] = (uint8_t)((2 * c + d) / 3); - codes[12 + i] = (uint8_t)((c + 2 * d) / 3); - } - } - - // Fill in alpha for intermediate values - codes[8 + 3] = 255; - codes[12 + 3] = (isDxt1 && a <= b) ? (uint8_t)0 : (uint8_t)255; - - - // unpack the indices - std::vector indices(16); - for (int i = 0; i < 4; i++) - { - const int packed = block[blockIndex + 4 + i]; - - indices[0 + i * 4] = (uint8_t)(packed & 0x3); - indices[1 + i * 4] = (uint8_t)((packed >> 2) & 0x3); - indices[2 + i * 4] = (uint8_t)((packed >> 4) & 0x3); - indices[3 + i * 4] = (uint8_t)((packed >> 6) & 0x3); - } - - // store out the colours - for (int i = 0; i < 16; i++) - { - const int offset = 4 * indices[i]; - - rgba[4 * i + 0] = codes[offset + 0]; - rgba[4 * i + 1] = codes[offset + 1]; - rgba[4 * i + 2] = codes[offset + 2]; - rgba[4 * i + 3] = codes[offset + 3]; - } - } - - void DXT::DecompressAlphaDxt3(std::vector& rgba, std::vector& block, const int blockIndex) - { - // Unpack the alpha values pairwise - for (int i = 0; i < 8; i++) - { - // Quantise down to 4 bits - int quant = block[blockIndex + i]; - - const uint8_t lo = (uint8_t)(quant & 0x0F); - const uint8_t hi = (uint8_t)(quant & 0xF0); - - // Convert back up to bytes - rgba[8 * i + 3] = (uint8_t)(lo | (lo << 4)); - rgba[8 * i + 7] = (uint8_t)(hi | (hi >> 4)); - } - } - - void DXT::DecompressAlphaDxt5(std::vector& rgba, std::vector& block, const int blockIndex) - { - // Get the two alpha values - uint8_t alpha0 = block[blockIndex + 0]; - uint8_t alpha1 = block[blockIndex + 1]; - - // compare the values to build the codebook - std::vector codes(8); - codes[0] = alpha0; - codes[1] = alpha1; - if (alpha0 <= alpha1) - { - // Use 5-Alpha Codebook - for (int i = 1; i < 5; i++) - codes[1 + i] = (uint8_t)(((5 - i) * alpha0 + i * alpha1) / 5); - codes[6] = 0; - codes[7] = 255; - } - else - { - // Use 7-Alpha Codebook - for (int i = 1; i < 7; i++) - { - codes[i + 1] = (uint8_t)(((7 - i) * alpha0 + i * alpha1) / 7); - } - } - - // decode indices - std::vector indices(16); - uint8_t blockSrc_pos = 2; - uint8_t indices_pos = 0; - for (int i = 0; i < 2; i++) - { - // grab 3 bytes - int value = 0; - for (int j = 0; j < 3; j++) - { - int _byte = block[blockIndex + blockSrc_pos++]; - value |= (_byte << 8 * j); - } - - // unpack 8 3-bit values from it - for (int j = 0; j < 8; j++) - { - int index = (value >> 3 * j) & 0x07; - indices[indices_pos++] = (uint8_t)index; - } - } - - // write out the indexed codebook values - for (int i = 0; i < 16; i++) - { - rgba[4 * i + 3] = codes[indices[i]]; - } - } - - int DXT::UnPack565(std::vector& block, const int blockIndex, const int packedOffset, std::vector& color, const int colorOffset) - { - // build packed value - const int value = block[blockIndex + packedOffset] | (block[blockIndex + packedOffset + 1] << 8); - - // get components in the stored range - const uint16_t red = ((value >> 11) & 0x1F); - const uint16_t green = ((value >> 5) & 0x3F); - const uint16_t blue = (value & 0x1F); - - - // Scale up to 8 Bit - color[0 + colorOffset] = (uint8_t)((red << 3) | (red >> 2)); - color[1 + colorOffset] = (uint8_t)((green << 2) | (green >> 4)); - color[2 + colorOffset] = (uint8_t)((blue << 3) | (blue >> 2)); - color[3 + colorOffset] = 255; - - return value; - } -} diff --git a/expkg/src/DXT/DXT.h b/expkg/src/DXT/DXT.h deleted file mode 100644 index 1e2c335..0000000 --- a/expkg/src/DXT/DXT.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by sfd on 25-9-21. -// - -#ifndef DXT_H -#define DXT_H -#include -#include - -namespace PKG -{ - enum class DXTFlags - { - DXT1 = 1, - DXT3 = 1 << 1, - DXT5 = 1 << 2, - }; - - - class DXT - { - public: - // public static byte[] DecompressImage(int width, int height, byte[] data, DXTFlags flags) - - static void DecompressImage(int width, int height, std::vector& data, DXTFlags flags); - - private: - static void Decompress(std::vector& rgba, std::vector& block, int blockIndex, DXTFlags flags); - - static int UnPack565(std::vector& block, int blockIndex, int packedOffset, std::vector& color, int colorOffset); - static void DecompressColor(std::vector& rgba, std::vector& block, int blockIndex, bool isDxt1); - static void DecompressAlphaDxt3(std::vector& rgba, std::vector& block, int blockIndex); - static void DecompressAlphaDxt5(std::vector& rgba, std::vector& block, int blockIndex); - }; -} - - -#endif //DXT_H diff --git a/expkg/src/EXPKG/EXPKG.cpp b/expkg/src/EXPKG/EXPKG.cpp deleted file mode 100644 index db00918..0000000 --- a/expkg/src/EXPKG/EXPKG.cpp +++ /dev/null @@ -1,544 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#include "EXPKG.h" - -#include - -#include "gif.h" -#include "BinaryOPT/BinaryWriter.h" -#include "BinaryOPT/ImageReader.h" -#include "DXT/DXT.h" -#include "Tex/Tex.h" - -extern "C" unsigned char* stbi_write_png_to_mem(const unsigned char* pixels, int stride_bytes, int x, int y, int n, - int* out_len); - -namespace PKG -{ - const char* help = R"( -usage: - expkg path/to/file.pkg [path/to/output](optional) -example: - expkg demo.pkg - expkg demo.pkg outdir -)"; - - enum class FILE_EXTENSION - { - TEX, - PKG, - UNKNOWN - }; - - EXPKG::EXPKG(const CommandArgs& commandArgs) - { - if (commandArgs.argc < 2) - { - std::cout << help << std::endl; - system("pause"); - exit(0); - } - m_Reader = std::make_shared(commandArgs.argv[1]); - - if (commandArgs.argc == 3) - { - m_OutDir = commandArgs.argv[2]; - m_OutDir = m_OutDir.make_preferred(); - } - else - { - m_OutDir = "out"; - } - - Run(); - } - - EXPKG::EXPKG(const std::string& filePath, const std::string& outDir) - { - - - m_Reader = std::make_shared(std::filesystem::u8path(filePath)); - m_OutDir = std::filesystem::u8path(outDir); - m_OutDir = m_OutDir.make_preferred(); - - if (m_Reader) - Run(); - } - - FILE_EXTENSION EXPKG::checkExtension(const std::filesystem::path& filePath) - { - if (filePath.extension() == ".pkg") - return FILE_EXTENSION::PKG; - if (filePath.extension() == ".mpkg") - return FILE_EXTENSION::PKG; - if (filePath.extension() == ".tex") - return FILE_EXTENSION::TEX; - - std::cerr << "not a pkg file or mpkg file or tex file" << std::endl; - return FILE_EXTENSION::UNKNOWN; - } - - - void EXPKG::Run() - { - switch (checkExtension(m_Reader->GetFilePath())) - { - case FILE_EXTENSION::TEX: - ExtractTex(); - break; - case FILE_EXTENSION::PKG: - ExtractPkg(); - break; - case FILE_EXTENSION::UNKNOWN: - break; - } - } - - - void EXPKG::ExtractPkg() - { - - // Read Binary resource - const int head = m_Reader->ReadInt32(); - const std::string magicHeader = m_Reader->ReadString(head); - - - if (magicHeader.substr(0,3) != "PKG") - { - std::cerr << "unknown header: " << m_Reader->GetFilePath() << std::endl; - std::cerr << "not a pkg file " << std::endl; - exit(0); - } - - const int count = m_Reader->ReadInt32(); - - if (count > 0) - { - for (int i = 0; i < count; i++) - { - Entry entry; - - const int size = m_Reader->ReadInt32(); - entry.FullPath = m_Reader->ReadString(size); - entry.FullPath = entry.FullPath.make_preferred(); // conflict with system "\\" or "/", use it to solve - entry.Offset = m_Reader->ReadInt32(); - entry.Length = m_Reader->ReadInt32(); - entry.Type = entry.FullPath.extension().string(); - - m_Entries.push_back(entry); - } - - } - else - { - std::cerr << "could not get resource: " << m_Reader->GetFilePath() << std::endl; - exit(0); - } - - // try Extract - - uint32_t offsetPosition = m_Reader->tellg(); - for (const auto& entry : m_Entries) - { - std::cout << "convert file: " << m_OutDir / entry.FullPath << std::endl; - - m_Reader->seekg(entry.Offset + offsetPosition); - - if (entry.Type == ".tex") - { - std::filesystem::path texPath = m_OutDir / entry.FullPath; - { - BinaryWriter writer(texPath, std::ios::binary); - - std::string texdata; - m_Reader->ReadData(texdata, entry.Length); - writer.WriteBytes(texdata.data(), texdata.size()); - writer.close(); - } - - ExtractTex(texPath); - } - else if (entry.Type == ".gif" || - entry.Type == ".jpg" || - entry.Type == ".png" || - entry.Type == ".jpeg" || - entry.Type == ".webp") - { - BinaryWriter writer(m_OutDir / entry.FullPath, std::ios::binary); - - std::string texdata; - m_Reader->ReadData(texdata, entry.Length); - writer.WriteBytes(texdata.data(), texdata.size()); - writer.close(); - } - else - { - BinaryWriter writer(m_OutDir / entry.FullPath); - writer.WriteString(m_Reader->ReadStringFileData(entry.Length)); - } - } - } - - void EXPKG::ExtractTex(const std::filesystem::path& path) const - { - std::shared_ptr reader = m_Reader; - if (path != "") - { - reader = std::make_shared(path); - - } - // Tex ReadHeader - Tex tex{}; - - - tex.Magic1 = reader->ReadNString(16); - if (tex.Magic1 != "TEXV0005") - { - std::cerr << "bad magic" << std::endl; - return; - } - - tex.Magic2 = reader->ReadNString(16); - if (tex.Magic2 != "TEXI0001") - { - std::cerr << "bad magic" << std::endl; - return; - } - - - tex.Header.Format = (TexFormat)reader->ReadInt32(); - tex.Header.Flags = (TexType)reader->ReadInt32(); - tex.Header.TextureWidth = reader->ReadInt32(); - tex.Header.TextureHeight = reader->ReadInt32(); - tex.Header.ImageWidth = reader->ReadInt32(); - tex.Header.ImageHeight = reader->ReadInt32(); - tex.Header.UnkInt0 = reader->ReadInt32(); - if ((int)tex.Header.Flags & (int)TexType::IsGif) tex.IsGif = true; - if ((int)tex.Header.Flags & (int)TexType::IsVideoTexture) tex.IsVideoTexture = true; - - tex.ImageContainer = ImageReader::ImageContainerReaderReadFrom(*reader, tex.Header.Format); - // ReadHeader end - - if (!tex.ImageContainer.Images.empty()) - { - // GetConvertFormat - MipmapFormat format; - if (tex.IsVideoTexture) - format = MipmapFormat::VideoMp4; - else - format = tex.ImageContainer.Images[0].Mipmaps[0].Format; - - auto tmpfotmat = format; - for(auto& Image : tex.ImageContainer.Images) - { - auto& mipmap = Image.Mipmaps[0]; - switch (tmpfotmat) - { - case MipmapFormat::CompressedDXT5: - DXT::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT5); - mipmap.Format = MipmapFormat::RGBA8888; format = MipmapFormat::RGBA8888; - break; - case MipmapFormat::CompressedDXT3: - DXT::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT3); - mipmap.Format = MipmapFormat::RGBA8888; format = MipmapFormat::RGBA8888; - break; - case MipmapFormat::CompressedDXT1: - DXT::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT1); - mipmap.Format = MipmapFormat::RGBA8888; format = MipmapFormat::RGBA8888; - break; - default: - break; - } - } - - if ((int)format >= 1 && (int)format <= 3) - { - format = MipmapFormat::ImagePNG; - } - - // GetConvertFormat end - - // Convert source - - if (tex.IsGif) - { - // convert gif - - // tex.GifContainer - auto& container = tex.FrameInfoContainer; - - container.Magic = reader->ReadNString(16); - - int frameCount = reader->ReadInt32(); - - /* - switch (container.Magic) - { - case "TEXS0001": - case "TEXS0002": - break; - case "TEXS0003": - container.GifWidth = reader->ReadInt32(); - container.GifHeight = reader->ReadInt32(); - break; - default: - std::cerr << "bad magic" << std::endl; - } - */ - - { - if (container.Magic == "TEXS0001" || container.Magic == "TEXS0002") - { - }else if (container.Magic == "TEXS0003") - { - container.GifWidth = reader->ReadInt32(); - container.GifHeight = reader->ReadInt32(); - }else - { - std::cerr << "bad magic" << std::endl; - } - } - - - /* - switch (container.Magic) - { - case "TEXS0001": - for (int i = 0; i < frameCount; i++) - { - TexFrameInfo frameInfo = {}; - frameInfo.ImageId = reader->ReadInt32(); - frameInfo.Frametime = reader->ReadSingle(); - frameInfo.X = reader->ReadInt32(); - frameInfo.Y = reader->ReadInt32(); - frameInfo.Width = reader->ReadInt32(); - frameInfo.WidthY = reader->ReadInt32(); - frameInfo.HeightX = reader->ReadInt32(); - frameInfo.Height = reader->ReadInt32(); - - container.Frames.push_back(frameInfo); - } - case "TEXS0002": - case "TEXS0003": - for (int i = 0; i < frameCount; i++) - { - TexFrameInfo frameInfo = {}; - frameInfo.ImageId = reader->ReadInt32(); - frameInfo.Frametime = reader->ReadSingle(); - frameInfo.X = reader->ReadSingle(); - frameInfo.Y = reader->ReadSingle(); - frameInfo.Width = reader->ReadSingle(); - frameInfo.WidthY = reader->ReadSingle(); - frameInfo.HeightX = reader->ReadSingle(); - frameInfo.Height = reader->ReadSingle(); - - container.Frames.push_back(frameInfo); - } - default: - std::cerr << "bad magic" << std::endl; - } - */ - { - if (container.Magic == "TEXS0001") - { - for (int i = 0; i < frameCount; i++) - { - TexFrameInfo frameInfo = {}; - frameInfo.ImageId = reader->ReadInt32(); - frameInfo.Frametime = reader->ReadSingle(); - frameInfo.PosX = reader->ReadInt32(); - frameInfo.PosY = reader->ReadInt32(); - frameInfo.Width = reader->ReadInt32(); - frameInfo.WidthY = reader->ReadInt32(); - frameInfo.HeightX = reader->ReadInt32(); - frameInfo.Height = reader->ReadInt32(); - - container.Frames.push_back(frameInfo); - } - }else if (container.Magic == "TEXS0002" || container.Magic == "TEXS0003") - { - for (int i = 0; i < frameCount; i++) - { - TexFrameInfo frameInfo = {}; - frameInfo.ImageId = reader->ReadInt32(); - frameInfo.Frametime = reader->ReadSingle(); - frameInfo.PosX = reader->ReadSingle(); - frameInfo.PosY = reader->ReadSingle(); - frameInfo.Width = reader->ReadSingle(); - frameInfo.WidthY = reader->ReadSingle(); - frameInfo.HeightX = reader->ReadSingle(); - frameInfo.Height = reader->ReadSingle(); - - container.Frames.push_back(frameInfo); - } - }else - { - std::cerr << "bad magic" << std::endl; - } - } - - - if (container.GifWidth == 0 || container.GifHeight == 0) - { - container.GifWidth = (int) container.Frames[0].Width; - container.GifHeight = (int) container.Frames[0].Height; - } - - - std::filesystem::path outPath = reader->GetFilePath(); - outPath.replace_extension("gif"); - - std::cout << "convert file: " << outPath << std::endl; - - GifWriter writer; - - uint32_t delay = (int)(tex.FrameInfoContainer.Frames[0].Frametime * 100); - - GifBegin(&writer, - outPath.string().c_str(), - (uint32_t)tex.FrameInfoContainer.Frames[0].Width, - (uint32_t)tex.FrameInfoContainer.Frames[0].Height, - delay); - - - int frameIndex = 0; - int imageIndex = 1; - - for (const auto& [Mipmap] : tex.ImageContainer.Images) - { - - const auto& Image = Mipmap[0]; - - int SingleImageFrameCount = (Image.Width / container.GifWidth) * (Image.Height / container.GifHeight); - - - for (; frameIndex < SingleImageFrameCount * imageIndex; frameIndex++) - { - const auto& frameInfo = container.Frames[frameIndex]; - std::vector frameImage; - - - for (int heightIndex = 0; heightIndex < container.GifHeight; heightIndex++) - { - auto lineDataStart = Image.Data.begin() + Image.Width * 4 * ((int)frameInfo.PosY + heightIndex)+ (int)frameInfo.PosX * 4; - auto lineData = std::vector(lineDataStart, lineDataStart + (int)frameInfo.Width * 4); - - frameImage.insert(frameImage.end(), lineData.begin(), lineData.end()); - } - - // output by gif - { - GifWriteFrame(&writer, frameImage.data(), (uint32_t)frameInfo.Width, (uint32_t)frameInfo.Height, delay); - } - - - // output one by one - /* - { - int len = 0; - static int index = 0; - - auto* data = stbi_write_png_to_mem(frameImage.data(), - (int)frameInfo.Width * 4, - (int)frameInfo.Width, - (int)frameInfo.Height, - 4, - &len); - - std::filesystem::path outputfile = outPath; - std::string name = outputfile.filename().string(); - outputfile = outputfile.parent_path(); - - - std::string filename = std::to_string(index++) + "_" + name; - - outputfile /= "out"; - outputfile /= filename; - - std::cout << "convert file: " << outputfile << std::endl; - - BinaryWriter imageWriter(outputfile, std::ios::binary); - imageWriter.WriteBytes(reinterpret_cast(data), len); - imageWriter.close(); - - free(data); - data = nullptr; - } - */ - } - imageIndex ++; - } - - GifEnd(&writer); - - }else - { - auto& sourceMipmap = tex.ImageContainer.Images[0].Mipmaps[0]; - - if (tex.IsVideoTexture) - { - if (sourceMipmap.Data.size() < 12) - { - std::cerr << "expect mp4 magic header" << std::endl; - } - - std::string mp4Magic = std::string(reinterpret_cast(&sourceMipmap.Data[4]), 8); - - if (mp4Magic != "ftypisom" && mp4Magic != "ftypmsnv" && mp4Magic != "ftypmp42") - { - std::cerr << "bad mp4 magic header" << std::endl; - } - } - else - { - auto imgformat = sourceMipmap.Format; - - if ((int)imgformat >= 1 && (int)imgformat <= 3) - { - int len = 0; - auto& imgData = tex.ImageContainer.Images[0].Mipmaps[0].Data; - - uint8_t* data = nullptr; - int channel = 4; - - switch (imgformat) - { - case MipmapFormat::R8: channel = 1; break; - case MipmapFormat::RG88: channel = 2; break; - case MipmapFormat::RGBA8888: channel = 4; break; - default: break; - } - - data = stbi_write_png_to_mem(sourceMipmap.Data.data(), - sourceMipmap.Width * channel, - sourceMipmap.Width, - sourceMipmap.Height, - channel, - &len); - - if (data) - { - imgData.assign(data, data + len); - free(data); - } - } - } - - - // return ImageResult - // data format - std::filesystem::path outPath = reader->GetFilePath(); - outPath.replace_extension(GetFileExtension(format)); - - std::cout << "convert file: " << outPath << std::endl; - - BinaryWriter imageWriter(outPath, std::ios::binary); - imageWriter.WriteBytes(reinterpret_cast(sourceMipmap.Data.data()), sourceMipmap.Data.size()); - imageWriter.close(); - // Convert source end - } - } - } -} diff --git a/expkg/src/EXPKG/EXPKG.h b/expkg/src/EXPKG/EXPKG.h deleted file mode 100644 index 11f226d..0000000 --- a/expkg/src/EXPKG/EXPKG.h +++ /dev/null @@ -1,48 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#ifndef EXPKG_H -#define EXPKG_H - -#include - -#include "Entry.h" - - -typedef struct CommandArgs -{ - int argc; - char** argv; -} CommandArgs; - -namespace PKG -{ - class BinaryReader; - enum class FILE_EXTENSION; - - class PKG_API EXPKG - { - public: - EXPKG(const CommandArgs& commandArgs); - EXPKG(const std::string& filePath, const std::string& outDir = "out"); - - - private: - static FILE_EXTENSION checkExtension(const std::filesystem::path& filePath); - - void ExtractTex(const std::filesystem::path& path = "") const; - - void ExtractPkg(); - void Run(); - - private: - std::shared_ptr m_Reader; - std::filesystem::path m_OutDir; - - - std::vector m_Entries; - }; -} - -#endif //EXPKG_H diff --git a/expkg/src/Entry.cpp b/expkg/src/Entry.cpp deleted file mode 100644 index 777aac3..0000000 --- a/expkg/src/Entry.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#include "Entry.h" diff --git a/expkg/src/Entry.h b/expkg/src/Entry.h deleted file mode 100644 index e8c822b..0000000 --- a/expkg/src/Entry.h +++ /dev/null @@ -1,427 +0,0 @@ -// -// Created by sfd on 25-8-4. -// - -#ifndef ENTRY_H -#define ENTRY_H - -#include -#include - -#include "Core.h" - - -namespace PKG -{ - enum class TexFormat - { - RGBA8888 = 0, - DXT5 = 4, - DXT3 = 6, - DXT1 = 7, - RG88 = 8, - R8 = 9 - }; - - enum class TexType - { - None = 0, - NoInterpolation = 1, - ClampUVs = 2, - IsGif = 4, - // Placeholders - Unk3 = 8, - Unk4 = 16, - IsVideoTexture = 32, - Unk6 = 64, - Unk7 = 128, - }; - - - enum class MipmapFormat - { - Invalid = 0, - - /// Raw pixels (4 bytes per pixel) (RGBA8888) - RGBA8888 = 1, - - /// Raw pixels (1 byte per pixel) (R8) - R8 = 2, - - /// Raw pixels (2 bytes per pixel) (RG88) - RG88 = 3, - - /// Raw pixels compressed using DXT5 - CompressedDXT5, - - /// Raw pixels compressed using DXT3 - CompressedDXT3, - - /// Raw pixels compressed using DXT1 - CompressedDXT1, - - - /// MP4 Video - VideoMp4, - - - /// Windows or OS/2 Bitmap File (*.BMP) - - /// Keep '= 1000' because MipmapFormatExtensions.IsImage uses this to check if format is an image format - ImageBMP = 1000, - - - /// Windows Icon (*.ICO) - ImageICO, - - - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - ImageJPEG, - - - /// JPEG Network Graphics (*.JNG) - ImageJNG, - - - /// Commodore 64 Koala format (*.KOA) - ImageKOALA, - - - /// Amiga IFF (*.IFF, *.LBM) - ImageLBM, - - - /// Amiga IFF (*.IFF, *.LBM) - ImageIFF, - - - /// Multiple Network Graphics (*.MNG) - ImageMNG, - - - /// Portable Bitmap (ASCII) (*.PBM) - ImagePBM, - - - /// Portable Bitmap (BINARY) (*.PBM) - ImagePBMRAW, - - - /// Kodak PhotoCD (*.PCD) - ImagePCD, - - - /// Zsoft Paintbrush PCX bitmap format (*.PCX) - ImagePCX, - - - /// Portable Graymap (ASCII) (*.PGM) - ImagePGM, - - - /// Portable Graymap (BINARY) (*.PGM) - ImagePGMRAW, - - - /// Portable Network Graphics (*.PNG) - ImagePNG, - - - /// Portable Pixelmap (ASCII) (*.PPM) - ImagePPM, - - - /// Portable Pixelmap (BINARY) (*.PPM) - ImagePPMRAW, - - - /// Sun Rasterfile (*.RAS) - ImageRAS, - - - /// truevision Targa files (*.TGA, *.TARGA) - ImageTARGA, - - - /// Tagged Image File Format (*.TIF, *.TIFF) - ImageTIFF, - - - /// Wireless Bitmap (*.WBMP) - ImageWBMP, - - - /// Adobe Photoshop (*.PSD) - ImagePSD, - - - /// Dr. Halo (*.CUT) - ImageCUT, - - - /// X11 Bitmap Format (*.XBM) - ImageXBM, - - - /// X11 Pixmap Format (*.XPM) - ImageXPM, - - - /// DirectDraw Surface (*.DDS) - ImageDDS, - - - /// Graphics Interchange Format (*.GIF) - ImageGIF, - - - /// High Dynamic Range (*.HDR) - ImageHDR, - - - /// Raw Fax format CCITT G3 (*.G3) - ImageFAXG3, - - - /// Silicon Graphics SGI image format (*.SGI) - ImageSGI, - - - /// OpenEXR format (*.EXR) - ImageEXR, - - - /// JPEG-2000 format (*.J2K, *.J2C) - ImageJ2K, - - - /// JPEG-2000 format (*.JP2) - ImageJP2, - - - /// Portable FloatMap (*.PFM) - ImagePFM, - - - /// Macintosh PICT (*.PICT) - ImagePICT, - - - /// RAW camera image (*.*) - ImageRAW, - }; - - enum class FreeImageFormat { - /// - /// Unknown format (returned value only, never use it as input value) - /// - FIF_UNKNOWN = -1, - - /// - /// Windows or OS/2 Bitmap File (*.BMP) - /// - FIF_BMP = 0, - - /// - /// Windows Icon (*.ICO) - /// - FIF_ICO = 1, - - /// - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - /// - FIF_JPEG = 2, - - /// - /// JPEG Network Graphics (*.JNG) - /// - FIF_JNG = 3, - - /// - /// Commodore 64 Koala format (*.KOA) - /// - FIF_KOALA = 4, - - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - FIF_LBM = 5, - - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - FIF_IFF = 5, - - /// - /// Multiple Network Graphics (*.MNG) - /// - FIF_MNG = 6, - - /// - /// Portable Bitmap (ASCII) (*.PBM) - /// - FIF_PBM = 7, - - /// - /// Portable Bitmap (BINARY) (*.PBM) - /// - FIF_PBMRAW = 8, - - /// - /// Kodak PhotoCD (*.PCD) - /// - FIF_PCD = 9, - - /// - /// Zsoft Paintbrush PCX bitmap format (*.PCX) - /// - FIF_PCX = 10, - - /// - /// Portable Graymap (ASCII) (*.PGM) - /// - FIF_PGM = 11, - - /// - /// Portable Graymap (BINARY) (*.PGM) - /// - FIF_PGMRAW = 12, - - /// - /// Portable Network Graphics (*.PNG) - /// - FIF_PNG = 13, - - /// - /// Portable Pixelmap (ASCII) (*.PPM) - /// - FIF_PPM = 14, - - /// - /// Portable Pixelmap (BINARY) (*.PPM) - /// - FIF_PPMRAW = 15, - - /// - /// Sun Rasterfile (*.RAS) - /// - FIF_RAS = 16, - - /// - /// truevision Targa files (*.TGA, *.TARGA) - /// - FIF_TARGA = 17, - - /// - /// Tagged Image File Format (*.TIF, *.TIFF) - /// - FIF_TIFF = 18, - - /// - /// Wireless Bitmap (*.WBMP) - /// - FIF_WBMP = 19, - - /// - /// Adobe Photoshop (*.PSD) - /// - FIF_PSD = 20, - - /// - /// Dr. Halo (*.CUT) - /// - FIF_CUT = 21, - - /// - /// X11 Bitmap Format (*.XBM) - /// - FIF_XBM = 22, - - /// - /// X11 Pixmap Format (*.XPM) - /// - FIF_XPM = 23, - - /// - /// DirectDraw Surface (*.DDS) - /// - FIF_DDS = 24, - - /// - /// Graphics Interchange Format (*.GIF) - /// - FIF_GIF = 25, - - /// - /// High Dynamic Range (*.HDR) - /// - FIF_HDR = 26, - - /// - /// Raw Fax format CCITT G3 (*.G3) - /// - FIF_FAXG3 = 27, - - /// - /// Silicon Graphics SGI image format (*.SGI) - /// - FIF_SGI = 28, - - /// - /// OpenEXR format (*.EXR) - /// - FIF_EXR = 29, - - /// - /// JPEG-2000 format (*.J2K, *.J2C) - /// - FIF_J2K = 30, - - /// - /// JPEG-2000 format (*.JP2) - /// - FIF_JP2 = 31, - - /// - /// Portable FloatMap (*.PFM) - /// - FIF_PFM = 32, - - /// - /// Macintosh PICT (*.PICT) - /// - FIF_PICT = 33, - - /// - /// RAW camera image (*.*) - /// - FIF_RAW = 34, - - /// - /// RAW camera MP4 (*.mp4) - /// - FIF_MP4 = 35, - }; - - struct PKG_API Entry - { - std::filesystem::path FullPath; - int32_t Offset{}; - int32_t Length{}; - std::string Type; - }; - - struct PKG_API TexHeader - { - TexFormat Format; - TexType Flags; - int32_t TextureWidth; - int32_t TextureHeight; - int32_t ImageWidth; - int32_t ImageHeight; - uint32_t UnkInt0; - }; -} - - -#endif //ENTRY_H diff --git a/expkg/src/Tex/Tex.cpp b/expkg/src/Tex/Tex.cpp deleted file mode 100644 index 2089cf1..0000000 --- a/expkg/src/Tex/Tex.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#include "Tex.h" diff --git a/expkg/src/Tex/Tex.h b/expkg/src/Tex/Tex.h deleted file mode 100644 index 9e8579a..0000000 --- a/expkg/src/Tex/Tex.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#ifndef TEX_H -#define TEX_H - -#include "TexFrameInfoContainer.h" -#include "TexImageContainer.h" - - -namespace PKG -{ - class Tex - { - public: - std::string Magic1; - std::string Magic2; - TexHeader Header = {}; - TexImageContainer ImageContainer = {}; - - bool IsGif = false; - bool IsVideoTexture = false; - - TexFrameInfoContainer FrameInfoContainer = {}; - }; -} - - -#endif //TEX_H diff --git a/expkg/src/Tex/TexFrameInfoContainer.cpp b/expkg/src/Tex/TexFrameInfoContainer.cpp deleted file mode 100644 index 825a83a..0000000 --- a/expkg/src/Tex/TexFrameInfoContainer.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// -// Created by sfd on 25-9-21. -// - -#include "TexFrameInfoContainer.h" diff --git a/expkg/src/Tex/TexFrameInfoContainer.h b/expkg/src/Tex/TexFrameInfoContainer.h deleted file mode 100644 index c8743cf..0000000 --- a/expkg/src/Tex/TexFrameInfoContainer.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// Created by sfd on 25-9-21. -// - -#ifndef TEXFRAMEINFOCONTAINER_H -#define TEXFRAMEINFOCONTAINER_H -#include -#include - - -namespace PKG -{ - - struct TexFrameInfo - { - int ImageId; - float Frametime; - float PosX; - float PosY; - float Width; - float WidthY; - float HeightX; - float Height; - }; - - - class TexFrameInfoContainer - { - public: - std::string Magic; - - std::vector Frames; - int GifWidth; - int GifHeight; - }; -} - - -#endif //TEXFRAMEINFOCONTAINER_H diff --git a/expkg/src/Tex/TexImage.cpp b/expkg/src/Tex/TexImage.cpp deleted file mode 100644 index 6884056..0000000 --- a/expkg/src/Tex/TexImage.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#include "TexImage.h" - -#include - -std::string PKG::GetFileExtension(const MipmapFormat format) -{ - switch (format) - { - case MipmapFormat::ImageBMP: - return "bmp"; - case MipmapFormat::ImageICO: - return "ico"; - case MipmapFormat::ImageJPEG: - return "jpg"; - case MipmapFormat::ImageJNG: - return "jng"; - case MipmapFormat::ImageKOALA: - return "koa"; - case MipmapFormat::ImageLBM: - return "lbm"; - case MipmapFormat::ImageIFF: - return "iff"; - case MipmapFormat::ImageMNG: - return "mng"; - case MipmapFormat::ImagePBM: - case MipmapFormat::ImagePBMRAW: - return "pbm"; - case MipmapFormat::ImagePCD: - return "pcd"; - case MipmapFormat::ImagePCX: - return "pcx"; - case MipmapFormat::ImagePGM: - case MipmapFormat::ImagePGMRAW: - return "pgm"; - case MipmapFormat::ImagePNG: - return "png"; - case MipmapFormat::ImagePPM: - case MipmapFormat::ImagePPMRAW: - return "ppm"; - case MipmapFormat::ImageRAS: - return "ras"; - case MipmapFormat::ImageTARGA: - return "tga"; - case MipmapFormat::ImageTIFF: - return "tif"; - case MipmapFormat::ImageWBMP: - return "wbmp"; - case MipmapFormat::ImagePSD: - return "psd"; - case MipmapFormat::ImageCUT: - return "cut"; - case MipmapFormat::ImageXBM: - return "xbm"; - case MipmapFormat::ImageXPM: - return "xpm"; - case MipmapFormat::ImageDDS: - return "dds"; - case MipmapFormat::ImageGIF: - return "gif"; - case MipmapFormat::ImageHDR: - return "hdr"; - case MipmapFormat::ImageFAXG3: - return "g3"; - case MipmapFormat::ImageSGI: - return "sgi"; - case MipmapFormat::ImageEXR: - return "exr"; - case MipmapFormat::ImageJ2K: - return "j2k"; - case MipmapFormat::ImageJP2: - return "jp2"; - case MipmapFormat::ImagePFM: - return "pfm"; - case MipmapFormat::ImagePICT: - return "pict"; - case MipmapFormat::ImageRAW: - return "raw"; - case MipmapFormat::VideoMp4: - return "mp4"; - } - - std::cerr << "unknown file type" << std::endl; - return ".unknown"; -} diff --git a/expkg/src/Tex/TexImage.h b/expkg/src/Tex/TexImage.h deleted file mode 100644 index df0d59a..0000000 --- a/expkg/src/Tex/TexImage.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#ifndef TEXIMAGE_H -#define TEXIMAGE_H - -#include - -#include "Entry.h" - -namespace PKG -{ - - std::string GetFileExtension(MipmapFormat format); - - class TexMipMap - { - public: - int Width; - int Height; - int DecompressedDataCount; - bool IsZ4Compressed = false; - - MipmapFormat Format; - - std::vector Data; - }; - - - class TexImage - { - public: - std::vector Mipmaps; - }; -} -#endif //TEXIMAGE_H diff --git a/expkg/src/Tex/TexImageContainer.cpp b/expkg/src/Tex/TexImageContainer.cpp deleted file mode 100644 index 71d1e1e..0000000 --- a/expkg/src/Tex/TexImageContainer.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#include "TexImageContainer.h" - diff --git a/expkg/src/Tex/TexImageContainer.h b/expkg/src/Tex/TexImageContainer.h deleted file mode 100644 index d9245ae..0000000 --- a/expkg/src/Tex/TexImageContainer.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by sfd on 25-8-5. -// - -#ifndef TEXIMAGECONTAINER_H -#define TEXIMAGECONTAINER_H - -#include "TexImage.h" - -namespace PKG -{ - enum class ImageContainerVersion - { - VERSION1 = 1, - VERSION2 = 2, - VERSION3 = 3, - VERSION4 = 4, - }; - - class TexImageContainer - { - public: - std::string Magic; - FreeImageFormat ImageFormat{}; - // name conflict - ImageContainerVersion imageContainerVersion; - - std::vector Images; - }; -} - -#endif //TEXIMAGECONTAINER_H diff --git a/expkg/src/expkg.h b/expkg/src/expkg.h deleted file mode 100644 index b494a97..0000000 --- a/expkg/src/expkg.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef EXPKG_H -#define EXPKG_H - -#include "Entry.h" -#include "BinaryOPT/BinaryReader.h" -#include "BinaryOPT/BinaryWriter.h" -#include "BinaryOPT/ImageReader.h" -#include "EXPKG/EXPKG.h" -#include "Tex/Tex.h" -#include "Tex/TexImage.h" -#include "Tex/TexImageContainer.h" - - -#endif // EXPKG_H diff --git a/expkg/vendor/lz4/build/.gitignore b/expkg/vendor/lz4/build/.gitignore deleted file mode 100644 index f0a2f9d..0000000 --- a/expkg/vendor/lz4/build/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -# Visual C++ -.vs/ -*Copy -*.db -*.opensdf -*.sdf -*.suo -*.user -ver*/ -VS2010/bin/ -VS2017/bin/ -VS*/bin/ -ipch - -# Fixup for lz4 project directories -!VS2010/lz4 -!VS2017/lz4 -!VS*/lz4 diff --git a/expkg/vendor/lz4/build/README.md b/expkg/vendor/lz4/build/README.md deleted file mode 100644 index d183edb..0000000 --- a/expkg/vendor/lz4/build/README.md +++ /dev/null @@ -1,44 +0,0 @@ -Projects for various integrated development environments (IDE) -============================================================== - -#### Included projects - -The following projects are included with the lz4 distribution: -- `cmake` - CMake project -- `meson` - Meson project -- `visual` - scripts to generate Visual Studio solutions from `cmake` script -- `VS2022` - Visual Studio 2022 solution - will soon be deprecated, prefer `visual` generators - - -#### Projects available within VS2022\lz4.sln - -The Visual Studio solution file `lz4.sln` contains many projects that will be compiled to the -`build\VS2010\bin\$(Platform)_$(Configuration)` directory. For example `lz4` set to `x64` and -`Release` will be compiled to `build\VS2010\bin\x64_Release\lz4.exe`. The solution file contains the -following projects: - -- `lz4` : Command Line Utility, supporting gzip-like arguments -- `datagen` : Synthetic and parametrable data generator, for tests -- `frametest` : Test tool that checks lz4frame integrity on target platform -- `fullbench` : Precisely measure speed for each lz4 inner functions -- `fuzzer` : Test tool, to check lz4 integrity on target platform -- `liblz4` : A static LZ4 library compiled to `liblz4_static.lib` -- `liblz4-dll` : A dynamic LZ4 library (DLL) compiled to `liblz4.dll` with the import library `liblz4.lib` -- `fullbench-dll` : The fullbench program compiled with the import library; the executable requires LZ4 DLL - - -#### Using LZ4 DLL with Microsoft Visual C++ project - -The header files `lib\lz4.h`, `lib\lz4hc.h`, `lib\lz4frame.h` and the import library -`build\VS2010\bin\$(Platform)_$(Configuration)\liblz4.lib` are required to -compile a project using Visual C++. - -1. The path to header files should be added to `Additional Include Directories` that can - be found in Project Properties of Visual Studio IDE in the `C/C++` Property Pages on the `General` page. -2. The import library has to be added to `Additional Dependencies` that can - be found in Project Properties in the `Linker` Property Pages on the `Input` page. - If one will provide only the name `liblz4.lib` without a full path to the library - then the directory has to be added to `Linker\General\Additional Library Directories`. - -The compiled executable will require LZ4 DLL which is available at -`build\VS2010\bin\$(Platform)_$(Configuration)\liblz4.dll`. diff --git a/expkg/vendor/lz4/build/VS2022/_build.bat b/expkg/vendor/lz4/build/VS2022/_build.bat deleted file mode 100644 index 2c2eb57..0000000 --- a/expkg/vendor/lz4/build/VS2022/_build.bat +++ /dev/null @@ -1,39 +0,0 @@ -set /a errorno=1 -for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E" - -rem https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - -set "sln=lz4.sln" - -@rem set "Configuration=Debug" -@rem set "Platform=Win32" - -set "BIN=.\bin\!Platform!_!Configuration!" -rmdir /S /Q "!BIN!" 2>nul -echo msbuild "%sln%" /p:Configuration=!Configuration! /p:Platform=!Platform! -msbuild "%sln%" ^ - /nologo ^ - /v:minimal ^ - /m ^ - /p:Configuration=!Configuration! ^ - /p:Platform=!Platform! ^ - /t:Clean,Build ^ - || goto :ERROR - -if not exist "!BIN!\datagen.exe" ( echo FAIL: "!BIN!\datagen.exe" && goto :ERROR ) -if not exist "!BIN!\frametest.exe" ( echo FAIL: "!BIN!\frametest.exe" && goto :ERROR ) -if not exist "!BIN!\fullbench-dll.exe" ( echo FAIL: "!BIN!\fullbench-dll.exe" && goto :ERROR ) -if not exist "!BIN!\fullbench.exe" ( echo FAIL: "!BIN!\fullbench.exe" && goto :ERROR ) -if not exist "!BIN!\fuzzer.exe" ( echo FAIL: "!BIN!\fuzzer.exe" && goto :ERROR ) -if not exist "!BIN!\liblz4.dll" ( echo FAIL: "!BIN!\liblz4.dll" && goto :ERROR ) -if not exist "!BIN!\liblz4.lib" ( echo FAIL: "!BIN!\liblz4.lib" && goto :ERROR ) -if not exist "!BIN!\liblz4_static.lib" ( echo FAIL: "!BIN!\liblz4_static.lib" && goto :ERROR ) -if not exist "!BIN!\lz4.exe" ( echo FAIL: "!BIN!\lz4.exe" && goto :ERROR ) - -set /a errorno=0 -goto :END - -:ERROR - -:END -exit /B %errorno% diff --git a/expkg/vendor/lz4/build/VS2022/_setup.bat b/expkg/vendor/lz4/build/VS2022/_setup.bat deleted file mode 100644 index b4dda51..0000000 --- a/expkg/vendor/lz4/build/VS2022/_setup.bat +++ /dev/null @@ -1,35 +0,0 @@ -set /a errorno=1 -for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E" - -rem https://github.com/Microsoft/vswhere -rem https://github.com/microsoft/vswhere/wiki/Find-VC#batch - -set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -if not exist "%vswhere%" ( - echo Failed to find "vswhere.exe". Please install the latest version of Visual Studio. - goto :ERROR -) - -set "InstallDir=" -for /f "usebackq tokens=*" %%i in ( - `"%vswhere%" -latest ^ - -products * ^ - -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^ - -property installationPath` -) do ( - set "InstallDir=%%i" -) -if "%InstallDir%" == "" ( - echo Failed to find Visual C++. Please install the latest version of Visual C++. - goto :ERROR -) - -call "%InstallDir%\VC\Auxiliary\Build\vcvars64.bat" || goto :ERROR - -set /a errorno=0 -goto :END - -:ERROR - -:END -exit /B %errorno% diff --git a/expkg/vendor/lz4/build/VS2022/_test.bat b/expkg/vendor/lz4/build/VS2022/_test.bat deleted file mode 100644 index 4614fa9..0000000 --- a/expkg/vendor/lz4/build/VS2022/_test.bat +++ /dev/null @@ -1,38 +0,0 @@ -set /a errorno=1 -for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E" - -@rem set "Configuration=Debug" -@rem set "Platform=Win32" - -set "BIN=.\bin\!Platform!_!Configuration!" -set "TEST_FILES=..\..\tests\COPYING" - -echo !BIN!\lz4 -h - !BIN!\lz4 -h || goto :ERROR - -echo !BIN!\lz4 -i1b - !BIN!\lz4 -i1b || goto :ERROR - -echo !BIN!\lz4 -i1b5 - !BIN!\lz4 -i1b5 || goto :ERROR - -echo !BIN!\lz4 -i1b10 - !BIN!\lz4 -i1b10 || goto :ERROR - -echo !BIN!\lz4 -i1b15 - !BIN!\lz4 -i1b15 || goto :ERROR - -echo fullbench -!BIN!\fullbench.exe --no-prompt -i1 %TEST_FILES% || goto :ERROR - -echo fuzzer -!BIN!\fuzzer.exe -v -T30s || goto :ERROR - - -set /a errorno=0 -goto :END - -:ERROR - -:END -exit /B %errorno% diff --git a/expkg/vendor/lz4/build/VS2022/build-and-test-win32-debug.bat b/expkg/vendor/lz4/build/VS2022/build-and-test-win32-debug.bat deleted file mode 100644 index e745f87..0000000 --- a/expkg/vendor/lz4/build/VS2022/build-and-test-win32-debug.bat +++ /dev/null @@ -1,26 +0,0 @@ -@setlocal enabledelayedexpansion -@echo off -set /a errorno=1 -for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E" - -call _setup.bat || goto :ERROR - -set "Configuration=Debug" -set "Platform=Win32" - -call _build.bat || goto :ERROR -call _test.bat || goto :ERROR - - -echo Build Status -%esc%[92m SUCCEEDED %esc%[0m -set /a errorno=0 -goto :END - - -:ERROR -echo Abort by error. -echo Build Status -%esc%[91m ERROR %esc%[0m - - -:END -exit /B %errorno% diff --git a/expkg/vendor/lz4/build/VS2022/build-and-test-win32-release.bat b/expkg/vendor/lz4/build/VS2022/build-and-test-win32-release.bat deleted file mode 100644 index f21007b..0000000 --- a/expkg/vendor/lz4/build/VS2022/build-and-test-win32-release.bat +++ /dev/null @@ -1,26 +0,0 @@ -@setlocal enabledelayedexpansion -@echo off -set /a errorno=1 -for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E" - -call _setup.bat || goto :ERROR - -set "Configuration=Release" -set "Platform=Win32" - -call _build.bat || goto :ERROR -call _test.bat || goto :ERROR - - -echo Build Status -%esc%[92m SUCCEEDED %esc%[0m -set /a errorno=0 -goto :END - - -:ERROR -echo Abort by error. -echo Build Status -%esc%[91m ERROR %esc%[0m - - -:END -exit /B %errorno% diff --git a/expkg/vendor/lz4/build/VS2022/build-and-test-x64-debug.bat b/expkg/vendor/lz4/build/VS2022/build-and-test-x64-debug.bat deleted file mode 100644 index 9d64a6f..0000000 --- a/expkg/vendor/lz4/build/VS2022/build-and-test-x64-debug.bat +++ /dev/null @@ -1,26 +0,0 @@ -@setlocal enabledelayedexpansion -@echo off -set /a errorno=1 -for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E" - -call _setup.bat || goto :ERROR - -set "Configuration=Debug" -set "Platform=x64" - -call _build.bat || goto :ERROR -call _test.bat || goto :ERROR - - -echo Build Status -%esc%[92m SUCCEEDED %esc%[0m -set /a errorno=0 -goto :END - - -:ERROR -echo Abort by error. -echo Build Status -%esc%[91m ERROR %esc%[0m - - -:END -exit /B %errorno% diff --git a/expkg/vendor/lz4/build/VS2022/build-and-test-x64-release.bat b/expkg/vendor/lz4/build/VS2022/build-and-test-x64-release.bat deleted file mode 100644 index 3ebb18f..0000000 --- a/expkg/vendor/lz4/build/VS2022/build-and-test-x64-release.bat +++ /dev/null @@ -1,26 +0,0 @@ -@setlocal enabledelayedexpansion -@echo off -set /a errorno=1 -for /F "delims=#" %%E in ('"prompt #$E# & for %%E in (1) do rem"') do set "esc=%%E" - -call _setup.bat || goto :ERROR - -set "Configuration=Release" -set "Platform=x64" - -call _build.bat || goto :ERROR -call _test.bat || goto :ERROR - - -echo Build Status -%esc%[92m SUCCEEDED %esc%[0m -set /a errorno=0 -goto :END - - -:ERROR -echo Abort by error. -echo Build Status -%esc%[91m ERROR %esc%[0m - - -:END -exit /B %errorno% diff --git a/expkg/vendor/lz4/build/VS2022/datagen/datagen.vcxproj b/expkg/vendor/lz4/build/VS2022/datagen/datagen.vcxproj deleted file mode 100644 index a65a5d5..0000000 --- a/expkg/vendor/lz4/build/VS2022/datagen/datagen.vcxproj +++ /dev/null @@ -1,177 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {D745AE2F-596A-403A-9B91-81A8C6779243} - Win32Proj - datagen - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - - - - Application - true - Unicode - v143 - - - Application - true - Unicode - v143 - - - Application - false - Unicode - true - v143 - - - Application - false - Unicode - true - v143 - - - - - - - - - - - - - - - - - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\programs;$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - false - MultiThreadedDebug - - - Console - true - - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreadedDebug - - - Console - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - false - MultiThreaded - - - Console - true - true - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreaded - - - Console - true - true - true - - - - - - - - - - - - - - - - - diff --git a/expkg/vendor/lz4/build/VS2022/frametest/frametest.vcxproj b/expkg/vendor/lz4/build/VS2022/frametest/frametest.vcxproj deleted file mode 100644 index 6b7ff75..0000000 --- a/expkg/vendor/lz4/build/VS2022/frametest/frametest.vcxproj +++ /dev/null @@ -1,180 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7} - Win32Proj - frametest - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - - - - Application - true - Unicode - v143 - - - Application - true - Unicode - v143 - - - Application - false - Unicode - true - v143 - - - Application - false - Unicode - true - v143 - - - - - - - - - - - - - - - - - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - false - MultiThreadedDebug - - - Console - true - - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreadedDebug - - - Console - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - false - MultiThreaded - - - Console - true - true - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreaded - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/expkg/vendor/lz4/build/VS2022/fullbench-dll/fullbench-dll.vcxproj b/expkg/vendor/lz4/build/VS2022/fullbench-dll/fullbench-dll.vcxproj deleted file mode 100644 index 143dc06..0000000 --- a/expkg/vendor/lz4/build/VS2022/fullbench-dll/fullbench-dll.vcxproj +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {13992FD2-077E-4954-B065-A428198201A9} - Win32Proj - fullbench-dll - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - - - - Application - true - Unicode - v143 - - - Application - true - Unicode - v143 - - - Application - false - Unicode - true - v143 - - - Application - false - Unicode - true - v143 - - - - - - - - - - - - - - - - - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions) - true - false - MultiThreadedDebug - - - Console - true - $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4.lib;%(AdditionalDependencies) - - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions) - true - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreadedDebug - - - Console - true - $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4.lib;%(AdditionalDependencies) - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions) - false - false - MultiThreaded - - - Console - true - true - true - $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4.lib;%(AdditionalDependencies) - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;LZ4_DLL_IMPORT=1;%(PreprocessorDefinitions) - false - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreaded - - - Console - true - true - true - $(SolutionDir)bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/expkg/vendor/lz4/build/VS2022/fullbench/fullbench.vcxproj b/expkg/vendor/lz4/build/VS2022/fullbench/fullbench.vcxproj deleted file mode 100644 index 57f4b5a..0000000 --- a/expkg/vendor/lz4/build/VS2022/fullbench/fullbench.vcxproj +++ /dev/null @@ -1,180 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E} - Win32Proj - fullbench - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - - - - Application - true - Unicode - v143 - - - Application - true - Unicode - v143 - - - Application - false - Unicode - true - v143 - - - Application - false - Unicode - true - v143 - - - - - - - - - - - - - - - - - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - false - MultiThreadedDebug - - - Console - true - - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreadedDebug - - - Console - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - false - MultiThreaded - - - Console - true - true - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreaded - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/expkg/vendor/lz4/build/VS2022/fuzzer/fuzzer.vcxproj b/expkg/vendor/lz4/build/VS2022/fuzzer/fuzzer.vcxproj deleted file mode 100644 index 83482c2..0000000 --- a/expkg/vendor/lz4/build/VS2022/fuzzer/fuzzer.vcxproj +++ /dev/null @@ -1,177 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {18B9F1A7-9C66-4352-898B-30804DADE0FD} - Win32Proj - fuzzer - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - - - - Application - true - Unicode - v143 - - - Application - true - Unicode - v143 - - - Application - false - Unicode - true - v143 - - - Application - false - Unicode - true - v143 - - - - - - - - - - - - - - - - - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - true - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - false - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - false - MultiThreadedDebug - - - Console - true - - - - - - - Level4 - Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreadedDebug - - - Console - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - false - MultiThreaded - - - Console - true - true - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - false - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreaded - - - Console - true - true - true - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.rc b/expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.rc deleted file mode 100644 index e089c24..0000000 --- a/expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.rc +++ /dev/null @@ -1,51 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// - -#include "lz4.h" /* LZ4_VERSION_STRING */ -#define APSTUDIO_READONLY_SYMBOLS -#include "verrsrc.h" -#undef APSTUDIO_READONLY_SYMBOLS - - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 - PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "Yann Collet" - VALUE "FileDescription", "Extremely fast compression" - VALUE "FileVersion", LZ4_VERSION_STRING - VALUE "InternalName", "lz4.dll" - VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet" - VALUE "OriginalFilename", "lz4.dll" - VALUE "ProductName", "LZ4" - VALUE "ProductVersion", LZ4_VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1200 - END -END - -#endif diff --git a/expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.vcxproj b/expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.vcxproj deleted file mode 100644 index 532ac75..0000000 --- a/expkg/vendor/lz4/build/VS2022/liblz4-dll/liblz4-dll.vcxproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {9800039D-4AAA-43A4-BB78-FEF6F4836927} - Win32Proj - liblz4-dll - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - liblz4-dll - - - - DynamicLibrary - true - Unicode - v143 - - - DynamicLibrary - true - Unicode - v143 - - - DynamicLibrary - false - Unicode - true - v143 - - - DynamicLibrary - false - Unicode - true - v143 - - - - - - - - - - - - - - - - - - - true - liblz4 - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - true - liblz4 - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - false - liblz4 - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - false - liblz4 - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - - - - Level4 - Disabled - WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true - false - MultiThreadedDebug - - - true - - - - - - - Level4 - Disabled - WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreadedDebug - - - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - false - false - MultiThreaded - - - true - true - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - false - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreaded - - - true - true - true - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/expkg/vendor/lz4/build/VS2022/liblz4/liblz4.vcxproj b/expkg/vendor/lz4/build/VS2022/liblz4/liblz4.vcxproj deleted file mode 100644 index fdddaaa..0000000 --- a/expkg/vendor/lz4/build/VS2022/liblz4/liblz4.vcxproj +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476} - Win32Proj - liblz4 - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - - - - StaticLibrary - true - Unicode - v143 - - - StaticLibrary - true - Unicode - v143 - - - StaticLibrary - false - Unicode - true - v143 - - - StaticLibrary - false - Unicode - true - v143 - - - - - - - - - - - - - - - - - - - true - liblz4_static - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - true - liblz4_static - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - false - liblz4_static - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - false - liblz4_static - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - true - - - - - - Level4 - Disabled - WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true - false - MultiThreadedDebug - - - true - - - - - - - Level4 - Disabled - WIN32;_DEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - true - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreadedDebug - - - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - false - false - MultiThreaded - - - true - true - true - - - - - Level4 - - - MaxSpeed - true - true - WIN32;NDEBUG;LZ4_DLL_EXPORT=1;%(PreprocessorDefinitions) - false - true - /analyze:stacksize295252 %(AdditionalOptions) - MultiThreaded - - - true - true - true - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/expkg/vendor/lz4/build/VS2022/lz4.sln b/expkg/vendor/lz4/build/VS2022/lz4.sln deleted file mode 100644 index 10f8ec1..0000000 --- a/expkg/vendor/lz4/build/VS2022/lz4.sln +++ /dev/null @@ -1,106 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.6.33712.159 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4-dll", "liblz4-dll\liblz4-dll.vcxproj", "{9800039D-4AAA-43A4-BB78-FEF6F4836927}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblz4", "liblz4\liblz4.vcxproj", "{9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fuzzer", "fuzzer\fuzzer.vcxproj", "{18B9F1A7-9C66-4352-898B-30804DADE0FD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench", "fullbench\fullbench.vcxproj", "{6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "frametest", "frametest\frametest.vcxproj", "{39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datagen", "datagen\datagen.vcxproj", "{D745AE2F-596A-403A-9B91-81A8C6779243}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullbench-dll", "fullbench-dll\fullbench-dll.vcxproj", "{13992FD2-077E-4954-B065-A428198201A9}" - ProjectSection(ProjectDependencies) = postProject - {9800039D-4AAA-43A4-BB78-FEF6F4836927} = {9800039D-4AAA-43A4-BB78-FEF6F4836927} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lz4", "lz4\lz4.vcxproj", "{60A3115E-B988-41EE-8815-F4D4F253D866}" - ProjectSection(ProjectDependencies) = postProject - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476} = {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.ActiveCfg = Debug|Win32 - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|Win32.Build.0 = Debug|Win32 - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.ActiveCfg = Debug|x64 - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Debug|x64.Build.0 = Debug|x64 - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.ActiveCfg = Release|Win32 - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|Win32.Build.0 = Release|Win32 - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.ActiveCfg = Release|x64 - {9800039D-4AAA-43A4-BB78-FEF6F4836927}.Release|x64.Build.0 = Release|x64 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.ActiveCfg = Debug|Win32 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|Win32.Build.0 = Debug|Win32 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.ActiveCfg = Debug|x64 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Debug|x64.Build.0 = Debug|x64 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.ActiveCfg = Release|Win32 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|Win32.Build.0 = Release|Win32 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.ActiveCfg = Release|x64 - {9092C5CC-3E71-41B3-BF68-4A7BDD8A5476}.Release|x64.Build.0 = Release|x64 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.ActiveCfg = Debug|Win32 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|Win32.Build.0 = Debug|Win32 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.ActiveCfg = Debug|x64 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Debug|x64.Build.0 = Debug|x64 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.ActiveCfg = Release|Win32 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|Win32.Build.0 = Release|Win32 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.ActiveCfg = Release|x64 - {18B9F1A7-9C66-4352-898B-30804DADE0FD}.Release|x64.Build.0 = Release|x64 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.ActiveCfg = Debug|Win32 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|Win32.Build.0 = Debug|Win32 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.ActiveCfg = Debug|x64 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Debug|x64.Build.0 = Debug|x64 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.ActiveCfg = Release|Win32 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|Win32.Build.0 = Release|Win32 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.ActiveCfg = Release|x64 - {6A4DF4EF-C77F-43C6-8901-DDCD20879E4E}.Release|x64.Build.0 = Release|x64 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.ActiveCfg = Debug|Win32 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|Win32.Build.0 = Debug|Win32 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.ActiveCfg = Debug|x64 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Debug|x64.Build.0 = Debug|x64 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.ActiveCfg = Release|Win32 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|Win32.Build.0 = Release|Win32 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.ActiveCfg = Release|x64 - {39AD6ECC-8BAD-4368-95E4-A1AA2F077BB7}.Release|x64.Build.0 = Release|x64 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.ActiveCfg = Debug|Win32 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|Win32.Build.0 = Debug|Win32 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.ActiveCfg = Debug|x64 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Debug|x64.Build.0 = Debug|x64 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.ActiveCfg = Release|Win32 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Release|Win32.Build.0 = Release|Win32 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.ActiveCfg = Release|x64 - {D745AE2F-596A-403A-9B91-81A8C6779243}.Release|x64.Build.0 = Release|x64 - {13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.ActiveCfg = Debug|Win32 - {13992FD2-077E-4954-B065-A428198201A9}.Debug|Win32.Build.0 = Debug|Win32 - {13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.ActiveCfg = Debug|x64 - {13992FD2-077E-4954-B065-A428198201A9}.Debug|x64.Build.0 = Debug|x64 - {13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.ActiveCfg = Release|Win32 - {13992FD2-077E-4954-B065-A428198201A9}.Release|Win32.Build.0 = Release|Win32 - {13992FD2-077E-4954-B065-A428198201A9}.Release|x64.ActiveCfg = Release|x64 - {13992FD2-077E-4954-B065-A428198201A9}.Release|x64.Build.0 = Release|x64 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.ActiveCfg = Debug|Win32 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|Win32.Build.0 = Debug|Win32 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.ActiveCfg = Debug|x64 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Debug|x64.Build.0 = Debug|x64 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.ActiveCfg = Release|Win32 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Release|Win32.Build.0 = Release|Win32 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.ActiveCfg = Release|x64 - {60A3115E-B988-41EE-8815-F4D4F253D866}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {BBC259B2-BABF-47CD-8A6A-7B8318A803AC} - EndGlobalSection -EndGlobal diff --git a/expkg/vendor/lz4/build/VS2022/lz4/lz4.rc b/expkg/vendor/lz4/build/VS2022/lz4/lz4.rc deleted file mode 100644 index 5eec36b..0000000 --- a/expkg/vendor/lz4/build/VS2022/lz4/lz4.rc +++ /dev/null @@ -1,51 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// - -#include "lz4.h" /* LZ4_VERSION_STRING */ -#define APSTUDIO_READONLY_SYMBOLS -#include "verrsrc.h" -#undef APSTUDIO_READONLY_SYMBOLS - - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE 9, 1 - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 - PRODUCTVERSION LZ4_VERSION_MAJOR,LZ4_VERSION_MINOR,LZ4_VERSION_RELEASE,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "Yann Collet" - VALUE "FileDescription", "Extremely fast compression" - VALUE "FileVersion", LZ4_VERSION_STRING - VALUE "InternalName", "lz4.exe" - VALUE "LegalCopyright", "Copyright (C) 2013-2020, Yann Collet" - VALUE "OriginalFilename", "lz4.exe" - VALUE "ProductName", "LZ4" - VALUE "ProductVersion", LZ4_VERSION_STRING - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1200 - END -END - -#endif diff --git a/expkg/vendor/lz4/build/VS2022/lz4/lz4.vcxproj b/expkg/vendor/lz4/build/VS2022/lz4/lz4.vcxproj deleted file mode 100644 index 3c964b4..0000000 --- a/expkg/vendor/lz4/build/VS2022/lz4/lz4.vcxproj +++ /dev/null @@ -1,189 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {60A3115E-B988-41EE-8815-F4D4F253D866} - lz4 - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - false - Unicode - - - Application - true - v143 - MultiByte - - - Application - false - v143 - true - MultiByte - - - - - - - - - - - - - - - - - - - - - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - false - - - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - - - $(SolutionDir)bin\$(Platform)_$(Configuration)\ - $(SolutionDir)bin\obj\$(RootNamespace)_$(Platform)_$(Configuration)\ - $(IncludePath);$(UniversalCRT_IncludePath);$(SolutionDir)..\..\lib;$(SolutionDir)..\..\programs;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath); - false - - - - Level4 - Disabled - true - true - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - Console - false - false - $(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) - - - - - Level3 - Disabled - true - true - - - $(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) - - - - - Level3 - MaxSpeed - true - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - - - true - true - true - Console - $(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) - - - - - Level3 - MaxSpeed - true - true - true - true - - - true - true - $(ProjectDir)..\bin\$(Platform)_$(Configuration);%(AdditionalLibraryDirectories) - liblz4_static.lib;$(CoreLibraryDependencies);%(AdditionalDependencies) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/expkg/vendor/lz4/build/cmake/.gitignore b/expkg/vendor/lz4/build/cmake/.gitignore deleted file mode 100644 index 0ad8240..0000000 --- a/expkg/vendor/lz4/build/cmake/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# cmake build artefact - -CMakeCache.txt -CMakeFiles -*.cmake -Makefile -liblz4.pc -lz4c -install_manifest.txt -build diff --git a/expkg/vendor/lz4/build/cmake/CMakeLists.txt b/expkg/vendor/lz4/build/cmake/CMakeLists.txt deleted file mode 100644 index 15418e6..0000000 --- a/expkg/vendor/lz4/build/cmake/CMakeLists.txt +++ /dev/null @@ -1,362 +0,0 @@ -# CMake support for LZ4 -# -# To the extent possible under law, the author(s) have dedicated all -# copyright and related and neighboring rights to this software to -# the public domain worldwide. This software is distributed without -# any warranty. -# -# For details, see . - - -# Use range version specification for policy control while maintaining -# compatibility with older CMake versions -cmake_minimum_required(VERSION 3.5...4.0.2) - -set(LZ4_TOP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") - -#----------------------------------------------------------------------------- -# VERSION EXTRACTION - Parse version information from header file -#----------------------------------------------------------------------------- -function(parse_lz4_version VERSION_TYPE) - file(STRINGS "${LZ4_TOP_SOURCE_DIR}/lib/lz4.h" version_line REGEX "^#define LZ4_VERSION_${VERSION_TYPE} +([0-9]+).*$") - string(REGEX REPLACE "^#define LZ4_VERSION_${VERSION_TYPE} +([0-9]+).*$" "\\1" version_number "${version_line}") - set(LZ4_VERSION_${VERSION_TYPE} ${version_number} PARENT_SCOPE) -endfunction() - -foreach(version_type IN ITEMS MAJOR MINOR RELEASE) - parse_lz4_version(${version_type}) -endforeach() - -set(LZ4_VERSION_STRING "${LZ4_VERSION_MAJOR}.${LZ4_VERSION_MINOR}.${LZ4_VERSION_RELEASE}") -mark_as_advanced(LZ4_VERSION_STRING LZ4_VERSION_MAJOR LZ4_VERSION_MINOR LZ4_VERSION_RELEASE) - -message(STATUS "Creating build script for LZ4 version: ${LZ4_VERSION_STRING}") - -project(LZ4 VERSION ${LZ4_VERSION_STRING} LANGUAGES C) - -#----------------------------------------------------------------------------- -# DEFAULT BUILD TYPE - Set Release as default when no build type is specified -#----------------------------------------------------------------------------- -# Set a default build type if none was specified -if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - message(STATUS "Setting build type to 'Release' as none was specified.") - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) - # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Release" "MinSizeRel" "RelWithDebInfo") -endif() - -#----------------------------------------------------------------------------- -# BUILD OPTIONS - Configure build targets and features -#----------------------------------------------------------------------------- -option(LZ4_BUILD_CLI "Build lz4 program" ON) -option(LZ4_BUILD_LEGACY_LZ4C "Build lz4c program with legacy argument support" OFF) - - -# Determine if LZ4 is being built as part of another project. -# If LZ4 is bundled in another project, we don't want to install anything. -# Default behavior can be overridden by setting the LZ4_BUNDLED_MODE variable. -if(NOT DEFINED LZ4_BUNDLED_MODE) - get_directory_property(LZ4_IS_SUBPROJECT PARENT_DIRECTORY) - if(LZ4_IS_SUBPROJECT) - set(LZ4_BUNDLED_MODE ON) - else() - set(LZ4_BUNDLED_MODE OFF) - endif() -endif() -mark_as_advanced(LZ4_BUNDLED_MODE) - -#----------------------------------------------------------------------------- -# PACKAGING - CPack configuration -#----------------------------------------------------------------------------- -if(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED) - set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LZ4 compression library") - set(CPACK_PACKAGE_DESCRIPTION_FILE "${LZ4_TOP_SOURCE_DIR}/README.md") - set(CPACK_RESOURCE_FILE_LICENSE "${LZ4_TOP_SOURCE_DIR}/LICENSE") - set(CPACK_PACKAGE_VERSION_MAJOR ${LZ4_VERSION_MAJOR}) - set(CPACK_PACKAGE_VERSION_MINOR ${LZ4_VERSION_MINOR}) - set(CPACK_PACKAGE_VERSION_PATCH ${LZ4_VERSION_RELEASE}) - include(CPack) -endif(NOT LZ4_BUNDLED_MODE AND NOT CPack_CMake_INCLUDED) - -#----------------------------------------------------------------------------- -# LIBRARY TYPE CONFIGURATION - Static vs Shared libraries -#----------------------------------------------------------------------------- -# Allow people to choose whether to build shared or static libraries -# via the BUILD_SHARED_LIBS option unless we are in bundled mode, in -# which case we always use static libraries. -include(CMakeDependentOption) -CMAKE_DEPENDENT_OPTION(BUILD_SHARED_LIBS "Build shared libraries" ON "NOT LZ4_BUNDLED_MODE" OFF) -CMAKE_DEPENDENT_OPTION(BUILD_STATIC_LIBS "Build static libraries" OFF "BUILD_SHARED_LIBS" ON) - -if(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) - message(FATAL_ERROR "Both BUILD_SHARED_LIBS and BUILD_STATIC_LIBS have been disabled") -endif(NOT BUILD_SHARED_LIBS AND NOT BUILD_STATIC_LIBS) - -#----------------------------------------------------------------------------- -# SOURCE FILES & DIRECTORIES - Path setup and source file collection -#----------------------------------------------------------------------------- -set(LZ4_LIB_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/lib") -set(LZ4_PROG_SOURCE_DIR "${LZ4_TOP_SOURCE_DIR}/programs") - -include_directories("${LZ4_LIB_SOURCE_DIR}") - -# CLI sources -file(GLOB LZ4_SOURCES - "${LZ4_LIB_SOURCE_DIR}/*.c") -file(GLOB LZ4_CLI_SOURCES - "${LZ4_PROG_SOURCE_DIR}/*.c") -list(APPEND LZ4_CLI_SOURCES ${LZ4_SOURCES}) # LZ4_CLI always use liblz4 sources directly. - -#----------------------------------------------------------------------------- -# POSITION INDEPENDENT CODE - PIC settings for static libraries -#----------------------------------------------------------------------------- -# Whether to use position independent code for the static library. If -# we're building a shared library this is ignored and PIC is always -# used. -if(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE OR CMAKE_POSITION_INDEPENDENT_CODE) - set(LZ4_POSITION_INDEPENDENT_LIB_DEFAULT ON) -else() - set(LZ4_POSITION_INDEPENDENT_LIB_DEFAULT OFF) -endif(NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE OR CMAKE_POSITION_INDEPENDENT_CODE) - -option(LZ4_POSITION_INDEPENDENT_LIB "Use position independent code for static library (if applicable)" ${LZ4_POSITION_INDEPENDENT_LIB_DEFAULT}) - -#----------------------------------------------------------------------------- -# TARGETS - Library and executable targets -#----------------------------------------------------------------------------- -# liblz4 -include(GNUInstallDirs) -set(LZ4_LIBRARIES_BUILT) -if(BUILD_SHARED_LIBS) - add_library(lz4_shared SHARED ${LZ4_SOURCES}) - target_include_directories(lz4_shared - PUBLIC $ - INTERFACE $) - set_target_properties(lz4_shared PROPERTIES - OUTPUT_NAME lz4 - SOVERSION "${LZ4_VERSION_MAJOR}" - VERSION "${LZ4_VERSION_STRING}") - if(MSVC) - target_compile_definitions(lz4_shared PRIVATE - LZ4_DLL_EXPORT=1) - endif(MSVC) - list(APPEND LZ4_LIBRARIES_BUILT lz4_shared) -endif() -if(BUILD_STATIC_LIBS) - set(STATIC_LIB_NAME lz4) - if(MSVC AND BUILD_SHARED_LIBS) - set(STATIC_LIB_NAME lz4_static) - endif(MSVC AND BUILD_SHARED_LIBS) - add_library(lz4_static STATIC ${LZ4_SOURCES}) - target_include_directories(lz4_static - PUBLIC $ - INTERFACE $) - set_target_properties(lz4_static PROPERTIES - OUTPUT_NAME ${STATIC_LIB_NAME} - POSITION_INDEPENDENT_CODE ${LZ4_POSITION_INDEPENDENT_LIB}) - list(APPEND LZ4_LIBRARIES_BUILT lz4_static) -endif() -# Add unified target. -add_library(lz4 INTERFACE) -list(APPEND LZ4_LIBRARIES_BUILT lz4) -if(BUILD_SHARED_LIBS) - target_link_libraries(lz4 INTERFACE lz4_shared) -else() - target_link_libraries(lz4 INTERFACE lz4_static) -endif(BUILD_SHARED_LIBS) - -#----------------------------------------------------------------------------- -# DEBUG CONFIGURATION - Configurable LZ4_DEBUG level -#----------------------------------------------------------------------------- -# LZ4_DEBUG levels: -# 0 - Disable everything (default for Release) -# 1 - Enable assert() statements -# 2-8 - Enable debug traces with increasing verbosity -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - set(LZ4_DEBUG_LEVEL_DEFAULT 1) -else() - set(LZ4_DEBUG_LEVEL_DEFAULT 0) -endif() - -set(LZ4_DEBUG_LEVEL ${LZ4_DEBUG_LEVEL_DEFAULT} CACHE STRING - "LZ4 debug level: 0=disabled, 1=assert(), 2-8=debug traces with increasing verbosity") -set_property(CACHE LZ4_DEBUG_LEVEL PROPERTY STRINGS "0" "1" "2" "3" "4" "5" "6" "7" "8") - -# Apply LZ4_DEBUG configuration if level > 0 -if(LZ4_DEBUG_LEVEL GREATER 0) - if(MSVC) - add_definitions(/DLZ4_DEBUG=${LZ4_DEBUG_LEVEL}) - else() - add_definitions(-DLZ4_DEBUG=${LZ4_DEBUG_LEVEL}) - endif() -endif() - -#----------------------------------------------------------------------------- -# NAMESPACE CONFIGURATION - xxHash namespace settings -#----------------------------------------------------------------------------- -# xxhash namespace -if(BUILD_SHARED_LIBS) - target_compile_definitions(lz4_shared PRIVATE - XXH_NAMESPACE=LZ4_) -endif(BUILD_SHARED_LIBS) -if(BUILD_STATIC_LIBS) - target_compile_definitions(lz4_static PRIVATE - XXH_NAMESPACE=LZ4_) -endif(BUILD_STATIC_LIBS) - -#----------------------------------------------------------------------------- -# CLI EXECUTABLES - Configuring command-line programs -#----------------------------------------------------------------------------- -# lz4 -if(LZ4_BUILD_CLI) - set(LZ4_PROGRAMS_BUILT lz4cli) - add_executable(lz4cli ${LZ4_CLI_SOURCES}) - set_target_properties(lz4cli PROPERTIES OUTPUT_NAME lz4) -endif(LZ4_BUILD_CLI) - -# lz4c -if(LZ4_BUILD_LEGACY_LZ4C) - list(APPEND LZ4_PROGRAMS_BUILT lz4c) - add_executable(lz4c ${LZ4_CLI_SOURCES}) - set_target_properties(lz4c PROPERTIES COMPILE_DEFINITIONS "ENABLE_LZ4C_LEGACY_OPTIONS") -endif(LZ4_BUILD_LEGACY_LZ4C) - -#----------------------------------------------------------------------------- -# COMPILER FLAGS - Configure warning flags and compiler-specific options -#----------------------------------------------------------------------------- -# Extra warning flags -if(MSVC) - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /W4") -else() - include(CheckCCompilerFlag) - foreach(flag - # GCC-style - -pedantic-errors - -Wall - -Wextra - -Wundef - -Wcast-qual - -Wcast-align - -Wshadow - -Wswitch-enum - -Wdeclaration-after-statement - -Wstrict-prototypes - -Wpointer-arith) - - # Because https://gcc.gnu.org/wiki/FAQ#wnowarning - string(REGEX REPLACE "\\-Wno\\-(.+)" "-W\\1" flag_to_test "${flag}") - string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" test_name "CFLAG_${flag_to_test}") - - check_c_compiler_flag("${ADD_COMPILER_FLAGS_PREPEND} ${flag_to_test}" ${test_name}) - - if(${test_name}) - set(CMAKE_C_FLAGS_DEBUG "${flag} ${CMAKE_C_FLAGS_DEBUG}") - endif() - - unset(test_name) - unset(flag_to_test) - endforeach(flag) -endif(MSVC) - - -#----------------------------------------------------------------------------- -# INSTALLATION - Install targets, headers, and documentation -#----------------------------------------------------------------------------- -if(NOT LZ4_BUNDLED_MODE) - install(TARGETS ${LZ4_PROGRAMS_BUILT} - BUNDLE DESTINATION "${CMAKE_INSTALL_BINDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - install(TARGETS ${LZ4_LIBRARIES_BUILT} - EXPORT lz4Targets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") - install(FILES - "${LZ4_LIB_SOURCE_DIR}/lz4.h" - "${LZ4_LIB_SOURCE_DIR}/lz4hc.h" - "${LZ4_LIB_SOURCE_DIR}/lz4frame.h" - "${LZ4_LIB_SOURCE_DIR}/lz4file.h" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") - install(FILES "${LZ4_PROG_SOURCE_DIR}/lz4.1" - DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblz4.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - -#----------------------------------------------------------------------------- -# CMAKE PACKAGE CONFIG - Configure CMake package for find_package support -#----------------------------------------------------------------------------- - include(CMakePackageConfigHelpers) - write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/lz4ConfigVersion.cmake" - VERSION ${LZ4_VERSION_STRING} - COMPATIBILITY SameMajorVersion) - - set(LZ4_PKG_INSTALLDIR "${CMAKE_INSTALL_LIBDIR}/cmake/lz4") - configure_package_config_file( - "${CMAKE_CURRENT_LIST_DIR}/lz4Config.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/lz4Config.cmake" - INSTALL_DESTINATION ${LZ4_PKG_INSTALLDIR}) - export(EXPORT lz4Targets - FILE ${CMAKE_CURRENT_BINARY_DIR}/lz4Targets.cmake - NAMESPACE LZ4::) - - install(EXPORT lz4Targets - FILE lz4Targets.cmake - NAMESPACE LZ4:: - DESTINATION ${LZ4_PKG_INSTALLDIR}) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/lz4Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/lz4ConfigVersion.cmake - DESTINATION ${LZ4_PKG_INSTALLDIR}) - -#----------------------------------------------------------------------------- -# SYMLINKS - Create and install Unix symlinks and manpage aliases -#----------------------------------------------------------------------------- - # Install lz4cat and unlz4 symlinks on Unix systems - if(UNIX AND LZ4_BUILD_CLI) - foreach(cli_tool IN ITEMS lz4cat unlz4) - # Create a custom target for the symlink creation - add_custom_target("create_${cli_tool}_symlink" ALL - COMMAND ${CMAKE_COMMAND} -E create_symlink - $ ${cli_tool} - DEPENDS lz4cli - COMMENT "Creating symlink for ${cli_tool}" - VERBATIM) - - # Install the symlink into the binary installation directory - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${cli_tool}" - DESTINATION ${CMAKE_INSTALL_BINDIR} - RENAME ${cli_tool}) - endforeach() - - # create manpage aliases - foreach(f lz4cat unlz4) - file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" ".so man1/lz4.1\n") - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" - DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") - endforeach() - endif(UNIX AND LZ4_BUILD_CLI) -endif(NOT LZ4_BUNDLED_MODE) - -#----------------------------------------------------------------------------- -# PKG-CONFIG - Generate and install pkg-config file -#----------------------------------------------------------------------------- -# pkg-config -set(PREFIX "${CMAKE_INSTALL_PREFIX}") - -if("${CMAKE_INSTALL_FULL_LIBDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") - set(LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}") -else() - set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") -endif("${CMAKE_INSTALL_FULL_LIBDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") - -if("${CMAKE_INSTALL_FULL_INCLUDEDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") - set(INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") -else() - set(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}") -endif("${CMAKE_INSTALL_FULL_INCLUDEDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") - -# for liblz4.pc substitution -set(VERSION ${LZ4_VERSION_STRING}) -configure_file(${LZ4_LIB_SOURCE_DIR}/liblz4.pc.in liblz4.pc @ONLY) diff --git a/expkg/vendor/lz4/build/cmake/lz4Config.cmake.in b/expkg/vendor/lz4/build/cmake/lz4Config.cmake.in deleted file mode 100644 index 4b48032..0000000 --- a/expkg/vendor/lz4/build/cmake/lz4Config.cmake.in +++ /dev/null @@ -1,10 +0,0 @@ -@PACKAGE_INIT@ -include( "${CMAKE_CURRENT_LIST_DIR}/lz4Targets.cmake" ) -if(NOT TARGET lz4::lz4) - add_library(lz4::lz4 INTERFACE IMPORTED) - if("@BUILD_SHARED_LIBS@") - set_target_properties(lz4::lz4 PROPERTIES INTERFACE_LINK_LIBRARIES LZ4::lz4_shared) - else() - set_target_properties(lz4::lz4 PROPERTIES INTERFACE_LINK_LIBRARIES LZ4::lz4_static) - endif() -endif() diff --git a/expkg/vendor/lz4/build/make/README.md b/expkg/vendor/lz4/build/make/README.md deleted file mode 100644 index 6e90dbd..0000000 --- a/expkg/vendor/lz4/build/make/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# multiconf.make - -**multiconf.make** is a self-contained Makefile include that lets you build the **same targets under many different flag sets**—debug vs release, ASan vs UBSan, GCC vs Clang, etc.—without the usual “object-file soup.” -It hashes every combination of `CC/CXX`, `CFLAGS/CXXFLAGS`, `CPPFLAGS`, `LDFLAGS` and `LDLIBS` into a **dedicated cache directory**, so objects compiled with one configuration are never reused by another. Swap flags, rebuild, swap back—previous objects are still there and never collide. - ---- - -## Key Benefits - -| Why it matters | What multiconf.make does | -| --- | --- | -| **Isolated configs** | Stores objects into `cachedObjs//`, one directory per unique flag set. | -| **Fast switching** | Reusing an old config is instant—link only, no recompilation. | -| **Header deps** | Edits to headers trigger only needed rebuilds. | -| **One-liner targets** | Macros (`c_program`, `cxx_program`, …) hide all rule boilerplate. | -| **Parallel-ready** | Safe with `make -j`, no duplicate compiles of shared sources. | - ---- - -## Quick Start - -### 1 · List your sources - -```make -C_SRCDIRS := src src/cdeps # all .c are in these directories -CXX_SRCDIRS := src src/cxxdeps # all .cpp are in these directories -``` - -### 2 · Add and include - -```make -# root/Makefile -include multiconf.make -``` - -### 3 · Declare targets - -```make -app: -$(eval $(call c_program,app,app.o obj1.o obj2.o)) -test: -$(eval $(call cxx_program,test, test.o objcxx1.o objcxx2.o)) -``` - -### 4 · Build any config you like - -```sh -# Release with GCC -make CFLAGS="-O3" - -# Debug with Clang + AddressSanitizer (new cache dir) -make CC=clang CFLAGS="-g -O0 -fsanitize=address" - -# Switch back to GCC release (objects still valid, relink only) -make CFLAGS="-O3" -``` - -Objects for each command live in different sub-folders; nothing overlaps. - ---- - -## Additional capabilities - -| Command | Description | -| --- | --- | -| `make clean_cache` | Wipe **all** cached objects & deps (full rebuild next time) | -| `V=1` | Show full compile/link commands | - ---- diff --git a/expkg/vendor/lz4/build/make/lz4defs.make b/expkg/vendor/lz4/build/make/lz4defs.make deleted file mode 100644 index 1b7bf23..0000000 --- a/expkg/vendor/lz4/build/make/lz4defs.make +++ /dev/null @@ -1,115 +0,0 @@ -# ################################################################ -# LZ4 - Makefile common definitions -# Copyright (C) Yann Collet 2020 -# All rights reserved. -# -# BSD license -# Redistribution and use in source and binary forms, with or without modification, -# are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# * Redistributions in binary form must reproduce the above copyright notice, this -# list of conditions and the following disclaimer in the documentation and/or -# other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# You can contact the author at : -# - LZ4 source repository : https://github.com/lz4/lz4 -# - LZ4 forum froup : https://groups.google.com/forum/#!forum/lz4c -# ################################################################ - -UNAME ?= uname - -TARGET_OS ?= $(shell $(UNAME)) -ifeq ($(TARGET_OS),) - TARGET_OS ?= $(OS) -endif - -ifneq (,$(filter Windows%,$(TARGET_OS))) -LIBLZ4_NAME = liblz4-$(LIBVER_MAJOR) -LIBLZ4_EXP = liblz4.lib -WINBASED = yes -else -LIBLZ4_EXP = liblz4.dll.a - ifneq (,$(filter MINGW%,$(TARGET_OS))) -LIBLZ4_NAME = liblz4 -WINBASED = yes - else - ifneq (,$(filter MSYS%,$(TARGET_OS))) -LIBLZ4_NAME = msys-lz4-$(LIBVER_MAJOR) -WINBASED = yes - else - ifneq (,$(filter CYGWIN%,$(TARGET_OS))) -LIBLZ4_NAME = cyglz4-$(LIBVER_MAJOR) -WINBASED = yes - else -LIBLZ4_NAME = liblz4 -WINBASED = no -EXT = - endif - endif - endif -endif - -ifeq ($(WINBASED),yes) -EXT = .exe -WINDRES ?= windres -LDFLAGS += -Wl,--force-exe-suffix -endif - -LIBLZ4 = $(LIBLZ4_NAME).$(SHARED_EXT_VER) - -#determine if dev/nul based on host environment -ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME)))) -VOID := /dev/null -else - ifneq (,$(filter Windows%,$(OS))) -VOID := nul - else -VOID := /dev/null - endif -endif - -ifneq (,$(filter Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku MidnightBSD MINGW% CYGWIN% MSYS% AIX,$(shell $(UNAME)))) -POSIX_ENV = Yes -else -POSIX_ENV = No -endif - -# Avoid symlinks when targeting Windows or building on a Windows host -ifeq ($(WINBASED),yes) -LN_SF = cp -p -else - ifneq (,$(filter MINGW% MSYS% CYGWIN%,$(shell $(UNAME)))) -LN_SF = cp -p - else - ifneq (,$(filter Windows%,$(OS))) -LN_SF = cp -p - else -LN_SF = ln -sf - endif - endif -endif - -ifneq (,$(filter $(shell $(UNAME)),SunOS)) -INSTALL ?= ginstall -else -INSTALL ?= install -endif - -INSTALL_PROGRAM ?= $(INSTALL) -m 755 -INSTALL_DATA ?= $(INSTALL) -m 644 -MAKE_DIR ?= $(INSTALL) -d -m 755 - diff --git a/expkg/vendor/lz4/build/make/multiconf.make b/expkg/vendor/lz4/build/make/multiconf.make deleted file mode 100644 index 1581f57..0000000 --- a/expkg/vendor/lz4/build/make/multiconf.make +++ /dev/null @@ -1,258 +0,0 @@ -# ########################################################################## -# multiconf.make -# Copyright (C) Yann Collet -# -# GPL v2 License -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# ########################################################################## - - -# Provides c_program(_shared_o) and cxx_program(_shared_o) target generation macros -# Provides static_library and c_dynamic_library target generation macros -# Support recompilation of only impacted units when an associated *.h is updated. -# Provides V=1 / VERBOSE=1 support. V=2 is used for debugging purposes. -# Complement target clean: delete objects and binaries created by this script - -# Requires: -# - C_SRCDIRS, CXX_SRCDIRS, ASM_SRCDIRS defined -# OR -# C_SRCS, CXX_SRCS and ASM_SRCS variables defined -# *and* vpath set to find all source files -# OR -# C_OBJS, CXX_OBJS and ASM_OBJS variables defined -# *and* vpath set to find all source files -# - directory `cachedObjs/` available to cache object files. -# alternatively: set CACHE_ROOT to some different value. -# Optional: -# - HASH can be set to a different custom hash program. - -# *_program*: generates a recipe for a target that will be built in a cache directory. -# The cache directory is automatically derived from CACHE_ROOT and list of flags and compilers. -# *_shared_o* variants are optional optimization variants, that share the same objects across multiple targets. -# However, as a consequence, all these objects must have exactly the same list of flags, -# which in practice means that there must be no target-level modification (like: target: CFLAGS += someFlag). -# If unsure, only use the standard variants, c_program and cxx_program. - -# All *_program* macro functions take up to 4 argument: -# - The name of the target -# - The list of object files to build in the cache directory -# - An optional list of dependencies for linking, that will not be built -# - An optional complementary recipe code, that will run after compilation and link - - -# Silent mode is default; use V = 1 or VERBOSE = 1 to see compilation lines -VERBOSE ?= $(V) -$(VERBOSE).SILENT: - -# Directory where object files will be built -CACHE_ROOT ?= cachedObjs - -# -------------------------------------------------------------------------------------------- - -# Dependency management -DEPFLAGS = -MT $@ -MMD -MP -MF - -# Include dependency files -include $(wildcard $(CACHE_ROOT)/**/*.d) -include $(wildcard $(CACHE_ROOT)/generic/*/*.d) - -# -------------------------------------------------------------------------------------------- - -# Automatic determination of build artifacts cache directory, keyed on build -# flags, so that we can do incremental, parallel builds of different binaries -# with different build flags without collisions. - -UNAME ?= $(shell uname) -ifeq ($(UNAME), Darwin) - HASH ?= md5 -else ifeq ($(UNAME), FreeBSD) - HASH ?= gmd5sum -else ifeq ($(UNAME), OpenBSD) - HASH ?= md5 -endif -HASH ?= md5sum - -HAVE_HASH := $(shell echo 1 | $(HASH) > /dev/null && echo 1 || echo 0) -ifeq ($(HAVE_HASH),0) - $(info warning : could not find HASH ($(HASH)), required to differentiate builds using different flags) - HASH_FUNC = generic/$(1) -else - HASH_FUNC = $(firstword $(shell echo $(2) | $(HASH) )) -endif - - -MKDIR ?= mkdir -LN ?= ln - -# -------------------------------------------------------------------------------------------- -# The following macros are used to create object files in the cache directory. -# The object files are named after the source file, but with a different path. - -# Create build directories on-demand. -# -# For some reason, make treats the directory as an intermediate file and tries -# to delete it. So we work around that by marking it "precious". Solution found -# here: -# http://ismail.badawi.io/blog/2017/03/28/automatic-directory-creation-in-make/ -.PRECIOUS: $(CACHE_ROOT)/%/. -$(CACHE_ROOT)/%/. : - $(MKDIR) -p $@ - - -define addTargetAsmObject # targetName, addlDeps -$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2)))) - -.PRECIOUS: $$(CACHE_ROOT)/%/$(1) -$$(CACHE_ROOT)/%/$(1) : $(1:.o=.S) $(2) | $$(CACHE_ROOT)/%/. - @echo AS $$@ - $$(CC) $$(CPPFLAGS) $$(CXXFLAGS) $$(DEPFLAGS) $$(CACHE_ROOT)/$$*/$(1:.o=.d) -c $$< -o $$@ - -endef # addTargetAsmObject - -define addTargetCObject # targetName, addlDeps -$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2)))) #debug print - -.PRECIOUS: $$(CACHE_ROOT)/%/$(1) -$$(CACHE_ROOT)/%/$(1) : $(1:.o=.c) $(2) | $$(CACHE_ROOT)/%/. - @echo CC $$@ - $$(CC) $$(CPPFLAGS) $$(CFLAGS) $$(DEPFLAGS) $$(CACHE_ROOT)/$$*/$(1:.o=.d) -c $$< -o $$@ - -endef # addTargetCObject - -define addTargetCxxObject # targetName, suffix, addlDeps -$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3)))) - -.PRECIOUS: $$(CACHE_ROOT)/%/$(1) -$$(CACHE_ROOT)/%/$(1) : $(1:.o=.$(2)) $(3) | $$(CACHE_ROOT)/%/. - @echo CXX $$@ - $$(CXX) $$(CPPFLAGS) $$(CXXFLAGS) $$(DEPFLAGS) $$(CACHE_ROOT)/$$*/$(1:.o=.d) -c $$< -o $$@ - -endef # addTargetCxxObject - -# Create targets for individual object files -C_SRCDIRS += . -vpath %.c $(C_SRCDIRS) -CXX_SRCDIRS += . -vpath %.cpp $(CXX_SRCDIRS) -vpath %.cc $(CXX_SRCDIRS) -ASM_SRCDIRS += . -vpath %.S $(ASM_SRCDIRS) - -# If C_SRCDIRS, CXX_SRCDIRS and ASM_SRCDIRS are not defined, use C_SRCS, CXX_SRCS and ASM_SRCS -C_SRCS ?= $(notdir $(foreach dir,$(C_SRCDIRS),$(wildcard $(dir)/*.c))) -CPP_SRCS ?= $(notdir $(foreach dir,$(CXX_SRCDIRS),$(wildcard $(dir)/*.cpp))) -CC_SRCS ?= $(notdir $(foreach dir,$(CXX_SRCDIRS),$(wildcard $(dir)/*.cc))) -CXX_SRCS ?= $(CPP_SRCS) $(CC_SRCS) -ASM_SRCS ?= $(notdir $(foreach dir,$(ASM_SRCDIRS),$(wildcard $(dir)/*.S))) - -# If C_SRCS, CXX_SRCS and ASM_SRCS are not defined, use C_OBJS, CXX_OBJS and ASM_OBJS -C_OBJS ?= $(patsubst %.c,%.o,$(C_SRCS)) -CPP_OBJS ?= $(patsubst %.cpp,%.o,$(CPP_SRCS)) -CC_OBJS ?= $(patsubst %.cc,%.o,$(CC_SRCS)) -CXX_OBJS ?= $(CPP_OBJS) $(CC_OBJS) # Note: not used -ASM_OBJS ?= $(patsubst %.S,%.o,$(ASM_SRCS)) - -$(foreach OBJ,$(C_OBJS),$(eval $(call addTargetCObject,$(OBJ)))) -$(foreach OBJ,$(CPP_OBJS),$(eval $(call addTargetCxxObject,$(OBJ),cpp))) -$(foreach OBJ,$(CC_OBJS),$(eval $(call addTargetCxxObject,$(OBJ),cc))) -$(foreach OBJ,$(ASM_OBJS),$(eval $(call addTargetAsmObject,$(OBJ)))) - -# -------------------------------------------------------------------------------------------- -# The following macros are used to create targets in the user Makefile. -# Binaries are built in the cache directory, and then symlinked to the current directory. -# The cache directory is automatically derived from CACHE_ROOT and list of flags and compilers. - -define static_library # targetName, targetDeps, addlDeps, addRecipe, hashComplement - -$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3),$(4),$(5)))) -MCM_ALL_BINS += $(1) - -$$(CACHE_ROOT)/%/$(1) : $$(addprefix $$(CACHE_ROOT)/%/,$(2)) $(3) - @echo AR $$@ - $$(AR) $$(ARFLAGS) $$@ $$^ - $(4) - -.PHONY: $(1) -$(1) : ARFLAGS = rcs -$(1) : $$(CACHE_ROOT)/$$(call HASH_FUNC,$(1),$(2) $$(CPPFLAGS) $$(CC) $$(CFLAGS) $$(CXX) $$(CXXFLAGS) $$(AR) $$(ARFLAGS) $(5))/$(1) - $$(LN) -sf $$< $$@ - -endef # static_library - - -define c_dynamic_library # targetName, targetDeps, addlDeps, addRecipe, hashComplement - -$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3),$(4),$(5)))) -MCM_ALL_BINS += $(1) - -$$(CACHE_ROOT)/%/$(1) : $$(addprefix $$(CACHE_ROOT)/%/,$(2)) $(3) - @echo LD $$@ - $$(CC) $$(CPPFLAGS) $$(CFLAGS) $$(LDFLAGS) -shared -o $$@ $$^ $$(LDLIBS) - $(4) - -.PHONY: $(1) -$(1) : CFLAGS += -fPIC -$(1) : $$(CACHE_ROOT)/$$(call HASH_FUNC,$(1),$(2) $$(CPPFLAGS) $$(CC) $$(CFLAGS) $$(LDFLAGS) $$(LDLIBS) $(5))/$(1) - $$(LN) -sf $$< $$@ - -endef # c_dynamic_library - - -define program_base # targetName, targetDeps, addlDeps, addRecipe, hashComplement, compiler, flags - -$$(if $$(filter 2,$$(V)),$$(info $$(call $(0),$(1),$(2),$(3),$(4),$(5),$(6),$(7)))) -MCM_ALL_BINS += $(1) - -$$(CACHE_ROOT)/%/$(1) : $$(addprefix $$(CACHE_ROOT)/%/,$(2)) $(3) - @echo LD $$@ - $$($(6)) $$(CPPFLAGS) $$($(7)) $$^ -o $$@ $$(LDFLAGS) $$(LDLIBS) - $(4) - -.PHONY: $(1) -$(1) : $$(CACHE_ROOT)/$$(call HASH_FUNC,$(1),$$($(6)) $$(CPPFLAGS) $$($(7)) $$(LDFLAGS) $$(LDLIBS) $(5))/$(1) - $$(LN) -sf $$< $$@$(EXT) - -endef # program_base -# Note: $(EXT) must be set to .exe for Windows - -define c_program # targetName, targetDeps, addlDeps, addRecipe -$$(eval $$(call program_base,$(1),$(2),$(3),$(4),$(1)$(2),CC,CFLAGS)) -endef # c_program - -define c_program_shared_o # targetName, targetDeps, addlDeps, addRecipe -$$(eval $$(call program_base,$(1),$(2),$(3),$(4),,CC,CFLAGS)) -endef # c_program_shared_o - -define cxx_program # targetName, targetDeps, addlDeps, addRecipe -$$(eval $$(call program_base,$(1),$(2),$(3),$(4),$(1)$(2),CXX,CXXFLAGS)) -endef # cxx_program - -define cxx_program_shared_o # targetName, targetDeps, addlDeps, addRecipe -$$(eval $$(call program_base,$(1),$(2),$(3),$(4),,CXX,CXXFLAGS)) -endef # cxx_program_shared_o - -# -------------------------------------------------------------------------------------------- - -# Cleaning: delete all objects and binaries created with this script -.PHONY: clean_cache -clean_cache: - $(RM) -rf $(CACHE_ROOT) - $(RM) $(MCM_ALL_BINS) - -# automatically attach to standard clean target -.PHONY: clean -clean: clean_cache diff --git a/expkg/vendor/lz4/build/meson/GetLz4LibraryVersion.py b/expkg/vendor/lz4/build/meson/GetLz4LibraryVersion.py deleted file mode 100644 index 831fc53..0000000 --- a/expkg/vendor/lz4/build/meson/GetLz4LibraryVersion.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python3 -# ############################################################################# -# Copyright (c) 2018-present lzutao -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# -import re - - -def find_version_tuple(filepath): - version_file_data = None - with open(filepath) as fd: - version_file_data = fd.read() - - patterns = r"""\s*#\s*define\s+LZ4_VERSION_MAJOR\s+([0-9]+).*$ -\s*#\s*define\s+LZ4_VERSION_MINOR\s+([0-9]+).*$ -\s*#\s*define\s+LZ4_VERSION_RELEASE\s+([0-9]+).*$ -""" - regex = re.compile(patterns, re.MULTILINE) - version_match = regex.search(version_file_data) - if version_match: - return version_match.groups() - raise Exception("Unable to find version string.") - - -def main(): - import argparse - parser = argparse.ArgumentParser(description='Print lz4 version from lib/lz4.h') - parser.add_argument('file', help='path to lib/lz4.h') - args = parser.parse_args() - version_tuple = find_version_tuple(args.file) - print('.'.join(version_tuple)) - - -if __name__ == '__main__': - main() diff --git a/expkg/vendor/lz4/build/meson/README.md b/expkg/vendor/lz4/build/meson/README.md deleted file mode 100644 index 2caaaa7..0000000 --- a/expkg/vendor/lz4/build/meson/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Meson build system for lz4 -========================== - -Meson is a build system designed to optimize programmer productivity. -It aims to do this by providing simple, out-of-the-box support for -modern software development tools and practices, such as unit tests, -coverage reports, Valgrind, CCache and the like. - -This Meson build system is provided with no guarantee. - -## How to build - -`cd` to this meson directory (`build/meson`) - -```sh -meson setup --buildtype=release -Ddefault_library=shared -Dprograms=true builddir -cd builddir -ninja # to build -ninja install # to install -``` - -You might want to install it in staging directory: - -```sh -DESTDIR=./staging ninja install -``` - -To configure build options, use: - -```sh -meson configure -``` - -See [man meson(1)](https://manpages.debian.org/testing/meson/meson.1.en.html). diff --git a/expkg/vendor/lz4/build/meson/meson.build b/expkg/vendor/lz4/build/meson/meson.build deleted file mode 100644 index 7e16968..0000000 --- a/expkg/vendor/lz4/build/meson/meson.build +++ /dev/null @@ -1,30 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -# This is a dummy meson file. -# The intention is that it can be easily moved to the root of the project -# (together with meson_options.txt) and packaged for wrapdb. - -project( - 'lz4', - 'c', - license: 'BSD-2-Clause-Patent AND GPL-2.0-or-later', - default_options: [ - 'buildtype=release', - 'warning_level=3' - ], - version: run_command( - find_program('GetLz4LibraryVersion.py'), - '../../lib/lz4.h', - check: true - ).stdout().strip(), - meson_version: '>=0.58.0' -) - -subdir('meson') diff --git a/expkg/vendor/lz4/build/meson/meson/contrib/gen_manual/meson.build b/expkg/vendor/lz4/build/meson/meson/contrib/gen_manual/meson.build deleted file mode 100644 index c4349aa..0000000 --- a/expkg/vendor/lz4/build/meson/meson/contrib/gen_manual/meson.build +++ /dev/null @@ -1,42 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -lz4_source_root = '../../../../..' - -add_languages('cpp', native: true) - -sources = files( - lz4_source_root / 'contrib/gen_manual/gen_manual.cpp' -) - -gen_manual = executable( - 'gen_manual', - sources, - native: true, - install: false -) - -manual_pages = ['lz4', 'lz4frame'] - -foreach mp : manual_pages - custom_target( - '@0@_manual.html'.format(mp), - build_by_default: true, - input: lz4_source_root / 'lib/@0@.h'.format(mp), - output: '@0@_manual.html'.format(mp), - command: [ - gen_manual, - meson.project_version(), - '@INPUT@', - '@OUTPUT@', - ], - install: false - ) -endforeach diff --git a/expkg/vendor/lz4/build/meson/meson/contrib/meson.build b/expkg/vendor/lz4/build/meson/meson/contrib/meson.build deleted file mode 100644 index ef780fb..0000000 --- a/expkg/vendor/lz4/build/meson/meson/contrib/meson.build +++ /dev/null @@ -1,11 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -subdir('gen_manual') diff --git a/expkg/vendor/lz4/build/meson/meson/examples/meson.build b/expkg/vendor/lz4/build/meson/meson/examples/meson.build deleted file mode 100644 index dd26334..0000000 --- a/expkg/vendor/lz4/build/meson/meson/examples/meson.build +++ /dev/null @@ -1,32 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -lz4_source_root = '../../../..' - -examples = { - 'print_version': 'print_version.c', - 'blockStreaming_doubleBuffer': 'blockStreaming_doubleBuffer.c', - 'dictionaryRandomAccess': 'dictionaryRandomAccess.c', - 'blockStreaming_ringBuffer': 'blockStreaming_ringBuffer.c', - 'streamingHC_ringBuffer': 'streamingHC_ringBuffer.c', - 'blockStreaming_lineByLine': 'blockStreaming_lineByLine.c', - 'frameCompress': 'frameCompress.c', - 'bench_functions': 'bench_functions.c', - 'simple_buffer': 'simple_buffer.c', -} - -foreach e, src : examples - executable( - e, - lz4_source_root / 'examples' / src, - dependencies: [liblz4_internal_dep], - install: false - ) -endforeach diff --git a/expkg/vendor/lz4/build/meson/meson/lib/meson.build b/expkg/vendor/lz4/build/meson/meson/lib/meson.build deleted file mode 100644 index 4acf614..0000000 --- a/expkg/vendor/lz4/build/meson/meson/lib/meson.build +++ /dev/null @@ -1,87 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -lz4_source_root = '../../../..' - -sources = files( - lz4_source_root / 'lib/lz4.c', - lz4_source_root / 'lib/lz4frame.c', - lz4_source_root / 'lib/lz4hc.c', - lz4_source_root / 'lib/xxhash.c' -) - -if get_option('unstable') - sources += files(lz4_source_root / 'lib/lz4file.c') -endif - -c_args = [] - -if host_machine.system() == 'windows' and get_option('default_library') != 'static' - c_args += '-DLZ4_DLL_EXPORT=1' -endif - -liblz4 = library( - 'lz4', - sources, - c_args: c_args, - install: true, - version: meson.project_version(), - gnu_symbol_visibility: 'hidden' -) - -liblz4_dep = declare_dependency( - link_with: liblz4, - compile_args: compile_args, - include_directories: include_directories(lz4_source_root / 'lib') -) - -meson.override_dependency('liblz4', liblz4_dep) - -if get_option('tests') or get_option('programs') or get_option('examples') or get_option('ossfuzz') - if get_option('default_library') == 'shared' - liblz4_internal = static_library( - 'lz4-internal', - objects: liblz4.extract_all_objects(recursive: true), - gnu_symbol_visibility: 'hidden' - ) - elif get_option('default_library') == 'static' - liblz4_internal = liblz4 - elif get_option('default_library') == 'both' - liblz4_internal = liblz4.get_static_lib() - endif - - liblz4_internal_dep = declare_dependency( - link_with: liblz4_internal, - compile_args: compile_args, - include_directories: include_directories(lz4_source_root / 'lib') - ) -endif - -pkgconfig.generate( - liblz4, - name: 'lz4', - filebase: 'liblz4', - description: 'extremely fast lossless compression algorithm library', - version: meson.project_version(), - url: 'http://www.lz4.org/' -) - -install_headers( - lz4_source_root / 'lib/lz4.h', - lz4_source_root / 'lib/lz4hc.h', - lz4_source_root / 'lib/lz4frame.h' -) - -if get_option('default_library') != 'shared' - install_headers(lz4_source_root / 'lib/lz4frame_static.h') - if get_option('unstable') - install_headers(lz4_source_root / 'lib/lz4file.h') - endif -endif diff --git a/expkg/vendor/lz4/build/meson/meson/meson.build b/expkg/vendor/lz4/build/meson/meson/meson.build deleted file mode 100644 index 90337bb..0000000 --- a/expkg/vendor/lz4/build/meson/meson/meson.build +++ /dev/null @@ -1,135 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -cc = meson.get_compiler('c') - -fs = import('fs') -pkgconfig = import('pkgconfig') - -lz4_source_root = '../../..' - -add_project_arguments('-DXXH_NAMESPACE=LZ4_', language: 'c') - -if get_option('debug') - add_project_arguments(cc.get_supported_arguments( - '-Wcast-qual', - '-Wcast-align', - '-Wshadow', - '-Wswitch-enum', - '-Wdeclaration-after-statement', - '-Wstrict-prototypes', - '-Wundef', - '-Wpointer-arith', - '-Wstrict-aliasing=1', - '-DLZ4_DEBUG=@0@'.format(get_option('debug-level')) - ), - language: 'c' - ) -endif - -compile_args = [] - -if not get_option('align-test') - add_project_arguments('-DLZ4_ALIGN_TEST=0', language: 'c') -endif - -if get_option('disable-memory-allocation') - if get_option('default_library') != 'static' - error('Memory allocation can only be disabled in static builds') - endif - - add_project_arguments('-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION') - compile_args += '-DLZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION' -endif - -add_project_arguments( - '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max')), - language: 'c' -) -compile_args += '-DLZ4_DISTANCE_MAX=@0@'.format(get_option('distance-max')) - -if not get_option('fast-dec-loop').auto() - add_project_arguments( - '-DLZ4_FAST_DEC_LOOP=@0@'.format( - get_option('fast-dec-loop').enabled() ? 1 : 0 - ), - language: 'c' - ) -endif - -if get_option('force-sw-bitcount') - add_project_arguments('-DLZ4_FORCE_SW_BITCOUNT', language: 'c') -endif - -if get_option('freestanding') - add_project_arguments('-DLZ4_FREESTANDING=1', language: 'c') - compile_args += '-DLZ4_FREESTANDING=1' -endif - -if get_option('memory-usage') > 0 - add_project_arguments( - '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')), - language: 'c' - ) - compile_args += '-DLZ4_MEMORY_USAGE=@0@'.format(get_option('memory-usage')) -endif - -if get_option('endianness-independent-output') - if get_option('default_library') != 'static' - error('Endianness-independent output can only be enabled in static builds') - endif - - add_project_arguments('-DLZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT') - compile_args += '-DLZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT' -endif - -if get_option('unstable') - add_project_arguments('-DLZ4_STATIC_LINKING_ONLY', language: 'c') - compile_args += '-DLZ4_STATIC_LINKING_ONLY' - if get_option('default_library') != 'static' - add_project_arguments('-DLZ4_PUBLISH_STATIC_FUNCTIONS', language: 'c') - compile_args += '-DLZ4_PUBLISH_STATIC_FUNCTIONS' - - add_project_arguments('-DLZ4F_PUBLISH_STATIC_FUNCTIONS', language: 'c') - compile_args += '-DLZ4F_PUBLISH_STATIC_FUNCTIONS' - endif -endif - -if get_option('user-memory-functions') - add_project_arguments('-DLZ4_USER_MEMORY_FUNCTIONS', language: 'c') -endif - -run_env = environment() - -subdir('lib') - -if get_option('programs') - subdir('programs') -else - lz4 = disabler() - lz4cat = disabler() - unlz4 = disabler() -endif - -if get_option('tests') - subdir('tests') -endif - -if get_option('contrib') - subdir('contrib') -endif - -if get_option('examples') - subdir('examples') -endif - -if get_option('ossfuzz') - subdir('ossfuzz') -endif diff --git a/expkg/vendor/lz4/build/meson/meson/ossfuzz/meson.build b/expkg/vendor/lz4/build/meson/meson/ossfuzz/meson.build deleted file mode 100644 index 39ab21c..0000000 --- a/expkg/vendor/lz4/build/meson/meson/ossfuzz/meson.build +++ /dev/null @@ -1,37 +0,0 @@ -lz4_source_root = '../../../..' - -fuzzers = [ - 'compress_frame_fuzzer', - 'compress_fuzzer', - 'compress_hc_fuzzer', - 'decompress_frame_fuzzer', - 'decompress_fuzzer', - 'round_trip_frame_uncompressed_fuzzer', - 'round_trip_fuzzer', - 'round_trip_hc_fuzzer', - 'round_trip_stream_fuzzer' -] - -c_args = cc.get_supported_arguments( - '-Wno-unused-function', - '-Wno-sign-compare', - '-Wno-declaration-after-statement' -) - -foreach f : fuzzers - lib = static_library( - f, - lz4_source_root / 'ossfuzz/@0@.c'.format(f), - lz4_source_root / 'ossfuzz/lz4_helpers.c', - lz4_source_root / 'ossfuzz/fuzz_data_producer.c', - c_args: c_args, - dependencies: [liblz4_internal_dep] - ) - - executable( - f, - lz4_source_root / 'ossfuzz/standaloneengine.c', - link_with: lib, - dependencies: [liblz4_internal_dep] - ) -endforeach diff --git a/expkg/vendor/lz4/build/meson/meson/programs/meson.build b/expkg/vendor/lz4/build/meson/meson/programs/meson.build deleted file mode 100644 index 44378c2..0000000 --- a/expkg/vendor/lz4/build/meson/meson/programs/meson.build +++ /dev/null @@ -1,91 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -lz4_source_root = '../../../..' - -# note: -# it would be preferable to use some kind of glob or wildcard expansion here... -sources = files( - lz4_source_root / 'programs/bench.c', - lz4_source_root / 'programs/lorem.c', - lz4_source_root / 'programs/lz4cli.c', - lz4_source_root / 'programs/lz4io.c', - lz4_source_root / 'programs/util.c', - lz4_source_root / 'programs/threadpool.c', - lz4_source_root / 'programs/timefn.c', -) - -# Initialize an empty list for extra dependencies -extra_deps = [] - -if get_option('enable_multithread') - pthread_dep = dependency('threads', required : true) - extra_deps += [pthread_dep] - multithread_args = ['-DLZ4IO_MULTITHREAD'] -else - multithread_args = [] -endif - -lz4 = executable( - 'lz4', - sources, - include_directories: include_directories(lz4_source_root / 'programs'), - dependencies: [liblz4_internal_dep] + extra_deps, - c_args: multithread_args, - export_dynamic: get_option('debug') and host_machine.system() == 'windows', - install: true -) - -lz4cat = custom_target( - 'lz4cat', - input: lz4, - output: 'lz4cat', - command: [ - 'ln', - '-s', - '-f', - fs.name(lz4.full_path()), - '@OUTPUT@' - ] -) - -unlz4 = custom_target( - 'unlz4', - input: lz4, - output: 'unlz4', - command: [ - 'ln', - '-s', - '-f', - fs.name(lz4.full_path()), - '@OUTPUT@' - ] -) - -meson.override_find_program('lz4', lz4) - -run_env.prepend('PATH', meson.current_build_dir()) - -install_man(lz4_source_root / 'programs/lz4.1') - -if meson.version().version_compare('>=0.61.0') - foreach alias : ['lz4c', 'lz4cat', 'unlz4'] - install_symlink( - alias, - install_dir: get_option('bindir'), - pointing_to: 'lz4' - ) - install_symlink( - '@0@.1'.format(alias), - install_dir: get_option('mandir') / 'man1', - pointing_to: 'lz4.1' - ) - endforeach -endif diff --git a/expkg/vendor/lz4/build/meson/meson/tests/meson.build b/expkg/vendor/lz4/build/meson/meson/tests/meson.build deleted file mode 100644 index cf68812..0000000 --- a/expkg/vendor/lz4/build/meson/meson/tests/meson.build +++ /dev/null @@ -1,162 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -lz4_source_root = '../../../..' - -fuzzer_time = 90 -test_exes = { - 'abiTest': { - 'sources': files(lz4_source_root / 'tests/abiTest.c'), - 'test': false, - }, - 'checkFrame': { - 'sources': files(lz4_source_root / 'tests/checkFrame.c'), - 'include_directories': include_directories(lz4_source_root / 'programs'), - }, - 'checkTag': { - 'sources': files(lz4_source_root / 'tests/checkTag.c'), - 'test': false, - }, - 'datagen': { - 'sources': files( - lz4_source_root / 'programs/lorem.c', - lz4_source_root / 'tests/datagencli.c', - lz4_source_root / 'tests/datagen.c', - lz4_source_root / 'tests/loremOut.c', - ), - 'include_directories': include_directories(lz4_source_root / 'programs'), - }, - 'decompress-partial-usingDict.c': { - 'sources': files(lz4_source_root / 'tests/decompress-partial-usingDict.c'), - }, - 'decompress-partial.c': { - 'sources': files(lz4_source_root / 'tests/decompress-partial.c'), - }, - 'frametest': { - 'sources': files(lz4_source_root / 'tests/frametest.c'), - 'include_directories': include_directories(lz4_source_root / 'programs'), - 'args': ['-v', '-T@0@s'.format(fuzzer_time)], - 'test': false, - }, - 'freestanding': { - 'sources': files(lz4_source_root / 'tests/freestanding.c'), - 'c_args': ['-ffreestanding', '-fno-stack-protector', '-Wno-unused-parameter', '-Wno-declaration-after-statement', '-DLZ4_DEBUG=0'], - 'link_args': ['-nostdlib'], - 'build': cc.get_id() in ['gcc', 'clang'] and - host_machine.system() == 'linux' and host_machine.cpu_family() == 'x86_64', - 'override_options': ['optimization=1'], - }, - 'fullbench': { - 'sources': files(lz4_source_root / 'tests/fullbench.c'), - 'include_directories': include_directories(lz4_source_root / 'programs'), - 'args': ['--no-prompt', '-i1', files(lz4_source_root / 'tests/COPYING')], - 'test': false, - }, - 'fuzzer': { - 'sources': files(lz4_source_root / 'tests/fuzzer.c'), - 'include_directories': include_directories(lz4_source_root / 'programs'), - 'args': ['-T@0@s'.format(fuzzer_time)], - 'test': false, - }, - 'roundTripTest': { - 'sources': files(lz4_source_root / 'tests/roundTripTest.c'), - 'test': false, - }, -} - -targets = {} - -foreach e, attrs : test_exes - if not attrs.get('build', true) - targets += {e: disabler()} - continue - endif - - t = executable( - e, - attrs.get('sources'), - c_args: attrs.get('c_args', []), - link_args: attrs.get('link_args', []), - objects: attrs.get('objects', []), - dependencies: [liblz4_internal_dep], - include_directories: attrs.get('include_directories', []), - install: false, - override_options: attrs.get('override_options', []) - ) - - targets += {e: t} - - if not attrs.get('test', true) - continue - endif - - test( - e, - t, - args: attrs.get('params', []), - timeout: 120 - ) -endforeach - -fs = import('fs') - -run_env.prepend('PATH', meson.current_build_dir()) - -test_scripts = { - 'lz4-basic': { - 'depends': [lz4, lz4cat, unlz4, targets['datagen']], - }, - 'lz4-dict': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-contentSize': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-fast-hugefile': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-frame-concatenation': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-multiple': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-multiple-legacy': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-opt-parser': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-skippable': { - 'depends': [lz4], - }, - 'lz4-sparse': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4-testmode': { - 'depends': [lz4, targets['datagen']], - }, - 'lz4hc-hugefile': { - 'depends': [lz4, targets['datagen']], - }, -} - -foreach s, attrs : test_scripts - script = find_program(lz4_source_root / 'tests/test-@0@.sh'.format(s)) - - test( - '@0@'.format(s), - script, - depends: attrs.get('depends', []), - workdir: fs.parent(script.full_path()), - env: run_env, - timeout: 360 - ) -endforeach diff --git a/expkg/vendor/lz4/build/meson/meson_options.txt b/expkg/vendor/lz4/build/meson/meson_options.txt deleted file mode 100644 index d9c30d6..0000000 --- a/expkg/vendor/lz4/build/meson/meson_options.txt +++ /dev/null @@ -1,44 +0,0 @@ -# ############################################################################# -# Copyright (c) 2018-present lzutao -# Copyright (c) 2022-present Tristan Partin -# All rights reserved. -# -# This source code is licensed under both the BSD-style license (found in the -# LICENSE file in the root directory of this source tree) and the GPLv2 (found -# in the COPYING file in the root directory of this source tree). -# ############################################################################# - -option('enable_multithread', type: 'boolean', value: true, - description: 'Enable multi-threading support') -option('align-test', type: 'boolean', value: true, - description: 'See LZ4_ALIGN_TEST') -option('contrib', type: 'boolean', value: false, - description: 'Enable contrib') -option('debug-level', type: 'integer', min: 0, max: 7, value: 1, - description: 'Enable run-time debug. See lib/lz4hc.c') -option('disable-memory-allocation', type: 'boolean', value: false, - description: 'See LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION. Static builds only') -option('distance-max', type: 'integer', min: 0, max: 65535, value: 65535, - description: 'See LZ4_DISTANCE_MAX') -option('endianness-independent-output', type: 'boolean', value: false, - description: 'See LZ4_STATIC_LINKING_ONLY_ENDIANNESS_INDEPENDENT_OUTPUT. Static builds only') -option('examples', type: 'boolean', value: false, - description: 'Enable examples') -option('fast-dec-loop', type: 'feature', value: 'auto', - description: 'See LZ4_FAST_DEC_LOOP') -option('force-sw-bitcount', type: 'boolean', value: false, - description: 'See LZ4_FORCE_SW_BITCOUNT') -option('freestanding', type: 'boolean', value: false, - description: 'See LZ4_FREESTANDING') -option('memory-usage', type: 'integer', min: 0, max: 20, value: 0, - description: 'See LZ4_MEMORY_USAGE. 0 means use the LZ4 default') -option('ossfuzz', type: 'boolean', value: true, - description: 'Enable ossfuzz') -option('programs', type: 'boolean', value: false, - description: 'Enable programs') -option('tests', type: 'boolean', value: false, - description: 'Enable tests') -option('unstable', type: 'boolean', value: false, - description: 'Expose unstable interfaces') -option('user-memory-functions', type: 'boolean', value: false, - description: 'See LZ4_USER_MEMORY_FUNCTIONS') diff --git a/expkg/vendor/lz4/build/visual/README.md b/expkg/vendor/lz4/build/visual/README.md deleted file mode 100644 index e96c42a..0000000 --- a/expkg/vendor/lz4/build/visual/README.md +++ /dev/null @@ -1,5 +0,0 @@ -These scripts will generate Visual Studio Solutions for a selected set of supported versions of MS Visual. - -For these scripts to work, both `cmake` and the relevant Visual Studio version must be locally installed on the system where the script is run. - -If `cmake` is installed into a non-standard directory, or user wants to test a specific version of `cmake`, the target `cmake` directory can be provided via the environment variable `CMAKE_PATH`. diff --git a/expkg/vendor/lz4/build/visual/generate_solution.cmd b/expkg/vendor/lz4/build/visual/generate_solution.cmd deleted file mode 100644 index 644d812..0000000 --- a/expkg/vendor/lz4/build/visual/generate_solution.cmd +++ /dev/null @@ -1,55 +0,0 @@ -:: Requires 1 parameter == GENERATOR -@echo off -setlocal - -:: Set path -set "BUILD_BASE_DIR=%~dp0" :: Use the directory where the script is located -set "CMAKELIST_DIR=..\..\cmake" - -if "%~1"=="" ( - echo No generator specified as first parameter - exit /b 1 -) -set "GENERATOR=%~1" - -:: Check if a user-defined CMAKE_PATH is set and prioritize it -if defined CMAKE_PATH ( - set "CMAKE_EXECUTABLE=%CMAKE_PATH%\cmake.exe" - echo Using user-defined cmake at %CMAKE_PATH% -) else ( - :: Attempt to find cmake in the system PATH - where cmake >nul 2>&1 - if %ERRORLEVEL% neq 0 ( - :: Use the default standard cmake installation directory if not found in PATH - set "CMAKE_PATH=C:\Program Files\CMake\bin" - echo CMake not in system PATH => using default CMAKE_PATH=%CMAKE_PATH% - set "CMAKE_EXECUTABLE=%CMAKE_PATH%\cmake.exe" - ) else ( - set "CMAKE_EXECUTABLE=cmake" - echo CMake found in system PATH. - ) -) - -:: Set the build directory to a subdirectory named after the generator -set "BUILD_DIR=%BUILD_BASE_DIR%\%GENERATOR%" - -:: Create the build directory if it doesn't exist -if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%" - -:: Run CMake to configure the project and generate the solution -pushd "%BUILD_DIR%" -"%CMAKE_EXECUTABLE%" -G "%GENERATOR%" "%CMAKELIST_DIR%" -if %ERRORLEVEL% neq 0 goto :error - -:: If successful, end script -echo Build configuration successful for %GENERATOR%. -goto :end - -:error -echo Failed to configure build for %GENERATOR%. -exit /b 1 - -:end -popd -endlocal -@echo on diff --git a/expkg/vendor/lz4/build/visual/generate_vs2015.cmd b/expkg/vendor/lz4/build/visual/generate_vs2015.cmd deleted file mode 100644 index 9b64a4f..0000000 --- a/expkg/vendor/lz4/build/visual/generate_vs2015.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -:: Call the central script with the specific generator for VS2015 -call generate_solution.cmd "Visual Studio 14 2015" diff --git a/expkg/vendor/lz4/build/visual/generate_vs2017.cmd b/expkg/vendor/lz4/build/visual/generate_vs2017.cmd deleted file mode 100644 index d5ab8fc..0000000 --- a/expkg/vendor/lz4/build/visual/generate_vs2017.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -:: Call the central script with the specific generator for VS2017 -call generate_solution.cmd "Visual Studio 15 2017" diff --git a/expkg/vendor/lz4/build/visual/generate_vs2019.cmd b/expkg/vendor/lz4/build/visual/generate_vs2019.cmd deleted file mode 100644 index 653fc6e..0000000 --- a/expkg/vendor/lz4/build/visual/generate_vs2019.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -:: Call the central script with the specific generator for VS2019 -call generate_solution.cmd "Visual Studio 16 2019" diff --git a/expkg/vendor/lz4/build/visual/generate_vs2022.cmd b/expkg/vendor/lz4/build/visual/generate_vs2022.cmd deleted file mode 100644 index a48f744..0000000 --- a/expkg/vendor/lz4/build/visual/generate_vs2022.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@echo off -:: Call the central script with the specific generator for VS2022 -call generate_solution.cmd "Visual Studio 17 2022" diff --git a/src/Core/Config.h b/src/Core/Config.h new file mode 100644 index 0000000..e74284b --- /dev/null +++ b/src/Core/Config.h @@ -0,0 +1,15 @@ +#ifndef PKG_CONFIG_H +#define PKG_CONFIG_H + +#include + +namespace PKG { + +// 提取配置 +struct ExtractConfig { + uint32_t threadCount = 0; // 工作线程数;0 = 自动(hardware_concurrency) +}; + +} // namespace PKG + +#endif // PKG_CONFIG_H diff --git a/src/Core/ExtractStats.h b/src/Core/ExtractStats.h new file mode 100644 index 0000000..2be6146 --- /dev/null +++ b/src/Core/ExtractStats.h @@ -0,0 +1,51 @@ +#ifndef PKG_EXTRACT_STATS_H +#define PKG_EXTRACT_STATS_H + +#include +#include +#include +#include +#include +#include + +namespace PKG { + +// 提取统计信息(线程安全,可在多线程环境中累加) +// 由 ExtractPipeline::Run 填充,调用方可读取展示 +struct ExtractStats { + std::atomic totalEntries{0}; // 总条目数 + std::atomic succeeded{0}; // 成功数 + std::atomic failed{0}; // 失败数 + std::atomic totalOutputBytes{0}; // 输出总字节数 + + // 各输出格式数量(按扩展名统计,如 "png" -> 23) + // 注意:map 操作非原子,内部用 mutex 保护 + std::map formatCounts; + std::mutex formatMutex; + + std::chrono::steady_clock::time_point startTime; // 由 Run 设置 + std::chrono::steady_clock::time_point endTime; + uint64_t inputFileSize = 0; // 输入文件大小(字节) + + // 记录一个成功输出的文件(线程安全) + void AddOutput(const std::string &ext, uint64_t bytes) { + succeeded.fetch_add(1, std::memory_order_relaxed); + totalOutputBytes.fetch_add(bytes, std::memory_order_relaxed); + std::lock_guard lock(formatMutex); + formatCounts[ext]++; + } + + // 记录一个失败(线程安全) + void AddFailure() { + failed.fetch_add(1, std::memory_order_relaxed); + } + + // 耗时(秒) + double ElapsedSeconds() const { + return std::chrono::duration(endTime - startTime).count(); + } +}; + +} // namespace PKG + +#endif // PKG_EXTRACT_STATS_H diff --git a/src/Core/Logger.cpp b/src/Core/Logger.cpp new file mode 100644 index 0000000..89dccc8 --- /dev/null +++ b/src/Core/Logger.cpp @@ -0,0 +1,33 @@ +#include "Logger.h" +#include "ProgressBar.h" +#include + +namespace PKG { + +Logger& Logger::Instance() { + static Logger instance; + return instance; +} + +void Logger::SetProgressBar(ProgressBar* pb) { + std::lock_guard lock(m_Mutex); + m_ProgressBar = pb; +} + +void Logger::Info(const std::string& msg) { + std::lock_guard lock(m_Mutex); + if (m_ProgressBar) + m_ProgressBar->PrintLog(msg); + else + std::cout << msg << std::endl; +} + +void Logger::Error(const std::string& msg) { + std::lock_guard lock(m_Mutex); + if (m_ProgressBar) + m_ProgressBar->PrintLog("[ERROR] " + msg); + else + std::cerr << "[ERROR] " << msg << std::endl; +} + +} // namespace PKG diff --git a/src/Core/Logger.h b/src/Core/Logger.h new file mode 100644 index 0000000..fc36d0c --- /dev/null +++ b/src/Core/Logger.h @@ -0,0 +1,32 @@ +#ifndef PKG_LOGGER_H +#define PKG_LOGGER_H + +#include +#include + +namespace PKG { + +class ProgressBar; // 前向声明 + +// 线程安全的日志输出(单例) +// 关联 ProgressBar 后,日志会通过进度条协调打印(pacman 风格: +// 日志在进度条上方滚动,进度条始终固定在底部) +class Logger { +public: + static Logger& Instance(); + + void Info(const std::string& msg); + void Error(const std::string& msg); + + // 关联/取消关联进度条(线程安全) + void SetProgressBar(ProgressBar* pb); + +private: + Logger() = default; + std::mutex m_Mutex; + ProgressBar* m_ProgressBar = nullptr; +}; + +} // namespace PKG + +#endif // PKG_LOGGER_H diff --git a/src/Core/ProcessInfo.cpp b/src/Core/ProcessInfo.cpp new file mode 100644 index 0000000..879452d --- /dev/null +++ b/src/Core/ProcessInfo.cpp @@ -0,0 +1,59 @@ +#include "ProcessInfo.h" + +#include +#include + +// ─── 字节格式化(跨平台通用)────────────────────────────────────── +namespace PKG { +std::string FormatBytes(uint64_t bytes) { + static const char* units[] = {"B", "KB", "MB", "GB"}; + int u = 0; + double size = static_cast(bytes); + while (size >= 1024 && u < 3) { size /= 1024; ++u; } + + std::ostringstream oss; + oss << std::fixed << std::setprecision(u == 0 ? 0 : 1) << size << " " << units[u]; + return oss.str(); +} +} // namespace PKG + +// ─── POSIX (Linux/macOS) ────────────────────────────────────────── +#if defined(__unix__) || defined(__APPLE__) + #include + #include + +namespace PKG { +size_t GetPeakRssBytes() { + struct rusage usage {}; + if (getrusage(RUSAGE_SELF, &usage) != 0) + return 0; +#if defined(__APPLE__) + return static_cast(usage.ru_maxrss); // macOS: 字节 +#else + return static_cast(usage.ru_maxrss) * 1024; // Linux: KB → 字节 +#endif +} +} // namespace PKG + +// ─── Windows ────────────────────────────────────────────────────── +#elif defined(_WIN32) + #include + #include + +namespace PKG { +size_t GetPeakRssBytes() { + PROCESS_MEMORY_COUNTERS pmc; + if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) + return 0; + return static_cast(pmc.PeakWorkingSetSize); +} +} // namespace PKG + +#else + #warning "Unsupported platform: GetPeakRssBytes returns 0" + +namespace PKG { +size_t GetPeakRssBytes() { return 0; } +} // namespace PKG + +#endif diff --git a/src/Core/ProcessInfo.h b/src/Core/ProcessInfo.h new file mode 100644 index 0000000..d985d57 --- /dev/null +++ b/src/Core/ProcessInfo.h @@ -0,0 +1,23 @@ +#ifndef PKG_PROCESS_INFO_H +#define PKG_PROCESS_INFO_H + +// 跨平台进程内存占用查询与字节格式化工具 +// POSIX: getrusage(RUSAGE_SELF) +// Windows: GetProcessMemoryInfo + +#include +#include +#include + +namespace PKG { + +// 返回当前进程峰值物理内存占用,单位字节;失败返回 0 +size_t GetPeakRssBytes(); + +// 将字节数格式化为人类可读字符串(如 "1.2 MB") +// 单位自动选择:B / KB / MB / GB +std::string FormatBytes(uint64_t bytes); + +} // namespace PKG + +#endif // PKG_PROCESS_INFO_H diff --git a/src/Core/ProgressBar.cpp b/src/Core/ProgressBar.cpp new file mode 100644 index 0000000..ffbbd70 --- /dev/null +++ b/src/Core/ProgressBar.cpp @@ -0,0 +1,262 @@ +#include "ProgressBar.h" + +#include +#include + +// Windows: 启用 VT100 转义序列 + 终端宽度检测 +#if defined(_WIN32) +#include +static void EnableVt100() { + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + if (h == INVALID_HANDLE_VALUE) + return; + DWORD mode = 0; + if (!GetConsoleMode(h, &mode)) + return; + SetConsoleMode(h, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING); +} +#else +#include +#include +static void EnableVt100() {} +#endif + +namespace PKG { + +// braille 盲文点 spinner 字符序列 +static const char *kSpinnerFrames[] = { + "\xe2\xa0\x8b", // ⠋ + "\xe2\xa0\x99", // ⠙ + "\xe2\xa0\xb9", // ⠹ + "\xe2\xa0\xb8", // ⠸ + "\xe2\xa0\xbc", // ⠼ + "\xe2\xa0\xb4", // ⠴ + "\xe2\xa0\xa6", // ⠦ + "\xe2\xa0\xa7", // ⠧ + "\xe2\xa0\x87", // ⠇ + "\xe2\xa0\x8f", // ⠏ +}; +static const size_t kSpinnerCount = sizeof(kSpinnerFrames) / sizeof(kSpinnerFrames[0]); + +// ─── ProgressStyle 预设 ─────────────────────────────────────────── + +ProgressStyle ProgressStyle::Modern() { + ProgressStyle s; + s.filledChar = "\xe2\x94\x81"; // ━ + s.emptyChar = "\xe2\x94\x80"; // ─ + s.suffixFormat = " {percent}% ({done}/{total}) {elapsed}s {spinner}"; + s.filledColor = "\033[36m"; // cyan + s.emptyColor = "\033[90m"; // gray + s.suffixColor = "\033[2m"; // dim + s.showSpinner = true; + return s; +} + +ProgressStyle ProgressStyle::Classic() { + ProgressStyle s; + s.filledChar = "\xe2\x96\x88"; // █ + s.emptyChar = "\xe2\x96\x91"; // ░ + s.leftBracket = "["; + s.rightBracket = "]"; + s.suffixFormat = " {percent}% ({done}/{total}) {elapsed}s"; + s.filledColor.clear(); + s.emptyColor.clear(); + s.suffixColor.clear(); + s.showSpinner = false; + return s; +} + +ProgressStyle ProgressStyle::Minimal() { + ProgressStyle s; + s.filledChar = "\xe2\x96\x88"; // █ + s.emptyChar = " "; + s.suffixFormat = " {percent}% {done}/{total}"; + s.filledColor = "\033[32m"; // green + s.showSpinner = false; + return s; +} + +ProgressStyle ProgressStyle::Blocks() { + ProgressStyle s; + s.filledChar = "\xe2\x96\x93"; // ▓ + s.emptyChar = "\xe2\x96\x91"; // ░ + s.suffixFormat = " {percent}% ({done}/{total}) {elapsed}s {spinner}"; + s.filledColor = "\033[35m"; // magenta + s.emptyColor = "\033[90m"; // gray + s.suffixColor = "\033[2m"; // dim + s.showSpinner = true; + return s; +} + +// ─── ProgressBar ────────────────────────────────────────────────── + +ProgressBar::ProgressBar(size_t total, ProgressStyle style) + : m_Total(total), m_Style(std::move(style)), m_Start(std::chrono::steady_clock::now()) { + EnableVt100(); + if (m_Total == 0) { + m_Running = false; + return; + } + m_Thread = std::thread(&ProgressBar::RefreshLoop, this); +} + +ProgressBar::~ProgressBar() { + if (!m_Running.exchange(false)) + return; + if (m_Thread.joinable()) + m_Thread.join(); + std::lock_guard lock(m_DrawMutex); + DrawLocked(); + std::fputc('\n', stdout); + std::fflush(stdout); +} + +void ProgressBar::PrintLog(const std::string &msg) { + std::lock_guard lock(m_DrawMutex); + // 清除当前进度条行:\r 回到行首,\033[K 清除到行尾 + std::fputs("\r\033[K", stdout); + std::fputs(msg.c_str(), stdout); + std::fputc('\n', stdout); + DrawLocked(); + std::fflush(stdout); +} + +void ProgressBar::RefreshLoop() { + while (m_Running.load(std::memory_order_relaxed)) { + { + std::lock_guard lock(m_DrawMutex); + DrawLocked(); + } + if (m_Done.load(std::memory_order_relaxed) >= m_Total) + break; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } +} + +int ProgressBar::GetTerminalWidth() { +#if defined(_WIN32) + HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE); + CONSOLE_SCREEN_BUFFER_INFO csbi; + if (GetConsoleScreenBufferInfo(h, &csbi)) + return csbi.srWindow.Right - csbi.srWindow.Left + 1; + return 80; +#else + struct winsize w; + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == 0 && w.ws_col > 0) + return w.ws_col; + return 80; +#endif +} + +// 占位符替换:{percent} {done} {total} {elapsed} {spinner} +std::string ProgressBar::FormatSuffix(size_t done, size_t total, size_t percent, double secs) { + std::string out; + out.reserve(m_Style.suffixFormat.size() + 32); + const std::string &fmt = m_Style.suffixFormat; + + for (size_t i = 0; i < fmt.size();) { + if (fmt[i] == '{') { + size_t end = fmt.find('}', i); + if (end == std::string::npos) { + out += fmt[i++]; + continue; + } + std::string key = fmt.substr(i + 1, end - i - 1); + if (key == "percent") + out += std::to_string(percent); + else if (key == "done") + out += std::to_string(done); + else if (key == "total") + out += std::to_string(total); + else if (key == "elapsed") + out += std::to_string(secs); + else if (key == "spinner") { + if (m_Style.showSpinner) + out += kSpinnerFrames[m_SpinnerIndex % kSpinnerCount]; + } else { + out += fmt.substr(i, end - i + 1); + } + i = end + 1; + } else { + out += fmt[i++]; + } + } + return out; +} + +void ProgressBar::DrawLocked() { + size_t done = m_Done.load(std::memory_order_relaxed); + size_t total = m_Total; + if (total == 0) + return; + + size_t percent = (done * 100) / total; + + auto elapsed = std::chrono::duration_cast( + std::chrono::steady_clock::now() - m_Start) + .count(); + double secs = elapsed / 1000.0; + + // 推进 spinner + m_SpinnerIndex = (m_SpinnerIndex + 1) % kSpinnerCount; + + // 格式化后缀(含颜色) + std::string suffix = FormatSuffix(done, total, percent, secs); + if (!m_Style.suffixColor.empty()) + suffix = m_Style.suffixColor + suffix + m_Style.resetColor; + + // 计算后缀可见宽度(排除 ANSI 转义序列) + size_t suffixVisible = 0; + bool inEscape = false; + for (char c : suffix) { + if (c == '\033') { + inEscape = true; + continue; + } + if (inEscape) { + if (c == 'm') + inEscape = false; + continue; + } + ++suffixVisible; + } + + int termWidth = GetTerminalWidth(); + int fixedWidth = static_cast(m_Style.leftBracket.size()) + static_cast(m_Style.rightBracket.size()) + static_cast(suffixVisible); + int barWidth = termWidth - fixedWidth; + if (barWidth < 1) + barWidth = 1; + + size_t filled = (done * static_cast(barWidth)) / total; + + // 构建进度条 + std::string bar; + bar.reserve(static_cast(barWidth) * 6); // 含颜色预留 + if (!m_Style.leftBracket.empty()) + bar += m_Style.leftBracket; + + if (!m_Style.filledColor.empty()) + bar += m_Style.filledColor; + for (int i = 0; i < barWidth; ++i) { + if (static_cast(i) < filled) { + bar += m_Style.filledChar; + } else { + // 切换到 empty 颜色(仅首次遇到空白时) + if (i > 0 && !m_Style.emptyColor.empty()) + bar += m_Style.resetColor + m_Style.emptyColor; + bar += m_Style.emptyChar; + } + } + if (!m_Style.filledColor.empty() || !m_Style.emptyColor.empty()) + bar += m_Style.resetColor; + + if (!m_Style.rightBracket.empty()) + bar += m_Style.rightBracket; + + bar += suffix; + + std::fprintf(stdout, "\r%s", bar.c_str()); + std::fflush(stdout); +} + +} // namespace PKG diff --git a/src/Core/ProgressBar.h b/src/Core/ProgressBar.h new file mode 100644 index 0000000..cfeb462 --- /dev/null +++ b/src/Core/ProgressBar.h @@ -0,0 +1,73 @@ +#ifndef PKG_PROGRESS_BAR_H +#define PKG_PROGRESS_BAR_H + +#include +#include +#include +#include +#include +#include + +namespace PKG { + +// 进度条样式(可定制) +// 后缀格式支持占位符:{percent} {done} {total} {elapsed} {spinner} +struct ProgressStyle { + std::string filledChar = "\xe2\x94\x81"; // ━ U+2501 heavy horizontal + std::string emptyChar = "\xe2\x94\x80"; // ─ U+2500 light horizontal + std::string leftBracket; + std::string rightBracket; + std::string suffixFormat = " {percent}% ({done}/{total}) {elapsed}s {spinner}"; + + // ANSI 颜色(空字符串表示不着色) + std::string filledColor = "\033[36m"; // cyan + std::string emptyColor = "\033[90m"; // bright black (gray) + std::string suffixColor = "\033[2m"; // dim + std::string resetColor = "\033[0m"; + + bool showSpinner = true; + + // 预设样式 + static ProgressStyle Modern(); // 横线 + 青色 + braille spinner(默认) + static ProgressStyle Classic(); // 方块 █░ + 无色 + 括号 + static ProgressStyle Minimal(); // 极简:百分比 + 计数 + static ProgressStyle Blocks(); // 彩色方块 ▓░ + spinner +}; + +// 线程安全终端进度条 +// - 全宽度自适应终端宽度 +// - 日志在进度条上方滚动打印(通过 PrintLog 协调,pacman 风格) +// - 样式可通过构造函数定制 +class ProgressBar { +public: + explicit ProgressBar(size_t total, ProgressStyle style = ProgressStyle::Modern()); + ~ProgressBar(); + + ProgressBar(const ProgressBar&) = delete; + ProgressBar& operator=(const ProgressBar&) = delete; + + // 原子递增已完成数(线程安全) + void Increment() { m_Done.fetch_add(1, std::memory_order_relaxed); } + + // 打印日志:清除进度条行 → 打印日志 → 重绘进度条 + void PrintLog(const std::string& msg); + +private: + void RefreshLoop(); + void DrawLocked(); + int GetTerminalWidth(); + std::string FormatSuffix(size_t done, size_t total, size_t percent, double secs); + + std::atomic m_Done{0}; + size_t m_Total; + ProgressStyle m_Style; + std::atomic m_Running{true}; + std::thread m_Thread; + std::chrono::steady_clock::time_point m_Start; + std::mutex m_DrawMutex; + size_t m_SpinnerIndex{0}; +}; + +} // namespace PKG + +#endif // PKG_PROGRESS_BAR_H diff --git a/src/Core/Result.h b/src/Core/Result.h new file mode 100644 index 0000000..d5e75cd --- /dev/null +++ b/src/Core/Result.h @@ -0,0 +1,77 @@ +#ifndef PKG_RESULT_H +#define PKG_RESULT_H + +#include +#include + +namespace PKG { + +// ===== 错误码 ===== +enum class ErrorCode { + None, + FileOpen, // 文件打开失败 + FileCreate, // 文件创建失败 + BadMagic, // 魔数校验失败(格式不符) + ReadFailed, // 读取失败 + WriteFailed, // 写入失败 + DecompressFailed, // 解压失败(LZ4/DXT) + EncodeFailed, // 编码失败(PNG/GIF) + UnsupportedFormat, // 不支持的格式 + InvalidArgument, // 无效参数 +}; + +// ===== 错误信息 ===== +struct Error { + ErrorCode code = ErrorCode::None; + std::string message; + + bool IsOk() const { return code == ErrorCode::None; } + explicit operator bool() const { return IsOk(); } +}; + +// ===== Result: 携带值与错误的返回类型 ===== +template +struct Result { + T value; + Error error; + + bool IsOk() const { return error.IsOk(); } + explicit operator bool() const { return IsOk(); } + + T &operator*() { return value; } + const T &operator*() const { return value; } + T *operator->() { return &value; } + const T *operator->() const { return &value; } +}; + +// ===== Result 特化:仅含错误 ===== +template <> +struct Result { + Error error; + + bool IsOk() const { return error.IsOk(); } + explicit operator bool() const { return IsOk(); } +}; + +// ===== 工厂函数 ===== +template +inline Result Ok(T value) { + return Result{std::move(value), Error{}}; +} + +inline Result Ok() { + return Result{Error{}}; +} + +template +inline Result Fail(ErrorCode code, std::string message = "") { + return Result{T{}, Error{code, std::move(message)}}; +} + +inline Result Fail(ErrorCode code, std::string message = "") { + return Result{Error{code, std::move(message)}}; +} + +} // namespace PKG + +#endif // PKG_RESULT_H diff --git a/src/Core/Types.h b/src/Core/Types.h new file mode 100644 index 0000000..231bf32 --- /dev/null +++ b/src/Core/Types.h @@ -0,0 +1,223 @@ +#ifndef PKG_TYPES_H +#define PKG_TYPES_H + +#include +#include +#include +#include + +namespace PKG { + +// ===== 纹理原始格式(TEX 文件头中声明)===== +enum class TexFormat { + RGBA8888 = 0, // 未压缩 RGBA + DXT5 = 4, // DXT5 压缩(含 alpha) + DXT3 = 6, // DXT3 压缩(显式 alpha) + DXT1 = 7, // DXT1 压缩(无 alpha) + RG88 = 8, // 双通道 + R8 = 9, // 单通道 +}; + +// ===== 纹理标志位(可按位组合)===== +enum class TexType { + None = 0, + NoInterpolation = 1, // 禁用纹理过滤 + ClampUVs = 2, // UV 钳制(非重复) + IsGif = 4, // GIF 动画纹理 + Unk3 = 8, + Unk4 = 16, + IsVideoTexture = 32, // 视频纹理(MP4) + Unk6 = 64, + Unk7 = 128, +}; + +// ===== Mipmap 数据格式 ===== +enum class MipmapFormat { + Invalid = 0, + + // 原始像素格式(1-3) + RGBA8888 = 1, + R8 = 2, + RG88 = 3, + + // DXT 块压缩格式 + CompressedDXT5, + CompressedDXT3, + CompressedDXT1, + + // 视频 + VideoMp4, + + // 已编码图像格式(>= 1000,对应 FreeImage 格式) + ImageBMP = 1000, + ImageICO, + ImageJPEG, + ImageJNG, + ImageKOALA, + ImageLBM, + ImageIFF, + ImageMNG, + ImagePBM, + ImagePBMRAW, + ImagePCD, + ImagePCX, + ImagePGM, + ImagePGMRAW, + ImagePNG, + ImagePPM, + ImagePPMRAW, + ImageRAS, + ImageTARGA, + ImageTIFF, + ImageWBMP, + ImagePSD, + ImageCUT, + ImageXBM, + ImageXPM, + ImageDDS, + ImageGIF, + ImageHDR, + ImageFAXG3, + ImageSGI, + ImageEXR, + ImageJ2K, + ImageJP2, + ImagePFM, + ImagePICT, + ImageRAW, +}; + +// ===== FreeImage 格式标识(对应原项目 FreeImageFormat 枚举)===== +enum class FreeImageFormat { + FIF_UNKNOWN = -1, + FIF_BMP = 0, + FIF_ICO, + FIF_JPEG, + FIF_JNG, + FIF_KOALA, + FIF_LBM, + FIF_IFF = 5, + FIF_MNG, + FIF_PBM, + FIF_PBMRAW, + FIF_PCD, + FIF_PCX, + FIF_PGM, + FIF_PGMRAW, + FIF_PNG, + FIF_PPM, + FIF_PPMRAW, + FIF_RAS, + FIF_TARGA, + FIF_TIFF, + FIF_WBMP, + FIF_PSD, + FIF_CUT, + FIF_XBM, + FIF_XPM, + FIF_DDS, + FIF_GIF, + FIF_HDR, + FIF_FAXG3, + FIF_SGI, + FIF_EXR, + FIF_J2K, + FIF_JP2, + FIF_PFM, + FIF_PICT, + FIF_RAW, + FIF_MP4 = 35, +}; + +// ===== 图像容器版本(对应 TEXB0001~0004)===== +enum class ImageContainerVersion { + VERSION1 = 1, + VERSION2 = 2, + VERSION3 = 3, + VERSION4 = 4, +}; + +// ===== DXT 解压标志 ===== +enum class DXTFlags { + DXT1 = 1, + DXT3 = 1 << 1, + DXT5 = 1 << 2, +}; + +// ===== 数据结构 ===== + +// PKG 索引条目:描述一个文件在 PKG 中的位置与类型 +struct Entry { + std::filesystem::path FullPath; // 文件相对路径 + int32_t Offset{}; // 相对数据区起始的偏移 + int32_t Length{}; // 数据长度(字节) + std::string Type; // 扩展名(含点,如 ".tex") +}; + +// TEX 文件头 +struct TexHeader { + TexFormat Format = TexFormat::RGBA8888; + TexType Flags = TexType::None; + int32_t TextureWidth = 0; // 纹理尺寸(可能含 padding) + int32_t TextureHeight = 0; + int32_t ImageWidth = 0; // 实际图像尺寸 + int32_t ImageHeight = 0; + uint32_t UnkInt0 = 0; // 未知字段 +}; + +// 单个 mipmap 层级 +struct TexMipMap { + int Width = 0; + int Height = 0; + int DecompressedDataCount = 0; // LZ4 解压后大小 + bool IsZ4Compressed = false; + MipmapFormat Format = MipmapFormat::Invalid; + std::vector Data; // 像素或压缩数据 +}; + +// 一张图像(可含多个 mipmap 层级) +struct TexImage { + std::vector Mipmaps; +}; + +// 图像容器(TEXB 块) +struct TexImageContainer { + std::string Magic; // "TEXB0001"~"TEXB0004" + FreeImageFormat ImageFormat = FreeImageFormat::FIF_UNKNOWN; + ImageContainerVersion imageContainerVersion = ImageContainerVersion::VERSION1; + std::vector Images; +}; + +// GIF 单帧信息(位置、尺寸、帧时长) +struct TexFrameInfo { + int ImageId = 0; + float Frametime = 0.0f; // 秒 + float PosX = 0.0f, PosY = 0.0f; + float Width = 0.0f, WidthY = 0.0f, HeightX = 0.0f, Height = 0.0f; +}; + +// GIF 帧信息容器(TEXS 块) +struct TexFrameInfoContainer { + std::string Magic; // "TEXS0001" 或 "TEXS0003" + std::vector Frames; + int GifWidth = 0; // GIF 画布尺寸 + int GifHeight = 0; +}; + +// 完整 TEX 文件结构 +struct Tex { + std::string Magic1; // "TEXV0005" + std::string Magic2; // "TEXI0001" + TexHeader Header; + TexImageContainer ImageContainer; + bool IsGif = false; // 是否为 GIF 动画 + bool IsVideoTexture = false; // 是否为视频纹理 + TexFrameInfoContainer FrameInfoContainer; +}; + +// 根据 MipmapFormat 获取对应文件扩展名(不含点,如 "png") +std::string GetFileExtension(MipmapFormat format); + +} // namespace PKG + +#endif // PKG_TYPES_H diff --git a/src/Decoder/DxtDecoder.cpp b/src/Decoder/DxtDecoder.cpp new file mode 100644 index 0000000..46aa2b4 --- /dev/null +++ b/src/Decoder/DxtDecoder.cpp @@ -0,0 +1,142 @@ +#include "DxtDecoder.h" + +namespace PKG { + +// DXT 解压:每 4x4 像素为一个块 +// - DXT1: 8 字节/块(仅颜色,1-bit alpha) +// - DXT3: 16 字节/块(显式 alpha + 颜色) +// - DXT5: 16 字节/块(插值 alpha + 颜色) +void DxtDecoder::DecompressImage(int width, int height, std::vector& data, DXTFlags flags) { + std::vector rgba(width * height * 4); + int sourceBlockPos = 0; + int bytesPerBlock = (flags == DXTFlags::DXT1) ? 8 : 16; + + // 循环外分配,避免每块重复分配 + std::vector targetRGBA(4 * 16); // 当前块 4x4 像素的 RGBA + std::vector codes(16); // 4 个颜色调色板(RGBA) + std::vector indices(16); // 每像素的调色板索引(2-bit) + std::vector alphaCodes(8); // DXT5: 8 个 alpha 值 + std::vector alphaIndices(16); // DXT5: 每像素的 alpha 索引(3-bit) + + for (int y = 0; y < height; y += 4) { + for (int x = 0; x < width; x += 4) { + if (static_cast(sourceBlockPos) >= data.size()) + continue; + + // 颜色块位置(DXT3/DXT5 前 8 字节是 alpha) + int colorBlockIndex = sourceBlockPos; + if (flags == DXTFlags::DXT3 || flags == DXTFlags::DXT5) + colorBlockIndex += 8; + + // 解码 2 个 16-bit RGB565 基色,插值出 4 个颜色 + int a = data[colorBlockIndex] | (data[colorBlockIndex + 1] << 8); + int b = data[colorBlockIndex + 2] | (data[colorBlockIndex + 3] << 8); + + codes[0] = (a >> 11) & 0x1F; + codes[1] = (a >> 5) & 0x3F; + codes[2] = a & 0x1F; + codes[3] = 255; + + codes[4] = (b >> 11) & 0x1F; + codes[5] = (b >> 5) & 0x3F; + codes[6] = b & 0x1F; + codes[7] = 255; + + for (int i = 0; i < 3; i++) { + int c = codes[i]; + int d = codes[4 + i]; + if (flags == DXTFlags::DXT1 && a <= b) { + codes[8 + i] = static_cast((c + d) / 2); + codes[12 + i] = 0; + } else { + codes[8 + i] = static_cast((2 * c + d) / 3); + codes[12 + i] = static_cast((c + 2 * d) / 3); + } + } + codes[8 + 3] = 255; + codes[12 + 3] = (flags == DXTFlags::DXT1 && a <= b) ? 0 : 255; + + // 解码 4x4 像素的 2-bit 颜色索引 + for (int i = 0; i < 4; i++) { + int packed = data[colorBlockIndex + 4 + i]; + indices[0 + i * 4] = packed & 0x3; + indices[1 + i * 4] = (packed >> 2) & 0x3; + indices[2 + i * 4] = (packed >> 4) & 0x3; + indices[3 + i * 4] = (packed >> 6) & 0x3; + } + + // 根据索引查表得到 RGBA + for (int i = 0; i < 16; i++) { + int offset = 4 * indices[i]; + targetRGBA[4 * i + 0] = (codes[offset] << 3) | (codes[offset] >> 2); + targetRGBA[4 * i + 1] = (codes[offset + 1] << 2) | (codes[offset + 1] >> 4); + targetRGBA[4 * i + 2] = (codes[offset + 2] << 3) | (codes[offset + 2] >> 2); + targetRGBA[4 * i + 3] = codes[offset + 3]; + } + + // 解码 alpha + if (flags == DXTFlags::DXT3) { + // DXT3: 显式 4-bit alpha + for (int i = 0; i < 8; i++) { + int quant = data[sourceBlockPos + i]; + uint8_t lo = quant & 0x0F; + uint8_t hi = (quant >> 4) & 0x0F; + targetRGBA[8 * i + 3] = lo | (lo << 4); + targetRGBA[8 * i + 7] = hi | (hi << 4); + } + } else if (flags == DXTFlags::DXT5) { + // DXT5: 2 个 alpha 基值 + 3-bit 索引插值 + uint8_t alpha0 = data[sourceBlockPos + 0]; + uint8_t alpha1 = data[sourceBlockPos + 1]; + alphaCodes[0] = alpha0; + alphaCodes[1] = alpha1; + + if (alpha0 <= alpha1) { + for (int i = 1; i < 5; i++) + alphaCodes[1 + i] = static_cast(((5 - i) * alpha0 + i * alpha1) / 5); + alphaCodes[6] = 0; + alphaCodes[7] = 255; + } else { + for (int i = 1; i < 7; i++) + alphaCodes[i + 1] = static_cast(((7 - i) * alpha0 + i * alpha1) / 7); + } + + // 解码 16 个 3-bit alpha 索引(共 6 字节) + int blockSrcPos = 2; + int indicesPos = 0; + for (int i = 0; i < 2; i++) { + int value = 0; + for (int j = 0; j < 3; j++) + value |= (data[sourceBlockPos + blockSrcPos++] << (8 * j)); + for (int j = 0; j < 8; j++) + alphaIndices[indicesPos++] = (value >> (3 * j)) & 0x07; + } + + for (int i = 0; i < 16; i++) + targetRGBA[4 * i + 3] = alphaCodes[alphaIndices[i]]; + } + + // 将 4x4 块写入目标图像 + uint8_t targetRGBA_pos = 0; + for (int py = 0; py < 4; py++) { + for (int px = 0; px < 4; px++) { + int sx = x + px; + int sy = y + py; + if (sx < width && sy < height) { + int targetPixel = 4 * (width * sy + sx); + rgba[targetPixel + 0] = targetRGBA[targetRGBA_pos + 0]; + rgba[targetPixel + 1] = targetRGBA[targetRGBA_pos + 1]; + rgba[targetPixel + 2] = targetRGBA[targetRGBA_pos + 2]; + rgba[targetPixel + 3] = targetRGBA[targetRGBA_pos + 3]; + } + targetRGBA_pos += 4; + } + } + sourceBlockPos += bytesPerBlock; + } + } + + data = std::move(rgba); +} + +} // namespace PKG diff --git a/src/Decoder/DxtDecoder.h b/src/Decoder/DxtDecoder.h new file mode 100644 index 0000000..926bea8 --- /dev/null +++ b/src/Decoder/DxtDecoder.h @@ -0,0 +1,18 @@ +#ifndef PKG_DXT_DECODER_H +#define PKG_DXT_DECODER_H + +#include "Core/Types.h" + +namespace PKG { + +// DXT 块压缩纹理解码器 +// 将 DXT1/DXT3/DXT5 压缩数据解压为 RGBA8888 +class DxtDecoder { +public: + // 就地解压:data 既输入压缩数据,也输出 RGBA8888 数据 + static void DecompressImage(int width, int height, std::vector& data, DXTFlags flags); +}; + +} // namespace PKG + +#endif // PKG_DXT_DECODER_H diff --git a/src/Decoder/ImageReader.cpp b/src/Decoder/ImageReader.cpp new file mode 100644 index 0000000..366ce72 --- /dev/null +++ b/src/Decoder/ImageReader.cpp @@ -0,0 +1,264 @@ +#include "ImageReader.h" +#include "lz4.h" + +namespace PKG { + +// LZ4 解压 +static std::vector Lz4Decompress(const unsigned char* compressedData, size_t compressedSize, size_t decompressedSize) { + std::vector output(decompressedSize); + int result = LZ4_decompress_safe( + reinterpret_cast(compressedData), + reinterpret_cast(output.data()), + static_cast(compressedSize), + static_cast(decompressedSize)); + + if (result < 0 || static_cast(result) != decompressedSize) + throw std::runtime_error("LZ4 decompression failed"); + + return output; +} + +// ─── Mipmap 读取(按容器版本区分)────────────────────────────────── + +// V1: [width][height][count][data:count] +static Result ReadMipMapV1(StreamReader& reader) { + auto widthRes = reader.ReadInt32(); + if (!widthRes) return Fail(widthRes.error.code, widthRes.error.message); + + auto heightRes = reader.ReadInt32(); + if (!heightRes) return Fail(heightRes.error.code, heightRes.error.message); + + auto countRes = reader.ReadInt32(); + if (!countRes) return Fail(countRes.error.code, countRes.error.message); + + std::vector bytes; + auto dataRes = reader.ReadData(bytes, *countRes); + if (!dataRes) return Fail(dataRes.error.code, dataRes.error.message); + + return Ok(TexMipMap{ *widthRes, *heightRes, 0, false, MipmapFormat::Invalid, std::move(bytes) }); +} + +// V2/V3: [width][height][compressed][decompressed][count][data:count] +static Result ReadMipMapV2AndV3(StreamReader& reader) { + auto widthRes = reader.ReadInt32(); + if (!widthRes) return Fail(widthRes.error.code, widthRes.error.message); + + auto heightRes = reader.ReadInt32(); + if (!heightRes) return Fail(heightRes.error.code, heightRes.error.message); + + auto compressedRes = reader.ReadInt32(); + if (!compressedRes) return Fail(compressedRes.error.code, compressedRes.error.message); + + auto decompressedRes = reader.ReadInt32(); + if (!decompressedRes) return Fail(decompressedRes.error.code, decompressedRes.error.message); + + auto countRes = reader.ReadInt32(); + if (!countRes) return Fail(countRes.error.code, countRes.error.message); + + std::vector bytes; + auto dataRes = reader.ReadData(bytes, *countRes); + if (!dataRes) return Fail(dataRes.error.code, dataRes.error.message); + + return Ok(TexMipMap{ *widthRes, *heightRes, *decompressedRes, + (*compressedRes) == 1, MipmapFormat::Invalid, std::move(bytes) }); +} + +// V4: [param1][param2][condition:NString][param3] + V2/V3 数据 +static Result ReadMipMapV4(StreamReader& reader) { + auto param1Res = reader.ReadInt32(); + if (!param1Res) return Fail(param1Res.error.code, param1Res.error.message); + + auto param2Res = reader.ReadInt32(); + if (!param2Res) return Fail(param2Res.error.code, param2Res.error.message); + + auto conditionRes = reader.ReadNString(); + if (!conditionRes) return Fail(conditionRes.error.code, conditionRes.error.message); + + auto param3Res = reader.ReadInt32(); + if (!param3Res) return Fail(param3Res.error.code, param3Res.error.message); + + return ReadMipMapV2AndV3(reader); +} + +// ─── 格式映射 ───────────────────────────────────────────────────── + +// FreeImage 格式 → MipmapFormat(已编码图像) +static MipmapFormat FreeImageToMipmap(FreeImageFormat fmt) { + switch (fmt) { + case FreeImageFormat::FIF_BMP: return MipmapFormat::ImageBMP; + case FreeImageFormat::FIF_ICO: return MipmapFormat::ImageICO; + case FreeImageFormat::FIF_JPEG: return MipmapFormat::ImageJPEG; + case FreeImageFormat::FIF_JNG: return MipmapFormat::ImageJNG; + case FreeImageFormat::FIF_KOALA: return MipmapFormat::ImageKOALA; + case FreeImageFormat::FIF_LBM: return MipmapFormat::ImageLBM; + // FIF_IFF 与 FIF_LBM 同值(均为 5),共用一个 case + case FreeImageFormat::FIF_MNG: return MipmapFormat::ImageMNG; + case FreeImageFormat::FIF_PBM: return MipmapFormat::ImagePBM; + case FreeImageFormat::FIF_PBMRAW: return MipmapFormat::ImagePBMRAW; + case FreeImageFormat::FIF_PCD: return MipmapFormat::ImagePCD; + case FreeImageFormat::FIF_PCX: return MipmapFormat::ImagePCX; + case FreeImageFormat::FIF_PGM: return MipmapFormat::ImagePGM; + case FreeImageFormat::FIF_PGMRAW: return MipmapFormat::ImagePGMRAW; + case FreeImageFormat::FIF_PNG: return MipmapFormat::ImagePNG; + case FreeImageFormat::FIF_PPM: return MipmapFormat::ImagePPM; + case FreeImageFormat::FIF_PPMRAW: return MipmapFormat::ImagePPMRAW; + case FreeImageFormat::FIF_RAS: return MipmapFormat::ImageRAS; + case FreeImageFormat::FIF_TARGA: return MipmapFormat::ImageTARGA; + case FreeImageFormat::FIF_TIFF: return MipmapFormat::ImageTIFF; + case FreeImageFormat::FIF_WBMP: return MipmapFormat::ImageWBMP; + case FreeImageFormat::FIF_PSD: return MipmapFormat::ImagePSD; + case FreeImageFormat::FIF_CUT: return MipmapFormat::ImageCUT; + case FreeImageFormat::FIF_XBM: return MipmapFormat::ImageXBM; + case FreeImageFormat::FIF_XPM: return MipmapFormat::ImageXPM; + case FreeImageFormat::FIF_DDS: return MipmapFormat::ImageDDS; + case FreeImageFormat::FIF_GIF: return MipmapFormat::ImageGIF; + case FreeImageFormat::FIF_HDR: return MipmapFormat::ImageHDR; + case FreeImageFormat::FIF_FAXG3: return MipmapFormat::ImageFAXG3; + case FreeImageFormat::FIF_SGI: return MipmapFormat::ImageSGI; + case FreeImageFormat::FIF_EXR: return MipmapFormat::ImageEXR; + case FreeImageFormat::FIF_J2K: return MipmapFormat::ImageJ2K; + case FreeImageFormat::FIF_JP2: return MipmapFormat::ImageJP2; + case FreeImageFormat::FIF_PFM: return MipmapFormat::ImagePFM; + case FreeImageFormat::FIF_PICT: return MipmapFormat::ImagePICT; + case FreeImageFormat::FIF_RAW: return MipmapFormat::ImageRAW; + case FreeImageFormat::FIF_MP4: return MipmapFormat::VideoMp4; + default: return MipmapFormat::Invalid; + } +} + +// TexFormat → MipmapFormat(原始像素或 DXT 压缩) +static MipmapFormat TexToMipmap(TexFormat fmt) { + switch (fmt) { + case TexFormat::RGBA8888: return MipmapFormat::RGBA8888; + case TexFormat::DXT5: return MipmapFormat::CompressedDXT5; + case TexFormat::DXT3: return MipmapFormat::CompressedDXT3; + case TexFormat::DXT1: return MipmapFormat::CompressedDXT1; + case TexFormat::RG88: return MipmapFormat::RG88; + case TexFormat::R8: return MipmapFormat::R8; + default: return MipmapFormat::Invalid; + } +} + +// 综合格式判定:优先使用 FreeImage 格式,否则用 TexFormat +static MipmapFormat GetFormatFromTex(FreeImageFormat imageFormat, TexFormat format) { + if (imageFormat != FreeImageFormat::FIF_UNKNOWN) + return FreeImageToMipmap(imageFormat); + return TexToMipmap(format); +} + +// ─── 公开接口 ───────────────────────────────────────────────────── + +Result ImageReader::ReadFrom(StreamReader& reader, const TexImageContainer& container, TexFormat format) { + auto mipMapCountRes = reader.ReadInt32(); + if (!mipMapCountRes) + return Fail(mipMapCountRes.error.code, mipMapCountRes.error.message); + + MipmapFormat aFormat = GetFormatFromTex(container.ImageFormat, format); + TexImage image{}; + + for (int i = 0; i < *mipMapCountRes; i++) { + TexMipMap mipmap{}; + + switch (container.imageContainerVersion) { + case ImageContainerVersion::VERSION1: + { + auto res = ReadMipMapV1(reader); + if (!res) return Fail(res.error.code, res.error.message); + mipmap = *res; + break; + } + case ImageContainerVersion::VERSION2: + case ImageContainerVersion::VERSION3: + { + auto res = ReadMipMapV2AndV3(reader); + if (!res) return Fail(res.error.code, res.error.message); + mipmap = *res; + break; + } + case ImageContainerVersion::VERSION4: + { + auto res = ReadMipMapV4(reader); + if (!res) return Fail(res.error.code, res.error.message); + mipmap = *res; + break; + } + } + + mipmap.Format = aFormat; + + // LZ4 解压 + if (mipmap.IsZ4Compressed) { + try { + mipmap.Data = Lz4Decompress(mipmap.Data.data(), mipmap.Data.size(), mipmap.DecompressedDataCount); + mipmap.IsZ4Compressed = false; + } catch (const std::exception& e) { + return Fail(ErrorCode::DecompressFailed, e.what()); + } + } + + image.Mipmaps.push_back(mipmap); + } + + return Ok(std::move(image)); +} + +// TEXB 容器结构: +// [magic:NString] "TEXB0001"~"TEXB0004" +// [imageCount:int32] +// V3: [imageFormat:int32] +// V4: [imageFormat:int32][isVideo:int32] (FIF_UNKNOWN + isVideo=1 → MP4) +// repeat imageCount: +Result ImageReader::ReadContainer(StreamReader& reader, TexFormat texFormat) { + TexImageContainer container{}; + + auto magicRes = reader.ReadNString(); + if (!magicRes) + return Fail(magicRes.error.code, magicRes.error.message); + container.Magic = *magicRes; + + auto imageCountRes = reader.ReadInt32(); + if (!imageCountRes) + return Fail(imageCountRes.error.code, imageCountRes.error.message); + + // 按版本读取附加字段 + if (container.Magic == "TEXB0003") { + auto formatRes = reader.ReadInt32(); + if (!formatRes) return Fail(formatRes.error.code, formatRes.error.message); + container.ImageFormat = static_cast(*formatRes); + } else if (container.Magic == "TEXB0004") { + auto formatRes = reader.ReadInt32(); + if (!formatRes) return Fail(formatRes.error.code, formatRes.error.message); + auto format = static_cast(*formatRes); + + auto isVideoRes = reader.ReadInt32(); + if (!isVideoRes) return Fail(isVideoRes.error.code, isVideoRes.error.message); + + // 视频纹理:FIF_UNKNOWN + isVideo=1 → MP4 + if (format == FreeImageFormat::FIF_UNKNOWN && (*isVideoRes) == 1) + format = FreeImageFormat::FIF_MP4; + + container.ImageFormat = format; + } else if (container.Magic != "TEXB0001" && container.Magic != "TEXB0002") { + return Fail(ErrorCode::BadMagic, "Invalid TEXB magic: " + container.Magic); + } + + // 从魔数提取版本号("TEXB0003" → 3) + int version = std::stoi(container.Magic.substr(4, 4)); + container.imageContainerVersion = static_cast(version); + + // V4 仅对 MP4 有效,其余降级为 V3 + if (container.imageContainerVersion == ImageContainerVersion::VERSION4 + && container.ImageFormat != FreeImageFormat::FIF_MP4) + container.imageContainerVersion = ImageContainerVersion::VERSION3; + + for (int i = 0; i < *imageCountRes; i++) { + auto imageRes = ReadFrom(reader, container, texFormat); + if (!imageRes) + return Fail(imageRes.error.code, imageRes.error.message); + container.Images.push_back(*imageRes); + } + + return Ok(std::move(container)); +} + +} // namespace PKG diff --git a/src/Decoder/ImageReader.h b/src/Decoder/ImageReader.h new file mode 100644 index 0000000..f847b8b --- /dev/null +++ b/src/Decoder/ImageReader.h @@ -0,0 +1,22 @@ +#ifndef PKG_IMAGE_READER_H +#define PKG_IMAGE_READER_H + +#include "Core/Types.h" +#include "Core/Result.h" +#include "IO/StreamReader.h" + +namespace PKG { + +// TEX 图像容器与 mipmap 读取器 +class ImageReader { +public: + // 读取单张图像(含多个 mipmap 层级) + static Result ReadFrom(StreamReader& reader, const TexImageContainer& container, TexFormat format); + + // 读取图像容器(TEXB 块) + static Result ReadContainer(StreamReader& reader, TexFormat texFormat); +}; + +} // namespace PKG + +#endif // PKG_IMAGE_READER_H diff --git a/src/Decoder/PkgExtractor.cpp b/src/Decoder/PkgExtractor.cpp new file mode 100644 index 0000000..2872219 --- /dev/null +++ b/src/Decoder/PkgExtractor.cpp @@ -0,0 +1,67 @@ +#include "PkgExtractor.h" + +namespace PKG { + +// PKG 文件结构: +// [magicLen:int32][magic:string(magicLen)] // "PKG..." +// [count:int32] +// repeat count: +// [pathLen:int32][path:string(pathLen)] +// [offset:int32][length:int32] +// <数据区,offset 相对此处> +Result> PkgExtractor::ParseIndex(StreamReader& reader) { + // 读取魔数 + auto headRes = reader.ReadInt32(); + if (!headRes) + return Fail>(headRes.error.code, headRes.error.message); + + auto magicHeaderRes = reader.ReadString(*headRes); + if (!magicHeaderRes) + return Fail>(magicHeaderRes.error.code, magicHeaderRes.error.message); + + if (magicHeaderRes->substr(0, 3) != "PKG") + return Fail>(ErrorCode::BadMagic, "Invalid PKG header: " + *magicHeaderRes); + + // 读取条目数 + auto countRes = reader.ReadInt32(); + if (!countRes) + return Fail>(countRes.error.code, countRes.error.message); + + if (*countRes <= 0) + return Fail>(ErrorCode::InvalidArgument, "No entries found"); + + // 逐条解析索引 + std::vector entries; + entries.reserve(*countRes); + + for (int i = 0; i < *countRes; i++) { + Entry entry{}; + + auto sizeRes = reader.ReadInt32(); + if (!sizeRes) + return Fail>(sizeRes.error.code, sizeRes.error.message); + + auto pathRes = reader.ReadString(*sizeRes); + if (!pathRes) + return Fail>(pathRes.error.code, pathRes.error.message); + + entry.FullPath = std::filesystem::path(*pathRes).make_preferred(); + + auto offsetRes = reader.ReadInt32(); + if (!offsetRes) + return Fail>(offsetRes.error.code, offsetRes.error.message); + entry.Offset = *offsetRes; + + auto lengthRes = reader.ReadInt32(); + if (!lengthRes) + return Fail>(lengthRes.error.code, lengthRes.error.message); + entry.Length = *lengthRes; + + entry.Type = entry.FullPath.extension().string(); + entries.push_back(entry); + } + + return Ok(std::move(entries)); +} + +} // namespace PKG diff --git a/src/Decoder/PkgExtractor.h b/src/Decoder/PkgExtractor.h new file mode 100644 index 0000000..592b47d --- /dev/null +++ b/src/Decoder/PkgExtractor.h @@ -0,0 +1,19 @@ +#ifndef PKG_PKG_EXTRACTOR_H +#define PKG_PKG_EXTRACTOR_H + +#include "Core/Types.h" +#include "Core/Result.h" +#include "IO/StreamReader.h" + +namespace PKG { + +// PKG/MPKG 包索引解析器 +// 解析包头部与文件索引表,返回所有条目的元信息 +class PkgExtractor { +public: + Result> ParseIndex(StreamReader& reader); +}; + +} // namespace PKG + +#endif // PKG_PKG_EXTRACTOR_H diff --git a/src/Decoder/TexDecoder.cpp b/src/Decoder/TexDecoder.cpp new file mode 100644 index 0000000..5bdf429 --- /dev/null +++ b/src/Decoder/TexDecoder.cpp @@ -0,0 +1,75 @@ +#include "TexDecoder.h" +#include "ImageReader.h" + +namespace PKG { + +// TEX 文件结构: +// [magic1:NString(16)] "TEXV0005" +// [magic2:NString(16)] "TEXI0001" +// [format:int32] TexFormat +// [flags:int32] TexType 标志位 +// [texW:int32][texH:int32] 纹理尺寸 +// [imgW:int32][imgH:int32] 图像尺寸 +// [unk:uint32] +// 图像数据(TEXB 块) +Result TexDecoder::Decode(StreamReader& reader) { + Tex tex{}; + + // 校验魔数 + auto magic1Res = reader.ReadNString(16); + if (!magic1Res) + return Fail(magic1Res.error.code, magic1Res.error.message); + tex.Magic1 = *magic1Res; + if (tex.Magic1 != "TEXV0005") + return Fail(ErrorCode::BadMagic, "Invalid TEX magic1: " + tex.Magic1); + + auto magic2Res = reader.ReadNString(16); + if (!magic2Res) + return Fail(magic2Res.error.code, magic2Res.error.message); + tex.Magic2 = *magic2Res; + if (tex.Magic2 != "TEXI0001") + return Fail(ErrorCode::BadMagic, "Invalid TEX magic2: " + tex.Magic2); + + // 读取头部字段 + auto formatRes = reader.ReadInt32(); + if (!formatRes) return Fail(formatRes.error.code, formatRes.error.message); + tex.Header.Format = static_cast(*formatRes); + + auto flagsRes = reader.ReadInt32(); + if (!flagsRes) return Fail(flagsRes.error.code, flagsRes.error.message); + tex.Header.Flags = static_cast(*flagsRes); + + auto texWidthRes = reader.ReadInt32(); + if (!texWidthRes) return Fail(texWidthRes.error.code, texWidthRes.error.message); + tex.Header.TextureWidth = *texWidthRes; + + auto texHeightRes = reader.ReadInt32(); + if (!texHeightRes) return Fail(texHeightRes.error.code, texHeightRes.error.message); + tex.Header.TextureHeight = *texHeightRes; + + auto imgWidthRes = reader.ReadInt32(); + if (!imgWidthRes) return Fail(imgWidthRes.error.code, imgWidthRes.error.message); + tex.Header.ImageWidth = *imgWidthRes; + + auto imgHeightRes = reader.ReadInt32(); + if (!imgHeightRes) return Fail(imgHeightRes.error.code, imgHeightRes.error.message); + tex.Header.ImageHeight = *imgHeightRes; + + auto unkRes = reader.ReadUInt32(); + if (!unkRes) return Fail(unkRes.error.code, unkRes.error.message); + tex.Header.UnkInt0 = *unkRes; + + // 解析标志位 + tex.IsGif = (static_cast(tex.Header.Flags) & static_cast(TexType::IsGif)) != 0; + tex.IsVideoTexture = (static_cast(tex.Header.Flags) & static_cast(TexType::IsVideoTexture)) != 0; + + // 读取图像容器 + auto containerRes = ImageReader::ReadContainer(reader, tex.Header.Format); + if (!containerRes) + return Fail(containerRes.error.code, containerRes.error.message); + tex.ImageContainer = *containerRes; + + return Ok(std::move(tex)); +} + +} // namespace PKG diff --git a/src/Decoder/TexDecoder.h b/src/Decoder/TexDecoder.h new file mode 100644 index 0000000..da30c8d --- /dev/null +++ b/src/Decoder/TexDecoder.h @@ -0,0 +1,20 @@ +#ifndef PKG_TEX_DECODER_H +#define PKG_TEX_DECODER_H + +#include "Core/Types.h" +#include "Core/Result.h" +#include "IO/StreamReader.h" + +namespace PKG { + +// TEX 纹理文件解码器 +// 解析 TEXV0005/TEXI0001 头部与图像容器(TEXB 块) +// GIF 帧信息(TEXS 块)由 ExtractPipeline::ReadGifFrameInfo 单独读取 +class TexDecoder { +public: + Result Decode(StreamReader& reader); +}; + +} // namespace PKG + +#endif // PKG_TEX_DECODER_H diff --git a/src/Encoder/ImageEncoder.cpp b/src/Encoder/ImageEncoder.cpp new file mode 100644 index 0000000..ab5f632 --- /dev/null +++ b/src/Encoder/ImageEncoder.cpp @@ -0,0 +1,223 @@ +#include "ImageEncoder.h" +#include "IO/StreamWriter.h" +#include "Decoder/DxtDecoder.h" +#include "gif.h" + +#include +#include + +extern "C" unsigned char* stbi_write_png_to_mem(const unsigned char* pixels, int stride_bytes, + int x, int y, int n, int* out_len); + +namespace PKG +{ + // ─── RAII 工具 ─────────────────────────────────────────────────── + + // 管理 stbi_write_png_to_mem 返回的 C 缓冲,确保任何退出路径都释放 + struct StbiPngBufferDeleter { + void operator()(uint8_t* p) const { free(p); } + }; + using StbiPngBuffer = std::unique_ptr; + + // GifWriter 的 RAII 守卫:构造时调用 GifBegin,析构时调用 GifEnd + // 保证即使编码过程中抛异常或提前 return,文件句柄和 oldImage 都被释放 + class GifWriterGuard { + public: + GifWriterGuard() = default; + + // 调用 GifBegin 初始化;成功返回 true,失败返回 false + bool Begin(const char* filename, uint32_t width, uint32_t height, uint32_t delay) + { + return GifBegin(&m_Writer, filename, width, height, delay); + } + + GifWriter* Get() { return &m_Writer; } + + ~GifWriterGuard() + { + if (m_Writer.f) // f 非空表示 GifBegin 成功,需要清理 + GifEnd(&m_Writer); + } + + GifWriterGuard(const GifWriterGuard&) = delete; + GifWriterGuard& operator=(const GifWriterGuard&) = delete; + + private: + GifWriter m_Writer{}; + }; + + // ─── 格式 → 扩展名映射表 ───────────────────────────────────────── + // 使用静态 map 替代冗长的 switch-case,便于维护和扩展 + static const std::unordered_map& FormatExtensionMap() + { + static const std::unordered_map map = { + {MipmapFormat::ImageBMP, "bmp"}, + {MipmapFormat::ImageICO, "ico"}, + {MipmapFormat::ImageJPEG, "jpg"}, + {MipmapFormat::ImageJNG, "jng"}, + {MipmapFormat::ImageKOALA, "koa"}, + {MipmapFormat::ImageLBM, "lbm"}, + {MipmapFormat::ImageIFF, "iff"}, + {MipmapFormat::ImageMNG, "mng"}, + {MipmapFormat::ImagePBM, "pbm"}, + {MipmapFormat::ImagePBMRAW, "pbm"}, + {MipmapFormat::ImagePCD, "pcd"}, + {MipmapFormat::ImagePCX, "pcx"}, + {MipmapFormat::ImagePGM, "pgm"}, + {MipmapFormat::ImagePGMRAW, "pgm"}, + {MipmapFormat::ImagePNG, "png"}, + {MipmapFormat::ImagePPM, "ppm"}, + {MipmapFormat::ImagePPMRAW, "ppm"}, + {MipmapFormat::ImageRAS, "ras"}, + {MipmapFormat::ImageTARGA, "tga"}, + {MipmapFormat::ImageTIFF, "tif"}, + {MipmapFormat::ImageWBMP, "wbmp"}, + {MipmapFormat::ImagePSD, "psd"}, + {MipmapFormat::ImageCUT, "cut"}, + {MipmapFormat::ImageXBM, "xbm"}, + {MipmapFormat::ImageXPM, "xpm"}, + {MipmapFormat::ImageDDS, "dds"}, + {MipmapFormat::ImageGIF, "gif"}, + {MipmapFormat::ImageHDR, "hdr"}, + {MipmapFormat::ImageFAXG3, "g3"}, + {MipmapFormat::ImageSGI, "sgi"}, + {MipmapFormat::ImageEXR, "exr"}, + {MipmapFormat::ImageJ2K, "j2k"}, + {MipmapFormat::ImageJP2, "jp2"}, + {MipmapFormat::ImagePFM, "pfm"}, + {MipmapFormat::ImagePICT, "pict"}, + {MipmapFormat::ImageRAW, "raw"}, + {MipmapFormat::VideoMp4, "mp4"}, + }; + return map; + } + + std::string GetFileExtension(MipmapFormat format) + { + const auto& map = FormatExtensionMap(); + auto it = map.find(format); + return it != map.end() ? it->second : "unknown"; + } + + // ─── PNG 编码 ──────────────────────────────────────────────────── + // 将原始像素数据(R8/RG88/RGBA8888)编码为 PNG 文件 + // 使用 stb_image_write 的内存编码接口,再一次性写入磁盘 + Result ImageEncoder::EncodePng(const TexMipMap& mipmap, const std::filesystem::path& outPath) + { + // 根据像素格式确定通道数 + int channel = 4; + switch (mipmap.Format) + { + case MipmapFormat::R8: channel = 1; break; + case MipmapFormat::RG88: channel = 2; break; + case MipmapFormat::RGBA8888: channel = 4; break; + default: + return Fail(ErrorCode::UnsupportedFormat, "Unsupported format for PNG encoding"); + } + + // 编码到内存缓冲(StbiPngBuffer 的 RAII 析构会自动 free,无需手动释放) + int len = 0; + StbiPngBuffer data(stbi_write_png_to_mem(mipmap.Data.data(), mipmap.Width * channel, + mipmap.Width, mipmap.Height, channel, &len)); + if (!data) + return Fail(ErrorCode::EncodeFailed, "Failed to encode PNG"); + + // 写入磁盘 + StreamWriter writer(outPath, std::ios::binary); + return writer.WriteBytes(reinterpret_cast(data.get()), len); + } + + // ─── GIF 编码 ──────────────────────────────────────────────────── + // 逐帧处理策略(降低峰值内存): + // 1. 遍历每张源图像(图集),仅对当前图像执行 DXT 解压 + // 2. 从解压后的图集中按帧信息裁剪出每一帧 + // 3. 写入 GIF 后立即释放该图集的像素数据 + // 这样任意时刻内存中最多只保留一张图集的 RGBA 数据 + Result ImageEncoder::EncodeGif(Tex& tex, const std::filesystem::path& outPath) + { + // GifWriterGuard 在析构时自动调用 GifEnd,保证异常/提前返回时也释放资源 + GifWriterGuard writer; + // GIF 帧延时单位:1/100 秒 + uint32_t delay = static_cast(tex.FrameInfoContainer.Frames[0].Frametime * 100); + + if (!writer.Begin(outPath.string().c_str(), + static_cast(tex.FrameInfoContainer.Frames[0].Width), + static_cast(tex.FrameInfoContainer.Frames[0].Height), delay)) + return Fail(ErrorCode::EncodeFailed, "Failed to create GIF file"); + + int frameIndex = 0; // 已写入的全局帧序号 + int imageIndex = 1; // 当前图集序号(用于计算帧边界) + + for (auto& image : tex.ImageContainer.Images) + { + if (image.Mipmaps.empty()) + continue; + + auto& mipmap = image.Mipmaps[0]; + + // 就地 DXT 解压(仅当前帧所在的图集),避免一次性解压所有图集 + switch (mipmap.Format) + { + case MipmapFormat::CompressedDXT5: + DxtDecoder::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT5); + mipmap.Format = MipmapFormat::RGBA8888; + break; + case MipmapFormat::CompressedDXT3: + DxtDecoder::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT3); + mipmap.Format = MipmapFormat::RGBA8888; + break; + case MipmapFormat::CompressedDXT1: + DxtDecoder::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT1); + mipmap.Format = MipmapFormat::RGBA8888; + break; + default: + break; + } + + // 当前图集可切分出的帧数(图集尺寸 / 单帧尺寸) + int singleImageFrameCount = (mipmap.Width / tex.FrameInfoContainer.GifWidth) + * (mipmap.Height / tex.FrameInfoContainer.GifHeight); + + // 从图集中逐帧裁剪并写入 GIF + for (; frameIndex < singleImageFrameCount * imageIndex + && frameIndex < static_cast(tex.FrameInfoContainer.Frames.size()); + frameIndex++) + { + const auto& frameInfo = tex.FrameInfoContainer.Frames[frameIndex]; + std::vector frameImage; + frameImage.reserve(static_cast(frameInfo.Width) * frameInfo.Height * 4); + + // 按行裁剪:从图集的 (PosX, PosY) 处取 Width×Height 的像素块 + for (int row = 0; row < tex.FrameInfoContainer.GifHeight; row++) + { + auto lineStart = mipmap.Data.begin() + + mipmap.Width * 4 * (static_cast(frameInfo.PosY) + row) + + static_cast(frameInfo.PosX) * 4; + auto lineEnd = lineStart + static_cast(frameInfo.Width) * 4; + frameImage.insert(frameImage.end(), lineStart, lineEnd); + } + + GifWriteFrame(writer.Get(), frameImage.data(), + static_cast(frameInfo.Width), + static_cast(frameInfo.Height), delay); + } + imageIndex++; + + // 释放已编码图集的像素数据,降低峰值内存 + std::vector().swap(mipmap.Data); + } + + // writer 析构时自动调用 GifEnd + return Ok(); + } + + // ─── 原始数据写出 ──────────────────────────────────────────────── + // 直接将 mipmap 数据写入文件,不做任何转码 + // 用于 MP4 视频纹理或已编码图像(PNG/JPEG 等) + Result ImageEncoder::EncodeRaw(const TexMipMap& mipmap, const std::filesystem::path& outPath) + { + StreamWriter writer(outPath, std::ios::binary); + return writer.WriteBytes(reinterpret_cast(mipmap.Data.data()), + static_cast(mipmap.Data.size())); + } +} diff --git a/src/Encoder/ImageEncoder.h b/src/Encoder/ImageEncoder.h new file mode 100644 index 0000000..2a0dc27 --- /dev/null +++ b/src/Encoder/ImageEncoder.h @@ -0,0 +1,24 @@ +#ifndef PKG_IMAGE_ENCODER_H +#define PKG_IMAGE_ENCODER_H + +#include "Core/Types.h" +#include "Core/Result.h" + +namespace PKG +{ + // 图像编码器:将 TEX mipmap 数据编码为 PNG/GIF 或直接写出原始数据 + class ImageEncoder + { + public: + // PNG 编码:支持 R8/RG88/RGBA8888 像素格式 + Result EncodePng(const TexMipMap& mipmap, const std::filesystem::path& outPath); + + // GIF 编码:逐帧 DXT 解压 + 裁剪,降低峰值内存 + Result EncodeGif(Tex& tex, const std::filesystem::path& outPath); + + // 原始数据写出:用于 MP4 视频纹理或已编码图像 + Result EncodeRaw(const TexMipMap& mipmap, const std::filesystem::path& outPath); + }; +} + +#endif // PKG_IMAGE_ENCODER_H diff --git a/src/IO/StreamReader.cpp b/src/IO/StreamReader.cpp new file mode 100644 index 0000000..7c6d545 --- /dev/null +++ b/src/IO/StreamReader.cpp @@ -0,0 +1,125 @@ +#include "StreamReader.h" + +namespace PKG { + +StreamReader::StreamReader(const std::filesystem::path& fileName) + : m_FilePath(fileName.string()) { + m_File.open(m_FilePath, std::ios::in | std::ios::binary); + if (m_File.is_open()) + m_Stream = &m_File; +} + +StreamReader::StreamReader(std::string data) + : m_MemoryStream(std::move(data), std::ios::in | std::ios::binary) + , m_Stream(&m_MemoryStream) + , m_FilePath("") { +} + +StreamReader::~StreamReader() { + if (m_File.is_open()) + m_File.close(); +} + +Result StreamReader::ReadInt32() { + int32_t result = 0; + m_Stream->read(reinterpret_cast(&result), sizeof(int32_t)); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read int32"); + return Ok(result); +} + +Result StreamReader::ReadUInt32() { + uint32_t result = 0; + m_Stream->read(reinterpret_cast(&result), sizeof(uint32_t)); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read uint32"); + return Ok(result); +} + +Result StreamReader::ReadSingle() { + float result = 0; + m_Stream->read(reinterpret_cast(&result), sizeof(float)); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read float"); + return Ok(result); +} + +Result StreamReader::ReadChar() { + char result = 0; + m_Stream->read(&result, sizeof(char)); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read char"); + return Ok(result); +} + +Result StreamReader::ReadString(uint32_t length) { + std::vector result(length); + m_Stream->read(reinterpret_cast(result.data()), length); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read string"); + // 按 UTF-8 路径解码(处理多字节字符文件名) + return Ok(std::filesystem::u8path( + std::string(reinterpret_cast(result.data()), length)).string()); +} + +Result StreamReader::ReadNString(int32_t maxLength) { + std::vector result; + int count = 0; + + while (maxLength == -1 || count < maxLength) { + auto readRes = ReadChar(); + if (!readRes) + return Fail(readRes.error.code, readRes.error.message); + + char chr = *readRes; + if (chr == '\0') + break; + + result.push_back(chr); + count++; + } + + return Ok(std::string(reinterpret_cast(result.data()), result.size())); +} + +Result StreamReader::ReadStringFileData(uint32_t length) { + std::vector result(length); + m_Stream->read(reinterpret_cast(result.data()), length); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read file data"); + return Ok(std::string(reinterpret_cast(result.data()), length)); +} + +Result StreamReader::ReadData(std::string& data, uint32_t length) { + data.resize(length); + m_Stream->read(data.data(), length); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read data to string"); + return Ok(); +} + +Result StreamReader::ReadData(std::vector& data, uint32_t length) { + data.resize(length); + m_Stream->read(reinterpret_cast(data.data()), length); + if (m_Stream->fail()) + return Fail(ErrorCode::ReadFailed, "Failed to read data to vector"); + return Ok(); +} + +void StreamReader::seekg(pos_type pos) { + m_Stream->seekg(pos); +} + +pos_type StreamReader::tellg() { + return m_Stream->tellg(); +} + +std::string StreamReader::GetFilePath() const { + return m_FilePath; +} + +std::string StreamReader::GetFileName() const { + return m_FilePath.substr(m_FilePath.find_last_of("\\/") + 1); +} + +} // namespace PKG diff --git a/src/IO/StreamReader.h b/src/IO/StreamReader.h new file mode 100644 index 0000000..38700ff --- /dev/null +++ b/src/IO/StreamReader.h @@ -0,0 +1,57 @@ +#ifndef PKG_STREAM_READER_H +#define PKG_STREAM_READER_H + +#include +#include +#include +#include +#include + +#include "Core/Result.h" + +namespace PKG { + +using pos_type = long long; + +// 流式读取器:支持文件模式与内存模式 +// - 文件模式:从磁盘文件读取 +// - 内存模式:从 std::string 缓冲区读取(避免中间文件 I/O) +// 两种模式通过 m_Stream 指针统一操作 +class StreamReader { +public: + explicit StreamReader(const std::filesystem::path& fileName); // 文件模式 + explicit StreamReader(std::string data); // 内存模式(move 语义,零拷贝) + ~StreamReader(); + + // 基本类型读取(小端序) + Result ReadInt32(); + Result ReadUInt32(); + Result ReadSingle(); + Result ReadChar(); + + // 字符串读取 + Result ReadString(uint32_t length); // 读取 length 字节并按 UTF-8 路径解码 + Result ReadNString(int32_t maxLength = -1); // 读取 NUL 结尾字符串 + Result ReadStringFileData(uint32_t length); // 读取 length 字节为原始字符串 + + // 数据块读取 + Result ReadData(std::string& data, uint32_t length); + Result ReadData(std::vector& data, uint32_t length); + + void seekg(pos_type pos); + pos_type tellg(); + + bool IsOpen() const { return m_Stream != nullptr; } + std::string GetFilePath() const; + std::string GetFileName() const; + +private: + std::ifstream m_File; // 文件模式底层流 + std::istringstream m_MemoryStream; // 内存模式底层流 + std::istream* m_Stream = nullptr; // 统一操作指针(指向 m_File 或 m_MemoryStream) + std::string m_FilePath; +}; + +} // namespace PKG + +#endif // PKG_STREAM_READER_H diff --git a/src/IO/StreamWriter.cpp b/src/IO/StreamWriter.cpp new file mode 100644 index 0000000..f10be26 --- /dev/null +++ b/src/IO/StreamWriter.cpp @@ -0,0 +1,46 @@ +#include "StreamWriter.h" + +namespace PKG { + +StreamWriter::StreamWriter(const std::filesystem::path& fileName, std::ios_base::openmode optMode) + : m_FilePath(fileName.string()) { + // 自动创建父目录(多线程安全:create_directories 对已存在目录是 no-op) + const std::filesystem::path parent = fileName.parent_path(); + if (!parent.empty() && !std::filesystem::exists(parent)) + std::filesystem::create_directories(parent); + + m_File.open(m_FilePath, optMode); +} + +StreamWriter::~StreamWriter() { + close(); +} + +Result StreamWriter::WriteBytes(const char* data, uint32_t size) { + m_File.write(data, size); + if (m_File.fail()) + return Fail(ErrorCode::WriteFailed, "Failed to write bytes"); + return Ok(); +} + +Result StreamWriter::WriteString(const std::string& str) { + m_File.write(str.c_str(), str.size()); + if (m_File.fail()) + return Fail(ErrorCode::WriteFailed, "Failed to write string"); + return Ok(); +} + +void StreamWriter::close() { + if (m_File.is_open()) + m_File.close(); +} + +std::string StreamWriter::GetFilePath() const { + return m_FilePath; +} + +std::string StreamWriter::GetFileName() const { + return m_FilePath.substr(m_FilePath.find_last_of("\\/") + 1); +} + +} // namespace PKG diff --git a/src/IO/StreamWriter.h b/src/IO/StreamWriter.h new file mode 100644 index 0000000..c56c297 --- /dev/null +++ b/src/IO/StreamWriter.h @@ -0,0 +1,34 @@ +#ifndef PKG_STREAM_WRITER_H +#define PKG_STREAM_WRITER_H + +#include +#include +#include + +#include "Core/Result.h" + +namespace PKG { + +// 文件写入器:构造时自动创建父目录 +class StreamWriter { +public: + StreamWriter() = delete; + explicit StreamWriter(const std::filesystem::path& fileName, + std::ios_base::openmode optMode = std::ios::out); + ~StreamWriter(); + + Result WriteBytes(const char* data, uint32_t size); + Result WriteString(const std::string& str); + + void close(); + std::string GetFilePath() const; + std::string GetFileName() const; + +private: + std::ofstream m_File; + std::string m_FilePath; +}; + +} // namespace PKG + +#endif // PKG_STREAM_WRITER_H diff --git a/src/Pipeline/ExtractPipeline.cpp b/src/Pipeline/ExtractPipeline.cpp new file mode 100644 index 0000000..3190e8b --- /dev/null +++ b/src/Pipeline/ExtractPipeline.cpp @@ -0,0 +1,528 @@ +#include "Core/Logger.h" +#include "Core/ProgressBar.h" +#include "Decoder/DxtDecoder.h" +#include "Decoder/PkgExtractor.h" +#include "Decoder/TexDecoder.h" +#include "Encoder/ImageEncoder.h" +#include "ExtractPipeline.h" +#include "IO/StreamReader.h" +#include "IO/StreamWriter.h" +#include "TaskScheduler.h" + +#include +#include + +namespace PKG { + +// ─── RAII 计时器 ───────────────────────────────────────────────── +// 构造时记录起始时间,析构时打印耗时(自动选择 ms/s 单位) +class ScopedTimer { + public: + ScopedTimer() : m_Start(std::chrono::steady_clock::now()) {} + ~ScopedTimer() { + auto ms = std::chrono::duration_cast( + std::chrono::steady_clock::now() - m_Start) + .count(); + if (ms < 1000) + Logger::Instance().Info("Time: " + std::to_string(ms) + " ms"); + else + Logger::Instance().Info("Time: " + std::to_string(ms / 1000.0) + " s"); + } + + private: + std::chrono::steady_clock::time_point m_Start; +}; + +// ─── 辅助函数 ───────────────────────────────────────────────────── + +// 就地 DXT 解压并将格式标记为 RGBA8888 +// 返回是否实际执行了解压 +static bool DecompressDxtInPlace(TexMipMap &mipmap) { + switch (mipmap.Format) { + case MipmapFormat::CompressedDXT5: + DxtDecoder::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT5); + mipmap.Format = MipmapFormat::RGBA8888; + return true; + case MipmapFormat::CompressedDXT3: + DxtDecoder::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT3); + mipmap.Format = MipmapFormat::RGBA8888; + return true; + case MipmapFormat::CompressedDXT1: + DxtDecoder::DecompressImage(mipmap.Width, mipmap.Height, mipmap.Data, DXTFlags::DXT1); + mipmap.Format = MipmapFormat::RGBA8888; + return true; + default: + return false; + } +} + +// 通过文件头魔数检测图像格式,返回对应扩展名(不含点) +// 用于修正未识别格式的输出扩展名,避免产生 .unknown 文件 +static std::string DetectExtensionByMagic(const std::vector &data) { + if (data.size() >= 8 && data[0] == 0x89 && data[1] == 0x50 && data[2] == 0x4E && data[3] == 0x47) + return "png"; // \x89PNG + if (data.size() >= 3 && data[0] == 0xFF && data[1] == 0xD8 && data[2] == 0xFF) + return "jpg"; // \xFF\xD8\xFF + if (data.size() >= 6 && data[0] == 0x47 && data[1] == 0x49 && data[2] == 0x46) + return "gif"; // GIF8 + if (data.size() >= 2 && data[0] == 0x42 && data[1] == 0x4D) + return "bmp"; // BM + if (data.size() >= 12 && data[0] == 0x52 && data[1] == 0x49 && data[2] == 0x46 && data[3] == 0x46 && data[8] == 0x57 && data[9] == 0x45 && data[10] == 0x42 && data[11] == 0x50) + return "webp"; // RIFF....WEBP + return {}; +} + +// 判断是否为已编码图像扩展名(直接拷贝无需转码) +static bool IsRawImageFile(const std::string &ext) { + return ext == ".gif" || ext == ".jpg" || ext == ".png" || ext == ".jpeg" || ext == ".webp"; +} + +// ─── ExtractPipeline 公开接口 ───────────────────────────────────── + +ExtractPipeline::ExtractPipeline() = default; + +ExtractPipeline::ExtractPipeline(const ExtractConfig &config) + : m_Config(config) {} + +Result ExtractPipeline::Run(const std::filesystem::path &inputPath, + const std::filesystem::path &outDir, + bool showProgress, + ExtractStats *stats) { + ScopedTimer timer; + + // 记录起始时间和输入文件大小 + if (stats) { + stats->startTime = std::chrono::steady_clock::now(); + std::error_code ec; + uint64_t sz = std::filesystem::file_size(inputPath, ec); + stats->inputFileSize = ec ? 0 : sz; // 文件不存在时置 0,避免垃圾值 + } + + // 输出路径:outDir/<输入文件名(去扩展名)>/ + // 这样多次提取不同 pkg 时,输出按文件名分目录存放,互不混淆 + std::filesystem::path subDir = outDir / inputPath.stem(); + + std::string ext = inputPath.extension().string(); + + Result res; + if (ext == ".pkg" || ext == ".mpkg") + res = RunPkg(inputPath, subDir, showProgress, stats); + else if (ext == ".tex") + res = RunTex(inputPath, subDir, stats); + else + res = Fail(ErrorCode::UnsupportedFormat, "Unsupported file extension: " + ext); + + // 统一设置结束时间,确保早期失败时 stats 时间也有效 + if (stats) + stats->endTime = std::chrono::steady_clock::now(); + + return res; +} + +// ─── PKG/MPKG 包提取 ────────────────────────────────────────────── + +Result ExtractPipeline::RunPkg(const std::filesystem::path &inputPath, + const std::filesystem::path &outDir, + bool showProgress, + ExtractStats *stats) { + StreamReader reader(inputPath); + if (!reader.IsOpen()) + return Fail(ErrorCode::FileOpen, "Failed to open file: " + inputPath.string()); + + // 解析包索引 + PkgExtractor extractor; + auto entriesRes = extractor.ParseIndex(reader); + if (!entriesRes) + return Fail(entriesRes.error.code, entriesRes.error.message); + + uint32_t offsetPosition = static_cast(reader.tellg()); + + // 预创建所有目录,避免多线程并发创建冲突 + for (const auto &entry : *entriesRes) { + auto parentDir = (outDir / entry.FullPath).parent_path(); + if (!parentDir.empty() && !std::filesystem::exists(parentDir)) + std::filesystem::create_directories(parentDir); + } + + // 线程数上限:不超过条目数,避免创建无用线程 + uint32_t threadCount = m_Config.threadCount; + if (threadCount == 0) + threadCount = std::thread::hardware_concurrency(); + threadCount = std::min(threadCount, static_cast(entriesRes->size())); + if (threadCount == 0) + threadCount = 1; + + TaskScheduler scheduler(threadCount); + Logger::Instance().Info("Using " + std::to_string(scheduler.ThreadCount()) + " threads"); + + // 限制并发 .tex 处理数:.tex 解码 + DXT 解压 + PNG 编码内存开销大, + // 全部线程同时处理大纹理会导致峰值内存过高 + Semaphore texSem(4); + + // 进度条在解析索引后创建(此时已知总条目数) + // 注册到 Logger,日志会通过进度条协调打印 + ProgressBar progress(showProgress ? entriesRes->size() : 0); + if (showProgress) + Logger::Instance().SetProgressBar(&progress); + + if (stats) + stats->totalEntries.store(entriesRes->size(), std::memory_order_relaxed); + + // 提交所有任务到线程池 + std::vector>> futures; + futures.reserve(entriesRes->size()); + + for (const auto &entry : *entriesRes) { + auto future = scheduler.Submit( + [this, entry, pkgPath = inputPath, offsetPosition, outDir, &texSem, &progress, stats]() -> Result { + auto res = ProcessEntry(entry, pkgPath, offsetPosition, outDir, texSem, stats); + progress.Increment(); + if (!res && stats) + stats->AddFailure(); + return res; + }); + futures.push_back(std::move(future)); + } + + scheduler.WaitAll(); + Logger::Instance().SetProgressBar(nullptr); + + if (stats) + stats->endTime = std::chrono::steady_clock::now(); + + // 收集错误信息 + std::vector errors; + for (size_t i = 0; i < futures.size(); i++) { + auto res = futures[i].get(); + if (!res) + errors.push_back((*entriesRes)[i].FullPath.string() + ": " + res.error.message); + } + + if (!errors.empty()) { + std::string msg = "Completed with " + std::to_string(errors.size()) + " errors:\n"; + for (const auto &e : errors) + msg += " " + e + "\n"; + return Fail(ErrorCode::ReadFailed, msg); + } + + return Ok(); +} + +// ─── 单个 TEX 文件提取 ──────────────────────────────────────────── + +Result ExtractPipeline::RunTex(const std::filesystem::path &inputPath, + const std::filesystem::path &outDir, + ExtractStats *stats) { + StreamReader reader(inputPath); + if (!reader.IsOpen()) + return Fail(ErrorCode::FileOpen, "Failed to open file: " + inputPath.string()); + + TexDecoder texDecoder; + auto texRes = texDecoder.Decode(reader); + if (!texRes) + return Fail(texRes.error.code, texRes.error.message); + + auto &tex = *texRes; + + // GIF 需要额外读取帧信息表(位于 TEX 数据末尾) + if (tex.IsGif) { + auto frameRes = ReadGifFrameInfo(tex, reader); + if (!frameRes) + return frameRes; + } + + if (stats) + stats->totalEntries.store(1, std::memory_order_relaxed); + + // 输出路径:outDir/<输入文件名(去扩展名)>/<输入文件名(去扩展名)>.<新扩展名> + // 确保输出目录存在 + std::error_code ec; + std::filesystem::create_directories(outDir, ec); + std::filesystem::path outPath = outDir / inputPath.stem(); + + auto res = EncodeTex(tex, outPath, stats); + if (stats) + stats->endTime = std::chrono::steady_clock::now(); + if (!res && stats) + stats->AddFailure(); + return res; +} + +// ─── GIF 帧信息读取 ─────────────────────────────────────────────── +// TEXS 块位于 TEX 文件末尾,包含 GIF 动画的每一帧位置与时长 +// 支持 TEXS0001(整数坐标)和 TEXS0003(浮点坐标 + 画布尺寸)两个版本 +Result ExtractPipeline::ReadGifFrameInfo(Tex &tex, StreamReader &reader) { + auto magicRes = reader.ReadNString(16); + if (!magicRes) + return Fail(magicRes.error.code, magicRes.error.message); + tex.FrameInfoContainer.Magic = *magicRes; + + auto frameCountRes = reader.ReadInt32(); + if (!frameCountRes) + return Fail(frameCountRes.error.code, frameCountRes.error.message); + + // TEXS0003 额外包含 GIF 画布尺寸 + if (tex.FrameInfoContainer.Magic == "TEXS0003") { + auto widthRes = reader.ReadInt32(); + if (!widthRes) + return Fail(widthRes.error.code, widthRes.error.message); + tex.FrameInfoContainer.GifWidth = *widthRes; + + auto heightRes = reader.ReadInt32(); + if (!heightRes) + return Fail(heightRes.error.code, heightRes.error.message); + tex.FrameInfoContainer.GifHeight = *heightRes; + } + + // 逐帧读取 + for (int i = 0; i < *frameCountRes; i++) { + TexFrameInfo frameInfo{}; + + auto imageIdRes = reader.ReadInt32(); + if (!imageIdRes) + return Fail(imageIdRes.error.code, imageIdRes.error.message); + frameInfo.ImageId = *imageIdRes; + + auto frametimeRes = reader.ReadSingle(); + if (!frametimeRes) + return Fail(frametimeRes.error.code, frametimeRes.error.message); + frameInfo.Frametime = *frametimeRes; + + // TEXS0001: 坐标为整数;TEXS0003: 坐标为浮点 + if (tex.FrameInfoContainer.Magic == "TEXS0001") { + auto posXRes = reader.ReadInt32(); + if (!posXRes) + return Fail(posXRes.error.code, posXRes.error.message); + frameInfo.PosX = static_cast(*posXRes); + + auto posYRes = reader.ReadInt32(); + if (!posYRes) + return Fail(posYRes.error.code, posYRes.error.message); + frameInfo.PosY = static_cast(*posYRes); + + auto widthRes = reader.ReadInt32(); + if (!widthRes) + return Fail(widthRes.error.code, widthRes.error.message); + frameInfo.Width = static_cast(*widthRes); + + auto widthYRes = reader.ReadInt32(); + if (!widthYRes) + return Fail(widthYRes.error.code, widthYRes.error.message); + frameInfo.WidthY = static_cast(*widthYRes); + + auto heightXRes = reader.ReadInt32(); + if (!heightXRes) + return Fail(heightXRes.error.code, heightXRes.error.message); + frameInfo.HeightX = static_cast(*heightXRes); + + auto heightRes = reader.ReadInt32(); + if (!heightRes) + return Fail(heightRes.error.code, heightRes.error.message); + frameInfo.Height = static_cast(*heightRes); + } else { + auto posXRes = reader.ReadSingle(); + if (!posXRes) + return Fail(posXRes.error.code, posXRes.error.message); + frameInfo.PosX = *posXRes; + + auto posYRes = reader.ReadSingle(); + if (!posYRes) + return Fail(posYRes.error.code, posYRes.error.message); + frameInfo.PosY = *posYRes; + + auto widthRes = reader.ReadSingle(); + if (!widthRes) + return Fail(widthRes.error.code, widthRes.error.message); + frameInfo.Width = *widthRes; + + auto widthYRes = reader.ReadSingle(); + if (!widthYRes) + return Fail(widthYRes.error.code, widthYRes.error.message); + frameInfo.WidthY = *widthYRes; + + auto heightXRes = reader.ReadSingle(); + if (!heightXRes) + return Fail(heightXRes.error.code, heightXRes.error.message); + frameInfo.HeightX = *heightXRes; + + auto heightRes = reader.ReadSingle(); + if (!heightRes) + return Fail(heightRes.error.code, heightRes.error.message); + frameInfo.Height = *heightRes; + } + + tex.FrameInfoContainer.Frames.push_back(frameInfo); + } + + // 兜底:若画布尺寸未设置,取首帧尺寸 + if (tex.FrameInfoContainer.GifWidth == 0 || tex.FrameInfoContainer.GifHeight == 0) { + tex.FrameInfoContainer.GifWidth = static_cast(tex.FrameInfoContainer.Frames[0].Width); + tex.FrameInfoContainer.GifHeight = static_cast(tex.FrameInfoContainer.Frames[0].Height); + } + + return Ok(); +} + +// ─── TEX 编码输出 ──────────────────────────────────────────────── +// 根据纹理类型选择编码方式: +// - GIF 动画 → EncodeGif(逐帧处理) +// - 视频纹理 → 原始数据写出(MP4) +// - DXT 压缩 → 解压后 PNG 编码 +// - 已编码图像 → 魔数检测修正扩展名后直接写出 +Result ExtractPipeline::EncodeTex(Tex &tex, const std::filesystem::path &outPath, ExtractStats *stats) { + if (tex.ImageContainer.Images.empty()) + return Ok(); + + // GIF 动画:交给 EncodeGif 逐帧处理 + if (tex.IsGif) { + std::filesystem::path gifOutPath = outPath; + gifOutPath.replace_extension("gif"); + Logger::Instance().Info("Convert: " + gifOutPath.string()); + + ImageEncoder encoder; + auto res = encoder.EncodeGif(tex, gifOutPath); + if (res && stats) + stats->AddOutput("gif", std::filesystem::file_size(gifOutPath)); + return res; + } + + auto &sourceMipmap = tex.ImageContainer.Images[0].Mipmaps[0]; + MipmapFormat format = tex.IsVideoTexture ? MipmapFormat::VideoMp4 : sourceMipmap.Format; + + // 视频纹理:校验 MP4 头并直接写出 + if (tex.IsVideoTexture) { + if (sourceMipmap.Data.size() >= 12) { + std::string mp4Magic = std::string(reinterpret_cast(&sourceMipmap.Data[4]), 8); + if (mp4Magic != "ftypisom" && mp4Magic != "ftypmsnv" && mp4Magic != "ftypmp42") + Logger::Instance().Error("Warning: Bad MP4 magic header"); + } else { + Logger::Instance().Error("Warning: MP4 data too short"); + } + + std::filesystem::path imgOutPath = outPath; + imgOutPath.replace_extension(GetFileExtension(format)); + Logger::Instance().Info("Convert: " + imgOutPath.string()); + + ImageEncoder encoder; + auto res = encoder.EncodeRaw(sourceMipmap, imgOutPath); + if (res && stats) + stats->AddOutput(imgOutPath.extension().string().substr(1), + std::filesystem::file_size(imgOutPath)); + return res; + } + + // 非 GIF、非视频:尝试 DXT 解压 + DecompressDxtInPlace(sourceMipmap); + + // DXT 解压后为原始像素(R8/RG88/RGBA8888),编码为 PNG + if (static_cast(sourceMipmap.Format) >= 1 && static_cast(sourceMipmap.Format) <= 3) { + std::filesystem::path imgOutPath = outPath; + imgOutPath.replace_extension("png"); + Logger::Instance().Info("Convert: " + imgOutPath.string()); + + ImageEncoder encoder; + auto res = encoder.EncodePng(sourceMipmap, imgOutPath); + if (res && stats) + stats->AddOutput("png", std::filesystem::file_size(imgOutPath)); + return res; + } + + // 原始数据可能是已编码图像(PNG/JPEG/GIF/BMP/WEBP), + // 通过魔数检测修正扩展名,避免输出 .unknown + std::filesystem::path imgOutPath = outPath; + std::string detectedExt = DetectExtensionByMagic(sourceMipmap.Data); + if (!detectedExt.empty()) + imgOutPath.replace_extension(detectedExt); + else + imgOutPath.replace_extension(GetFileExtension(format)); + + Logger::Instance().Info("Convert: " + imgOutPath.string()); + + StreamWriter writer(imgOutPath, std::ios::binary); + auto res = writer.WriteBytes(reinterpret_cast(sourceMipmap.Data.data()), + static_cast(sourceMipmap.Data.size())); + if (res && stats) + stats->AddOutput(imgOutPath.extension().string().substr(1), + std::filesystem::file_size(imgOutPath)); + return res; +} + +// ─── 单条目处理(线程池任务)────────────────────────────────────── +// 每个任务独立打开 PKG 文件并 seek 到条目偏移,避免共享 StreamReader +Result ExtractPipeline::ProcessEntry(const Entry &entry, + const std::filesystem::path &pkgPath, + uint32_t offsetPosition, + const std::filesystem::path &outDir, + Semaphore &texSem, + ExtractStats *stats) { + std::filesystem::path outPath = outDir / entry.FullPath; + + StreamReader reader(pkgPath); + if (!reader.IsOpen()) + return Fail(ErrorCode::FileOpen, "Failed to open pkg: " + pkgPath.string()); + + reader.seekg(entry.Offset + offsetPosition); + + // .tex 文件:解码 + 编码(内存开销大,需信号量限流) + if (entry.Type == ".tex") { + SemaphoreGuard guard(texSem); + + // 读取条目数据到内存,再用内存模式 reader 解码(零拷贝) + std::string texData; + auto readRes = reader.ReadData(texData, entry.Length); + if (!readRes) + return readRes; + + StreamReader texReader(std::move(texData)); + + TexDecoder texDecoder; + auto texRes = texDecoder.Decode(texReader); + if (!texRes) + return Fail(texRes.error.code, texRes.error.message); + + auto &tex = *texRes; + + if (tex.IsGif) { + auto frameRes = ReadGifFrameInfo(tex, texReader); + if (!frameRes) + return frameRes; + } + + return EncodeTex(tex, outPath, stats); + } + + // 已编码图像文件:直接拷贝 + if (IsRawImageFile(entry.Type)) { + Logger::Instance().Info("Extract: " + outPath.string()); + + std::string data; + auto readRes = reader.ReadData(data, entry.Length); + if (!readRes) + return readRes; + + StreamWriter writer(outPath, std::ios::binary); + auto res = writer.WriteBytes(data.data(), static_cast(data.size())); + if (res && stats) + stats->AddOutput(outPath.extension().string().substr(1), + std::filesystem::file_size(outPath)); + return res; + } + + // 其他文本文件(.json/.frag/.vert/.mdl 等) + Logger::Instance().Info("Extract: " + outPath.string()); + + auto dataRes = reader.ReadStringFileData(entry.Length); + if (!dataRes) + return Fail(dataRes.error.code, dataRes.error.message); + + StreamWriter writer(outPath); + auto res = writer.WriteString(*dataRes); + if (res && stats) { + std::string ext = outPath.extension().string(); + stats->AddOutput(ext.empty() ? "bin" : ext.substr(1), + std::filesystem::file_size(outPath)); + } + return res; +} + +} // namespace PKG diff --git a/src/Pipeline/ExtractPipeline.h b/src/Pipeline/ExtractPipeline.h new file mode 100644 index 0000000..5322607 --- /dev/null +++ b/src/Pipeline/ExtractPipeline.h @@ -0,0 +1,64 @@ +#ifndef PKG_EXTRACT_PIPELINE_H +#define PKG_EXTRACT_PIPELINE_H + +#include "Core/Types.h" +#include "Core/Result.h" +#include "Core/Config.h" +#include "Core/ExtractStats.h" +#include "IO/StreamReader.h" + +namespace PKG +{ + class Semaphore; // 前向声明,定义在 TaskScheduler.h + + // 提取流水线:PKG/MPKG/TEX 文件解码与编码的协调器 + // - PKG/MPKG: 多线程并行提取所有条目 + // - TEX: 单文件解码后编码输出 + class ExtractPipeline + { + public: + ExtractPipeline(); + explicit ExtractPipeline(const ExtractConfig& config); + + // 执行提取 + // inputPath 输入文件路径(.pkg/.mpkg/.tex) + // outDir 输出目录 + // showProgress 为 true 时显示终端进度条 + // stats 可选,传入则填充统计信息 + Result Run(const std::filesystem::path& inputPath, + const std::filesystem::path& outDir, + bool showProgress = false, + ExtractStats* stats = nullptr); + + private: + // PKG/MPKG 包提取:解析索引 + 多线程处理所有条目 + Result RunPkg(const std::filesystem::path& inputPath, + const std::filesystem::path& outDir, + bool showProgress, + ExtractStats* stats); + + // 单个 TEX 文件提取:解码 + 编码输出 + Result RunTex(const std::filesystem::path& inputPath, + const std::filesystem::path& outDir, + ExtractStats* stats); + + // 处理单个条目(线程池任务,可并行执行) + // texSem 用于限制并发 .tex 处理数,降低峰值内存 + Result ProcessEntry(const Entry& entry, + const std::filesystem::path& pkgPath, + uint32_t offsetPosition, + const std::filesystem::path& outDir, + Semaphore& texSem, + ExtractStats* stats); + + // 读取 GIF 帧信息(TEXS 块,位于 TEX 数据末尾) + Result ReadGifFrameInfo(Tex& tex, StreamReader& reader); + + // TEX 编码输出:根据类型选择 GIF/PNG/MP4/原始数据 + Result EncodeTex(Tex& tex, const std::filesystem::path& outPath, ExtractStats* stats); + + ExtractConfig m_Config; + }; +} + +#endif // PKG_EXTRACT_PIPELINE_H diff --git a/src/Pipeline/TaskScheduler.cpp b/src/Pipeline/TaskScheduler.cpp new file mode 100644 index 0000000..7994727 --- /dev/null +++ b/src/Pipeline/TaskScheduler.cpp @@ -0,0 +1,109 @@ +#include "TaskScheduler.h" + +namespace PKG +{ + // ─── 线程池构造 ───────────────────────────────────────────────── + // 创建 threadCount 个工作线程,每个线程循环从任务队列取任务执行 + TaskScheduler::TaskScheduler(uint32_t threadCount) + { + if (threadCount == 0) + threadCount = std::thread::hardware_concurrency(); + if (threadCount == 0) + threadCount = 4; // hardware_concurrency 失败时的兜底值 + + for (uint32_t i = 0; i < threadCount; i++) + { + m_Workers.emplace_back([this] + { + while (true) + { + std::function task; + { + // 等待:有任务可取 或 收到停止信号 + std::unique_lock lock(m_QueueMutex); + m_Condition.wait(lock, [this] { return m_Stop || !m_Tasks.empty(); }); + + // 停止且队列空 → 退出线程 + if (m_Stop && m_Tasks.empty()) + return; + + task = std::move(m_Tasks.front()); + m_Tasks.pop(); + } + + task(); // 执行任务(已捕获异常,不会抛出) + + // 任务完成:递减活跃计数,可能唤醒 WaitAll + { + std::lock_guard lock(m_ActiveMutex); + if (m_ActiveTasks > 0) + m_ActiveTasks--; + if (m_ActiveTasks == 0) + m_ActiveCondition.notify_all(); + } + } + }); + } + } + + TaskScheduler::~TaskScheduler() + { + { + std::lock_guard lock(m_QueueMutex); + m_Stop = true; + } + m_Condition.notify_all(); // 唤醒所有等待的工作线程 + + for (auto& worker : m_Workers) + { + if (worker.joinable()) + worker.join(); + } + } + + // ─── 提交任务 ─────────────────────────────────────────────────── + // 将任务包装为 promise/future 模式,捕获所有异常转为错误结果 + std::future> TaskScheduler::Submit(std::function()> task) + { + auto promise = std::make_shared>>(); + auto future = promise->get_future(); + + // 活跃任务数 +1(必须在入队前完成,防止 WaitAll 提前返回) + { + std::lock_guard lock(m_ActiveMutex); + m_ActiveTasks++; + } + + // 包装任务:执行并设置结果,捕获所有异常 + std::function wrapped = [promise, task = std::move(task)]() + { + try + { + promise->set_value(task()); + } + catch (const std::exception& e) + { + promise->set_value(Fail(ErrorCode::ReadFailed, std::string("Exception: ") + e.what())); + } + catch (...) + { + promise->set_value(Fail(ErrorCode::ReadFailed, "Unknown exception")); + } + }; + + { + std::lock_guard lock(m_QueueMutex); + m_Tasks.emplace(std::move(wrapped)); + } + m_Condition.notify_one(); // 唤醒一个等待的工作线程 + + return future; + } + + // ─── 等待所有任务完成 ─────────────────────────────────────────── + void TaskScheduler::WaitAll() + { + std::unique_lock lock(m_ActiveMutex); + m_ActiveCondition.wait(lock, [this] { return m_ActiveTasks == 0; }); + } +} diff --git a/src/Pipeline/TaskScheduler.h b/src/Pipeline/TaskScheduler.h new file mode 100644 index 0000000..ae22a29 --- /dev/null +++ b/src/Pipeline/TaskScheduler.h @@ -0,0 +1,94 @@ +#ifndef PKG_TASK_SCHEDULER_H +#define PKG_TASK_SCHEDULER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Core/Result.h" + +namespace PKG +{ + // ─── 计数信号量 ───────────────────────────────────────────────── + // 用于限制并发重操作(如 .tex 解码)的数量,降低峰值内存 + class Semaphore + { + public: + explicit Semaphore(int count) : m_Count(count) {} + + // 获取一个许可(计数为 0 时阻塞等待) + void Acquire() + { + std::unique_lock lock(m_Mutex); + m_Cond.wait(lock, [this] { return m_Count > 0; }); + m_Count--; + } + + // 释放一个许可(唤醒一个等待者) + void Release() + { + std::lock_guard lock(m_Mutex); + m_Count++; + m_Cond.notify_one(); + } + + private: + std::mutex m_Mutex; + std::condition_variable m_Cond; + int m_Count; + }; + + // ─── RAII 信号量守卫 ──────────────────────────────────────────── + // 构造时获取信号量,析构时自动释放(异常安全) + class SemaphoreGuard + { + public: + explicit SemaphoreGuard(Semaphore& sem) : m_Sem(sem) { m_Sem.Acquire(); } + ~SemaphoreGuard() { m_Sem.Release(); } + + SemaphoreGuard(const SemaphoreGuard&) = delete; + SemaphoreGuard& operator=(const SemaphoreGuard&) = delete; + + private: + Semaphore& m_Sem; + }; + + // ─── 线程池 ───────────────────────────────────────────────────── + // 固定大小的线程池,提交任务返回 future 用于获取结果 + // 支持 WaitAll() 等待所有已提交任务完成 + class TaskScheduler + { + public: + // threadCount = 0 时自动使用 hardware_concurrency + explicit TaskScheduler(uint32_t threadCount = 0); + ~TaskScheduler(); + + TaskScheduler(const TaskScheduler&) = delete; + TaskScheduler& operator=(const TaskScheduler&) = delete; + + // 提交任务,返回 future 以获取结果或等待完成 + std::future> Submit(std::function()> task); + + // 阻塞等待所有已提交任务完成 + void WaitAll(); + + uint32_t ThreadCount() const { return static_cast(m_Workers.size()); } + + private: + std::vector m_Workers; // 工作线程 + std::queue> m_Tasks; // 待执行任务队列 + std::mutex m_QueueMutex; // 保护 m_Tasks + std::condition_variable m_Condition; // 唤醒等待任务的工作线程 + bool m_Stop = false; // 析构标志 + uint32_t m_ActiveTasks = 0; // 正在执行的任务数 + std::mutex m_ActiveMutex; // 保护 m_ActiveTasks + std::condition_variable m_ActiveCondition; // WaitAll 等待条件 + }; +} + +#endif // PKG_TASK_SCHEDULER_H diff --git a/src/expkg.h b/src/expkg.h new file mode 100644 index 0000000..e18bd94 --- /dev/null +++ b/src/expkg.h @@ -0,0 +1,20 @@ +#ifndef PKG_EXPKG_H +#define PKG_EXPKG_H + +#include "Core/Types.h" +#include "Core/Result.h" +#include "Core/Config.h" +#include "Core/Logger.h" +#include "Core/ProcessInfo.h" +#include "Core/ExtractStats.h" +#include "IO/StreamReader.h" +#include "IO/StreamWriter.h" +#include "Decoder/PkgExtractor.h" +#include "Decoder/TexDecoder.h" +#include "Decoder/DxtDecoder.h" +#include "Decoder/ImageReader.h" +#include "Encoder/ImageEncoder.h" +#include "Pipeline/TaskScheduler.h" +#include "Pipeline/ExtractPipeline.h" + +#endif // PKG_EXPKG_H diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..f7b25db --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,87 @@ +#include "expkg.h" + +#include +#include + +int main(int argc, char **argv) { + if (argc < 2) { + std::cout << "Usage: expkg path/to/file.pkg|file.tex [output_dir]" << std::endl; + return 0; + } + + std::filesystem::path inputPath = argv[1]; + std::filesystem::path outDir = argc >= 3 ? argv[2] : "out"; + + PKG::ExtractPipeline pipeline; + PKG::ExtractStats stats; + auto result = pipeline.Run(inputPath, outDir, /*showProgress=*/true, &stats); + + std::cout << std::endl; // 进度条换行后空一行 + + size_t total = stats.totalEntries.load(); + size_t ok = stats.succeeded.load(); + size_t fail = stats.failed.load(); + uint64_t outBytes = stats.totalOutputBytes.load(); + + // 完全失败(没有任何条目被处理):只打印错误,不显示统计面板 + if (!result && ok == 0 && fail == 0) { + std::cerr << "错误: " << result.error.message << std::endl; + return 1; + } + + // 成功或部分成功:打印结果与统计 + if (result) + std::cout << "提取完成" << std::endl; + else + std::cerr << "错误: " << result.error.message << std::endl; + + double elapsed = stats.ElapsedSeconds(); + + std::cout << "──────────────────────────────" << std::endl; + + // 文件总数 + std::cout << "文件总数: " << ok << " 个"; + if (fail > 0) + std::cout << " (失败 " << fail << " 个)"; + if (total > ok + fail) + std::cout << " / 共 " << total << " 个"; + std::cout << std::endl; + + // 输出大小 + std::cout << "输出大小: " << PKG::FormatBytes(outBytes) << std::endl; + + // 耗时与吞吐(仅在时间有效时打印) + if (elapsed >= 0) { + std::cout << "耗时: " << std::fixed << std::setprecision(2) << elapsed << " 秒"; + if (elapsed > 0 && ok > 0) + std::cout << " (" << std::setprecision(1) << (ok / elapsed) << " 个/秒)"; + std::cout << std::endl; + } + + // 输入 → 输出对比(仅在输入大小有效时打印) + if (stats.inputFileSize > 0 && stats.inputFileSize < 1ULL << 40) { + std::cout << "输入文件: " << PKG::FormatBytes(stats.inputFileSize); + if (outBytes > 0) { + double ratio = static_cast(outBytes) / stats.inputFileSize; + std::cout << " → 输出 " << PKG::FormatBytes(outBytes) + << " (×" << std::setprecision(2) << ratio << ")"; + } + std::cout << std::endl; + } + + // 各格式分布 + if (!stats.formatCounts.empty()) { + std::cout << "格式分布:" << std::endl; + for (const auto &[ext, count] : stats.formatCounts) + std::cout << " ." << ext << " " << count << " 个" << std::endl; + } + + // 内存占用(峰值) + size_t peakRss = PKG::GetPeakRssBytes(); + if (peakRss > 0) + std::cout << "内存占用: " << PKG::FormatBytes(peakRss) << " (峰值)" << std::endl; + + std::cout << "──────────────────────────────" << std::endl; + + return result ? 0 : 1; +} diff --git a/testApp/CMakeLists.txt b/testApp/CMakeLists.txt deleted file mode 100644 index 81cefa2..0000000 --- a/testApp/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(TARGET demo) - -file(GLOB_RECURSE SRC_SOURCE src/**.cpp) -add_executable(${TARGET} ${SRC_SOURCE}) - -target_link_libraries(${TARGET} expkg-static) - diff --git a/testApp/src/main.cpp b/testApp/src/main.cpp deleted file mode 100644 index bb03b21..0000000 --- a/testApp/src/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "EXPKG/EXPKG.h" - -int main(const int argc, char** argv) -{ - const CommandArgs args{ argc, argv }; - - PKG::EXPKG app{ args }; - - return 0; -} diff --git a/expkg/vendor/gif-h/LICENSE b/vendor/gif-h/LICENSE similarity index 100% rename from expkg/vendor/gif-h/LICENSE rename to vendor/gif-h/LICENSE diff --git a/expkg/vendor/gif-h/gif.h b/vendor/gif-h/gif.h similarity index 100% rename from expkg/vendor/gif-h/gif.h rename to vendor/gif-h/gif.h diff --git a/expkg/vendor/lz4/.cirrus.yml b/vendor/lz4/.cirrus.yml similarity index 100% rename from expkg/vendor/lz4/.cirrus.yml rename to vendor/lz4/.cirrus.yml diff --git a/expkg/vendor/lz4/.clang-format b/vendor/lz4/.clang-format similarity index 100% rename from expkg/vendor/lz4/.clang-format rename to vendor/lz4/.clang-format diff --git a/expkg/vendor/lz4/.gitattributes b/vendor/lz4/.gitattributes similarity index 100% rename from expkg/vendor/lz4/.gitattributes rename to vendor/lz4/.gitattributes diff --git a/expkg/vendor/lz4/.gitignore b/vendor/lz4/.gitignore similarity index 100% rename from expkg/vendor/lz4/.gitignore rename to vendor/lz4/.gitignore diff --git a/expkg/vendor/lz4/CODING_STYLE b/vendor/lz4/CODING_STYLE similarity index 100% rename from expkg/vendor/lz4/CODING_STYLE rename to vendor/lz4/CODING_STYLE diff --git a/expkg/vendor/lz4/INSTALL b/vendor/lz4/INSTALL similarity index 100% rename from expkg/vendor/lz4/INSTALL rename to vendor/lz4/INSTALL diff --git a/expkg/vendor/lz4/LICENSE b/vendor/lz4/LICENSE similarity index 100% rename from expkg/vendor/lz4/LICENSE rename to vendor/lz4/LICENSE diff --git a/expkg/vendor/lz4/Makefile b/vendor/lz4/Makefile similarity index 100% rename from expkg/vendor/lz4/Makefile rename to vendor/lz4/Makefile diff --git a/expkg/vendor/lz4/NEWS b/vendor/lz4/NEWS similarity index 100% rename from expkg/vendor/lz4/NEWS rename to vendor/lz4/NEWS diff --git a/expkg/vendor/lz4/README.md b/vendor/lz4/README.md similarity index 100% rename from expkg/vendor/lz4/README.md rename to vendor/lz4/README.md diff --git a/expkg/vendor/lz4/SECURITY.md b/vendor/lz4/SECURITY.md similarity index 100% rename from expkg/vendor/lz4/SECURITY.md rename to vendor/lz4/SECURITY.md diff --git a/expkg/vendor/lz4/appveyor.yml b/vendor/lz4/appveyor.yml similarity index 100% rename from expkg/vendor/lz4/appveyor.yml rename to vendor/lz4/appveyor.yml diff --git a/expkg/vendor/lz4/contrib/debian/changelog b/vendor/lz4/contrib/debian/changelog similarity index 100% rename from expkg/vendor/lz4/contrib/debian/changelog rename to vendor/lz4/contrib/debian/changelog diff --git a/expkg/vendor/lz4/contrib/debian/compat b/vendor/lz4/contrib/debian/compat similarity index 100% rename from expkg/vendor/lz4/contrib/debian/compat rename to vendor/lz4/contrib/debian/compat diff --git a/expkg/vendor/lz4/contrib/debian/control b/vendor/lz4/contrib/debian/control similarity index 100% rename from expkg/vendor/lz4/contrib/debian/control rename to vendor/lz4/contrib/debian/control diff --git a/expkg/vendor/lz4/contrib/debian/copyright b/vendor/lz4/contrib/debian/copyright similarity index 100% rename from expkg/vendor/lz4/contrib/debian/copyright rename to vendor/lz4/contrib/debian/copyright diff --git a/expkg/vendor/lz4/contrib/debian/dirs b/vendor/lz4/contrib/debian/dirs similarity index 100% rename from expkg/vendor/lz4/contrib/debian/dirs rename to vendor/lz4/contrib/debian/dirs diff --git a/expkg/vendor/lz4/contrib/debian/docs b/vendor/lz4/contrib/debian/docs similarity index 100% rename from expkg/vendor/lz4/contrib/debian/docs rename to vendor/lz4/contrib/debian/docs diff --git a/expkg/vendor/lz4/contrib/debian/liblz4-dev.install b/vendor/lz4/contrib/debian/liblz4-dev.install similarity index 100% rename from expkg/vendor/lz4/contrib/debian/liblz4-dev.install rename to vendor/lz4/contrib/debian/liblz4-dev.install diff --git a/expkg/vendor/lz4/contrib/debian/liblz4.install b/vendor/lz4/contrib/debian/liblz4.install similarity index 100% rename from expkg/vendor/lz4/contrib/debian/liblz4.install rename to vendor/lz4/contrib/debian/liblz4.install diff --git a/expkg/vendor/lz4/contrib/debian/rules b/vendor/lz4/contrib/debian/rules similarity index 100% rename from expkg/vendor/lz4/contrib/debian/rules rename to vendor/lz4/contrib/debian/rules diff --git a/expkg/vendor/lz4/contrib/djgpp/LICENSE b/vendor/lz4/contrib/djgpp/LICENSE similarity index 100% rename from expkg/vendor/lz4/contrib/djgpp/LICENSE rename to vendor/lz4/contrib/djgpp/LICENSE diff --git a/expkg/vendor/lz4/contrib/djgpp/Makefile b/vendor/lz4/contrib/djgpp/Makefile similarity index 100% rename from expkg/vendor/lz4/contrib/djgpp/Makefile rename to vendor/lz4/contrib/djgpp/Makefile diff --git a/expkg/vendor/lz4/contrib/djgpp/README.MD b/vendor/lz4/contrib/djgpp/README.MD similarity index 100% rename from expkg/vendor/lz4/contrib/djgpp/README.MD rename to vendor/lz4/contrib/djgpp/README.MD diff --git a/expkg/vendor/lz4/contrib/gen_manual/.gitignore b/vendor/lz4/contrib/gen_manual/.gitignore similarity index 100% rename from expkg/vendor/lz4/contrib/gen_manual/.gitignore rename to vendor/lz4/contrib/gen_manual/.gitignore diff --git a/expkg/vendor/lz4/contrib/gen_manual/Makefile b/vendor/lz4/contrib/gen_manual/Makefile similarity index 100% rename from expkg/vendor/lz4/contrib/gen_manual/Makefile rename to vendor/lz4/contrib/gen_manual/Makefile diff --git a/expkg/vendor/lz4/contrib/gen_manual/README.md b/vendor/lz4/contrib/gen_manual/README.md similarity index 100% rename from expkg/vendor/lz4/contrib/gen_manual/README.md rename to vendor/lz4/contrib/gen_manual/README.md diff --git a/expkg/vendor/lz4/contrib/gen_manual/gen-lz4-manual.sh b/vendor/lz4/contrib/gen_manual/gen-lz4-manual.sh similarity index 100% rename from expkg/vendor/lz4/contrib/gen_manual/gen-lz4-manual.sh rename to vendor/lz4/contrib/gen_manual/gen-lz4-manual.sh diff --git a/expkg/vendor/lz4/contrib/gen_manual/gen_manual.cpp b/vendor/lz4/contrib/gen_manual/gen_manual.cpp similarity index 100% rename from expkg/vendor/lz4/contrib/gen_manual/gen_manual.cpp rename to vendor/lz4/contrib/gen_manual/gen_manual.cpp diff --git a/expkg/vendor/lz4/contrib/snap/README.md b/vendor/lz4/contrib/snap/README.md similarity index 100% rename from expkg/vendor/lz4/contrib/snap/README.md rename to vendor/lz4/contrib/snap/README.md diff --git a/expkg/vendor/lz4/contrib/snap/snapcraft.yaml b/vendor/lz4/contrib/snap/snapcraft.yaml similarity index 100% rename from expkg/vendor/lz4/contrib/snap/snapcraft.yaml rename to vendor/lz4/contrib/snap/snapcraft.yaml diff --git a/expkg/vendor/lz4/doc/lz4_Block_format.md b/vendor/lz4/doc/lz4_Block_format.md similarity index 100% rename from expkg/vendor/lz4/doc/lz4_Block_format.md rename to vendor/lz4/doc/lz4_Block_format.md diff --git a/expkg/vendor/lz4/doc/lz4_Frame_format.md b/vendor/lz4/doc/lz4_Frame_format.md similarity index 100% rename from expkg/vendor/lz4/doc/lz4_Frame_format.md rename to vendor/lz4/doc/lz4_Frame_format.md diff --git a/expkg/vendor/lz4/doc/lz4_manual.html b/vendor/lz4/doc/lz4_manual.html similarity index 100% rename from expkg/vendor/lz4/doc/lz4_manual.html rename to vendor/lz4/doc/lz4_manual.html diff --git a/expkg/vendor/lz4/doc/lz4frame_manual.html b/vendor/lz4/doc/lz4frame_manual.html similarity index 100% rename from expkg/vendor/lz4/doc/lz4frame_manual.html rename to vendor/lz4/doc/lz4frame_manual.html diff --git a/expkg/vendor/lz4/examples/.gitignore b/vendor/lz4/examples/.gitignore similarity index 100% rename from expkg/vendor/lz4/examples/.gitignore rename to vendor/lz4/examples/.gitignore diff --git a/expkg/vendor/lz4/examples/COPYING b/vendor/lz4/examples/COPYING similarity index 100% rename from expkg/vendor/lz4/examples/COPYING rename to vendor/lz4/examples/COPYING diff --git a/expkg/vendor/lz4/examples/Makefile b/vendor/lz4/examples/Makefile similarity index 100% rename from expkg/vendor/lz4/examples/Makefile rename to vendor/lz4/examples/Makefile diff --git a/expkg/vendor/lz4/examples/README.md b/vendor/lz4/examples/README.md similarity index 100% rename from expkg/vendor/lz4/examples/README.md rename to vendor/lz4/examples/README.md diff --git a/expkg/vendor/lz4/examples/bench_functions.c b/vendor/lz4/examples/bench_functions.c similarity index 100% rename from expkg/vendor/lz4/examples/bench_functions.c rename to vendor/lz4/examples/bench_functions.c diff --git a/expkg/vendor/lz4/examples/blockStreaming_doubleBuffer.c b/vendor/lz4/examples/blockStreaming_doubleBuffer.c similarity index 100% rename from expkg/vendor/lz4/examples/blockStreaming_doubleBuffer.c rename to vendor/lz4/examples/blockStreaming_doubleBuffer.c diff --git a/expkg/vendor/lz4/examples/blockStreaming_doubleBuffer.md b/vendor/lz4/examples/blockStreaming_doubleBuffer.md similarity index 100% rename from expkg/vendor/lz4/examples/blockStreaming_doubleBuffer.md rename to vendor/lz4/examples/blockStreaming_doubleBuffer.md diff --git a/expkg/vendor/lz4/examples/blockStreaming_lineByLine.c b/vendor/lz4/examples/blockStreaming_lineByLine.c similarity index 100% rename from expkg/vendor/lz4/examples/blockStreaming_lineByLine.c rename to vendor/lz4/examples/blockStreaming_lineByLine.c diff --git a/expkg/vendor/lz4/examples/blockStreaming_lineByLine.md b/vendor/lz4/examples/blockStreaming_lineByLine.md similarity index 100% rename from expkg/vendor/lz4/examples/blockStreaming_lineByLine.md rename to vendor/lz4/examples/blockStreaming_lineByLine.md diff --git a/expkg/vendor/lz4/examples/blockStreaming_ringBuffer.c b/vendor/lz4/examples/blockStreaming_ringBuffer.c similarity index 100% rename from expkg/vendor/lz4/examples/blockStreaming_ringBuffer.c rename to vendor/lz4/examples/blockStreaming_ringBuffer.c diff --git a/expkg/vendor/lz4/examples/dictionaryRandomAccess.c b/vendor/lz4/examples/dictionaryRandomAccess.c similarity index 100% rename from expkg/vendor/lz4/examples/dictionaryRandomAccess.c rename to vendor/lz4/examples/dictionaryRandomAccess.c diff --git a/expkg/vendor/lz4/examples/dictionaryRandomAccess.md b/vendor/lz4/examples/dictionaryRandomAccess.md similarity index 100% rename from expkg/vendor/lz4/examples/dictionaryRandomAccess.md rename to vendor/lz4/examples/dictionaryRandomAccess.md diff --git a/expkg/vendor/lz4/examples/fileCompress.c b/vendor/lz4/examples/fileCompress.c similarity index 100% rename from expkg/vendor/lz4/examples/fileCompress.c rename to vendor/lz4/examples/fileCompress.c diff --git a/expkg/vendor/lz4/examples/frameCompress.c b/vendor/lz4/examples/frameCompress.c similarity index 100% rename from expkg/vendor/lz4/examples/frameCompress.c rename to vendor/lz4/examples/frameCompress.c diff --git a/expkg/vendor/lz4/examples/print_version.c b/vendor/lz4/examples/print_version.c similarity index 100% rename from expkg/vendor/lz4/examples/print_version.c rename to vendor/lz4/examples/print_version.c diff --git a/expkg/vendor/lz4/examples/simple_buffer.c b/vendor/lz4/examples/simple_buffer.c similarity index 100% rename from expkg/vendor/lz4/examples/simple_buffer.c rename to vendor/lz4/examples/simple_buffer.c diff --git a/expkg/vendor/lz4/examples/streamingHC_ringBuffer.c b/vendor/lz4/examples/streamingHC_ringBuffer.c similarity index 100% rename from expkg/vendor/lz4/examples/streamingHC_ringBuffer.c rename to vendor/lz4/examples/streamingHC_ringBuffer.c diff --git a/expkg/vendor/lz4/examples/streaming_api_basics.md b/vendor/lz4/examples/streaming_api_basics.md similarity index 100% rename from expkg/vendor/lz4/examples/streaming_api_basics.md rename to vendor/lz4/examples/streaming_api_basics.md diff --git a/expkg/vendor/lz4/lib/.gitignore b/vendor/lz4/lib/.gitignore similarity index 100% rename from expkg/vendor/lz4/lib/.gitignore rename to vendor/lz4/lib/.gitignore diff --git a/expkg/vendor/lz4/lib/LICENSE b/vendor/lz4/lib/LICENSE similarity index 100% rename from expkg/vendor/lz4/lib/LICENSE rename to vendor/lz4/lib/LICENSE diff --git a/expkg/vendor/lz4/lib/Makefile b/vendor/lz4/lib/Makefile similarity index 100% rename from expkg/vendor/lz4/lib/Makefile rename to vendor/lz4/lib/Makefile diff --git a/expkg/vendor/lz4/lib/README.md b/vendor/lz4/lib/README.md similarity index 100% rename from expkg/vendor/lz4/lib/README.md rename to vendor/lz4/lib/README.md diff --git a/expkg/vendor/lz4/lib/dll/example/Makefile b/vendor/lz4/lib/dll/example/Makefile similarity index 100% rename from expkg/vendor/lz4/lib/dll/example/Makefile rename to vendor/lz4/lib/dll/example/Makefile diff --git a/expkg/vendor/lz4/lib/dll/example/README.md b/vendor/lz4/lib/dll/example/README.md similarity index 100% rename from expkg/vendor/lz4/lib/dll/example/README.md rename to vendor/lz4/lib/dll/example/README.md diff --git a/expkg/vendor/lz4/lib/dll/example/fullbench-dll.sln b/vendor/lz4/lib/dll/example/fullbench-dll.sln similarity index 100% rename from expkg/vendor/lz4/lib/dll/example/fullbench-dll.sln rename to vendor/lz4/lib/dll/example/fullbench-dll.sln diff --git a/expkg/vendor/lz4/lib/dll/example/fullbench-dll.vcxproj b/vendor/lz4/lib/dll/example/fullbench-dll.vcxproj similarity index 100% rename from expkg/vendor/lz4/lib/dll/example/fullbench-dll.vcxproj rename to vendor/lz4/lib/dll/example/fullbench-dll.vcxproj diff --git a/expkg/vendor/lz4/lib/liblz4-dll.rc.in b/vendor/lz4/lib/liblz4-dll.rc.in similarity index 100% rename from expkg/vendor/lz4/lib/liblz4-dll.rc.in rename to vendor/lz4/lib/liblz4-dll.rc.in diff --git a/expkg/vendor/lz4/lib/liblz4.pc.in b/vendor/lz4/lib/liblz4.pc.in similarity index 100% rename from expkg/vendor/lz4/lib/liblz4.pc.in rename to vendor/lz4/lib/liblz4.pc.in diff --git a/expkg/vendor/lz4/lib/lz4.c b/vendor/lz4/lib/lz4.c similarity index 100% rename from expkg/vendor/lz4/lib/lz4.c rename to vendor/lz4/lib/lz4.c diff --git a/expkg/vendor/lz4/lib/lz4.h b/vendor/lz4/lib/lz4.h similarity index 100% rename from expkg/vendor/lz4/lib/lz4.h rename to vendor/lz4/lib/lz4.h diff --git a/expkg/vendor/lz4/lib/lz4file.c b/vendor/lz4/lib/lz4file.c similarity index 100% rename from expkg/vendor/lz4/lib/lz4file.c rename to vendor/lz4/lib/lz4file.c diff --git a/expkg/vendor/lz4/lib/lz4file.h b/vendor/lz4/lib/lz4file.h similarity index 100% rename from expkg/vendor/lz4/lib/lz4file.h rename to vendor/lz4/lib/lz4file.h diff --git a/expkg/vendor/lz4/lib/lz4frame.c b/vendor/lz4/lib/lz4frame.c similarity index 100% rename from expkg/vendor/lz4/lib/lz4frame.c rename to vendor/lz4/lib/lz4frame.c diff --git a/expkg/vendor/lz4/lib/lz4frame.h b/vendor/lz4/lib/lz4frame.h similarity index 100% rename from expkg/vendor/lz4/lib/lz4frame.h rename to vendor/lz4/lib/lz4frame.h diff --git a/expkg/vendor/lz4/lib/lz4frame_static.h b/vendor/lz4/lib/lz4frame_static.h similarity index 100% rename from expkg/vendor/lz4/lib/lz4frame_static.h rename to vendor/lz4/lib/lz4frame_static.h diff --git a/expkg/vendor/lz4/lib/lz4hc.c b/vendor/lz4/lib/lz4hc.c similarity index 100% rename from expkg/vendor/lz4/lib/lz4hc.c rename to vendor/lz4/lib/lz4hc.c diff --git a/expkg/vendor/lz4/lib/lz4hc.h b/vendor/lz4/lib/lz4hc.h similarity index 100% rename from expkg/vendor/lz4/lib/lz4hc.h rename to vendor/lz4/lib/lz4hc.h diff --git a/expkg/vendor/lz4/lib/xxhash.c b/vendor/lz4/lib/xxhash.c similarity index 100% rename from expkg/vendor/lz4/lib/xxhash.c rename to vendor/lz4/lib/xxhash.c diff --git a/expkg/vendor/lz4/lib/xxhash.h b/vendor/lz4/lib/xxhash.h similarity index 100% rename from expkg/vendor/lz4/lib/xxhash.h rename to vendor/lz4/lib/xxhash.h diff --git a/expkg/vendor/lz4/ossfuzz/.gitignore b/vendor/lz4/ossfuzz/.gitignore similarity index 100% rename from expkg/vendor/lz4/ossfuzz/.gitignore rename to vendor/lz4/ossfuzz/.gitignore diff --git a/expkg/vendor/lz4/ossfuzz/Makefile b/vendor/lz4/ossfuzz/Makefile similarity index 100% rename from expkg/vendor/lz4/ossfuzz/Makefile rename to vendor/lz4/ossfuzz/Makefile diff --git a/expkg/vendor/lz4/ossfuzz/compress_frame_fuzzer.c b/vendor/lz4/ossfuzz/compress_frame_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/compress_frame_fuzzer.c rename to vendor/lz4/ossfuzz/compress_frame_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/compress_fuzzer.c b/vendor/lz4/ossfuzz/compress_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/compress_fuzzer.c rename to vendor/lz4/ossfuzz/compress_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/compress_hc_fuzzer.c b/vendor/lz4/ossfuzz/compress_hc_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/compress_hc_fuzzer.c rename to vendor/lz4/ossfuzz/compress_hc_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/decompress_frame_fuzzer.c b/vendor/lz4/ossfuzz/decompress_frame_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/decompress_frame_fuzzer.c rename to vendor/lz4/ossfuzz/decompress_frame_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/decompress_fuzzer.c b/vendor/lz4/ossfuzz/decompress_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/decompress_fuzzer.c rename to vendor/lz4/ossfuzz/decompress_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/fuzz.h b/vendor/lz4/ossfuzz/fuzz.h similarity index 100% rename from expkg/vendor/lz4/ossfuzz/fuzz.h rename to vendor/lz4/ossfuzz/fuzz.h diff --git a/expkg/vendor/lz4/ossfuzz/fuzz_data_producer.c b/vendor/lz4/ossfuzz/fuzz_data_producer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/fuzz_data_producer.c rename to vendor/lz4/ossfuzz/fuzz_data_producer.c diff --git a/expkg/vendor/lz4/ossfuzz/fuzz_data_producer.h b/vendor/lz4/ossfuzz/fuzz_data_producer.h similarity index 100% rename from expkg/vendor/lz4/ossfuzz/fuzz_data_producer.h rename to vendor/lz4/ossfuzz/fuzz_data_producer.h diff --git a/expkg/vendor/lz4/ossfuzz/fuzz_helpers.h b/vendor/lz4/ossfuzz/fuzz_helpers.h similarity index 100% rename from expkg/vendor/lz4/ossfuzz/fuzz_helpers.h rename to vendor/lz4/ossfuzz/fuzz_helpers.h diff --git a/expkg/vendor/lz4/ossfuzz/lz4_helpers.c b/vendor/lz4/ossfuzz/lz4_helpers.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/lz4_helpers.c rename to vendor/lz4/ossfuzz/lz4_helpers.c diff --git a/expkg/vendor/lz4/ossfuzz/lz4_helpers.h b/vendor/lz4/ossfuzz/lz4_helpers.h similarity index 100% rename from expkg/vendor/lz4/ossfuzz/lz4_helpers.h rename to vendor/lz4/ossfuzz/lz4_helpers.h diff --git a/expkg/vendor/lz4/ossfuzz/ossfuzz.sh b/vendor/lz4/ossfuzz/ossfuzz.sh similarity index 100% rename from expkg/vendor/lz4/ossfuzz/ossfuzz.sh rename to vendor/lz4/ossfuzz/ossfuzz.sh diff --git a/expkg/vendor/lz4/ossfuzz/round_trip_frame_fuzzer.c b/vendor/lz4/ossfuzz/round_trip_frame_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/round_trip_frame_fuzzer.c rename to vendor/lz4/ossfuzz/round_trip_frame_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/round_trip_frame_uncompressed_fuzzer.c b/vendor/lz4/ossfuzz/round_trip_frame_uncompressed_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/round_trip_frame_uncompressed_fuzzer.c rename to vendor/lz4/ossfuzz/round_trip_frame_uncompressed_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/round_trip_fuzzer.c b/vendor/lz4/ossfuzz/round_trip_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/round_trip_fuzzer.c rename to vendor/lz4/ossfuzz/round_trip_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/round_trip_hc_fuzzer.c b/vendor/lz4/ossfuzz/round_trip_hc_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/round_trip_hc_fuzzer.c rename to vendor/lz4/ossfuzz/round_trip_hc_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/round_trip_stream_fuzzer.c b/vendor/lz4/ossfuzz/round_trip_stream_fuzzer.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/round_trip_stream_fuzzer.c rename to vendor/lz4/ossfuzz/round_trip_stream_fuzzer.c diff --git a/expkg/vendor/lz4/ossfuzz/standaloneengine.c b/vendor/lz4/ossfuzz/standaloneengine.c similarity index 100% rename from expkg/vendor/lz4/ossfuzz/standaloneengine.c rename to vendor/lz4/ossfuzz/standaloneengine.c diff --git a/expkg/vendor/lz4/ossfuzz/travisoss.sh b/vendor/lz4/ossfuzz/travisoss.sh similarity index 100% rename from expkg/vendor/lz4/ossfuzz/travisoss.sh rename to vendor/lz4/ossfuzz/travisoss.sh diff --git a/expkg/vendor/lz4/programs/.gitignore b/vendor/lz4/programs/.gitignore similarity index 100% rename from expkg/vendor/lz4/programs/.gitignore rename to vendor/lz4/programs/.gitignore diff --git a/expkg/vendor/lz4/programs/COPYING b/vendor/lz4/programs/COPYING similarity index 100% rename from expkg/vendor/lz4/programs/COPYING rename to vendor/lz4/programs/COPYING diff --git a/expkg/vendor/lz4/programs/Makefile b/vendor/lz4/programs/Makefile similarity index 100% rename from expkg/vendor/lz4/programs/Makefile rename to vendor/lz4/programs/Makefile diff --git a/expkg/vendor/lz4/programs/README.md b/vendor/lz4/programs/README.md similarity index 100% rename from expkg/vendor/lz4/programs/README.md rename to vendor/lz4/programs/README.md diff --git a/expkg/vendor/lz4/programs/bench.c b/vendor/lz4/programs/bench.c similarity index 100% rename from expkg/vendor/lz4/programs/bench.c rename to vendor/lz4/programs/bench.c diff --git a/expkg/vendor/lz4/programs/bench.h b/vendor/lz4/programs/bench.h similarity index 100% rename from expkg/vendor/lz4/programs/bench.h rename to vendor/lz4/programs/bench.h diff --git a/expkg/vendor/lz4/programs/lorem.c b/vendor/lz4/programs/lorem.c similarity index 100% rename from expkg/vendor/lz4/programs/lorem.c rename to vendor/lz4/programs/lorem.c diff --git a/expkg/vendor/lz4/programs/lorem.h b/vendor/lz4/programs/lorem.h similarity index 100% rename from expkg/vendor/lz4/programs/lorem.h rename to vendor/lz4/programs/lorem.h diff --git a/expkg/vendor/lz4/programs/lz4-exe.rc.in b/vendor/lz4/programs/lz4-exe.rc.in similarity index 100% rename from expkg/vendor/lz4/programs/lz4-exe.rc.in rename to vendor/lz4/programs/lz4-exe.rc.in diff --git a/expkg/vendor/lz4/programs/lz4.1 b/vendor/lz4/programs/lz4.1 similarity index 100% rename from expkg/vendor/lz4/programs/lz4.1 rename to vendor/lz4/programs/lz4.1 diff --git a/expkg/vendor/lz4/programs/lz4.1.md b/vendor/lz4/programs/lz4.1.md similarity index 100% rename from expkg/vendor/lz4/programs/lz4.1.md rename to vendor/lz4/programs/lz4.1.md diff --git a/expkg/vendor/lz4/programs/lz4cli.c b/vendor/lz4/programs/lz4cli.c similarity index 100% rename from expkg/vendor/lz4/programs/lz4cli.c rename to vendor/lz4/programs/lz4cli.c diff --git a/expkg/vendor/lz4/programs/lz4conf.h b/vendor/lz4/programs/lz4conf.h similarity index 100% rename from expkg/vendor/lz4/programs/lz4conf.h rename to vendor/lz4/programs/lz4conf.h diff --git a/expkg/vendor/lz4/programs/lz4io.c b/vendor/lz4/programs/lz4io.c similarity index 100% rename from expkg/vendor/lz4/programs/lz4io.c rename to vendor/lz4/programs/lz4io.c diff --git a/expkg/vendor/lz4/programs/lz4io.h b/vendor/lz4/programs/lz4io.h similarity index 100% rename from expkg/vendor/lz4/programs/lz4io.h rename to vendor/lz4/programs/lz4io.h diff --git a/expkg/vendor/lz4/programs/platform.h b/vendor/lz4/programs/platform.h similarity index 100% rename from expkg/vendor/lz4/programs/platform.h rename to vendor/lz4/programs/platform.h diff --git a/expkg/vendor/lz4/programs/threadpool.c b/vendor/lz4/programs/threadpool.c similarity index 100% rename from expkg/vendor/lz4/programs/threadpool.c rename to vendor/lz4/programs/threadpool.c diff --git a/expkg/vendor/lz4/programs/threadpool.h b/vendor/lz4/programs/threadpool.h similarity index 100% rename from expkg/vendor/lz4/programs/threadpool.h rename to vendor/lz4/programs/threadpool.h diff --git a/expkg/vendor/lz4/programs/timefn.c b/vendor/lz4/programs/timefn.c similarity index 100% rename from expkg/vendor/lz4/programs/timefn.c rename to vendor/lz4/programs/timefn.c diff --git a/expkg/vendor/lz4/programs/timefn.h b/vendor/lz4/programs/timefn.h similarity index 100% rename from expkg/vendor/lz4/programs/timefn.h rename to vendor/lz4/programs/timefn.h diff --git a/expkg/vendor/lz4/programs/util.c b/vendor/lz4/programs/util.c similarity index 100% rename from expkg/vendor/lz4/programs/util.c rename to vendor/lz4/programs/util.c diff --git a/expkg/vendor/lz4/programs/util.h b/vendor/lz4/programs/util.h similarity index 100% rename from expkg/vendor/lz4/programs/util.h rename to vendor/lz4/programs/util.h diff --git a/expkg/vendor/lz4/tests/.gitignore b/vendor/lz4/tests/.gitignore similarity index 100% rename from expkg/vendor/lz4/tests/.gitignore rename to vendor/lz4/tests/.gitignore diff --git a/expkg/vendor/lz4/tests/COPYING b/vendor/lz4/tests/COPYING similarity index 100% rename from expkg/vendor/lz4/tests/COPYING rename to vendor/lz4/tests/COPYING diff --git a/expkg/vendor/lz4/tests/Makefile b/vendor/lz4/tests/Makefile similarity index 100% rename from expkg/vendor/lz4/tests/Makefile rename to vendor/lz4/tests/Makefile diff --git a/expkg/vendor/lz4/tests/README.md b/vendor/lz4/tests/README.md similarity index 100% rename from expkg/vendor/lz4/tests/README.md rename to vendor/lz4/tests/README.md diff --git a/expkg/vendor/lz4/tests/abiTest.c b/vendor/lz4/tests/abiTest.c similarity index 100% rename from expkg/vendor/lz4/tests/abiTest.c rename to vendor/lz4/tests/abiTest.c diff --git a/expkg/vendor/lz4/tests/checkFrame.c b/vendor/lz4/tests/checkFrame.c similarity index 100% rename from expkg/vendor/lz4/tests/checkFrame.c rename to vendor/lz4/tests/checkFrame.c diff --git a/expkg/vendor/lz4/tests/checkTag.c b/vendor/lz4/tests/checkTag.c similarity index 100% rename from expkg/vendor/lz4/tests/checkTag.c rename to vendor/lz4/tests/checkTag.c diff --git a/expkg/vendor/lz4/tests/check_liblz4_version.sh b/vendor/lz4/tests/check_liblz4_version.sh similarity index 100% rename from expkg/vendor/lz4/tests/check_liblz4_version.sh rename to vendor/lz4/tests/check_liblz4_version.sh diff --git a/expkg/vendor/lz4/tests/check_stdvars.sh b/vendor/lz4/tests/check_stdvars.sh similarity index 100% rename from expkg/vendor/lz4/tests/check_stdvars.sh rename to vendor/lz4/tests/check_stdvars.sh diff --git a/expkg/vendor/lz4/tests/cmake/CMakeLists.txt b/vendor/lz4/tests/cmake/CMakeLists.txt similarity index 100% rename from expkg/vendor/lz4/tests/cmake/CMakeLists.txt rename to vendor/lz4/tests/cmake/CMakeLists.txt diff --git a/expkg/vendor/lz4/tests/datagen.c b/vendor/lz4/tests/datagen.c similarity index 100% rename from expkg/vendor/lz4/tests/datagen.c rename to vendor/lz4/tests/datagen.c diff --git a/expkg/vendor/lz4/tests/datagen.h b/vendor/lz4/tests/datagen.h similarity index 100% rename from expkg/vendor/lz4/tests/datagen.h rename to vendor/lz4/tests/datagen.h diff --git a/expkg/vendor/lz4/tests/datagencli.c b/vendor/lz4/tests/datagencli.c similarity index 100% rename from expkg/vendor/lz4/tests/datagencli.c rename to vendor/lz4/tests/datagencli.c diff --git a/expkg/vendor/lz4/tests/decompress-partial-usingDict.c b/vendor/lz4/tests/decompress-partial-usingDict.c similarity index 100% rename from expkg/vendor/lz4/tests/decompress-partial-usingDict.c rename to vendor/lz4/tests/decompress-partial-usingDict.c diff --git a/expkg/vendor/lz4/tests/decompress-partial.c b/vendor/lz4/tests/decompress-partial.c similarity index 100% rename from expkg/vendor/lz4/tests/decompress-partial.c rename to vendor/lz4/tests/decompress-partial.c diff --git a/expkg/vendor/lz4/tests/frametest.c b/vendor/lz4/tests/frametest.c similarity index 100% rename from expkg/vendor/lz4/tests/frametest.c rename to vendor/lz4/tests/frametest.c diff --git a/expkg/vendor/lz4/tests/freestanding.c b/vendor/lz4/tests/freestanding.c similarity index 100% rename from expkg/vendor/lz4/tests/freestanding.c rename to vendor/lz4/tests/freestanding.c diff --git a/expkg/vendor/lz4/tests/fullbench.c b/vendor/lz4/tests/fullbench.c similarity index 100% rename from expkg/vendor/lz4/tests/fullbench.c rename to vendor/lz4/tests/fullbench.c diff --git a/expkg/vendor/lz4/tests/fuzzer.c b/vendor/lz4/tests/fuzzer.c similarity index 100% rename from expkg/vendor/lz4/tests/fuzzer.c rename to vendor/lz4/tests/fuzzer.c diff --git a/expkg/vendor/lz4/tests/goldenSamples/skip.bin b/vendor/lz4/tests/goldenSamples/skip.bin similarity index 100% rename from expkg/vendor/lz4/tests/goldenSamples/skip.bin rename to vendor/lz4/tests/goldenSamples/skip.bin diff --git a/expkg/vendor/lz4/tests/loremOut.c b/vendor/lz4/tests/loremOut.c similarity index 100% rename from expkg/vendor/lz4/tests/loremOut.c rename to vendor/lz4/tests/loremOut.c diff --git a/expkg/vendor/lz4/tests/loremOut.h b/vendor/lz4/tests/loremOut.h similarity index 100% rename from expkg/vendor/lz4/tests/loremOut.h rename to vendor/lz4/tests/loremOut.h diff --git a/expkg/vendor/lz4/tests/roundTripTest.c b/vendor/lz4/tests/roundTripTest.c similarity index 100% rename from expkg/vendor/lz4/tests/roundTripTest.c rename to vendor/lz4/tests/roundTripTest.c diff --git a/expkg/vendor/lz4/tests/test-lz4-abi.py b/vendor/lz4/tests/test-lz4-abi.py similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-abi.py rename to vendor/lz4/tests/test-lz4-abi.py diff --git a/expkg/vendor/lz4/tests/test-lz4-basic.sh b/vendor/lz4/tests/test-lz4-basic.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-basic.sh rename to vendor/lz4/tests/test-lz4-basic.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-contentSize.sh b/vendor/lz4/tests/test-lz4-contentSize.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-contentSize.sh rename to vendor/lz4/tests/test-lz4-contentSize.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-dict.sh b/vendor/lz4/tests/test-lz4-dict.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-dict.sh rename to vendor/lz4/tests/test-lz4-dict.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-fast-hugefile.sh b/vendor/lz4/tests/test-lz4-fast-hugefile.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-fast-hugefile.sh rename to vendor/lz4/tests/test-lz4-fast-hugefile.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-frame-concatenation.sh b/vendor/lz4/tests/test-lz4-frame-concatenation.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-frame-concatenation.sh rename to vendor/lz4/tests/test-lz4-frame-concatenation.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-list.py b/vendor/lz4/tests/test-lz4-list.py similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-list.py rename to vendor/lz4/tests/test-lz4-list.py diff --git a/expkg/vendor/lz4/tests/test-lz4-multiple-legacy.sh b/vendor/lz4/tests/test-lz4-multiple-legacy.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-multiple-legacy.sh rename to vendor/lz4/tests/test-lz4-multiple-legacy.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-multiple.sh b/vendor/lz4/tests/test-lz4-multiple.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-multiple.sh rename to vendor/lz4/tests/test-lz4-multiple.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-opt-parser.sh b/vendor/lz4/tests/test-lz4-opt-parser.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-opt-parser.sh rename to vendor/lz4/tests/test-lz4-opt-parser.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-skippable.sh b/vendor/lz4/tests/test-lz4-skippable.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-skippable.sh rename to vendor/lz4/tests/test-lz4-skippable.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-sparse.sh b/vendor/lz4/tests/test-lz4-sparse.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-sparse.sh rename to vendor/lz4/tests/test-lz4-sparse.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-speed.py b/vendor/lz4/tests/test-lz4-speed.py similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-speed.py rename to vendor/lz4/tests/test-lz4-speed.py diff --git a/expkg/vendor/lz4/tests/test-lz4-testmode.sh b/vendor/lz4/tests/test-lz4-testmode.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-testmode.sh rename to vendor/lz4/tests/test-lz4-testmode.sh diff --git a/expkg/vendor/lz4/tests/test-lz4-versions.py b/vendor/lz4/tests/test-lz4-versions.py similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4-versions.py rename to vendor/lz4/tests/test-lz4-versions.py diff --git a/expkg/vendor/lz4/tests/test-lz4hc-hugefile.sh b/vendor/lz4/tests/test-lz4hc-hugefile.sh similarity index 100% rename from expkg/vendor/lz4/tests/test-lz4hc-hugefile.sh rename to vendor/lz4/tests/test-lz4hc-hugefile.sh diff --git a/expkg/vendor/lz4/tests/test_custom_block_sizes.sh b/vendor/lz4/tests/test_custom_block_sizes.sh similarity index 100% rename from expkg/vendor/lz4/tests/test_custom_block_sizes.sh rename to vendor/lz4/tests/test_custom_block_sizes.sh diff --git a/expkg/vendor/lz4/tests/test_install.sh b/vendor/lz4/tests/test_install.sh similarity index 100% rename from expkg/vendor/lz4/tests/test_install.sh rename to vendor/lz4/tests/test_install.sh diff --git a/expkg/vendor/lz4/tests/unicode_lint.sh b/vendor/lz4/tests/unicode_lint.sh similarity index 100% rename from expkg/vendor/lz4/tests/unicode_lint.sh rename to vendor/lz4/tests/unicode_lint.sh diff --git a/expkg/vendor/stb/stb_image_write.cpp b/vendor/stb/stb_image_write.cpp similarity index 100% rename from expkg/vendor/stb/stb_image_write.cpp rename to vendor/stb/stb_image_write.cpp diff --git a/expkg/vendor/stb/stb_image_write.h b/vendor/stb/stb_image_write.h similarity index 100% rename from expkg/vendor/stb/stb_image_write.h rename to vendor/stb/stb_image_write.h