BFSEQ (File Format)

From MK8
Revision as of 22:37, 10 January 2019 by TheLordScruffy (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

BFSEQ (Binary CaFe SEQuence) is a sub file format found in BFSAR files from games like Mario Kart 8. It corresponds to the music data represented in a MIDI-like file, but in binary. Commands that process changes in attributes such as sound generation and volume change over time are described on this kind of file. Since the sequence data is simply a set of commands, sounds are actually producing using bank data (stored in BFBNK sub files) that corresponds to the sound source data.

File Format

File Header

Offset Type Description
0x00 String File magic. Always FSEQ in ASCII.
0x04 UInt16 Byte order mark (BOM): The value is always 0xFEFF. If value 0xFFFE is read, then little endian is used. (MK8 always uses the big endian byte order).
0x06 UInt16 Length of this header in bytes.
0x08 UInt32 Version number of the file format.
0x0C UInt32 Length of the file.
0x10 UInt16 N = Number of sections.

This next block is repeated N times. It describes information about each section.

Offset Type Description
0x00 UInt16 Section type (DATA is 0x5000, LABL is 0x5001).
0x02 UInt16 Padding.
0x04 UInt32 Offset to the section.
0x08 UInt32 Length of the section.
0x0C End of this block.

DATA

Offset Type Description
0x00 String Section magic. Always DATA in ASCII.
0x04 UInt32 Length of this section.

LABL

Offset Type Description
0x00 String Section magic. Always LABL in ASCII.
0x04 UInt32 Length of this section.
0x08 UInt32 N = Number of sound labels.

This next block is repeated N times. It declares information about each label.

Offset Type Description
0x00 UInt16 Entry type (Always 0x5100).
0x02 UInt16 Padding.
0x04 UInt32 Offset to label, relative to offset 0x08 in the LABL section.
0x08 End of this block.

Label Structure

This is the label structure.

Offset Type Description
0x00 UInt16 Label type. (Always 0x1F00).
0x02 UInt16 Padding.
0x04 UInt32 Offset to the sound data this label uses. Relative to the end of the DATA header.
0x08 UInt32 Length of label string.
0x0C String Label name.