Difference between revisions of "BRLYT (File Format)"
(→Sections: Added more sections) |
m |
||
(37 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | '''BRLYT''' files ('''B'''inary '''R'''evolution '''L'''a'''Y'''ou'''T''') 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]]. They are always found into '''blyt''' folders into [[U8]] files. | |
− | '''BRLYT''' files ('''B'''inary '''R'''evolution '''L'''a'''Y'''ou'''T''') are layout files. | ||
= File Format = | = File Format = | ||
Line 6: | Line 5: | ||
The file starts with a header that is 0x10 bytes long: | The file starts with a header that is 0x10 bytes long: | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 14: | Line 13: | ||
| 0x04 || UInt16 || {{BOM}} | | 0x04 || UInt16 || {{BOM}} | ||
|- | |- | ||
− | | 0x06 || UInt16 || '''Version number''' of the file format. | + | | 0x06 || UInt16 || '''Version number''' of the file format. Only seen as 00 0A. |
|- | |- | ||
| 0x08 || UInt32 || Length of the file in bytes. | | 0x08 || UInt32 || Length of the file in bytes. | ||
Line 25: | Line 24: | ||
|} | |} | ||
− | + | 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. | |
− | 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 after the header and defines the main layout. | + | The ''lyt1'' sections comes directly after the header and defines the main layout. |
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 43: | Line 41: | ||
| 0x09 || Byte[3] || {{Unknown-left|Padding?}} | | 0x09 || Byte[3] || {{Unknown-left|Padding?}} | ||
|- | |- | ||
− | | 0x0C || | + | | 0x0C || Float || Width of the layout. |
|- | |- | ||
− | | 0x10 || | + | | 0x10 || Float || Height of the layout. |
|} | |} | ||
+ | |||
+ | == usd1 == | ||
+ | The ''usd1'' section stores user data info defined by the user. The section occurs when a [[#Panes|pane]] has user data stored and then it comes after that section. The section starts with a header as follows: | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Information | ||
+ | |- | ||
+ | | 0x00 || String || '''Section magic'''. Always ''usd1'' in ASCII. | ||
+ | |- | ||
+ | | 0x04 || UInt32 || Section size. | ||
+ | |- | ||
+ | | 0x08 || UInt16 || Number of user data entries. | ||
+ | |- | ||
+ | | 0x0A || UInt16 || {{Unknown-left|'''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: | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || UInt32 || '''Name offset'''. Points to a null-termined 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-left|'''Unknown'''. Always 00.}} | ||
+ | |} | ||
+ | |||
+ | == Resources == | ||
+ | These sections contains info about resources. They are always specified after the [[#lyt|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 === | === txl1 === | ||
The ''txl1'' sections stores [[TPL]] filenames. The section starts with a header: | The ''txl1'' sections stores [[TPL]] filenames. The section starts with a header: | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 61: | Line 96: | ||
| 0x08 || UInt16 || Number of [[TPL]] filenames. | | 0x08 || UInt16 || Number of [[TPL]] filenames. | ||
|- | |- | ||
− | | 0x0A || UInt16 || {{Unknown-left|'''Unknown'''.}} | + | | 0x0A || UInt16 || {{Unknown-left|'''Unknown'''. Always 00 00.}} |
|} | |} | ||
After this section header comes the offsets to the strings. Each entry has the following structure. | After this section header comes the offsets to the strings. Each entry has the following structure. | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 78: | Line 113: | ||
The ''mat1'' section holds data about materials used in the layout. The section starts with a header: | The ''mat1'' section holds data about materials used in the layout. The section starts with a header: | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 88: | Line 123: | ||
| 0x08 || UInt16 || '''N'''= Number of '''materials'''. | | 0x08 || UInt16 || '''N'''= Number of '''materials'''. | ||
|- | |- | ||
− | | 0x0A || UInt16 || {{Unknown-left|'''Unknown'''.}} | + | | 0x0A || UInt16 || {{Unknown-left|'''Unknown'''. Always 00 00.}} |
|- | |- | ||
| 0x0C || UInt32['''N'''] || Offsets to the '''materials'''. Relative to the start of this section. | | 0x0C || UInt32['''N'''] || Offsets to the '''materials'''. Relative to the start of this section. | ||
Line 95: | Line 130: | ||
Each material is the following structure: | Each material is the following structure: | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 105: | Line 140: | ||
| 0x1C || Int16[4] || '''Back Color''' in RGBA format. | | 0x1C || Int16[4] || '''Back Color''' in RGBA format. | ||
|- | |- | ||
− | | 0x24 || Int16[4] || ''' | + | | 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 || Bitfield for material structures. After this field, the structures defined in the bitfield are defined. | ||
+ | {| class="wikitable" border="1" | ||
+ | |- | ||
+ | ! Bit | ||
+ | ! Flag / data | ||
+ | |- | ||
+ | |0-3 || {{Unknown-left|'''Unknown'''.}} | ||
+ | |- | ||
+ | |4 || Has Material Color. | ||
+ | |- | ||
+ | |5 || {{Unknown-left|'''Unknown'''.}} | ||
+ | |- | ||
+ | |6 || Has Channel Control. | ||
+ | |- | ||
+ | |7 || Has Blend Mode. | ||
+ | |- | ||
+ | |8 || Has Alpha Compare. | ||
+ | |- | ||
+ | |9-13 || TEV Stage Count. | ||
+ | |- | ||
+ | |14-16 || Indirect Texture Stage Count. | ||
+ | |- | ||
+ | |17-18 || Indirect Texture SRT Count. | ||
+ | |- | ||
+ | |19 || Has TEV Swap Table. | ||
+ | |- | ||
+ | |20-23 || TexCoord Gen Count. | ||
+ | |- | ||
+ | |24-27 || Texture SRT Count. | ||
+ | |- | ||
+ | |28-31 || Texture Map Count. | ||
+ | |} | ||
+ | |} | ||
+ | |||
+ | ==== Alpha Comparison ==== | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || Byte || Compare conditions. '''AAAA BBBB''' | ||
+ | '''A''' = Condition 1<br> | ||
+ | '''B''' = Condition 0 | ||
+ | |- | ||
+ | | 0x01 || Byte || Operation. | ||
+ | |- | ||
+ | | 0x02 || Byte || Value to operate on for condition 0. | ||
+ | |- | ||
+ | | 0x03 || Byte || Value to operate on for condition 1. | ||
+ | |} | ||
+ | |||
+ | Below are the possible comparisons on the values. | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || Never pass. | ||
+ | |- | ||
+ | | 0x01 || Alpha < Value. | ||
+ | |- | ||
+ | | 0x02 || Alpha <= Value. | ||
+ | |- | ||
+ | | 0x03 || Alpha == Value. | ||
+ | |- | ||
+ | | 0x04 || Alpha != Value. | ||
+ | |- | ||
+ | | 0x05 || Alpha >= Value. | ||
+ | |- | ||
+ | | 0x06 || Alpha > Value. | ||
+ | |- | ||
+ | | 0x07 || Always pass. | ||
+ | |} | ||
+ | |||
+ | Below are the possible operations on the comparisons. | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || AND. | ||
+ | |- | ||
+ | | 0x01 || OR. | ||
|- | |- | ||
− | | | + | | 0x02 || XOR. |
|- | |- | ||
− | | | + | | 0x03 || NOR. |
+ | |} | ||
+ | |||
+ | ==== Channel Control ==== | ||
+ | Both sources are indices into the material table. | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || Byte || Color material source. | ||
+ | |- | ||
+ | | 0x01 || Byte || Alpha material source. | ||
+ | |- | ||
+ | | 0x02 || UInt16 || Padding. | ||
+ | |} | ||
+ | |||
+ | ==== Indirect Texture SRT ==== | ||
+ | There can only be a total of three indirect texture SRTs (Scale, Rotation, Translation). | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || Float[2] || Translation. | ||
+ | |- | ||
+ | | 0x08 || Float || Rotation. | ||
+ | |- | ||
+ | | 0x0C || Float[2] || Scale. | ||
+ | |} | ||
+ | |||
+ | ==== Indirect Stage ==== | ||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || Byte || Texture coordinate index. | ||
+ | |- | ||
+ | | 0x01 || Byte || Texture map index. | ||
+ | |- | ||
+ | | 0x02 || Byte || Wrap S. | ||
+ | |- | ||
+ | | 0x03 || Byte || Wrap T. | ||
|} | |} | ||
Line 115: | Line 280: | ||
The ''fnl1'' section is a list of fonts. | The ''fnl1'' section is a list of fonts. | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 123: | Line 288: | ||
| 0x04 || UInt32 || Section size. | | 0x04 || UInt32 || Section size. | ||
|- | |- | ||
− | | 0x08 || UInt16 || '''N'''= Number of '''fonts'''. | + | | 0x08 || UInt16 || '''N''' = Number of '''fonts'''. |
|- | |- | ||
− | | 0x0A || UInt16 || {{Unknown-left|'''Unknown'''.}} | + | | 0x0A || UInt16 || {{Unknown-left|'''Unknown'''. Always 00 00.}} |
|} | |} | ||
After this section header comes the offsets to the strings. Each entry has the following structure. | After this section header comes the offsets to the strings. Each entry has the following structure. | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 139: | Line 304: | ||
|} | |} | ||
+ | == Panes == | ||
=== pan1 === | === pan1 === | ||
− | The ''pan1'' section contains information about a pane | + | 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: | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 150: | Line 317: | ||
| 0x04 || UInt32 || Section size. | | 0x04 || UInt32 || Section size. | ||
|- | |- | ||
− | | 0x08 || Byte || | + | | 0x08 || Byte || Flag (0x1 = Visible, 0x2 = Influenced Alpha, 0x4 = Is Widescreen). |
|- | |- | ||
− | | 0x09 || Byte || Origin. | + | | 0x09 || Byte || Origin type. |
|- | |- | ||
| 0x0A || Byte || Alpha. | | 0x0A || Byte || Alpha. | ||
Line 160: | Line 327: | ||
| 0x0C || String || '''Pane name'''. The length is always 0x10, unused bytes are set to 00. | | 0x0C || String || '''Pane name'''. The length is always 0x10, unused bytes are set to 00. | ||
|- | |- | ||
− | | 0x1C || String || User | + | | 0x1C || String || User information, stored as a string. |
|- | |- | ||
| 0x24 || Float[3] || Translation. | | 0x24 || Float[3] || Translation. | ||
Line 168: | Line 335: | ||
| 0x3C || Float[2] || Scale. | | 0x3C || Float[2] || Scale. | ||
|- | |- | ||
− | | 0x44 || Float || Width. | + | | 0x44 || Float || Width of the pane. |
|- | |- | ||
− | | 0x48 || Float || Height. | + | | 0x48 || Float || Height of the pane. |
|} | |} | ||
=== pas1 === | === pas1 === | ||
− | The ''pas1'' section is used as start of pane children data, after this section other panes can be defined. [[#pae1|pae1]] ends it. | + | The ''pas1'' section is used as start of pane children data, after this section other panes can be defined as children. [[#pae1|pae1]] ends it. |
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 186: | Line 353: | ||
=== pae1 === | === pae1 === | ||
− | The ''pae1'' section is used to end pane | + | The ''pae1'' section is used to end pane children. [[#pas1|pas1]] starts it. |
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
Line 197: | Line 364: | ||
|} | |} | ||
− | === | + | === pic1 === |
− | The '' | + | The ''pic1'' section defines a simple image pane. This extends from the normal panel structure. |
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 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 || [[#mat1|Material index]]. | ||
+ | |- | ||
+ | | 0x5E || Byte || Number of [[#UV coordinate set|UV sets]]. | ||
+ | |- | ||
+ | | 0x5F || Byte || {{Unknown-left|'''Unknown'''.}} | ||
+ | |} | ||
+ | |||
+ | After that the [[#UV coordinate set|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|pan1 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. This extends from the normal panel structure. | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | | + | | 0x4C || UInt16 || String size. |
+ | |- | ||
+ | | 0x4E || UInt16 || Maximum string size. | ||
+ | |- | ||
+ | | 0x50 || UInt16 || [[#mat1|Material index]]. | ||
+ | |- | ||
+ | | 0x52 || UInt16 || [[#fnl1|Font index]]. | ||
+ | |- | ||
+ | | 0x54 || Byte || String origin. | ||
+ | |- | ||
+ | | 0x55 || Byte || Line alignment. | ||
+ | '''0''' = Not specified<br> | ||
+ | '''1''' = Left<br> | ||
+ | '''2''' = Center<br> | ||
+ | '''3''' = Right | ||
+ | |- | ||
+ | | 0x56 || UInt16 || Padding. | ||
+ | |- | ||
+ | | 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 || Font Size X. |
|- | |- | ||
− | | | + | | 0x68 || Float || Font Size Y. |
|- | |- | ||
− | | | + | | 0x6C || Float || Character size. |
|- | |- | ||
− | | | + | | 0x70 || Float || Line size. |
|- | |- | ||
− | | | + | | '''T''' || String || Null-termined string of the text in UTF-16. |
|} | |} | ||
− | === | + | === wnd1 === |
− | The '' | + | The ''wnd1'' describes a window pane. A window pane is a more advanced image pane, because windows can represent multiple materials. This extends from the normal panel structure. |
+ | |||
+ | ==== Window Content ==== | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | | + | | 0x4C || Float || Coordinate 1. |
+ | |- | ||
+ | | 0x50 || Float || Coordinate 2. | ||
+ | |- | ||
+ | | 0x54 || Float || Coordinate 3. | ||
+ | |- | ||
+ | | 0x58 || Float || Coordinate 4. | ||
|- | |- | ||
− | | | + | | 0x5C || Byte || Number of frames. |
|- | |- | ||
− | | | + | | 0x5D || Byte || Flag. |
|- | |- | ||
− | | | + | | 0x5E || UInt16 || Padding. |
|- | |- | ||
− | | | + | | 0x60 || UInt32 || Offset to window content. |
|- | |- | ||
− | | | + | | 0x64 || UInt32 || '''Window frame 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 || [[#mat1|Material index]]. |
|- | |- | ||
− | | | + | | 0x7A || Byte || Number of [[#UV coordinate set|UV sets]]. |
|- | |- | ||
− | | | + | | 0x7B || Byte || {{Unknown-left|'''Unknown'''.}} |
|} | |} | ||
− | === | + | After that the [[#UV coordinate set|UV sets]] are specified. |
− | + | ||
+ | ==== Window Frames ==== | ||
+ | After all of the window contents are identified, the window frames for materials are specified. | ||
− | {| class="wikitable" | + | ; Window Frame |
+ | {|class="wikitable" | ||
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || | + | | 0x00 || UInt16 || [[#mat1|Material index]]. |
+ | |- | ||
+ | | 0x02 || Byte || Flip Type. | ||
+ | |- | ||
+ | | 0x03 || Byte || Padding. | ||
|} | |} | ||
− | === | + | Below is a table of possible material flip types. |
− | '' | + | |
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Type !! Description | ||
+ | |- | ||
+ | | 0 || None | ||
+ | |- | ||
+ | | 1 || Flip (Horizontal) | ||
+ | |- | ||
+ | | 2 || Flip (Vertical) | ||
+ | |- | ||
+ | | 3 || Rotate 90 Degrees | ||
+ | |- | ||
+ | | 4 || Rotate 180 Degrees | ||
+ | |- | ||
+ | | 5 || Rotate 270 Degrees | ||
+ | |} | ||
+ | |||
+ | == Groups == | ||
+ | === grp1 === | ||
+ | The ''grp1'' section defines a group. | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || String || '''Section magic'''. Always '' | + | | 0x00 || String || '''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 || Padding. | ||
+ | |- | ||
+ | | 0x1C || String['''N''']|| An array of entries in this group. The length of each string is always 0x10, unused characters are set to 00. | ||
|} | |} | ||
Line 274: | Line 535: | ||
The ''grs1'' section defines a group of groups. [[#gre1|gre1]] ends the group of groups. | The ''grs1'' section defines a group of groups. [[#gre1|gre1]] ends the group of groups. | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
| 0x00 || String || '''Section magic'''. Always ''grs1'' in ASCII. | | 0x00 || String || '''Section magic'''. Always ''grs1'' in ASCII. | ||
+ | |- | ||
+ | | 0x04 || UInt32 || Section size. | ||
|} | |} | ||
Line 284: | Line 547: | ||
The ''gre1'' section ends a group of groups. [[#grs1|grs1]] starts the group of groups. | The ''gre1'' section ends a group of groups. [[#grs1|grs1]] starts the group of groups. | ||
− | {| class="wikitable" | + | {|class="wikitable" |
|- | |- | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
| 0x00 || String || '''Section magic'''. Always ''gre1'' in ASCII. | | 0x00 || String || '''Section magic'''. Always ''gre1'' in ASCII. | ||
+ | |- | ||
+ | | 0x04 || UInt32 || Section size. | ||
+ | |} | ||
+ | |||
+ | == Common data structures == | ||
+ | === UV coordinate set === | ||
+ | Specifies the UV coordinates for an image. Each entry is a 0x20 byte structure as follows: | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! 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 = | = Tools = | ||
The following tools can handle BRLYT files: | The following tools can handle BRLYT files: | ||
− | * [http://wiibrew.org/wiki/Benzin Benzin] (converts BRLYT to XML and viceversa) | + | * [http://wiibrew.org/wiki/Benzin Benzin], by [http://wiibrew.org/wiki/User:SquidMan SquidMan], [http://wiibrew.org/wiki/User:Comex comex], [http://wiibrew.org/wiki/User:Megazig megazig], and [http://wiibrew.org/wiki/User:Yossi Yossi] (converts BRLYT to XML and viceversa) |
− | * [[Wii Layout Editor]] | + | * [[Wii Layout Editor]], by Gericom |
+ | * [[Wexos's Toolbox]], by [[Wexos]] | ||
+ | * [https://github.com/KillzXGaming/Switch-Toolbox/releases Switch Toolbox], by [https://github.com/KillzXGaming KillzXGaming] | ||
− | [[Category:File Format]] | + | [[Category:File Format/Wii]] |
Revision as of 09:51, 18 June 2021
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. They are always found into blyt folders into U8 files.
File Format
Header
The file starts with a header that is 0x10 bytes long:
Offset | Type | Description |
---|---|---|
0x00 | String | File magic. Always RLYT 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 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 | String | 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 | String | 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-termined 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 | String | 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-termined 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 | String | 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 | Bitfield for material structures. After this field, the structures defined in the bitfield are defined.
|
Alpha Comparison
Offset | Type | Description |
---|---|---|
0x00 | Byte | Compare conditions. AAAA BBBB
A = Condition 1 |
0x01 | Byte | Operation. |
0x02 | Byte | Value to operate on for condition 0. |
0x03 | Byte | Value to operate on for condition 1. |
Below are the possible comparisons on the values.
Type | Description |
---|---|
0x00 | Never pass. |
0x01 | Alpha < Value. |
0x02 | Alpha <= Value. |
0x03 | Alpha == Value. |
0x04 | Alpha != Value. |
0x05 | Alpha >= Value. |
0x06 | Alpha > Value. |
0x07 | Always pass. |
Below are the possible operations on the comparisons.
Type | Description |
---|---|
0x00 | AND. |
0x01 | OR. |
0x02 | XOR. |
0x03 | NOR. |
Channel Control
Both sources are indices into the material table.
Offset | Type | Description |
---|---|---|
0x00 | Byte | Color material source. |
0x01 | Byte | Alpha material source. |
0x02 | UInt16 | Padding. |
Indirect Texture SRT
There can only be a total of three indirect texture SRTs (Scale, Rotation, Translation).
Offset | Type | Description |
---|---|---|
0x00 | Float[2] | Translation. |
0x08 | Float | Rotation. |
0x0C | Float[2] | Scale. |
Indirect Stage
Offset | Type | Description |
---|---|---|
0x00 | Byte | Texture coordinate index. |
0x01 | Byte | Texture map index. |
0x02 | Byte | Wrap S. |
0x03 | Byte | Wrap T. |
fnl1
The fnl1 section is a list of fonts.
Offset | Type | Description |
---|---|---|
0x00 | String | 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-termined 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 | String | Section magic. Always pan1 in ASCII. |
0x04 | UInt32 | Section size. |
0x08 | Byte | Flag (0x1 = Visible, 0x2 = Influenced Alpha, 0x4 = Is Widescreen). |
0x09 | Byte | Origin type. |
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 | String | 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 | String | Section magic. Always pae1 in ASCII. |
0x04 | UInt32 | Section size. |
pic1
The pic1 section defines a simple image pane. This extends from the normal panel structure.
Offset | Type | Description |
---|---|---|
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.
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. This extends from the normal panel structure.
Offset | Type | Description |
---|---|---|
0x4C | UInt16 | String size. |
0x4E | UInt16 | Maximum string size. |
0x50 | UInt16 | Material index. |
0x52 | UInt16 | Font index. |
0x54 | Byte | String origin. |
0x55 | Byte | Line alignment.
0 = Not specified |
0x56 | UInt16 | Padding. |
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 | Font Size X. |
0x68 | Float | Font Size Y. |
0x6C | Float | Character size. |
0x70 | Float | Line size. |
T | String | Null-termined string of the text in UTF-16. |
wnd1
The wnd1 describes a window pane. A window pane is a more advanced image pane, because windows can represent multiple materials. This extends from the normal panel structure.
Window Content
Offset | Type | Description |
---|---|---|
0x4C | Float | Coordinate 1. |
0x50 | Float | Coordinate 2. |
0x54 | Float | Coordinate 3. |
0x58 | Float | Coordinate 4. |
0x5C | Byte | Number of frames. |
0x5D | Byte | Flag. |
0x5E | UInt16 | Padding. |
0x60 | UInt32 | Offset to window content. |
0x64 | UInt32 | Window frame 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.
Window Frames
After all of the window contents are identified, the window frames for materials are specified.
- Window Frame
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Material index. |
0x02 | Byte | Flip Type. |
0x03 | Byte | Padding. |
Below is a table of possible material flip types.
Type | Description |
---|---|
0 | None |
1 | Flip (Horizontal) |
2 | Flip (Vertical) |
3 | Rotate 90 Degrees |
4 | Rotate 180 Degrees |
5 | Rotate 270 Degrees |
Groups
grp1
The grp1 section defines a group.
Offset | Type | Description |
---|---|---|
0x00 | String | 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 | Padding. |
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 | String | Section magic. Always grs1 in ASCII. |
0x04 | UInt32 | Section size. |
gre1
The gre1 section ends a group of groups. grs1 starts the group of groups.
Offset | Type | Description |
---|---|---|
0x00 | String | Section magic. Always gre1 in ASCII. |
0x04 | UInt32 | Section size. |
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:
- Benzin, by SquidMan, comex, megazig, and Yossi (converts BRLYT to XML and viceversa)
- Wii Layout Editor, by Gericom
- Wexos's Toolbox, by Wexos
- Switch Toolbox, by KillzXGaming