Skip to content

Commit

Permalink
update readme for tools and fix extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
GeffDev committed Feb 24, 2024
1 parent 7c04507 commit d0b644d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
Does the bare minimum of unpacking all data packs based off of `Pack.db` (converted to plain text). I plan on fleshing this out soon.

## Instructions
Compile, copy `files.txt` and the `Pack` folder from game files next to the executable.
Compile, copy `files.txt` and the `Pack` folder from game files next to the executable.

## Tools
`decompress_gzip.sh` - Run from inside `Pack/` to decompress all gzipped files (PVR texture files).
13 changes: 9 additions & 4 deletions src/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,20 @@ i32 extractPacks() {
strcat(full_file_path, path);
FILE *unpacked_file = fopen(full_file_path, "wb+");

// TODO: some files are under 48 bytes? which is the size of the file header?
if (remove_header && size > 0x30) {
if (remove_header) {
offset += 0x30;
size -= 0x30;
}

fseek(data_packs[pack], offset, SEEK_SET);

u8 *file_buffer = malloc(size);
u8 *file_buffer;
if (remove_header) {
file_buffer = malloc(size);
} else {
// size doesn't account for file header
file_buffer = malloc(size + 0x30);
}

if (file_buffer == NULL) {
printLog("ERROR: failed to allocate file buffer");
break;
Expand Down

0 comments on commit d0b644d

Please sign in to comment.