In the Groove PCK

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(documenting a weird game archive I ran into a while ago)
 
m (implementation notes)
Line 1: Line 1:
 
{{FormatInfo
 
{{FormatInfo
 
| extensions = pck
 
| extensions = pck
 +
| formattype = electronic
 +
| mimetypes =
 
| released = 2004
 
| released = 2004
 
}}
 
}}
Line 21: Line 23:
 
| 0 + 4 || Magic identifier || Must contain the string "PCKF". Files lacking this identifier will be rejected by ITG.
 
| 0 + 4 || Magic identifier || Must contain the string "PCKF". Files lacking this identifier will be rejected by ITG.
 
|-
 
|-
| 4 + 128 || Archive name || 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.
+
| 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.
 
| 132 + 4 || File count || Number of files in the archive.
Line 54: Line 56:
 
     compressed_data = zlib.compress(data, 9)[2:]
 
     compressed_data = zlib.compress(data, 9)[2:]
 
     decompressed_data = zlib.uncompress(data, -15)
 
     decompressed_data = zlib.uncompress(data, -15)
 +
 +
== Implementation notes ==
 +
 +
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.

Revision as of 07:18, 17 January 2013

File Format
Name In the Groove PCK
Ontology
Extension(s) pck
Released 2004

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.

Contents

Format details

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.

Header

A PCK archive always begins with a 132-byte header:

Offset Contents Details
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.

File table

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:

Offset Contents Details
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.

File data

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)

Implementation notes

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.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox