U8 archive

From WiiBrew
Jump to navigation Jump to search

The U8 archive (file extension can be as .arc, .carc or .szs) is an archive format used in various content files such as opening.bnr. It contains no compression or encryption by itself; it is just a way to attach files in a directory structure together.

The name U8 is not official, but what the homebrew scene calls it, based on the pronounceable letters of the tag viewed as ASCII.

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.

Tools

Name Language Author Description
parse-u8.c C magicus Extracts the contents of an U8 archive to a file structure.
Wii U8 Archive Extractor Perl Fybertech Simple Perl script to extract an U8 archive.