Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lingeringwillx authored Nov 16, 2023
1 parent 5957a08 commit 3d8da5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions dbpf-recompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int main(int argc, char *argv[]) {
string pathName = argv[fileArgIndex];

auto files = vector<filesystem::directory_entry>();
bool is_dir = false;

if(filesystem::is_regular_file(pathName)) {
auto file_entry = filesystem::directory_entry(pathName);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions qfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3d8da5f

Please sign in to comment.