Difference between revisions of "BFSEQ (File Format)"

From MK8
Jump to: navigation, search
(Created page with "'''BFSEQ''' ('''B'''inary Ca'''F'''e '''SEQ'''uence) is a sub file format found in BFSAR files from games like Mario Kart 8. It corresponds to the music data represent...")
 
(Remade the entire page.)
Line 2: Line 2:
  
 
= File Format =
 
= File Format =
 +
 
== File Header ==
 
== File Header ==
The file starts with a file header that is 0x40 bytes long.
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 11: Line 11:
 
| 0x00 || String || '''File magic'''. Always ''FSEQ'' in ASCII.
 
| 0x00 || String || '''File magic'''. Always ''FSEQ'' in ASCII.
 
|-
 
|-
| 0x0E || UInt32 || Length of the file in bytes.
+
| 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).
 
|-
 
|-
| 0x07 || UInt16 || Length of this header in bytes.
+
| 0x06 || UInt16 || Length of this header in bytes.
 
|-
 
|-
| 0x0E || UInt16 || '''Number of sections'''.
+
| 0x08 || UInt32 || '''Version number''' of the file format.
 
|-
 
|-
| 0x1B || UInt32 || Offset to '''[[#DATA|DATA section]]'''.
+
| 0x0C || UInt32 || Length of the file.
 
|-
 
|-
| 0x1E || UInt32 || Length of '''[[#DATA|DATA section]]'''.
+
| 0x10 || UInt16 || '''N''' = Number of sections.
 +
|}
 +
 
 +
This next block is repeated ''N'' times. It declares information about each section.
 +
 
 +
{| class="wikitable"
 
|-
 
|-
| 0x26 || UInt32 || Offset to '''[[#LABL|LABL section]]'''.
+
! Offset !! Type !! Description
 
|-
 
|-
| 0x2A || UInt32 || Length of '''[[#LABL|LABL section]]'''.
+
| 0x00 || UInt32 || Section type ('''[[#DATA|DATA]]''' is 0x5000, '''[[#LABL|LABL]]''' is 0x5001).
 +
|-
 +
| 0x04 || UInt32 || Offset to the section.
 +
|-
 +
| 0x08 || UInt32 || Length of the section.
 +
|-
 +
| 0x0C || colspan=2 {{unknown|End of this block.}}
 
|}
 
|}
  
Line 34: Line 45:
 
| 0x00 || String || '''Section magic'''. Always ''DATA'' in ASCII.
 
| 0x00 || String || '''Section magic'''. Always ''DATA'' in ASCII.
 
|-
 
|-
| 0x06 || UInt32 || Length of this section.
+
| 0x04 || UInt32 || Length of this section.
 
|}
 
|}
  
 
== LABL ==
 
== LABL ==
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 44: Line 56:
 
| 0x00 || String || '''Section magic'''. Always ''LABL'' in ASCII.
 
| 0x00 || String || '''Section magic'''. Always ''LABL'' in ASCII.
 
|-
 
|-
| 0x06 || UInt32 || Length of this section.
+
| 0x04 || UInt32 || Length of this section.
 +
|-
 +
| 0x08 || UInt32 || '''N''' = Number of sound labels.
 
|}
 
|}
  
= Tools =
+
This next block is repeated ''N'' times. It declares information about each label.
The following tools can handle BFSEQ files:
+
 
 +
{| class="wikitable"
 +
|-
 +
! Offset !! Type !! Description
 +
|-
 +
| 0x00 || UInt32 || Entry type (Always 0x51000000).
 +
|-
 +
| 0x04 || UInt32 || Offset to label, relative to offset 0x08 in the '''[[#LABL|LABL section]]'''.
 +
|-
 +
| 0x08 || colspan=2 {{unknown|End of this block.}}
 +
|}
 +
 
 +
=== Label Structure ===
 +
This is the label structure.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! Offset !! Type !! Description
 +
|-
 +
| 0x00 || UInt32 || Label type. (Always 0x1F000000).
 +
|-
 +
| 0x04 || UInt32 || Offset to the '''sound data''' this label uses. Relative to the end of the [[#DATA|DATA header]].
 +
|-
 +
| 0x08 || UInt32 || Length of label string.
 +
|-
 +
| 0x0C || String || Label name.
 +
|}
  
*none
 
  
 
[[Category:File Format]]
 
[[Category:File Format]]

Revision as of 19:46, 3 January 2019

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 declares information about each section.

Offset Type Description
0x00 UInt32 Section type (DATA is 0x5000, LABL is 0x5001).
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 UInt32 Entry type (Always 0x51000000).
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 UInt32 Label type. (Always 0x1F000000).
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.