PAK (Tropical Freeze)

Revision as of 18:37, 23 January 2015 by >Aruki (Created page with "The '''.pak format''' in Donkey Kong Country: Tropical Freeze is the third version of the .pak format, with another layout overhaul, file IDs being extended from 64 bits to 12...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The .pak format in Donkey Kong Country: Tropical Freeze is the third version of the .pak format, with another layout overhaul, file IDs being extended from 64 bits to 128 bits, and the addition of an extra metadata section.

Format

The format begins with two RFRM headers. Following that are three data sections: files, metadata, and strings.

Offset Size Description
0x0 32 "PACK" RFRM header
0x20 32 "TOCC" RFRM header
0x40 End of pak header

Resource Table

The resource table lists files sorted by their file ID in numerical order; they're often not listed in the same order that they actually appear in the file.

Offset Size Description
0x0 24 "ADIR" section header
0x18 4 Resource count
0x1C End of file table header

Following this header are resource entries, which are structured as follows:

Offset Size Description
0x0 4 File type fourCC
0x4 16 File ID
0x14 8 Offset
0x1C 8 Size
0x24 End of file entry

Metadata

The metadata section lists extra data for certain resource types, which are associated with them via their file ID. The structure and contents of a metadata entry varies depending on the resource type; check that type's page on the Wiki to check its structure.

If there's no resources with metadata attached to them in the entire pak, then the metadata section won't exist at all; make sure you check for that.

Offset Size Description
0x0 24 "META" section header
0x18 4 Metadata entry count
Offset Size Description
0x0 16 Resource ID
0x10 4 Metadata offset (relative to start of the metadata section)
0x14 End of entry

String Table

The string table attaches names to certain resources to allow the game to access them directly. It's structured as follows:

Offset Size Description
0x0 24 "STRG" section header
0x18 4 String entry count
Offset Size Description
0x0 4 Resource type fourCC
0x4 16 Resource ID
0x14 N Resource name; zero-terminated
0x14 + N End of string entry