PAK (Metroid Prime): Difference between revisions

Jump to navigation Jump to search
no edit summary
>Aruki
(Created page with "The '''.pak format''' in Metroid Prime is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) o...")
 
>Aruki
No edit summary
Line 1: Line 1:
The '''.pak format''' in Metroid Prime is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.
The '''.pak format''' in Metroid Prime and Metroid Prime 2 is a fairly simple packfile format; files are stored with a 32-bit file ID, and can optionally be compressed with zlib (Metroid Prime) or LZO1X-999 (Metroid Prime 2). The assets in a pak are split into two groups: named resources and dependencies. In general, only named resources are accessed directly by the game; the rest are dependencies of the named resources, and are accessed indirectly in the process of parsing those files.


Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number isn't even any different, so there isn't an easy way to check for this variation of the format.
Note that the Metroid Prime 3 E3 prototype uses this pak format as well, but has 64-bit file IDs. This is the only difference; the version number isn't even any different, so there isn't an easy way to check for this variation of the format.
Line 83: Line 83:
| 0xC
| 0xC
| 4
| 4
| '''Offset'''
| '''Size'''
|-
|-
| 0x10
| 0x10
| 4
| 4
| '''Size'''
| '''Offset'''
|-
|-
| 0x14
| 0x14
| colspan=2 | End of entry
| colspan=2 | End of entry
|}
|}
== Compression ==
Compressed files begin with their 32-bit decompressed size, followed by the compressed file data. Metroid Prime uses zlib, which is easily recognized from zlib's 0x78DA header at the start of the compressed data. Each file is compressed as a single zlib stream.
Metroid Prime 2 uses LZO1X-999, and gets slightly more complicated. Metroid Prime 2's compressed files are split up into multiple blocks of compressed data, each of which is 0x4000 bytes large when decompressed (except for the last one) and should be compressed and decompressed separately. Each block begins with a 16-bit size value before its actual compressed data begins.
== File Order ==
File order matters significantly and easily makes the difference between a pak loading quickly and optimally, or taking 30+ seconds on every door. While more research is required to figure out exactly how files should be ordered to optimize loading, the game generally clusters together resources that are used together, and a file's dependencies generally appear directly before the file itself. The game also often duplicates assets that are used multiple times within the same pak; there might be 10-11 copies of the same model file in order to allow the game to more easily find and load that file when it needs it.
Anonymous user

Navigation menu