SEAD > Archives (SARC)

This page describes version 0x100 of the file format.

OffsetSizeDescription
0x04Magic number (SARC)
0x42Header size (must be 0x14)
0x62Endianness (0xFEFF=Big, 0xFFFE=Little)
0x84Filesize
0xC4Offset to data section
0x102Version number
0x122Padding
0x14SFAT section
SFNT section
Data section

Certain files, such as textures, have specific alignment requirements. For this reason, there may be padding between the SFNT and data section, and between individual files within the data section.

SFAT Section

The hash multiplier is always 101 in official files.

OffsetSizeDescription
0x04Identifier (SFAT)
0x42Header size (must be 0xC)
0x62Number of files (up to 0x3FFF)
0x84Hash multiplier
0xCFAT entries (one per file)

FAT entry

These must be sorted by filename hash, because they are looked up with a binary search algorithm.

OffsetSizeDescription
0x04Filename hash
0x44Filename attributes (see below)
0x84Offset into data section (start of file)
0xC4Offset into data section (end of file)

Filename Hash

The filename hash is calculated as follows, using the hash multiplier from the SFAT header:

def calculate_hash(filename, multiplier):
    hash = 0
    for byte in filename:
        hash = hash * multiplier + byte
    return hash & 0xFFFFFFFF

In Switch games, each byte of the filename is sign extended. This is important if the filename uses non-ascii characters.

Filename Attributes

If this field is zero, the archive contains exactly one file with the given hash and no filename is stored.

Otherwise, this field is stored as 0xAABBBBBB. For a given hash, AA starts at 1 and is incremented on every FAT entry that has the same hash. In practice, AA is almost always 1 because the probability of hash collisions is quite low. BBBBBB is an offset into the filename table divided by 4.

SFNT Section

This section simply contains an array of filenames. Each filename is a null-terminated string, and must be aligned on 4 bytes.

OffsetSizeDescription
0x04Identifier (SFNT)
0x42Header size (must be 8)
0x62Padding
0x8Filename table