BRSAR (File Format)

From Custom Mario Kart
(Redirected from BRSAR)
Jump to navigation Jump to search

Overview

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 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 Offset to Sound tree.
0x10 UInt32 Offset to Player tree.
0x14 UInt32 Offset to Group tree.
0x18 UInt32 Offset to Bank tree.
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 String Table

Offset Type Description
0x00 UInt32 Root Index.
0x04 UInt32 Number of entries (N)
0x08 TreeNode[N] Entries.

SYMB String Tree Node

Offset Type Description
0x00 UInt16 Flags (0x01 = Leaf Node)
0x02 UInt16 Bit flag. Meaning unknown
0x04 UInt32 Left Index.
0x08 UInt32 Right Index.
0x0c UInt32 String Index.
0x10 UInt32 Index.

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 DataRef Reference to Sound Data Table
0x10 DataRef Reference to Soundbank Table
0x18 DataRef Reference to Player Info Table
0x20 DataRef Reference to File Table
0x28 DataRef Reference to Group Table
0x30 DataRef Reference to Sound Count Table
0x38 End of header

Sound Data Table

Offset Type Description
0x00 UInt32 N = Number of entries.
0x04 DataRef[N] References to Sound Data Entries.

Sound Data Entry

Offset Type Description
0x00 UInt32 File name index
0x04 UInt32 File index
0x08 UInt32 PlayerID
0x0C DataRef Reference to Sound3DParam
0x14 Byte Volume
0x15 Byte PlayerPriority
0x16 Byte SoundType:
  • 0x1 = SEQ
  • 0x2 = STRM
  • 0x3 = WAVE
0x17 Byte RemoteFilter
0x18 DataRef Reference to sound info.
Data type specifies sound:
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 Reserved.

Sound Data Subsection 2

RSEQ
Offset Type Description
0x00 UInt32 SeqLabelEntry
0x04 UInt32 Soundbank index
0x08 UInt32 RSEQAllocTrack
0x0C Byte SeqChannelPriority
0x0D Byte Release priority fix flag
0x0E Byte[2] Padding
0x10 UInt32 Reserved
RWSD
Offset Type Description
0x00 UInt32 waveIdx (index of wave file to be played)
0x04 UInt32 RWSDAllocTrack
0x08 Byte Channel Priority
0x09 Byte Release priority fix flag
0x0A Byte[2] Padding
0x0C UInt32 Reserved
RSTM
Offset Type Description
0x00 UInt32 Start Position
0x04 UInt16 AllocChannelCount
0x06 UInt16 AllocTrackFlag
0x08 UInt32 Reserved

Sound 3D Parameters

Offset Type Description
0x00 UInt32 Sound3DParam flags
0x04 Byte Decay Curve (1 = Logarithmic, 2 = Linear)
0x05 Byte Decay Ratio
0x06 Byte Doppler Factor
0x07 Byte Padding
0x08 UInt32 Reserved

Soundbank Table

Offset Type Description
0x00 UInt32 N = Number of entries.
0x04 DataRef[N] References to Soundbank Entries.

Soundbank Entry

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

Player Info Table

Offset Type Description
0x00 UInt32 N = Number of entries.
0x04 DataRef[N] References to Player Info Entries.

Player Info Entry

Offset Type Description
0x00 UInt32 File name index
0x04 Byte Playable Sound Count
0x05 Byte Padding
0x06 UInt16 Padding
0x08 UInt32 Heap Size
0x0C UInt32 Reserved

File Table

This section describes the files contained in the archive

Offset Type Description
0x00 UInt32 N = Number of entries.
0x04 DataRef[N] References to File Entries.

File Entry

Offset Type Description
0x00 UInt32 Length of the RBNK, RSEQ, or RWSD 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 Int32 Entry number (always -1)
0x0C DataRef Reference to external file name, or null if the file is embedded in the BRSAR
0x14 DataRef Reference to File Position Table. Null if an external file is used

File Position Table

The game loads files at the group level (all at once). However, sounds can belong in multiple groups, in which case they are duplicated within the BRSAR, once for each group. This table contains all instances of a file within any group.

Offset Type Description
0x00 UInt32 N = Number of entries.
0x04 DataRef[N] References to File Position Entries.

File Position Entry

Offset Type Description
0x00 UInt32 Group index
0x04 UInt32 Index within group

Group Table

Offset Type Description
0x00 UInt32 N = Number of entries.
0x04 DataRef[N] References to Group Data Entries.

Group Data Entry

Offset Type Description
0x00 UInt32 File name index.
0x04 UInt32 Entry Number.
0x08 DataRef Reference to external filepath string.
0x10 UInt32 Offset to the group file data.
0x14 UInt32 Size of the group file data.
0x18 UInt32 Offset to the group audio data.
0x1C UInt32 Size of the group audio data.
0x20 DataRef Reference to Group Item Reference Table.

Group Item Reference Table

Offset Type Description
0x00 UInt32 N = Number of entries.
0x04 DataRef[N] References to the Group Item Info Entries.

Group Item Info Entry

Offset Type Description
0x00 UInt32 Group index
0x04 UInt32 Offset to the file data (BRSEQ, BRBNK or BRWSD), relative to the value at 0x14 of the main entry.
0x08 UInt32 Size of the file data.
0x0C UInt32 Offset to the audio data (BRWAR or raw DSP data), relative to the value at 0x1C of the main entry.
0x10 UInt32 Size of the audio data.
0x14 UInt32 Reserved.

Sound Count Table

Offset Type Description
0x00 UInt16 SeqSoundCount
0x02 UInt16 SeqTrackCount
0x04 UInt16 StrmSoundCount
0x06 UInt16 StrmTrackCount
0x08 UInt16 StrmChannelCount
0x0A UInt16 WaveSoundCount
0x0C UInt16 WaveTrackCount
0x0E UInt16 Padding.
0x10 UInt32 Reserved.

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

Data Reference

The Data Reference structure is used to point to other data types.

Offset Type Description
0x00 Byte Reference type. (0 = Address, 1 = Offset).
0x01 Byte Data type. Usually 0x00.
0x02 UInt16 Reserved.
0x04 UInt32 Value.

Tools

The following tools can handle BRSAR files:

Links

All about BRRES files

BRRES fileIndex GroupSub Files

CHR0CLR0MDL0PAT0SCN0SHP0SRT0TEX0