Skip to content

Formats

Rena Kunisaki edited this page Nov 19, 2021 · 4 revisions

Common File Formats

Most can be identified by their four-byte signature.

E0E0E0E0

Header for some non-compressed data.

Offset Type Description
000000 u8[4] Signature: 0xE0, 0xE0, 0xE0, 0xE0
000004 u32 Length of data, in bytes
000008 u32 Offset of data (add 0x18 to this value)
00000C ? Presumably extra metadata goes here?

Following is uncompressed data of any format.

F0F0F0F0

Similar to E0E0E0E0, but for compressed data. Not sure if this is used in the final version.

Offset Type Description
000000 u8[4] Signature: 0xF0, 0xF0, 0xF0, 0xF0
000004 u32 Length of decompressed data, in bytes
000008 u32 Offset of data (add 0x28 (not 0x18) to this value)
00000C u32 Length of compressed data, in bytes
000010 ? Presumably extra metadata goes here?

In default.dol what follows is expected to be LZO-compressed.

FACEFEED

Header for some formats (mainly models) that allows some context-specific data to be added.

Offset Type Description
000000 u8[4] Signature: 0xFA, 0xCE, 0xFE, 0xED
000004 u32 Length of uncompressed data, in bytes
000008 u32 Offset of ZLB data (skips header)
00000C u32 Length of compressed data, in bytes
000010 ? zero or more words, whose count is in field 8, including ZLB header.

The full size of the header is (offset - 3) * 4 (where offset is field 0x8).

Often, what follows is a ZLB header, or 0xE0E0E0E0 signature.

LZO

Unknown compressed data format. Expected by default.dol, but no files are available in this format. Seems to be simpler than ZLB.

TAB

Table file. These don't have a specific format or signature, but most are one of three types:

  • An array of u32 offsets. In some cases the actual offset is this value times 2 or 4.
  • An array of u32 offsets in which the high bits have special meaning.
    • Usually, 0x10 means load from this map, 0x20 means load from the other loaded map (??? why?), 0x00 means don't load this (ie the asset isn't present in this map), and the other bits are ignored.
    • In the case of textures, 0x80 and 0x40 tell which map to load for/from, and the remaining 6 bits are a count telling how many mipmaps and/or animation frames the texture has.
  • An array of u16 offsets or indices. Usually these map IDs to indices into a table file; eg MODELIND.bin is an array of indices into MODELS.tab, with each element corresponding to a model ID.

ZLB

Standard zlib deflated data.

Offset Type Description
000000 u8[4] Signature: 0x5A, 0x4C, 0x42, 0x00 (ASCII ZLB\0)
000004 u32 Version (always 1)
000008 u32 Length of uncompressed data, in bytes
00000C u32 Length of compressed data, in bytes
000010 - Compressed data

The Python zlib module, or indeed any ordinary implementation of zlib, can read and write this format. The game seems to use parameters level=9, wbits=13 but can decompress with any parameters.

DIR

"Direct", ie uncompressed data. Used in place of ZLB when the compression is unhelpful (eg for already-compressed texture formats). Signature is DIR\0 or DIRn. Only supported for certain types of assets. (maybe only textures?) The header is the same format as ZLB; the two length fields should be the same, though the game only appears to check the latter field.

Clone this wiki locally