U8 archive

From WiiBrew
Jump to: navigation, search

The U8 archive is an archive format used in content.bin and opening.bnr, as well as in certain games such as Mario Kart Wii and New Super Mario Brother's Wii as .arc, .carc or .szs files. It contains no compression or encryption by itself; it is just a way to attach files in a directory structure together.

There is a tool available, parse-u8.c, which will split an U8 archive into a file structure.

(The name U8 is not official, but what I call it, from the pronounceable letters of the tag viewed as ASCII. Magicus 15:55, 1 March 2008 (PST))

Description

First comes a header:

struct U8_archive_header
{
 u32 tag; // 0x55AA382D "U.8-"
 u32 rootnode_offset; // offset to root_node, always 0x20.
 u32 header_size; // size of header from root_node to end of string table.
 u32 data_offset; // offset to data -- this is rootnode_offset + header_size, aligned to 0x40.
 u8 zeroes[16];
};

Then comes a series of file nodes. The first one is the root node; it determines how many nodes there are in total.

struct U8_node 
{
 u16 type; //this is really a u8
 u16 name_offset; //really a "u24"
 u32 data_offset;
 u32 size;
};

After the file nodes is the string table, which extends to the rest of the header. The name_offset gives the offset from the start of the string table to the start of this file's name. This is used for both files and directories.

For normal files, type is 0x0000. In this case the data_offset gives the address to where the data for this file is. This is given as an absolute offset from the start of the U8 header. The size is the size of the file.

For directories, type is 0x0100. In this case, the data_offset has no meaning. (It seems to be 0 or 1; it might signify the level of recursion even though this is redundant. In Mario Kart Wii U8 Files, it specifies the parent directory of the current directory, with the root directory specifying itself) The size field is used to indicate which files are included in this directory. The value given is the node number of the last file included, counting the root node as node number 1.

An example: In opening.bnr, there are five nodes:

1: root
2: "meta"
3: "banner.bin"
4: "icon.bin"
5: "sound.bin"

The root and "meta" are directories. Both of them have 5 as their size, which means that sound.bin is the last file included in the root directory, and it also is the last file included in the meta directory.

Personal tools
Resources
Community