3D:ZAR format
The ZAR format (Zelda Archive) is an archive format used in OoT 3D.
Structure
This section documents the structure of the file format.
Header
Offset | Type | Description |
---|---|---|
0000 | char[4] | Magic ("ZAR\1") |
0004 | u32 | Size of archive |
0008 | u16 | #types |
000A | u16 | #files |
000C | u32 | Offset to filetypes section |
0010 | u32 | Offset to file-metadata section |
0014 | u32 | Offset to data section |
0018 | char[8] | "queen" |
Filetypes section
Consists of a number of filetype entries. Each filetype is associated with a number of compressed files. Contains a table of 16-byte entries as detailed below, one entry for each of the [#types] filetypes (see main header).
Offset | Type | Description |
---|---|---|
0000 | u32 | #files |
0004 | u32 | Offset to files list |
0008 | u32 | Offset to type name |
000C | u32 | Unknown (always -1?) |
At [offset to files list] is a list of [#files] u32's, each corresponding to a file index (0 refers to the first file, etc). These lists and the type names are stored immediately afterwards within the section.
The number of filetypes vary between 2 and 8 in known files, and "unknown" is always the first type (even if it contains no files). Known filetype names are "anb", "ccb", "cmab", "cmb", "csab", "ctxb", "faceb", "qdb", "tbd", "unknown", "zsi". The only archive containing an "unknown" file is actor/zelda_magic_wind.zar, which contains Anim/new_magic_wind.cskla.
File metadata section
Consists of one entry for each file in the archive ([#files] in the main header).
Offset | Type | Description |
---|---|---|
0000 | u32 | File size |
0004 | u32 | Offset to filename |
The filenames are stored immediately afterwards within the section.
Data section
Consists of one u32 for each file in the archive, representing the offset to the file's data. The length of the file's data is taken from the metadata section above.
The offsets are immediately followed by the actual data, within the section.