From 3d8da5f9eccf2c2643568450984488aa871066cd Mon Sep 17 00:00:00 2001 From: lingeringwillx <111698406+lingeringwillx@users.noreply.github.com> Date: Thu, 16 Nov 2023 05:55:23 +0300 Subject: [PATCH] . --- dbpf-recompress.cpp | 10 ++++++---- qfs.h | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dbpf-recompress.cpp b/dbpf-recompress.cpp index 81fe646..f148ffa 100644 --- a/dbpf-recompress.cpp +++ b/dbpf-recompress.cpp @@ -46,6 +46,7 @@ int main(int argc, char *argv[]) { string pathName = argv[fileArgIndex]; auto files = vector(); + bool is_dir = false; if(filesystem::is_regular_file(pathName)) { auto file_entry = filesystem::directory_entry(pathName); @@ -57,7 +58,7 @@ int main(int argc, char *argv[]) { files.push_back(file_entry); } else if(filesystem::is_directory(pathName)) { - + is_dir = true; for(auto& dir_entry: filesystem::recursive_directory_iterator(pathName)) { if(dir_entry.is_regular_file() && dir_entry.path().extension() == ".package") { files.push_back(dir_entry); @@ -77,10 +78,11 @@ int main(int argc, char *argv[]) { float current_size = dir_entry.file_size() / 1024.0; string displayPath; //for cout - if(filesystem::is_regular_file(pathName)) { - displayPath = fileName; - } else { + + if(is_dir) { displayPath = filesystem::relative(fileName, pathName).string(); + } else { + displayPath = fileName; } fstream file = fstream(fileName, ios::in | ios::binary); diff --git a/qfs.h b/qfs.h index 1d4ba35..7b0402f 100644 --- a/qfs.h +++ b/qfs.h @@ -186,11 +186,11 @@ static int qfs_compress(const unsigned char* src, int srclen, unsigned char* dst #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -// corresponds to zlib compression level 6 +// corresponds to zlib compression level 5 #define GOOD_LENGTH 8 #define MAX_LAZY 16 -#define NICE_LENGTH 128 -#define MAX_CHAIN 128 +#define NICE_LENGTH 32 +#define MAX_CHAIN 32 #define HASH_BITS 16 #define HASH_SIZE 65536