├── .github └── workflows │ └── compile-release.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CMakeLists.txt ├── README.md ├── README_ZSO.md ├── include ├── banner.h └── ziso.h ├── lib └── CMakeLists.txt ├── src ├── CMakeLists.txt └── ziso.cpp └── tc-win64.cmake /.github/workflows/compile-release.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*" 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-22.04 11 | permissions: 12 | contents: write 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Install Packages 17 | run: sudo apt-get update && sudo apt-get install -y mingw-w64 zip cmake 18 | - name: Initializing submodules 19 | run: git submodule update --init 20 | - name: Build linux release 21 | run: cmake -B . && make 22 | - name: Build windows release 23 | run: rm -rf CMakeFiles ; rm -rf */CMakeFiles ; rm -rf */*/CMakeFiles && cmake -DCMAKE_TOOLCHAIN_FILE="tc-win64.cmake" -B . && make 24 | - name: Set env 25 | run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV 26 | - name: Generate release 27 | run: | 28 | cd bin 29 | zip ziso_${{ env.RELEASE_VERSION }}_linux.zip ziso 30 | zip ziso_${{ env.RELEASE_VERSION }}_win64.zip ziso.exe 31 | 32 | - name: Upload assets 33 | uses: marvinpinto/action-automatic-releases@v1.2.1 34 | with: 35 | repo_token: "${{ secrets.GITHUB_TOKEN }}" 36 | prerelease: false 37 | files: | 38 | bin/*.zip 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Libraries 12 | *.lib 13 | *.a 14 | *.la 15 | *.lo 16 | 17 | # Shared objects (inc. Windows DLLs) 18 | *.dll 19 | *.so 20 | *.so.* 21 | *.dylib 22 | 23 | # Executables 24 | *.exe 25 | *.out 26 | *.app 27 | *.i*86 28 | *.x86_64 29 | *.hex 30 | 31 | release/ 32 | **.bk 33 | .~lock.* 34 | 35 | .vscode/ 36 | *.txt 37 | test* 38 | 39 | # Cmake files (includes CMakeLists.txt because was ignored above) 40 | !**/CMakeLists.txt 41 | !CMakeLists.txt 42 | **/cmake-build-debug 43 | **/CMakeCache.txt 44 | **/cmake_install.cmake 45 | **/install_manifest.txt 46 | **/CMakeFiles/ 47 | **/CTestTestfile.cmake 48 | **/Makefile 49 | **/*.cbp 50 | **/CMakeScripts/ 51 | **/compile_commands.json 52 | build/ 53 | **/DartConfiguration.tcl 54 | 55 | # Google Docs files 56 | **.gsheet 57 | 58 | **/ziso.py 59 | src/ziso 60 | bin/ 61 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lib/lz4"] 2 | path = lib/lz4 3 | url = https://github.com/lz4/lz4.git 4 | [submodule "lib/spdlog"] 5 | path = lib/spdlog 6 | url = https://github.com/gabime/spdlog.git 7 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Ziso Changelog 2 | 3 | ## v0.5.2 4 | 5 | * Fixed a bug compressing/decompressing non standard blocksize files, like for example CDROM's (blocksize 2352) 6 | * Fixed a bug calculating the compression percentage and its ratio in progress message. 7 | 8 | ## v0.5.1 9 | 10 | * Added a fix to a bug in the hdl_dump program which causes corruption when a compressed file is copied and its size is not divisible by 2048. 11 | 12 | ## v0.5.0 13 | 14 | * First version of the program. 15 | * Includes two LZ4 compression methods whith different results. Their result can vary depending of the source data. By default the same as ziso.py will be used. 16 | * Brute force compression to select the best of the two methods for every block. 17 | * LZ4HC compression is included. 18 | * Faster than the original ziso.py compressor. 19 | * Blocks with bigger compressed size are not compressed (like the original ziso.py tool). 20 | * Ability to detect source CDROM to adjust the block size to their sector size (2352). This will improve the decompression speed by reducing the number of blocks to decompress to get a full sector (1 vs 2). -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Works with 3.14 and tested through 3.27 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | # Project name and a few useful settings. Other commands can pick up the results 5 | project( 6 | Ziso 7 | VERSION 0.7.0 8 | DESCRIPTION "Another Ziso compressor with advanced features" 9 | LANGUAGES C CXX) 10 | 11 | if(NOT CMAKE_BUILD_TYPE) 12 | set(CMAKE_BUILD_TYPE Release) 13 | endif() 14 | 15 | set(CMAKE_CXX_FLAGS "-Wall -Wextra") 16 | set(CMAKE_CXX_FLAGS_DEBUG "-g") 17 | set(CMAKE_CXX_FLAGS_RELEASE "-O2 -s") 18 | 19 | # Only do these if this is the main project, and not if it is included through add_subdirectory 20 | if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) 21 | set(CMAKE_CXX_EXTENSIONS OFF) 22 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 23 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 24 | 25 | # The compiled library code is here 26 | add_subdirectory(lib) 27 | 28 | # The executable code is here 29 | add_subdirectory(src) 30 | endif() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZISO compressor 2 | 3 | This ziso compressor is an alternative to the ziso.py compressor that I have found in the OPL repository. It doesn't respect the compression level and doesn't provide LZ4HC compression, so I have decided to create my own compressor. 4 | 5 | ## Features 6 | 7 | * Allows to set the compression level by using the LZ4 feature called "acceleration". 8 | * Includes the LZ4HC compression algorithm. 9 | * It includes an alternative compression method which can reduce the size in some cases. 10 | * Brute force compression to use the best compression method between the two LZ4 methods. 11 | * It's 40-45% faster than the ziso.py conversor. 12 | * ~~It's able to detect CD-ROM images and adjust the blocksize according with their sector size.~~ Removed due to an incompatibility of OPL with blocksizes different from 2048. 13 | 14 | ## ToDo 15 | 16 | There are some things I'd like to do, like for example: 17 | 18 | * ~~Try to add read and write buffers to improve the speed~~ -> 50-55% faster compressing and up to 70% decompressing. 19 | * ~~CD-ROM detection to select the best block size (DVD -> 2048 vs CD-ROM -> 2352)~~ -> ~~Done. Now the program detects CDROM images.~~ Removed... 20 | * ~~Add Multi Thread processing.~~ Don't worth it, the compression is very fast in modern processors. 21 | 22 | ## Compile 23 | 24 | Clone the repository: 25 | 26 | ``` 27 | git clone https://github.com/Danixu/ziso_compressor.git 28 | ``` 29 | 30 | Download the submodules: 31 | 32 | ``` 33 | cd ziso_compressor 34 | git submodule update --init 35 | ``` 36 | 37 | Compile the program: 38 | 39 | This repository includes the cmake configuration, so to compile you will have to run the standard commands: 40 | 41 | ``` 42 | $ cmake -B . 43 | $ make 44 | ``` 45 | 46 | This will create the binary files into the bin directory. 47 | 48 | Tested in Manjaro with the standard build tools, and Windows 11 with MSYS2 with MinGW64. 49 | 50 | ## Usage 51 | 52 | The program is easy to use, and the output filename will be determined if not provided. Also it is able to detect the ZISO files, so will determine if the file must be compressed or uncompressed. 53 | 54 | Compress/decompress a file: 55 | 56 | ``` 57 | ziso.exe -i 58 | 59 | ziso.exe -i -o 60 | ``` 61 | 62 | ## Arguments 63 | 64 | | Short | Long | Value | Description | 65 | |:-----:|:-------------:|:-----:|:-------------------------------------------------------------------:| 66 | | -i | --input | | Input file to process | 67 | | -o | --output | | Output file | 68 | | -c | --compression | 12 | Compression level | 69 | | -m | --mode2-lz4 | | Use an alternative LZ4 compression method | 70 | | -l | --lz4hc | | Activate the High Compression algorithm | 71 | | -f | --brute-force | | Test the two LZ4 compression methods and use the best | 72 | | -b | --block-size | 2048 | Block size, usually 2048 but is beter to set it to 2352 for CD-ROMS | 73 | | -z | --cache-size | 4 | Cache size in MB to improve the compression/decompression speed | 74 | | -r | --replace | | Force to overwrite the output file | 75 | | -h | --hdl-fix | | hdl_dump fix to avoid corruption when copied to internal PS2 HDD | 76 | 77 | 78 | ### Explanation 79 | 80 | #### Compression 81 | 82 | The standard LZ4 method doesn't have compression level argument. Instead, it has **acceleration** which will affects the speed and compression ratio (just like the way a compression argument will do). On my program I translate the compression level argument to a usable **acceleration** level. 83 | 84 | The LZ4HC method already includes the compression option, so the program will pass the compression level directly to the compressor. 85 | 86 | #### Alternative LZ4 compression method 87 | 88 | The standard LZ4 library has two ways to compress the data. One is intended to be used to compress the data at once, and the other to compress several blocks of data keeping the dictionary to improve the compression ratio. 89 | 90 | In this case both are used in the same way: compress all the data at once, but for any reason there are some differences between both even when they uses the same algorithm. Sometimes the first method compress better and sometimes the 2nd. That is why I provide the "alternative" method to be used when it compress a bit better. 91 | 92 | The default compression method produces the same output as the ziso.py program. 93 | 94 | #### LZ4 High Compression 95 | 96 | The LZ4 library provides an alternative compression method called LZ4HC, which provides a better compression ratio in most scenarios. It is also slower and some programs and hardwares can be incompatible with this compression method. That is why I only recommend to use if when we are fully sure that the reader is compatible. For example, the ziso.py compressor is able to decompress this files even when it doesn't have the compression method. Also moderns emulators can be compatible with it. 97 | 98 | #### Brute Force Search 99 | 100 | As I have explained above, there are two compression functions in the standard LZ4 library. This argument will compress every block using both and will write the smaller result to the output file. 101 | 102 | LZ4HC will not be tried because it also uses the best compression method, so using the brute-force option with the LZ4HC compression method included will produce the same result as to use directly the LZ4HC compression option. It is better to directly use that option unless we want to keep the compatibility with old LZ4 libraries without HC. 103 | 104 | #### Block Size 105 | 106 | Size of every compressed block. By default 2048, but it's recommended to change it to 2352 when a CD-ROM is being compressed. A bigger block size improve the compression ratio, but increases the memory required by the decompresor to get the original data. Also the reader must be compatible with the blocksize or will fail. 107 | 108 | The program is able to detect the CD-ROM images, so it will change the block size to 2352 automatically when detected. 109 | 110 | #### Cache Size 111 | 112 | The size of the cache memory used as buffer to improve the compression and decompression speed. It reduces the required read and write IO request improving the compression speed up to 40-50% and the decompression speed up to 70% compared with the ziso.py version. Normally the default size is enought and increasing the size will not improve the speed, but in some cases can be a good option. 113 | 114 | #### HDL Fix 115 | 116 | Actually there is a [bug in the hdl_dump](https://github.com/ps2homebrew/hdl-dump/issues/71) which will trim the latest bytes of the file if the size is not a multiple of 2048. To solve it, the program will pad the output file to the nearest upper 2048 bytes multiple. 117 | -------------------------------------------------------------------------------- /README_ZSO.md: -------------------------------------------------------------------------------- 1 | # ZSO Format information 2 | 3 | ZSO is an alternative to the CSO version 1 format in the PSP. It uses the LZ4 compression algorithm instead the deflate algorithm to reduce the resources usage and improve the decompression speed, at cost of some compression ratio. This format was experimental but now can be considered as stable. 4 | 5 | The format consist in a header, an index, and the data blocks. Additionally the "magic" bytes are **ZISO** and the preferred extension is **zso**. 6 | 7 | ## Header 8 | 9 | The main header is similar to the CSO version 1 header, and is composed by the following (little endian): 10 | 11 | | Position | Type | Size | Default Value | Description | 12 | |----------|----------|---------|---------------|--------------------------------------| 13 | | 0x00 | char | 4 bytes | ZISO | Magic bytes. Always ZISO. | 14 | | 0x04 | uint32_t | 4 bytes | 0x18 | The header size. Always 0x18. | 15 | | 0x08 | uint64_t | 8 bytes | N/A | ISO original size | 16 | | 0x10 | uint32_t | 4 bytes | N/A | Block size. Usually 2048. | 17 | | 0x14 | uint8_t | 1 byte | 1 | Version of the ZSO format. Always 1. | 18 | | 0x15 | uint8_t | 1 byte | N/A | Left shift of index values. | 19 | | 0x16 | uint8_t | 2 byte | N/A | Unused. | 20 | 21 | ## Index 22 | 23 | Following the header data there are the index entries. Those entries are composed by values in **uint32_t** (little endian), in which the **first byte (high byte)** indicates when the block is uncompressed, and the other **31 bits** are used to store the block position. 24 | 25 | The number of index entries can be determined using the ISO original size and the Block size, using the following formula: 26 | 27 | ``` 28 | ceil(uncompressed_size / block_size) + 1 29 | ``` 30 | 31 | The extra block will be used to store the *EOF* position. 32 | 33 | As you will have noticed the 31 index bits limits the size to at most 2GB. This is not a problem in the PSP games because the UMD size is at most 1.8GB, but with bigger image files we will have to use the **shift** header entry. 34 | 35 | The shift value is the number of bits that we will shift right to be able to store the position into the 31 index bits, for example: 36 | 37 | ``` 38 | 3.874.765.689 = 1110 0110 1111 0100 0011 1011 0111 1001 39 | ``` 40 | 41 | We will shift right the binary data: 42 | 43 | ``` 44 | 0111 0011 0111 1010 0001 1101 1011 1100 45 | ``` 46 | 47 | Now we have the 31 bits, but the problem is that there is a precission lost, so we will have to "ceil" the result: 48 | 49 | ``` 50 | 0111 0011 0111 1010 0001 1101 1011 1100 = 1.937.382.844 51 | 52 | The last bit was 1, so we will "ceil" the number: 53 | 54 | 1.937.382.844 + 1 = 1.937.382.845 = 0111 0011 0111 1010 0001 1101 1011 1101 55 | ``` 56 | 57 | Padding left the result will give us a new position, that we will have to use as real start point for the block data: 58 | 59 | ``` 60 | 0111 0011 0111 1010 0001 1101 1011 1101 << 1 = 3.874.765.690 61 | 3.874.765.690 - 3.874.765.689 = -1 62 | ``` 63 | 64 | The difference between the original block position and the correct position, must be padded using any byte value (usually 0x00). 65 | 66 | A c++ example code to do the above: 67 | 68 | ``` 69 | void file_align(std::fstream &fOut, uint8_t shift) 70 | { 71 | uint16_t paddingLostBytes = fOut.tellp() % (1 << shift); 72 | if (paddingLostBytes) 73 | { 74 | uint16_t alignment = (1 << shift) - paddingLostBytes; 75 | for (uint64_t i = 0; i < alignment; i++) 76 | { 77 | fOut.write("\0", 1); 78 | } 79 | } 80 | } 81 | ``` 82 | 83 | ## Data 84 | 85 | The data blocks consist in the LZ4 compressed data. To save some space we can store the RAW uncompressed data when the compressed data is bigger, setting the **uncompressed** bit in the index entry. 86 | 87 | ## LZ4HC 88 | 89 | The LZ4HC format is not standard in the LZO file container, so we can use it but will not be compatible with some programs or hardwares. Modern LZ4 libraries are able to decompress the LZ4HC without problem using the standard library, so modern emulators for sure will be compatible with LZ4HC format. 90 | 91 | I personally don't recommend to use the LZ4HC algorithm, because the saved space don't worth the compatibility loose. -------------------------------------------------------------------------------- /include/banner.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | //////////////////////////////////////////////////////////////////////////////// 5 | 6 | void banner(void) 7 | { 8 | std::print("ziso - ZSO compressor/decompressor\n" 9 | "Created by Daniel Carrasco (2024)\n" 10 | "Improved version 0.7.0" 11 | " ({:d}-bit " 12 | 13 | #if defined(__CYGWIN__) 14 | "Windows, Cygwin" 15 | #elif defined(__MINGW32__) 16 | "Windows, MinGW" 17 | #elif defined(_WIN32) && defined(_MSC_VER) && (defined(__alpha) || defined(__ALPHA) || defined(__Alpha_AXP)) 18 | "Windows, Digital AXP C" 19 | #elif defined(_WIN32) && defined(_MSC_VER) && defined(_M_ALPHA) 20 | "Windows, Microsoft C, Alpha" 21 | #elif defined(_WIN32) && defined(_MSC_VER) && defined(_M_MRX000) 22 | "Windows, Microsoft C, MIPS" 23 | #elif defined(_WIN32) && defined(_MSC_VER) 24 | "Windows, Microsoft C" 25 | #elif defined(__WIN32__) || defined(_WIN32) 26 | "Windows" 27 | #elif defined(__DJGPP__) 28 | "DOS, DJGPP" 29 | #elif defined(__MSDOS__) && defined(__TURBOC__) 30 | "DOS, Turbo C" 31 | #elif defined(_DOS) && defined(__WATCOMC__) 32 | "DOS, Watcom" 33 | #elif defined(__MSDOS__) || defined(MSDOS) || defined(_DOS) 34 | "DOS" 35 | #elif defined(__APPLE__) 36 | "Mac OS" 37 | #elif defined(__linux) || defined(__linux__) || defined(__gnu_linux__) || defined(linux) 38 | "Linux" 39 | #elif defined(__OpenBSD__) 40 | "OpenBSD" 41 | #elif defined(BSD) 42 | "BSD" 43 | #elif defined(human68k) || defined(HUMAN68K) || defined(__human68k) || defined(__HUMAN68K) || defined(__human68k__) || defined(__HUMAN68K__) 44 | "Human68k" 45 | #elif defined(__unix__) || defined(__unix) || defined(unix) 46 | "unknown Unix" 47 | #else 48 | "unknown platform" 49 | #endif 50 | 51 | "{:s})\n" 52 | " https://www.electrosoftcloud.com/\n" 53 | "\n" 54 | " Binary Build date: {:s} @ {:s}\n" 55 | "\n", 56 | (int)(sizeof(size_t) * 8), 57 | (sizeof(off_t) > 4 && sizeof(off_t) > sizeof(size_t)) ? ", large file support" : "", 58 | __DATE__, __TIME__); 59 | } 60 | 61 | //////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /include/ziso.h: -------------------------------------------------------------------------------- 1 | #include "banner.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "spdlog/spdlog.h" 11 | 12 | // The LZ4_ACCELERATION_MAX is defined in the lz4.c file and is about 65537 (now). 13 | // Testing I have noticed that above 1024 the compression was almost the same, so I'll set the max there. 14 | constexpr uint16_t LZ4_MAX_ACCELERATION = 1024; 15 | const std::vector lz4_compression_level = { 16 | LZ4_MAX_ACCELERATION, 17 | uint16_t(LZ4_MAX_ACCELERATION *((float)10 / 11)), 18 | uint16_t(LZ4_MAX_ACCELERATION *((float)9 / 11)), 19 | uint16_t(LZ4_MAX_ACCELERATION *((float)8 / 11)), 20 | uint16_t(LZ4_MAX_ACCELERATION *((float)7 / 11)), 21 | uint16_t(LZ4_MAX_ACCELERATION *((float)6 / 11)), 22 | uint16_t(LZ4_MAX_ACCELERATION *((float)5 / 11)), 23 | uint16_t(LZ4_MAX_ACCELERATION *((float)4 / 11)), 24 | uint16_t(LZ4_MAX_ACCELERATION *((float)3 / 11)), 25 | uint16_t(LZ4_MAX_ACCELERATION *((float)2 / 11)), 26 | uint16_t(LZ4_MAX_ACCELERATION *((float)1 / 11)), 27 | 1}; 28 | 29 | // MB Macro 30 | #define MB(x) ((float)(x) / 1024 / 1024) 31 | 32 | // Max Cache Size 33 | constexpr uint8_t CACHE_SIZE_MAX = 128; 34 | constexpr uint8_t CACHE_SIZE_DEFAULT = 4; 35 | 36 | #pragma pack(push) 37 | #pragma pack(1) 38 | struct zheader 39 | { 40 | const char magic[4] = {'Z', 'I', 'S', 'O'}; // Always "ZISO". 41 | const uint32_t headerSize = 0x18; // Always 0x18. 42 | uint64_t uncompressedSize = 0; // Total size of original ISO. 43 | uint32_t blockSize = 2048; // Size of each block, usually 2048. 44 | const uint8_t version = 1; // Always 1. 45 | uint8_t indexShift = 0; // Indicates left shift of index values. 46 | const uint8_t unused[2] = {0, 0}; // Always 0. 47 | }; 48 | #pragma pack(pop) 49 | 50 | struct opt 51 | { 52 | std::string inputFile = ""; 53 | std::string outputFile = ""; 54 | bool compress = true; 55 | bool blockSizeFixed = false; 56 | uint32_t blockSize = 2048; 57 | uint32_t cacheSize = CACHE_SIZE_DEFAULT * (1024 * 1024); 58 | uint8_t compressionLevel = 12; 59 | bool alternativeLz4 = false; 60 | bool bruteForce = false; 61 | bool lz4hc = false; 62 | bool overwrite = false; 63 | bool hdlFix = false; 64 | std::string logFile = ""; 65 | spdlog::level::level_enum logLevel = spdlog::level::err; 66 | bool ignoreHeaderSize = false; 67 | bool keepOutput = false; 68 | }; 69 | 70 | struct summary 71 | { 72 | uint64_t sourceSize = 0; 73 | uint64_t lz4Count = 0; 74 | uint64_t lz4In = 0; 75 | uint64_t lz4Out = 0; 76 | uint64_t lz4m2Count = 0; 77 | uint64_t lz4m2In = 0; 78 | uint64_t lz4m2Out = 0; 79 | uint64_t lz4hcCount = 0; 80 | uint64_t lz4hcIn = 0; 81 | uint64_t lz4hcOut = 0; 82 | uint64_t rawCount = 0; 83 | uint64_t raw = 0; 84 | }; 85 | 86 | /////////////////////////////// 87 | // 88 | // Functions 89 | // 90 | /** 91 | * @brief Compress a block 92 | * 93 | * @param src The source data to "compress" (or not) 94 | * @param srcSize The source data size 95 | * @param dst The destination buffer to store the data. It must have enough space or will fail 96 | * @param dstSize The space in the destination buffer 97 | * @param uncompressed (output) True if the data was not compressed or false otherwise. 98 | * @param options Program options 99 | * @return uint32_t The compressed data size. Will return 0 if something was wrong. 100 | */ 101 | inline uint32_t compress_block( 102 | const char *src, 103 | uint32_t srcSize, 104 | char *dst, 105 | uint32_t dstSize, 106 | bool &uncompressed, 107 | const opt &options, 108 | summary &summaryData); 109 | 110 | inline uint32_t decompress_block( 111 | const char *src, 112 | uint32_t srcSize, 113 | char *dst, 114 | uint32_t dstSize, 115 | bool uncompressed); 116 | 117 | bool is_cdrom(std::fstream &fIn); 118 | 119 | void file_align( 120 | std::fstream &fOut, 121 | uint8_t shift); 122 | 123 | uint16_t buffer_align( 124 | char *buffer, 125 | uint64_t currentPosition, 126 | uint8_t shift); 127 | /** 128 | * @brief Prints the help message 129 | * 130 | */ 131 | void print_help(); 132 | 133 | /** 134 | * @brief Get the options object 135 | * 136 | * @param argc 137 | * @param argv 138 | * @param options 139 | * @return int 140 | */ 141 | int get_options( 142 | int argc, 143 | char **argv, 144 | opt &options); 145 | 146 | static void progress_compress(uint64_t currentInput, uint64_t totalInput, uint64_t currentOutput, uint8_t &lastProgress); 147 | static void progress_decompress(uint64_t currentInput, uint64_t totalInput, uint8_t &lastProgress); 148 | static void show_summary(uint64_t outputSize, const opt &options, const summary &summaryData); -------------------------------------------------------------------------------- /lib/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Make an automatic library - will be static or dynamic based on user setting 2 | add_library(lz4 lz4/lib/lz4.c lz4/lib/lz4hc.c) 3 | 4 | # We need this directory, and users of our library will need it too 5 | target_include_directories(lz4 PUBLIC lz4/lib/) -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_executable(ziso ziso.cpp) 2 | #target_compile_features(ziso PRIVATE cxx_std_11) 3 | target_include_directories(ziso PUBLIC 4 | ../include/ 5 | ../lib/lz4/lib/ 6 | ../lib/spdlog/include/ 7 | ) 8 | set_target_properties(ziso PROPERTIES CXX_STANDARD 23) 9 | 10 | target_link_libraries(ziso PRIVATE stdc++ -static lz4) -------------------------------------------------------------------------------- /src/ziso.cpp: -------------------------------------------------------------------------------- 1 | #include "ziso.h" 2 | #include "lz4.h" 3 | #include "lz4hc.h" 4 | #include "spdlog/sinks/basic_file_sink.h" 5 | 6 | // Arguments list 7 | const char *const short_options = "i:o:c:b:rh"; 8 | const std::vector