BRLYT (File Format)

From Wexos's Wiki
(Redirected from BRLYT)
Jump to navigationJump to search

BRLYT files (Binary Revolution LaYouT) are the files used as layout in the Wii system. They manage how the UI TPL images show in the game, with specified flags such as material settings, colors, positions, size, rotations and more. BRLYT files are used with BRLAN animations, BRFNT fonts and also with BRCTR files in Mario Kart Wii.

File Format

Header

The file starts with a header that is 0x10 bytes long:

Offset Type Description
0x00 Char[4] File magic. Always RLYT in ASCII.
0x04 UInt16 Byte-order-mark. FE FF for big endian, FF FE for little endian.
0x06 UInt16 Version number of the file format. Only seen as 00 0A.
0x08 UInt32 Length of the file in bytes.
0x0C UInt16 Length of this header in bytes.
0x0E UInt16 Number of sections.
0x10 End of file header

After the header follows the sections. BRLYT files constist of many different sections. The section can be identified by checking the first four bytes; it is a magic that identifies the section.

lyt1

The lyt1 sections comes directly after the header and defines the main layout.

Offset Type Description
0x00 Char[4] Section magic. Always lyt1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Is Centered.
0x09 Byte[3] Padding?
0x0C Float Width of the layout.
0x10 Float Height of the layout.

usd1

The usd1 section stores user data info defined by the user. The section occurs when a pane has user data stored and then it comes after that section. The section starts with a header as follows:

Offset Type Information
0x00 Char[4] Section magic. Always usd1 in ASCII.
0x04 UInt32 Section size.
0x08 UInt16 Number of user data entries.
0x0A UInt16 Unknown. Always 00 00.
Entries

An entry can store a string, multiple Int32s or multiple floats. All these entries comes after the header, and then the actual data is stored. Each entry is a structure as follows:

Offset Type Description
0x00 UInt32 Name offset. Points to a null-terminated string which is the name of this entry. Relative to the start of this entry.
0x04 UInt32 Data offset. Points to the data of this entry. Relative to the start of this entry.
0x08 UInt16 Number of entries or length if the string if the data is a string.
0x0A Byte Type. 0 = String, 1 = Int32, 2 = Float
0x0B Byte Unknown. Always 00.

Resources

These sections contains info about resources. They are always specified after the lyt section in the order as follows. If a section is not needed (it doesn't contain any entries), then the section is not written to the file.

txl1

The txl1 sections stores TPL filenames. The section starts with a header:

Offset Type Description
0x00 Char[4] Section magic. Always txl1 in ASCII.
0x04 UInt32 Section size.
0x08 UInt16 Number of TPL filenames.
0x0A UInt16 Unknown. Always 00 00.

After this section header comes the offsets to the strings. Each entry has the following structure.

Offset Type Description
0x00 UInt32 Offset to a TPL filename which is stored as a null-terminated string. Relative to the start of the txl1 section.
0x04 UInt32 Padding.

mat1

The mat1 section holds data about materials used in the layout. The section starts with a header:

Offset Type Description
0x00 Char[4] Section magic. Always mat1 in ASCII.
0x04 UInt32 Section size.
0x08 UInt16 N= Number of materials.
0x0A UInt16 Unknown. Always 00 00.
0x0C UInt32[N] Offsets to the materials. Relative to the start of this section.

Each material is the following structure:

Offset Type Description
0x00 String Material name. The length is always 0x14, unused bytes are set to 00.
0x14 Int16[4] Fore Color in RGBA format.
0x1C Int16[4] Back Color in RGBA format.
0x24 Int16[4] Color Register 3 in RGBA format.
0x2C Byte[4] TEV Color 1 in RGBA format.
0x30 Byte[4] TEV Color 2 in RGBA format.
0x34 Byte[4] TEV Color 3 in RGBA format.
0x38 Byte[4] TEV Color 4 in RGBA format.
0x3C UInt32 Flags that set which material structures that come after this structure.

fnl1

The fnl1 section is a list of fonts.

Offset Type Description
0x00 Char[4] Section magic. Always fnl1 in ASCII.
0x04 UInt32 Section size.
0x08 UInt16 N = Number of fonts.
0x0A UInt16 Unknown. Always 00 00.

After this section header comes the offsets to the strings. Each entry has the following structure.

Offset Type Description
0x00 UInt32 Offset to a font filename which is stored as a null-terminated string. Relative to the start of the fnl1 section.
0x04 UInt32 Padding.

Panes

pan1

The pan1 section contains information about a null pane. All panes should children to a null pane. In Mario Kart Wii this pane is always called "RootPane". The null doesn't show up in game, but it can be animated so that all children to it are also animated. All other panes uses the same structure, but after this more data comes. The section has the following structure:

Offset Type Description
0x00 Char[4] Section magic. Always pan1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Flag.
0x09 Byte Flag.
0x0A Byte Alpha.
0x0B Byte Padding.
0x0C String Pane name. The length is always 0x10, unused bytes are set to 00.
0x1C String User information, stored as a string.
0x24 Float[3] Translation.
0x30 Float[3] Rotation.
0x3C Float[2] Scale.
0x44 Float Width of the pane.
0x48 Float Height of the pane.

pas1

The pas1 section is used as start of pane children data, after this section other panes can be defined as children. pae1 ends it.

Offset Type Description
0x00 Char[4] Section magic. Always pas1 in ASCII.
0x04 UInt32 Section size.

pae1

The pae1 section is used to end pane children. pas1 starts it.

Offset Type Description
0x00 Char[4] Section magic. Always pae1 in ASCII.
0x04 UInt32 Section size.

pic1

The pic1 section defines a simple image pane.

Offset Type Description
0x00 Char[4] Section magic. Always pic1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Flag.
0x09 Byte Flag.
0x0A Byte Alpha.
0x0B Byte Padding.
0x0C String Pane name. The length is always 0x10, unused bytes are set to 00.
0x1C String User information, stored as a string.
0x24 Float[3] Translation.
0x30 Float[3] Rotation.
0x3C Float[2] Scale.
0x44 Float Width of the pane.
0x48 Float Height of the pane.
0x4C Byte[4] Top left vertex color of the pane in RGBA format.
0x50 Byte[4] Top right vertex color of the pane in RGBA format.
0x54 Byte[4] Bottom left vertex color of the pane in RGBA format.
0x58 Byte[4] Bottom right vertex color of the pane in RGBA format.
0x5C UInt16 Material index.
0x5E Byte Number of UV sets.
0x5F Byte Unknown.

After that the UV sets are specified.

bnd1

The bnd1 section specifies a boundary pane. Its purpose is to delimit the cursor interaction with buttons and the structure is the same as a pan1 pane.

Offset Type Description
0x00 Char[4] Section magic. Always bnd1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Flag.
0x09 Byte Flag.
0x0A Byte Alpha.
0x0B Byte Padding.
0x0C String Pane name. The length is always 0x10, unused bytes are set to 00.
0x1C String User information, stored as a string.
0x24 Float[3] Translation.
0x30 Float[3] Rotation.
0x3C Float[2] Scale.
0x44 Float Width of the pane.
0x48 Float Height of the pane.

txt1

The txt1 section contains information about a textbox pane. It also stores the text but in Mario Kart Wii it's useless because the text is loaded from a BMG file instead.

Offset Type Description
0x00 Char[4] Section magic. Always txt1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Flag.
0x09 Byte Flag.
0x0A Byte Alpha.
0x0B Byte Padding.
0x0C String Pane name. The length is always 0x10, unused bytes are set to 00.
0x1C String User information, stored as a string.
0x24 Float[3] Translation.
0x30 Float[3] Rotation.
0x3C Float[2] Scale.
0x44 Float Width of the pane.
0x48 Float Height of the pane.
0x4C UInt16 Number of characters.
0x4E UInt16 Unknown.
0x50 UInt16 Material index.
0x52 UInt16 Font index.
0x54 Byte Flag
0x55 Byte[3] Unknown.
0x58 UInt32 T = Text offset. Relative to the start of this section.
0x5C Byte[4] Top color in RGBA format.
0x60 Byte[4] Bottom color in RGBA format.
0x64 Float Size X.
0x68 Float Size Y.
0x6C Float Character size.
0x70 Float Line size.
T String Null-terminated string of the text in UTF-16.

wnd1

The wnd1 describes a window pane. A window pane is a more advanced image pane. It is unknown exactly how the window pane works.

Offset Type Description
0x00 Char[4] Section magic. Always wnd1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Flag.
0x09 Byte Flag.
0x0A Byte Alpha.
0x0B Byte Padding.
0x0C String Pane name. The length is always 0x10, unused bytes are set to 00.
0x1C String User information, stored as a string.
0x24 Float[3] Translation.
0x30 Float[3] Rotation.
0x3C Float[2] Scale.
0x44 Float Width of the pane.
0x48 Float Height of the pane.
0x4C Float Coordinate 1.
0x50 Float Coordinate 2.
0x54 Float Coordinate 3.
0x58 Float Coordinate 4.
0x5C Byte Number of frames.
0x5D Byte[3] Unknown.
0x60 UInt32 Unknown. Probably an offset. Only seen as 0x68.
0x64 UInt32 Window material offsets offset. Points to offsets which points to the window materials. Relative to the start of this section.
0x68 Byte[4] Top left vertex color in RGBA format.
0x6C Byte[4] Top right vertex color in RGBA format.
0x70 Byte[4] Bottom left vertex color in RGBA format.
0x74 Byte[4] Bottom right vertex color in RGBA format.
0x78 UInt16 Material index.
0x7A Byte Number of UV sets.
0x7B Byte Unknown.

After that the UV sets are specified. Then the window material offsets are specified and after that the window materials.

Window material
Offset Type Description
0x00 UInt16 Material index.
0x02 Byte Index.
0x03 Byte Unknown.

Groups

grp1

The grp1 section defines a group.

Offset Type Description
0x00 Char[4] Section magic. Always grp1 in ASCII.
0x04 UInt32 Section size.
0x08 String Group name. The length is always 0x10 bytes long, unused characters are set to 00.
0x18 UInt16 N = Number of entries.
0x1A UInt16 Unknown.
0x1C String[N] An array of entries in this group. The length of each string is always 0x10, unused characters are set to 00.

grs1

The grs1 section defines a group of groups. gre1 ends the group of groups.

Offset Type Description
0x00 Char[4] Section magic. Always grs1 in ASCII.

gre1

The gre1 section ends a group of groups. grs1 starts the group of groups.

Offset Type Description
0x00 Char[4] Section magic. Always gre1 in ASCII.

Common data structures

UV coordinate set

Specifies the UV coordinates for an image. Each entry is a 0x20 byte structure as follows:

Offset Type Description
0x00 Float[2] Top left U and V coordinate.
0x08 Float[2] Top right U and V coordinate.
0x10 Float[2] Bottom left U and V coordinate.
0x18 Float[2] Bottom right U and V coordinate.

Tools

The following tools can handle BRLYT files: