Donkey Kong Country Returns Hacking
Users browsing this thread: 1 Guest(s)

Donkey kong country returns hacking for the win! I was able to decode .Pak and wrote a tool for it.

The Pak documentation. (Only version 2)
File Header
The file begins with a header which has a length of 0x80.

Offset Size Description
0x00 8 Unknown (Allways 0x0000000200000040)
0x08 16 Unknown
0x18 40 Null bytes
0x40 4 Section Count (Always 3 because PAK doesn't have more sections)
0x44 4 Magic "STRG" (STRG section)
0x48 4 Length of STRG section
0x4c 4 Magic "RSHD" (RSHD section)
0x50 4 Length of RSHD section
0x54 4 Magic "DATA" (DATA section)
0x58 4 Length of DATA section
0x5c 24 Null bytes
0x80 # End of header

The PAK file was make of three sections, which start from 0x80.

Section Description
STRG This section is used to store string data. such as file-names.
RSHD This section is the "Navigation" of the DATA section. This is important because it gives the files a ID
DATA This section contains all the files of the PAK. Compression on these files is a option.

STRG section

The string section starts with 4 bytes [00 00 00 01]. The last byte depends on how the PAK is used. Level PAKs use 01.

Each string contains the following information,
- The filename
- The extention of 0x05 bytes (a dot with 4 bytes of the extention name)
- The ID of the file it is assigned to. Length of 0x08 bytes

[53 41 56 57 5F 6C 30 32 5F 6A 75 6E 67 6C 65 5F 63 6C 69 6E 67] - File-name (reads SAVW_l02_jungle_cling)
[00 53 41 56 57] - Extention (reads .SAVW)
[5D C4 49 31 ED AC 51 B7] - File ID in hex

The section ends with a series of 00.

RSHD section

The RSHD section is made of little blocks of information for the DATA section. A block of information is 18 bytes long and gives a file the ID, extention and gives the whole length of the file in the DATA section.

A file block is made as follows:

Offset Size Description
0x00 4      Compressed or not (0x01 is compressed)
0x04 4 Magic (extension)
0x08 8 File ID
0x10 4 Length of File data (In the DATA section)
0x14 4 Pointer to File (Starts at the beginning of the DATA section)

DATA section

This is where all the file data is located.
MLVL documentation
This file contains meta-data, like what the main level model is and such. sadly this file is pretty useless and wasted my time on doing research on it. its possible to remove the file from the PAK and the game will still work. (only tested in dolphin)

Offset Size Description
0x00 4 Compression or uncompressed
0x04 4 Unknown (Always 0x0000001b)
0x08 8 ID of a .STRG
0x10 4 Level Number (string)
0x25 8 ID of a .SAWV
0x89 8 ID of a .MREA
0x9d N Filename of the PAK (N = Length of name in bytes)
0x9d+N 1 Null bytes
0x9e+N 4 01 command
0xa2+N 4 ?? (0x00000005)
0xa6+N 8 Always [0xFFFFFFFFFFFFFFFD]

and later in the mlvl you will find "string" data

My tool for Viewing and exporting files. Save buttons don't work yet.
CR PakTool v1
CR PakTool v2 - Added import button
[Image: get.php?id=GfU4lYzPs3996ikm]
(This post was last modified: 08-03-2016, 08:52 AM by Jesse.)

Donkey Kong Country Returns Hacking
Users browsing this thread: 1 Guest(s)