RARC (File Format)

From Custom Mario Kart
Revision as of 17:01, 9 December 2016 by Wexos (talk | contribs) (→‎Info Block)
Jump to navigation Jump to search

RARC files (Revolution ARChive) are archive files used in some Wii games, such as Super Mario Galaxy 1 & 2. The directories is always stored inside a root node. Compared to U8, this root node is always named.

File Format

Header

The file starts with a header that is 0x20 bytes long:

Offset Type Description
0x00 String File magic. Always RARC in ASCII.
0x04 UInt32 Length of the file in bytes.
0x08 UInt32 Length of this header in bytes. Always 0x20.
0x0C UInt32 Offset to the file data. Relative to the end of this header.
0x10 UInt32 Length of the file data.
0x14 UInt32 Length of the file data again? Always the same as the previous value.
0x18 UInt32 Unknown.
0x1C UInt32 Unknown.

Info Block

Directly after the header comes the info block. It is a 0x20 bytes structure:

Offset Type Description
0x00 UInt32 Number of nodes.
0x04 UInt32 Offset to the first node. Relative to the start of this block.
0x08 UInt32 Number of directories.
0x0C UInt32 Offset to the first directory. Relative to the start of this block.
0x10 UInt32 Length of the whole string table.
0x14 UInt32 Offset to string table. Relative to the start of this block.
0x18 UInt16 Number of directories again?
0x1A UInt16 Unknown.
0x1C UInt32 Unknown.

Node

A node represente a folder. There is a root folder which links to other files and folders. Each node is a 0x14 bytes structure:

Offset Type Description
0x00 String Some kind of identifier. The root has ROOT, other nodes have their first 4 characters of the name in upper case.
0x04 UInt32 Offset to a string into the string table. Relative to the start of the string table.
0x08 UInt16 Seems to be a hash of the name.
0x0A UInt16 Number of directories in this folder.
0x0C UInt32 The index of the directory.

Directory

A directory can either be a file or a folder. If it's a folder, then it refers to a node.

Offset Type Description
0x00 UInt16 Index of this directory. 0xFFFF if it's a folder.
0x02 UInt16 Seems to be a hash of the name.
0x04 UInt16 Unknown.
0x06 UInt16 Offset to a string into the string table. Relative to the start of the string table.
0x08 UInt32 File: Offset to file data.
Folder: Index of the node that represente this folder.
0x0C UInt32 Length of the file data in bytes. Unused if this is a folder.
0x10 UInt32 Unknown.

String Table

The string table consist of null-termined strings. The offset and length of this string table is stored in the info block.

Tools

The following tools can handle RARC files: