BREFF and BREFT (File Format)

From Custom Mario Kart
Jump to navigation Jump to search

BREFF and BREFT appears always as pair and always in a subdirectory of ./effect/. BREFF contains the control information and BREFT the graphic and texture data. A track can have up to 8 different effects, adding more will cause the game to crash.

File Format

File Header

The file begins with the header of 0x10 bytes. The structure is the same as for BRRES files:

Offset Size Type Description
0x00 0x04 String File identifier: String "REFF" for BREFF or "REFT" for BREFT in ASCII.
0x04 0x02 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 0x02 UInt16 Version number of file format. Value 9 for all files in MKW.
0x08 0x04 UInt32 Length of the file in bytes.
0x0C 0x02 UInt16 Size of the header (usually 0x10).
0x0E 0x02 UInt16 Number of blocks. Always 1 for all files in MKW.

Block Header

Offset Size Type Description
0x00 0x04 String File identifier: String REFF for BREFF or REFT for BREFT in ASCII.
0x04 0x04 UInt32 Length of section in bytes excluding this header.

Project Header

Offset Size Type Description
0x00 0x04 UInt32 Section header size.
0x04 0x04 UInt32 Pointer to previous project. Always 0.
0x08 0x04 UInt32 Pointer to next project. Always 0.
0x0C 0x02 UInt16 L = Length of NULL-terminated string.
0x0E 0x02 UInt16 Padding.
0x10 L String NULL-terminated ASCII name of project.

Subfile Table

This section is located right after Project Header.

Offset Size Type Description
0x00 0x04 UInt32 Size of the table.
0x04 0x02 UInt16 Number of entries.
0x06 0x02 UInt16 Padding.
0x08 Start of first subfile item

Subfile Table Item

Items are placed one after another and they are not aligned.

Offset Size Type Description
0x00 0x02 UInt16 L = Length of NULL-terminated name.
0x02 L String NULL-terminated ASCII name of object.
0x02 + L 0x04 UInt32 Offset of data, relative to the end of the Project Header / Start of Subfile Table.
0x06 + L 0x04 UInt32 Size of data in bytes. Add 0x20 for BREFT files.

Content

The Subfile Item List points to the specific data for BREFF or BREFT. Continue reading BREFF (File Format) or BREFT (File Format).