In the Groove PCK
The rhythm dancing game In the Groove internally uses several PCK archive files to store game data. The format is not publicly documented, but has been reverse-engineered.
A PCK archive consists overall of three segments: a short fixed header, a table listing file locations and details, and file data (which may be compressed).
Within the file, all strings are ASCII (the behavior of high-bit strings is unknown, as it is not used), all numbers are stored as little-endian 32-bit integers, and all sizes are in bytes.
A PCK archive always begins with a 132-byte header:
|0 + 4||Magic identifier||Must contain the string "PCKF". Files lacking this identifier will be rejected by ITG.|
|4 + 128||Comment||Contains a null-terminated string describing the archive's contents. This data is never displayed to the user; it is only shown in a few debug messages.|
|132 + 4||File count||Number of files in the archive.|
Immediately following the header is a list of the files contained in the archive. The order can be arbitrary. Each file is described with the following variable-length structure:
|0 + 4||Data size||Size of the file being described.|
|4 + 4||Compressed size||Size of the file within the archive. Equal to the data size if the file is not compressed.|
|8 + 4||Data offset||Byte offset within the archive where the data for this file begins.|
|12 + 4||Name length||Length of the filename|
|16 + 4||Compress flag||1 if the file is compressed, 0 if not.|
|20 + n||File name||Name of the file. Unterminated -- next file table entry immediately follows the last byte.|
While the data for files can technically be arranged however desired, in practice each file is stored in the same order given in the file table, at offsets specified in that table.
If the compress flag is set for a file, the data for that file is deflated using zlib. The following Python code can be used to implement compression and decompression:
compressed_data = zlib.compress(data, 9)[2:] decompressed_data = zlib.uncompress(data, -15)
In The Groove reads data from PCK files with the following file names and comments (for ITG r2 Mac, other versions may vary):
- DD70BA0B.PCK ("default base branding")
- DBFEE9B0.PCK ("default base other")
- DDF0C003.PCK ("default patch base")
- D82CA1FD.PCK ("default base song")
- D673D8A8.PCK ("default base movies")
- DC37F75E.PCK ("default packa song")
- D1513758.PCK ("default packa movies")
- D4D500B4.PCK ("default packa other")
The names and expected lengths of these files are hard-coded into the binary. Files with other names will not be examined, and larger / smaller files will cause game startup to fail.