Mario Making Mods

MasterVermilli0nUser is Offline
Dat weeb NSMBU hacker though :3
  • Normal user
Since: 05-18-17
From: Not under a rock! :3
Documentation restored from RHCafe wiki.

This is an archive that contains all sound effects and music streams used in the game.

Block pointers are looked up with their identifier. This may not be necessary, but to be safe, I'd still place them in the documented order.

Some General Data Structures

These structures are used in multiple places throughout the bfsar.

File Header

OffsetDescription
0x0 - 0x4Magic number
0x4 - 0x6BOM; always 0xFEFF (big-endian)
0x6 - 0x8Header length
0x8 - 0xCVersion number, must be 0x20000 in NSMBU. Observed values in other games: 0x20000, 0x20100, 0x20200. Probably 1 byte pad, 1 byte major version, 1 byte minor version, 1 byte patch version.
0xC - 0x10Filesize
0x10 - 0x12Number of sections
0x12 - 0x14Padding
0x14 - ...Block pointers

Block Pointer

Offset is relative to the start of the file.
OffsetDescription
0x0 - 0x2Identifier
0x2 - 0x4Padding
0x4 - 0x8Offset to block body
0x8 - 0xCSize of block body

Block Header

OffsetDescription
0x0 - 0x4Ascii identifier
0x4 - 0x8Block size

Offset With Identifier

OffsetDescription
0x0 - 0x2Identifier
0x2 - 0x4Padding
0x4 - 0x8Offset

Item ID

An item id consists of both file type and file id:
OffsetDescription
0x0File type: 1=Sound (SE/WSD/STRM), 2=Sound group (WSDSET/SEQSET), 3=Bank (BANK), 4=Player (PLAYER), 5=Wave archive (WAR), 6=Group (GROUP)
0x1 - 0x4Index into info reference table

Sound Archive (BFSAR)

BFSAR Header

FieldIdentifier
Magic number"FSAR"
String block pointer (STRG)0x2000
Info block pointer (INFO)0x2001
File block pointer (FILE)0x2002

String Block (STRG)

The string block contains a string table and a search tree that's used to look up files by name. The search tree is similar to the search tree found in BFRES files.
OffsetDescription
0x0 - 0x8Block header
0x8 - 0x10Offset to string table (0x2400)
0x10 - 0x18Offset to search tree (0x2401)

String Table

OffsetDescription
0x0 - 0x4String count
0x4 - 0x4 + count * 0xCString pointers

String Pointer

Offsets are relative to the start of the string table.
OffsetDescription
0x0 - 0x8Offset structure (id = 0x1F01)
0x8 - 0xCLength of string, including a null terminator

Search Tree

This is a patricia tree, similar to the binary search tree in BFRES files.
OffsetDescription
0x0 - 0x4Index of root node
0x4 - 0x8Amount of tree nodes

Tree Nodes

OffsetDescription
0x0 - 0x2A flag that's 1 if this is a leaf node
0x2 - 0x4Search value, basically the bit index from the left
0x4 - 0x8Left index, go here when the bit is 0
0x8 - 0xCRight index, go here when the bit is 1
0xC - 0x10String table index
0x10 - 0x14Item id

Info Block (INFO)

OffsetDescription
0x0 - 0x8Block header
0x8 - 0x10Offset to sound info reference table (0x2100)
0x10 - 0x18Offset to sound group info reference table (0x2104)
0x18 - 0x20Offset to bank info reference table (0x2101)
0x20 - 0x28Offset to wave archive info reference table (0x2103)
0x28 - 0x30Offset to group info reference table (0x2105)
0x30 - 0x38Offset to player info reference table (0x2102)
0x38 - 0x40Offset to file info reference table (0x2106)
0x40 - 0x48Offset to sound archive player info (0x220B)

Info Reference Table

Offsets are relative to start of info reference table.
OffsetDescription
0x0 - 0x4Count
0x4 - 0x4 + count * 8Offset structures:
Sound info: 0x2200
Sound group info: 0x2204
Bank info: 0x2206
Wave archive: 0x2207
Group info: 0x2208
Player info: 0x2209
File info: 0x220A

Offsets are relative to the start of the info structure. Depending on the flags, there may be more values behind the structures documented here. The optional fields are always 4 bytes long.

Sound Info

"actor player id" is unrelated to the player files in the bfsar.
OffsetDescription
0x0 - 0x4Index of FSTM, FWSD or FSEQ file in the file table
0x4 - 0x8Player info table index
0x8Initial volume
0x9Remote filter
0xA - 0xCPadding
0xC - 0x14Offset to stream (STRM; 0x2201), wave (WSD; 0x2202) or sequence (SE; 0x2203) info
0x14 - 0x18Flags
...Flags & 1: String index
...Flags & 2: 0x0000XXYY, XX = pan curve, YY = pan mode
...Flags & 4: 0x0000XXYY, XX = actor player id, YY = player priority
...Flags & 0x100: Offset to 3d info
...Flags & 0x20000: Is front bypass
...Flags & 0x10000000: User param
...Flags & 0x20000000: User param
...Flags & 0x40000000: User param
...Flags & 0x80000000: User param

Sound 3D Info
OffsetDescription
0x0 - 0x4Flags
0x4 - 0x8Unknown, float
0x8Unknown
0x9Unknown

Stream Sound Info
There can be up to 8 tracks.
OffsetDescription
0x0 - 0x2Bitmask, I think this defines which tracks are enabled. Only the lower byte is read.
0x2 - 0x4Number of channels (up to 16)
0x4 - 0xCOffset structure to track info table (id=0x0101)

Stream Track Info Table
OffsetDescription
0x0 - 0x4Count
0x4 - 0x4 + count * 8Offset structures (0x220E)

Stream Track Info
OffsetDescription
0x0Unknown
0x1Unknown
0x2Unknown
0x3Unknown
0x4 - 0xCOffset structure to mono/stereo information

Mono/Stereo Information
OffsetDescription
0x0 - 0x4Number of channels (up to 2)
0x4Unknown byte for channel 1
0x5Unknown byte for channel 2

Wave Sound Info
OffsetDescription
0x0 - 0x4Wave index in wave archive
0x4 - 0x8Unknown
0x8 - 0xCFlags
0xC - 0x10Flags & 1: 0x0000XXYY, XX = Is release priority fix, YY = Channel priority

Sequence Sound Info
OffsetDescription
0x0 - 0x8Offset to bank id table
0x8 - 0xCBitmask, I think this one is similar to the bitmask in stream sound info.
0xC - 0x10Flags
0x10 - 0x14Flags & 1: Start offset
0x14 - 0x18Flags & 2: 0x0000XXYY, XX = Is release priority fix, YY = Channel priority

Bank ID Table
OffsetDescription
0x0 - 0x4Count (up to 4)
0x4 - 0x4 + count * 4Bank item ids

Bank Info

OffsetDescription
0x0 - 0x4Index of FBNK file in the file table
0x4 - 0xCOffset to wave archive id table
0xC - 0x10Flags
...Flags & 1: String index

Wave Archive ID Table
OffsetDescription
0x0 - 0x4Count
0x4 - 0x4 + count * 4Wave archive item ids

Wave Archive Info

OffsetDescription
0x0 - 0x4Index of FWAR file in the file table
0x4Boolean, might be related to individual wave files?
0x5 - 0x8Padding
0x8 - 0xCFlags
...Flags & 1: String index
...Flags & 2: Wave count

Sound Group Info

I couldn't find code that uses the offsets described here, so I can't figure out the size of the structures they're pointing to.
OffsetDescription
0x0 - 0x4Item id of first sound
0x4 - 0x8Item id of last sound
0x8 - 0x10Offset to something
0x10 - 0x18Offset structure to unknown thing (0x2205)
0x18 - 0x1CFlags
...Flags & 1: String index

Sound Group Unknown Thing
OffsetDescription
0x0 - 0x14Unknown

Group Info

OffsetDescription
0x0 - 0x4Index of FGRP file in the file table
0x4 - 0x8Flags
...Flags & 1: String index

Player Info

OffsetDescription
0x0 - 0x4Playable sound limit
0x4 - 0x8Flags
...Flags & 1: String index
...Flags & 2: Player heap size

File Info

These structures are aligned to 0x4.
OffsetDescription
0x0 - 0x2File location: 0x220C = internal, 0x220D = external
0x2 - 0x4Padding
0x4 - 0x8Offset to internal file info if internal, or to null-terminated filename string if external

Internal File Info
OffsetDescription
0x0 - 0x8Offset into FILE block body
0x8 - 0xCFilesize

Sound Archive Player Info

This is used to calculate the required memory size for some classes.
OffsetDescription
0x0 - 0x2Unknown
0x2 - 0x4Unknown
0x4 - 0x6Unknown
0x6 - 0x8Unknown
0x8 - 0xAUnknown
0xA - 0xCUnknown
0xC - 0xEUnknown
0xE - 0x10Padding in 2.0.0 and 2.1.0 BFSARs; normally 0x100 in 2.2.0 BFSARs

File Block (FILE)

This block contains the actual subfiles.

Wave Sound Files (WSD)

WSD Header

FieldIdentifier
Magic number"FWSD"
Info block pointer (INFO)0x6800

Info Block (INFO)

OffsetDescription
0x0 - 0x8Block header
0x8 - 0xCUnknown
0xC - 0x10Offset to wave sound data reference table

Wave Sound Data Reference Table

OffsetDescription
0x0 - 0x4Count
0x4 - 0x4 + count * 8Offsets to wave sound datas (0x4900)

Wave Sound Data

OffsetDescription
0x0 - 0x4Unknown
0x4 - 0x8Offset to wave sound info
0x8 - 0x14Unknown
0x14 - 0x18Offset to note info reference table

Wave Sound Info

OffsetDescription
0x0 - 0x4Flags
...Flags & 1: 0x0000XXYY, XX = Surround pan, YY = Pan
...Flags & 2: Pitch (float)
...Flags & 4: 0x00XXYYZZ, XX = Biquad value, YY = Biquad type, ZZ = Low-pass filter frequency
...Flags & 0x100: Offset to weird send-value related thing
...Flags & 0x200: Offset to "AdshrCurve"-related structure

Sequence Sound Files (SE)

SEQ Header

FieldIdentifier
Magic number"FSEQ"
Data block pointer (DATA)0x5000
Label block pointer (LABL)0x5001

Label Block (LABL)

OffsetDescription
0x0 - 0x4Count
0x4 - 0x4 + count * 8Offsets to label info

Label Info

OffsetDescription
0x0 - 0x4Unknown
0x4 - 0x8Offset into data block
0x8 - 0xCUnknown
0xC - ...Label name

Bank Files (BANK)

BANK Header

FieldIdentifier
Magic number"FBNK"
Info block pointer (INFO)0x5800

Info Block (INFO)

OffsetDescription
0x0 - 0x8Offset to wave id table
0x8 - 0x10Offset to instrument reference table

Wave ID Table

OffsetDescription
0x0 - 0x4Count
0x4 - 0x4 + count * 8Wave ids

Wave ID

OffsetDescription
0x0 - 0x4Wave archive item id
0x4 - 0x8Wave index in wave archive

Wave Archive Files (WAR)

WAR Header

FieldIdentifier
Magic number"FWAR"
Info block pointer0x6800
File block pointer0x6801

Info Block

OffsetDescription
0x0 - 0x8Block header
0x8 - 0xCWave file count
0xC - 0xC + count * 12Wave file info

Wave File Info

OffsetDescription
0x0 - 0x8Offset into file block
0x8 - 0xCFile size

Group Files (GROUP)

When the offset field of the BFSAR file info structure is -1, or when the file info structure is not found in the BFSAR info block, the game tries to find the subfile in the GROUP files.

GROUP Header

FieldIdentifier
Magic number"FGRP"
Info block pointer (INFO)0x7800
File block pointer (FILE)0x7801
InfoEx block pointer (INFX)0x7802

Info Block (INFO)

OffsetDescription
0x0 - 0x8Block header
0x8 - 0xCGroup item location info count
0xC - 0xC + count * 8Offset structures to group item location info

Group Item Location Info

OffsetDescription
0x0 - 0x4File id
0x4 - 0x8Unknown
0x8 - 0xCOffset into file block
Posted on 12-19-17, 05:27 pm
  • Owner
Since: 05-17-17
From: Mushroom Kingdom
This would honestly be more fitting on the Wiki, but then again, I can't stop you.

Anyways, uh, for people like me, you might want to explain what a BFSAR even is. :P
Old 3DS XL info:
I used to have a 3DSafe A9LH V11.3.0-36U with Luma in my CTRNAND. Since ReiNAND Reibooted and Re-Reileased, I "switch"ed back.
Right now, I have boot9strap with Luma 8.0 as my CFW. Though, I'd like to see other CFW's for B9S.
Posted on 12-21-17, 03:50 am
  • Normal user
Since: 12-08-17
From: Canada
BFSAR is a Wii U game compressed music file. Most games have all their musics in this kind of file that can only be opened by a specific software. Luckily, Mario Maker has most of its music outside of the BFSAR wich is why we can easily put custom musics in the game.
Posted on 12-21-17, 03:59 am
  • Owner
Since: 05-17-17
From: Mushroom Kingdom
Ahhh...

I barely hack Super Mario Maker Wii U music files, so I didn't know. Sorry.
Old 3DS XL info:
I used to have a 3DSafe A9LH V11.3.0-36U with Luma in my CTRNAND. Since ReiNAND Reibooted and Re-Reileased, I "switch"ed back.
Right now, I have boot9strap with Luma 8.0 as my CFW. Though, I'd like to see other CFW's for B9S.
Posted on 12-21-17, 04:00 am
MasterVermilli0nUser is Offline
Dat weeb NSMBU hacker though :3
  • Normal user
Since: 05-18-17
From: Not under a rock! :3
Anyways, uh, for people like me, you might want to explain what a BFSAR even is. :P
Binary Cafe Sound Archive.
Just like what its name says, it's an archive which can contain sound files.

It usually contains sound effects, sequences, and such files. NSMBU is dumb, so all the music files are inside a BFSAR, unlike literally any other game I encountered.
Stella is best waifu. :3

Posted on 12-21-17, 07:08 am (rev. 1 by MasterVermilli0n on 12-21-17, 07:11 am)
  • Owner
Since: 05-17-17
From: Mushroom Kingdom
so all the music files are inside a BFSAR
Why is this a bad thing?
Old 3DS XL info:
I used to have a 3DSafe A9LH V11.3.0-36U with Luma in my CTRNAND. Since ReiNAND Reibooted and Re-Reileased, I "switch"ed back.
Right now, I have boot9strap with Luma 8.0 as my CFW. Though, I'd like to see other CFW's for B9S.
Posted on 02-15-18, 03:13 am (rev. 1 by NightYoshi370 on 02-15-18, 03:13 am)
  • Owner
Since: 05-17-17
From: Mushroom Kingdom
Trashed because this should be on the wiki.

Luckly, I added it: https://mariomods.net/wiki/BFSAR_Documentation
Old 3DS XL info:
I used to have a 3DSafe A9LH V11.3.0-36U with Luma in my CTRNAND. Since ReiNAND Reibooted and Re-Reileased, I "switch"ed back.
Right now, I have boot9strap with Luma 8.0 as my CFW. Though, I'd like to see other CFW's for B9S.
Posted on 05-10-18, 03:51 am