# HG changeset patch # User Matti Hamalainen # Date 1425218916 -7200 # Node ID d29058e937995f37929aaad72a14739201bf9ad3 # Parent 16e63811d0c2a8c0155c5b11ad080309dbcee329 Add option for setting the zlib compression level. diff -r 16e63811d0c2 -r d29058e93799 tools/packed.c --- a/tools/packed.c Sun Mar 01 16:07:45 2015 +0200 +++ b/tools/packed.c Sun Mar 01 16:08:36 2015 +0200 @@ -36,6 +36,7 @@ char * optPackFilename = NULL; BOOL optCompress = TRUE; +int optCompressLevel = Z_BEST_COMPRESSION; int optCommand = CMD_NONE; int optDefResFlags = 0; @@ -49,6 +50,7 @@ { 4, 'l', "list", "List files in PACK", OPT_NONE }, { 5, 'e', "extract", "Extract files from PACK", OPT_NONE }, { 6, 'n', "nocompress", "No compression / decompression", OPT_NONE }, + { 10, 'C', "level", "Set zlib compression level 1-9", OPT_ARGREQ }, { 7, 'v', "verbose", "Increase verbosity", OPT_NONE }, { 8, 'f', "resflags", "Set default resource flags (-f 0xff)", OPT_ARGREQ }, { 9, 'x', "exclude", "Exclude name/glob pattern from add", OPT_ARGREQ }, @@ -130,6 +132,15 @@ } break; + case 10: + optCompressLevel = atoi(optArg); + if (optCompressLevel < 1 || optCompressLevel > 9) + { + dmErrorMsg("Invalid compression level argument '%s', must be 1 .. 9.\n", optArg); + return FALSE; + } + break; + default: dmErrorMsg("Unknown argument '%s'.\n", currArg); return FALSE; @@ -651,7 +662,7 @@ DMPackEntry *node = NULL; int res = dmPackAddFile(pack, srcFilenames[i], optDefResFlags, optCompress, - Z_DEFAULT_COMPRESSION, &node); + optCompressLevel, &node); if (res != DMERR_OK) {