BFSAR (File Format)

From MK8
(Redirected from BFSAR)
Jump to navigation Jump to search

A BFSAR file is an archive containing sound effects. In NSMBU, it also contains all music streams, but I don't think this is the case for MK8.


I found this information by reverse engineering NSMBU and analyzing the bfsar files of NSMBU, SM3DW and Splatoon. I think the same applies to MK8, but since I don't have MK8's files, I can't assure this.


Offset Size Type Description
0x00 4 Char[4] Magic ("FSAR")
0x04 2 UInt16 Endianness. 0xFEFF is big endian, 0xFFFE is little endian
0x06 2 UInt16 Header size. Always 0x0040.
0x08 4 UInt32 Version number
0x0C 4 UInt32 File size of the entire file.
0x10 2 UInt16 Section count. Always 3.
0x12 2 Padding.
0x14 3 × 12 SectionInfo[3] Section info. 3 structures describing the offsets to and sizes of the bfsar sections.
0x38 8 ? Unknown, possibly alignment. Always 0.

Section information

Offset Size Type Description
0 2 UInt16 Identifier. Specifies which section it describes. 0x2000 is the STRG section, 0x2001 is INFO and 0x2002 is FILE.
2 2 Padding.
4 4 UInt32 Offset
8 4 UInt32 Size

STRG Section

This section contains a string table and data about the string.

Offset Size Description
0x00 4 ASCII identifier ("STRG")
0x04 4 Section size
0x08 4 Unknown. Always 0x24000000
0x0C 4 String table offset, relative to field 0x08 of the STRG section.
0x10 4 Unknown. Always 0x24010000
0x14 4 Offset to lookup table, relative to field 0x08 of the STRG section.

String table

The string table contains structures that point to null terminated strings. All offsets are relative to the start of the string table. It starts with a string count and then contains:

Offset Size Description
0 4 Unknown. Always 0x1F010000.
4 4 Offset to null terminated string.
8 4 Size of null terminated string.

Lookup table

This table is used to get the string table index and other data for a string. It starts with 8 bytes of data:

Offset Size Description
0x00 4 Index of the table entry where it starts.
0x04 4 Unknown. Seems to be some kind of index too. Must be higher than the other index.
0x18 4 Count of audio names.

And is then followed by 0x14 byte structures:

Offset Size Description
0x00 2 Endpoint. 0 if this is an entry that links to another list entry. 1 if the string has been found and the entry contains data about it.
0x02 2 String bit. This bit in the string that's being searched for decides with which entry the search should continue.
0x04 4 This is the table index of the next entry if the string bit is 0.
0x08 4 This is the index of the next entry if the string bit is 1.
0x0C 4 String table index if this structure is an endpoint.
0x10 1 Data about the file. 1 if it's an audio file (SE/WSD/STRM), 2 if it's a WSDSET or SEQSET, 3 is a BANK, 4=PLAYER and 6=GROUP.
0x11 3 File id

INFO Section

All offsets in this header are relative to the start of the INFO section + 8.

Offset Size Description
0x00 4 Magic ("INFO")
0x04 4 Size of INFO section.
0x08 4 Unknown. Always 0x21000000
0x0C 4 Audio list offset (SE/WSD/STRM)
0x10 4 Unknown. Always 0x21040000
0x14 4 Audio set list offset (WSDSET/SEQSET)
0x18 4 Unknown. Always 0x21010000
0x1C 4 Bank list offset
0x20 4 Unknown. Always 0x21030000
0x24 4 Unknown offset.
0x28 4 Unknown. Always 0x21050000
0x2C 4 Group list offset
0x30 4 Unknown. Always 0x21020000
0x34 4 Player list offset
0x38 4 Unknown. Always 0x21060000
0x3C 4 Unknown offset.
0x40 4 Unknown. Always 0x220B0000
0x44 4 Unknown offset.

Each list starts with the amount of list entries and is then followed by these structures:

Offset Size Description
0 4 Unknown
4 4 Offset

FILE Section

FILE contains all of the audio data in the BFSAR.

Offset Size Description
0x00 4 Magic ("FILE")
0x04 4 Size of FILE section.

There isn't a whole lot else to document about the FILE partition, since the data in it will most definitely vary depending on the game.

There are multiple FILE partitions, but only 1 of them is the 'main' FILE partition (it's the one you get from the BFSAR header). The 'main' FILE partition contains all of the other sub FILE partitions.