Skip to content

Instantly share code, notes, and snippets.

@RoyAwesome
Created September 14, 2012 02:55
Show Gist options
  • Save RoyAwesome/169c657b091bf356f7fd to your computer and use it in GitHub Desktop.
Save RoyAwesome/169c657b091bf356f7fd to your computer and use it in GitHub Desktop.
.pack file notes
Data is big endian.
Pack files have many sub packs. Each Subpack has an 8 byte header and a list of files in the Subpack.
Subpack Header:
First 4 bytes: uint. offset to the next subpack. 0 denotes the last subpack.
Second 4 bytes: uint. number of files in the sub pack
File List - Has a list of all files. Each entry in the file list table is variable length, but has atleast 16 bytes of data.
4 bytes - string length
string - File name. Not NUL terminated.
4 bytes - Offset into the .pack where the file is located
4 bytes - File Size
4 bytes - checksum
File Data
offset and size are denoted in the file list. Just seek to the offset and read in size bytes.
This pattern repeats multiple times until the first 4 bytes of the subpack header is 0.
@Jakobud
Copy link

Jakobud commented Sep 15, 2012

FYI regarding your ps2unpacker, there is a bug in the output. When it goes through and echos the names of the files it's reading and writing, it prints out a different list of files than what it actually writes out. For each Sub-Pack, the list of files is the same. For example, the first file of SubPack 4, is printed out as being the same file as the first file of SubPack 1... This is only a visual bug though, as it appears that the files do get written properly with the correct filenames and file sizes.

@RoyAwesome
Copy link
Author

Yeah, that's because I derp'd and made it always look at filename[0].

@Jakobud
Copy link

Jakobud commented Sep 16, 2012

I know you have the source code available for download via that Dropbox link but do you have it on github also?

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