Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repacking support #3

Open
pschord opened this issue Jul 2, 2016 · 2 comments
Open

Repacking support #3

pschord opened this issue Jul 2, 2016 · 2 comments

Comments

@pschord
Copy link
Member

pschord commented Jul 2, 2016

We want to be able to REPACK game files after editing them.

The general idea is there is a .PAK file that has a bunch of assets with in it. In order to repack, there needs to be a way to gather up all unpacked files, recompress them, and rebuild the index in the beginning of the PAK.

@shaql2
Copy link
Contributor

shaql2 commented Jul 3, 2016

For repacking, we need to Reverse Engineer the format a bit further:

In pack_index_entry, as far as I've seen, unk1 and unk3 are always 0, it should be safe to assume that while repacking; unk4 is simply the decompressed size; unk5 may be some crc32 or other checksum - note that it's 0x00000000 in case of an empty file.

In the PACK's header, the third unknown uint32 is the number of files packed (could be useful for simplifying decompressing too?); the first one is always 0x02 (possibly version, knowing SOE), the second is decompressed index size. So the whole PACK header is as follows:
"PACK", 0x02, compressed index size, decompressed index size, numFiles, unk3, unk4

@pschord
Copy link
Member Author

pschord commented Jul 20, 2016

Steps to repack:

  1. Select directory to pack
  2. Get list of all files
  3. Compress all files (either in memory or back to disk)
  4. Build pack index from files
  5. Compress pack index
  6. Write pack header off of the above information
  7. Finalize file from provided filename

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants