feat: Add CLI arguments for decompression options
This commit is contained in:
parent
3e9abd62c9
commit
6e10d022e5
1 changed files with 12 additions and 2 deletions
|
@ -35,6 +35,8 @@ void usage() {
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -v Increase Oodle's verbosity. May be specified up to three times.\n"
|
" -v Increase Oodle's verbosity. May be specified up to three times.\n"
|
||||||
" -c Only check if the library can be found and used.\n"
|
" -c Only check if the library can be found and used.\n"
|
||||||
|
" --fuzz-safe Use fuzz safe decompression.\n"
|
||||||
|
" --check-crc Check CRC during decompression.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The following environmental variables are recognized:\n"
|
"The following environmental variables are recognized:\n"
|
||||||
" DLL_SEARCH_PATH: A color (':') separated list of directories to search for the Oodle library. May be relative to the current working directory.\n";
|
" DLL_SEARCH_PATH: A color (':') separated list of directories to search for the Oodle library. May be relative to the current working directory.\n";
|
||||||
|
@ -67,6 +69,8 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int verbosity = 0;
|
int verbosity = 0;
|
||||||
bool check_lib = FALSE;
|
bool check_lib = FALSE;
|
||||||
|
OodleLZ_FuzzSafe fuzz_safe = OodleLZ_FuzzSafe_No;
|
||||||
|
OodleLZ_CheckCRC check_crc = OodleLZ_CheckCRC_No;
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
for (; i < argc; i++) {
|
for (; i < argc; i++) {
|
||||||
|
@ -86,6 +90,12 @@ int main(int argc, char* argv[])
|
||||||
else if (strcmp(arg, "-v") == 0) {
|
else if (strcmp(arg, "-v") == 0) {
|
||||||
verbosity++;
|
verbosity++;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(arg, "--fuzz-safe") == 0) {
|
||||||
|
fuzz_safe = OodleLZ_FuzzSafe_Yes;
|
||||||
|
}
|
||||||
|
else if (strcmp(arg, "--check-crc") == 0) {
|
||||||
|
check_crc = OodleLZ_CheckCRC_Yes;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
std::cerr << "ERROR: Unknown option '" << arg << "'!\n\n";
|
std::cerr << "ERROR: Unknown option '" << arg << "'!\n\n";
|
||||||
usage();
|
usage();
|
||||||
|
@ -186,8 +196,8 @@ int main(int argc, char* argv[])
|
||||||
compressed_buffer.size(),
|
compressed_buffer.size(),
|
||||||
raw_buffer.data(),
|
raw_buffer.data(),
|
||||||
raw_buffer_size,
|
raw_buffer_size,
|
||||||
OodleLZ_FuzzSafe_Yes,
|
fuzz_safe,
|
||||||
OodleLZ_CheckCRC_No,
|
check_crc,
|
||||||
(OodleLZ_Verbosity)verbosity,
|
(OodleLZ_Verbosity)verbosity,
|
||||||
nullptr,
|
nullptr,
|
||||||
0,
|
0,
|
||||||
|
|
Reference in a new issue