BCSAR

BCSAR

The BCSAR (Binary CTR Sound ARchive) format is the 3DS’s equivalent of the Wii’s BRSAR format. They’re not the same structures, though, but they do have the same purpose.

BCSAR are located in the RomFS, this is usually stored under “romfs:/sound/.bcsar”. This contains various audio formats, such as CSTM, CWSD, CSEQ, and CWAV.

BCSAR Header #

OFFSETSIZEDESCRIPTION
0x00x4MAGIC “CSAR”
0x40x2Byte order mark (0xFEFF = Big Endian, 0xFFFE = Little Endian)
0x60x2Length of BCSAR header
0x80x4Version
0xC0x4Length of the entire BCSAR (starting from 0x0)
0x100x4Amount of main partitions in the BCSAR [STRG + INFO + FILE = 0x03 (= 3)]
0x140x4STRG partition reference ID? (Always 0x2000)
0x180x4Location of STRG partition
0x1C0x4Length of STRG partition
0x200x4INFO partition reference ID? (Always 0x2001)
0x240x4Location of INFO partition
0x280x4Length of INFO partition
0x2C0x4Main FILE partition reference ID? (Always 0x2002)
0x300x4Location of main FILE partition
0x340x4Length of main FILE partition
0x380x4Reserved for 4th main partition location?
0x3C0x4Reserved for 4th main partition length?

Partitions #

STRG #

STRG contains the names of the audio files in the BCSAR.

OFFSETSIZEDESCRIPTION
0x00x4MAGIC “STRG”
0x40x4Length of STRG partition (also in CSAR header)
0x80x4String table type magic (always 0x2400)
0xC0x4This + 8 points to the string table (always 0x10)
0x100x4String table lookup type magic (always 0x2401)
0x140x4This + 8 points to the string lookup table
0x180x4Filename count
0x1C0xC * countString offset table

String offset table entry #

OFFSETSIZEDESCRIPTION
0x00x4Type of the node (should be 0x1F01)
0x40x4Offset to data from the end of the STRG header (sizeof 0x18)
0x80x4Length of the data buffer (includes NUL terminator)

Then every filename is rawly setted. You can set up a dictionary that contains, using a simple counter, the size of every filename in order. Then, using the same type of counter, get the values of the size of the filename in a correct order.

String lookup table #

Header #
OFFSETSIZEDESCRIPTION
0x00x4Index of the root entry
0x40x4Entry count
0x80x14 * countLookup entry
Entry #
OFFSETSIZEDESCRIPTION
0x00x2Nonzero if contains data
0x20x2Bit test condition (index = (this >> 3), bit = (~this & 7)), -1 if unused
0x40x4Fail condition leaf index (-1 if unused)
0x80x4Success condition leaf index (-1 if unused)
0xC0x4String lookup table index (-1 if unused)
0x100x33-byte Resource ID, Little Endian (-1 if unused)
0x130x1Resource type (01=sound, 02=sound list, 03=sound bank, 04=sound player name?, 06=sound group, FF=unused)

INFO #

INFO presumably contains information on the audio files? Possibly used to connect names from STRG to data from FILE?

For now I only know some information in the header for this partition, but I’m working on figuring the rest out.

Header #

OFFSETSIZEDESCRIPTION
0x00x4MAGIC “INFO”
0x40x4Length of INFO partition (also in CSAR header)
0x80x4Audio Table Reference ID (0x2100)
0xC0x4This + 8 points to the Audio Table
0x100x4Set Table Reference ID (0x2104)
0x140x4This + 8 points to the Set Table
0x180x4Bank Table Reference ID (0x2101)
0x1C0x4This + 8 points to the Bank Table
0x200x4WAV Archive Table Reference ID (0x2103)
0x240x4This + 8 points to the WAV Archive Table
0x280x4Group Table Reference ID (0x2105)
0x2C0x4This + 8 points to the Group Table
0x300x4Player Table Reference ID (0x2102)
0x340x4This + 8 points to Player Table
0x380x4FILE Table Reference ID (0x2106)
0x3C0x4This + 8 points to the FILE Table
0x400x4Unknown Table Reference ID (0x220B)
0x440x4This + 8 points to unknown

Blocks #

Every offset in the header points to data similar to this:

  • 4byte length
  • length array of the below struct
    • u32 type
    • u32 offset relative to the address of the length field (beginning of the block)

The data the offset points to is dependent on the type of the above struct:

0x2200 #
OFFSETSIZEDESCRIPTION
0x00x4Unknown
0x40x4Sound player ID
0x80x4Unknown
0xC0x4Type of the extended info
0x100x4Offset to extended info *relative to the beginning of this struct*
0x14???Unknown…
0x2204 #
OFFSETSIZEDESCRIPTION
0x00x4First Sound ID in this sequence set
0x40x4Last Sound ID in this sequence set
0x80x4Type of the extended info
0xC0x4Offset to extended info *relative to the beginning of this struct*
0x100x4Type of the extended info
0x140x4Offset to extended info *relative to the beginning of this struct*
0x180x4Unknown
0x1C0x4Unknown
0x2206 #
OFFSETSIZEDESCRIPTION
0x00x4Unknown
0x40x4Type of the extended info
0x80x4Offset to extended info *relative to the beginning of this struct*
0xC0x4Unknown
0x100x4Unknown
Table IDs #
IDNAME
0x2200Audio Table
0x2204Set Table
0x2206Bank Table
0x2207WAV Archive Table
0x2208Group Table
0x2208Player Table
0x220AFILE Table

FILE #

FILE contains all of the audio data in the BCSAR.

OFFSETSIZEDESCRIPTION
0x00x4MAGIC “FILE”
0x40x4Length of FILE partition (also in CSAR header)
0x80x24Padding

There isn’t a whole lot else I can document about the FILE partition, since the data in it will most definitely vary depending on the game. (since audio is more than likely to change in each game)

There is no table in FILE so a different partition (presumably INFO) must be used to connect the data in FILE with the names from STRG.

After some more research, there are multiple FILE partitions, but only 1 of them is the ‘main’ FILE partition (it’s the one you get from the BCSAR header). The ‘main’ FILE partition contains all of the other sub FILE partitions.

Tools #

Category:File formats