PAK (Tropical Freeze): Difference between revisions

From Retro Modding Wiki
Jump to navigation Jump to search
>Aruki
No edit summary
>Aruki
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
''See [[PAK (File Format)]] for the other revisions of this format.''
''See [[PAK (File Format)]] for the other revisions of this format.''


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.
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 (as they now use a new GUID system that is used to associate IDs with various objects across the entire game), and the addition of an extra metadata section.


__TOC__
__TOC__
Line 7: Line 7:
== Format ==
== Format ==


The format begins with two [[Form Descriptor (Tropical Freeze)|form descriptors]]. Following that are three data sections: files, metadata, and strings.
The Tropical Freeze pak format contains three main header sections: [[#Resource Directory|the resource directory]], [[#Metadata|metadata]], and [[#Name Tags|name tags]].


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Count
! Name
! Description
! Description
|-
|-
| 0x0
| 0x0
| 32
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]
| '''PACK [[Form Descriptor (Tropical Freeze)|Form Descriptor]]'''
| 1
| '''Package Form Descriptor'''
| Data type is <code>PACK</code>
|-
|-
| 0x20
| 0x20
| 32
| [[Form Descriptor (Tropical Freeze)|Form Descriptor]]
| '''TOCC [[Form Descriptor (Tropical Freeze)|Form Descriptor]]'''
| 1
| '''Table of Contents Form Descriptor'''
| Data type is <code>TOCC</code>
|-
|-
| 0x40
| 0x40
| colspan=2 | End of pak header
| colspan=4 {{unknown|Header data sections (ADIR, META, and STRG) begin}}
|}
|}


=== Resource Table ===
=== Asset Directory ===


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.
The asset directory contains a list of every asset in the pak, associating a GUID with an offset/size in the file. Assets are sorted by their GUID in numerical order, which is often not the same order that they actually appear in the file.


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 24
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| '''ADIR [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]'''
| 1
| '''Asset Directory Chunk Descriptor'''
| Data type is <code>ADIR</code>
|-
|-
| 0x18
| 0x18
| 4
| u32
| '''Resource count'''
| 1
| '''Asset Count'''
|
|-
|-
| 0x1C
| 0x1C
| colspan=2 | End of file table header
| [[#Asset Entry|Asset Entry]]
| ''Asset Count''
| '''Asset Directory'''
|
|-
| colspan=5 {{unknown|End of <code>ADIR</code> section}}
|}
|}


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


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| char
| 4
| 4
| '''File type''' fourCC
| '''Asset Type'''
| This is an abbreviated fourCC that doubles as the asset's cooked file extension.
|-
|-
| 0x4
| 0x4
| 16
| GUID
| '''File ID'''
| 1
| '''Asset ID'''
|
|-
|-
| 0x14
| 0x14
| 8
| u64
| 1
| '''Offset'''
| '''Offset'''
| This is an absolute offset relative to the start of the pak file.
|-
|-
| 0x1C
| 0x1C
| 8
| u64
| 1
| '''Size'''
| '''Size'''
|
|-
|-
| 0x24
| 0x24
| colspan=2 | End of file entry
| colspan=4 {{unknown|End of asset entry}}
|}
|}


=== Metadata ===
=== 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.
The metadata section lists extra metadata for some asset types, which are associated with them via their file ID. The structure and contents of a <code>META</code> entry varies depending on the asset type; check that type's page on the Wiki to check the structure of its <code>META</code> entries.


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.
Note that a lot of formats don't have any extra metadata. If there's no assets with extra metadata in the entire pak, then the <code>META</code> section won't appear in the file at all.


{| class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 24
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| '''META [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]'''
| 1
| '''Metadata Chunk Descriptor'''
| Data type is <code>META</code>
|-
|-
| 0x18
| 0x18
| 4
| u32
| '''Metadata entry count'''
| 1
| '''Metadata Entry Count'''
|
|-
| 0x1C
| [[#Metadata Entry|Metadata Entry]]
| ''Metadata Entry Count''
| '''Metadata Entry Table'''
|
|-
| colspan=5 {{unknown|End of <code>META</code> section}}
|}
|}


{|class="wikitable"
==== Metadata Entry ====
 
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 16
| GUID
| '''Resource ID'''
| 1
| '''Asset ID'''
| This is the ID of the asset that this metadata entry is associated with
|-
|-
| 0x10
| 0x10
| 4
| u32
| '''Metadata offset''' (relative to start of the metadata section)
| 1
| '''Metadata Offset'''
| Relative to the start of the <code>META</code> section.
|-
|-
| 0x14
| 0x14
| colspan=2 | End of entry
| colspan=4 {{unknown|End of metadata entry}}
|}
|}


=== String Table ===
=== Name Tags===


The string table attaches names to certain resources to allow the game to access them directly. It's structured as follows:
The name tags section associates certain assets with string names. These are the "main" assets of the pak; any asset that does not have a name is a dependency of one of the ones that do.


{|class="wikitable"
{| class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| 24
| [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]
| '''STRG [[Chunk Descriptor (Tropical Freeze)|Chunk Descriptor]]'''
| 1
| '''Name Tags Chunk Descriptor'''
| Data type is <code>STRG</code>
|-
|-
| 0x18
| 0x18
| 4
| u32
| '''String entry count'''
| 1
| '''Name Tag Count'''
|
|-
| 0x1C
| [[#Name Tag|Name Tag]]
| ''Name Tag Count''
| '''Name Tag Table'''
|
|-
| colspan=5 {{unknown|End of <code>STRG</code> section}}
|}
|}
==== Name Tag ====


{|class="wikitable"
{|class="wikitable"
! Offset
! Offset
! Size
! Type
! Description
! Count
! Name
! Notes
|-
|-
| 0x0
| 0x0
| char
| 4
| 4
| '''Resource type''' fourCC
| '''Asset Type'''
|
|-
|-
| 0x4
| 0x4
| 16
| GUID
| '''Resource ID'''
| 1
| '''Asset ID'''
|
|-
|-
| 0x14
| 0x14
| N
| string
| '''Resource name'''; zero-terminated
| 1
| '''Asset Name'''
| Zero-terminated.
|-
|-
| 0x14 + N
| colspan=5 {{unknown|End of name tag}}
| colspan=2 | End of string entry
|}
|}


== Tools ==
== Tools ==


* [https://drive.google.com/file/d/0B9MLV21H7SDvcGc1QjRfSTFJNk0/view?usp=sharing PakTool] by Parax; can extract and decompress files from Tropical Freeze paks, but doesn't support repacking or recompressing them
* [https://www.dropbox.com/s/bba2n9jzj719by4/PakTool.rar?dl=0 PakTool] by Aruki; can extract and decompress files from Tropical Freeze paks, but doesn't support repacking or recompressing them


[[Category:File Formats]]
[[Category:File Formats]]
[[Category:Donkey Kong Country: Tropical Freeze]]
[[Category:Donkey Kong Country: Tropical Freeze]]

Latest revision as of 01:33, 13 April 2019

See PAK (File Format) for the other revisions of this format.

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 (as they now use a new GUID system that is used to associate IDs with various objects across the entire game), and the addition of an extra metadata section.

Format

The Tropical Freeze pak format contains three main header sections: the resource directory, metadata, and name tags.

Offset Type Count Name Description
0x0 Form Descriptor 1 Package Form Descriptor Data type is PACK
0x20 Form Descriptor 1 Table of Contents Form Descriptor Data type is TOCC
0x40 Header data sections (ADIR, META, and STRG) begin

Asset Directory

The asset directory contains a list of every asset in the pak, associating a GUID with an offset/size in the file. Assets are sorted by their GUID in numerical order, which is often not the same order that they actually appear in the file.

Offset Type Count Name Notes
0x0 Chunk Descriptor 1 Asset Directory Chunk Descriptor Data type is ADIR
0x18 u32 1 Asset Count
0x1C Asset Entry Asset Count Asset Directory
End of ADIR section

Asset Entry

Offset Type Count Name Notes
0x0 char 4 Asset Type This is an abbreviated fourCC that doubles as the asset's cooked file extension.
0x4 GUID 1 Asset ID
0x14 u64 1 Offset This is an absolute offset relative to the start of the pak file.
0x1C u64 1 Size
0x24 End of asset entry

Metadata

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

Note that a lot of formats don't have any extra metadata. If there's no assets with extra metadata in the entire pak, then the META section won't appear in the file at all.

Offset Type Count Name Notes
0x0 Chunk Descriptor 1 Metadata Chunk Descriptor Data type is META
0x18 u32 1 Metadata Entry Count
0x1C Metadata Entry Metadata Entry Count Metadata Entry Table
End of META section

Metadata Entry

Offset Type Count Name Notes
0x0 GUID 1 Asset ID This is the ID of the asset that this metadata entry is associated with
0x10 u32 1 Metadata Offset Relative to the start of the META section.
0x14 End of metadata entry

Name Tags

The name tags section associates certain assets with string names. These are the "main" assets of the pak; any asset that does not have a name is a dependency of one of the ones that do.

Offset Type Count Name Notes
0x0 Chunk Descriptor 1 Name Tags Chunk Descriptor Data type is STRG
0x18 u32 1 Name Tag Count
0x1C Name Tag Name Tag Count Name Tag Table
End of STRG section

Name Tag

Offset Type Count Name Notes
0x0 char 4 Asset Type
0x4 GUID 1 Asset ID
0x14 string 1 Asset Name Zero-terminated.
End of name tag

Tools

  • PakTool by Aruki; can extract and decompress files from Tropical Freeze paks, but doesn't support repacking or recompressing them