BRSAR (File Format)

From Custom Mario Kart
Revision as of 14:59, 4 December 2017 by Wexos (talk | contribs)
Jump to navigation Jump to search
Under Construction
This article is not finished. Help improve it by adding accurate information or correcting grammar and spelling.

The BRSAR (Binary Revolution Sound ARchive) format is used to store sound effects and some music. It is used in Mario Kart Wii, Super Smash Bros. Brawl, The Legend of Zelda: Skyward Sword and other games. An index list of the known values of the revo_kart.brsar file used in Mario Kart Wii can be found here.

File Header

The file begins with a header of size 0x40 bytes.

Offset Type Description
0x00 String File magic. RSAR in ASCII.
0x04 UInt16 Byte order mark (BOM): The value is always 0xFEFF. If value 0xFFFE is read, then the false endian is used. Mario Kart Wii uses nearly always big endian (bytes 0xFE,0xFF).
0x06 UInt16 Version of the file format. "revo_kart.brsar" uses 01 04. "HomeButtonSe.brsar" (used for the Home Menu) uses 01 01.
0x08 UInt32 Length of the file.
0x0C UInt16 Length of the header (always 0x40).
0x0E UInt16 Number of sections.
0x10 UInt32 Offset to the SYMB section.
0x14 UInt32 Size of the SYMB section.
0x18 UInt32 Offset to the INFO section.
0x1C UInt32 Size of the INFO section.
0x20 UInt32 Offset to the FILE section.
0x24 UInt32 Size of the FILE section.
0x28 Byte[24] Padding.
0x40 End of header

Sections

Unless otherwise noted, offsets in each section are relative to the start of the section block, plus 0x8.

SYMB

The SYMB section consists of an FST-like data structure. It contains 3 header-less subsections.

Offset Type Description
0x00 String Section magic. SYMB in ASCII.
0x04 UInt32 Size of the SYMB section.
0x08 UInt32 Offset to file name table.
0x0C UInt32 Mask table offset 1
0x10 UInt32 Mask table offset 2
0x14 UInt32 Mask table offset 3
0x18 UInt32 Mask table offset 4
0x1C End of header

SYMB File Name Table

Offset Type Description
0x00 UInt32 Number of entries (N)
0x04 UInt32[N] Offset to file name

SYMB Mask Table

Offset Type Description
0x00 UInt32 Unknown. Type of mask?
0x04 UInt32 Number of entries

SYMB Mask Entry

Information about this is unknown at this time.

INFO

The INFO section contain parameters about the sounds in a BRSAR.

Offset Type Description
0x00 String Section magic. INFO in ASCII.
0x04 UInt32 Size of the INFO section.
0x08 UInt32 Unknown. Always 0x01000000.
0x0C UInt32 Offset to the sound data table.
0x10 UInt32 Unknown. Always 0x01000000.
0x14 UInt32 Offset to the soundbank table.
0x18 UInt32 Unknown. Always 0x01000000.
0x1C UInt32 Offset to the player info table.
0x20 UInt32 Unknown. Always 0x01000000.
0x24 UInt32 Offset to the collection table.
0x28 UInt32 Unknown. Always 0x01000000.
0x30 UInt32 Offset to the group table.
0x28 UInt32 Unknown. Always 0x01000000.
0x34 UInt32 Offset to the Sound Count table.
0x38 End of header

Sound Data Table

Offset Type Description
0x00 UInt32 Number of entries (N)
N * 8 + 0x04 UInt32 Unknown. Always 0x01000000.
N * 8 + 0x08 UInt32 Offset to entry

Sound Data Entry

Offset Type Description
0x00 UInt32 File name index
0x04 UInt32 File collection index
0x08 UInt32 PlayerID
0x0C UInt32 Unknown. Always 0x01000000.
0x10 UInt32 Offset to third subsection.
0x14 Byte Volume
0x15 Byte PlayerPriority
0x16 Byte SoundType:
  • 0x1 = SEQ
  • 0x2 = STRM
  • 0x3 = WAVE
0x17 Byte RemoteFilter
0x18 UInt32 Unknown. More flags? 0x19 seems to control section type of the second subsection.
0x1C UInt32 Offset to second subsection
0x20 UInt32 UserParam1
0x24 UInt32 UserParam2
0x28 Byte PanMode:
  • 0x0 = Dual
  • 0x1 = Balance
0x29 Byte PanCurve:
  • 0x0 = Sqrt
  • 0x1 = Sqrt0DB
  • 0x2 = Sqrt0DBClamp
  • 0x3 = SinCos
  • 0x4 = SinCos0DB
  • 0x5 = SinCos0DBClamp
  • 0x6 = Linear
  • 0x7 = Linear0DB
  • 0x8 = Linear0DBClamp
0x2A Byte ActorPlayerID
0x2B Byte Unknown. Padding?

Sound Data Subsection 2

RSEQ
Offset Type Description
0x00 UInt32 SeqLabelEntry
0x04 UInt32 Soundbank index
0x08 Byte[3] Unknown.
0x0B Byte RSEQAllocTrack
0x0C Byte SeqChannelPriority
0x0D Byte[7] Unknown. Padding?
RWSD
Offset Type Description
0x00 UInt32 SoundDataNode
0x04 Byte[3] Unknown.
0x07 Byte RWSDAllocTrack
0x08 Byte ChanelPriority
0x09 Byte[7] Unknown. Padding?
RSTM
Offset Type Description
0x00 UInt32 Start Position
0x04 Byte Unknown.
0x05 Byte AllocChannelCount
0x06 Byte RSTMAllocTrack
0x07 Byte[5] Unknown.

Sound Data Subsection 3

Offset Type Description
0x00 UInt32 Sound3DParam flags
0x04 Byte DecayCurve
0x05 Byte DecayRatio
0x06 Byte[6] Unknown.

Soundbank Table

Offset Type Description
0x00 UInt32 Number of entries (N)
N * 8 + 0x04 UInt32 Unknown. Always 0x01000000.
N * 8 + 0x08 UInt32 Offset to the entry

Soundbank Entry

Offset Type Description
0x00 UInt32 File name index
0x04 UInt32 File collection index
0x08 UInt32 Bank index

Player Info Table

Offset Type Description
0x00 UInt32 Number of entries.
0x04 UInt32 Unknown. Always 0x01000000.
0x08 UInt32 Offset to the first entry.
0x04 UInt32 Unknown. Always 0x01000000.
0x08 UInt32 Offset to the second entry.
...

Player Info Entry

Offset Type Description
0x00 UInt32 File name index
0x04 Byte Playable Sound Count
0x05 Byte[11] Unknown. Padding?

Collection Table

This section controls the BRSAR indexes shown in BrawlBox.

Offset Type Description
0x00 UInt32 Number of entries.
0x04 UInt32 Unknown. Always 0x01000000.
0x08 UInt32 Offset to the first entry.
0x04 UInt32 Unknown. Always 0x01000000.
0x08 UInt32 Offset to the second entry.
...

Collection Entry

Offset Type Description
0x00 UInt32 Length of the RBNK, RSEQ, or RWAV file except the audio data. Length of the entire file for external files.
0x04 UInt32 Length of the audio data. Null for RSEQ or external files.
0x08 UInt32 Unknown. Always 0xFFFFFFF
0x0C Byte[8] Unknown. Padding?
0x14 UInt32 Unknown. Always 0x01000000.
0x18 UInt32 Offset to the second subsection, or to the external file name for external files. Usually follows this value anyway.
0x1C UInt32 Group index
0x20 UInt32 Index within group

Group Table

Offset Type Description
0x00 UInt32 Number of entries.
0x04 UInt32 Unknown. Always 0x01000000.
0x08 UInt32 Offset to the first entry.
0x04 UInt32 Unknown. Always 0x01000000.
0x08 UInt32 Offset to the second entry.
...

Group Data Entry

Offset Type Description
0x00 UInt32 File name index
0x04 UInt32 Unknown. Always 0xFFFFFFF
0x08 Byte[8] Unknown. Padding?
0x10 UInt32 Offset to the RSEQ, RBNK, or RWSD file.
0x14 UInt32 Size of the RSEQ, RBNK, or RWSD file.
0x18 UInt32 Offset to the RWAR or DSP file.
0x1C UInt32 Size of the RWAR or DSP file.
0x20 UInt32 Unknown. Always 0x01000000.
0x24 UInt32 Offset to the second subsection. Usually follows this value anyway.
0x28 UInt32 Number of entries in the subsection. All data after this is absent if this is 0x00.
0x2C UInt32 Unknown. Always 0x01000000.
0x30 UInt32 Offset to the first entry
0x34 UInt32 Unknown. Always 0x01000000.
0x38 UInt32 Offset to the second entry.
...

Subsection 2 Entry

Offset Type Description
0x00 UInt32 Group index
0x04 UInt32 Offset to the file, relative to the value at 0x14 of the main entry.
0x08 UInt32 Size of the file.
0x0C UInt32 Offset to the audio data, relative to the value at 0x1C of the main entry.
0x10 UInt32 Size of the audio data.
0x14 UInt32 Unknown. Padding?

Sound Count Table

Offset Type Description
0x00 UInt16 SeqSoundCount
0x02 UInt16 SeqTrackCount
0x04 UInt16 StrmSoundCount
0x04 UInt16 StrmTrackCount
0x06 UInt16 WaveSoundCount
0x08 UInt16 WaveTrackCount
0x0A Byte[20] Unknown. Padding?

FILE

Offset Type Description
0x00 String Section magic. FILE in ASCII.
0x04 UInt32 Size of the FILE section.
0x08 Byte[24] Padding
0x0C File data

Tools

The following tools can handle BRSAR files: