BFLYT (File Format)

From MK8
Jump to navigation Jump to search

BFLYT (Binary caFe LaYouT) is an updated format for BRLYT files on the Wii. It contains 2D layout information.

Format

Header

The file starts with a header which is 0x14 bytes long.

Offset Type Description
0x00 String File magic. Always FLYT in ASCII.
0x04 UInt16 Byte Order Mark (BOM): 0xFEFF for big endian and 0xFFFE for little endian.
0x06 UInt16 Header size.
0x08 UInt32 Version.
0x0C UInt32 File size.
0x10 UInt16 Number of sections.
0x12 UInt16 Padding.

Sections

After the header comes first 4 sections, where 3 of them are optional. Then comes all the panes and then the groups.

lyt1

The lyt1 section contains general information about the layout.

Offset Type Description
0x00 String Section magic. Always lyt1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Drawn from center.
0x09 Byte[3] Padding.
0x0C Float Width of the layout.
0x10 Float Height of the layout.
0x14 Float Max parts height. Unknown meaning.
0x18 Float Max parts height. Unknown meaning.
0x1C Float Layout name.

txl1

The txl1 section is a list of external BFLIM references.

Offset Type Description
0x00 String Section magic. Always txl1 in ASCII.
0x04 UInt32 Section size.
0x08 UInt16 N = Number of textures.
0x0A UInt16 Padding.
0x0C UInt32[N] Texture string offsets. Links to null-termined strings.

fnl1

The fnl section is a font list. It links to external BFFNT files.

Offset Type Description
0x00 String Section magic. Always fnl1 in ASCII.
0x04 UInt32 Section size.
0x08 UInt16 N = Number of fonts.
0x0A UInt16 Padding.
0x0C UInt32[N] Font string offsets. Links to null-termined strings.

mat1

The mat1 section stores materials. It is currently unknown.

Offset Type Description
0x00 String Section magic. Always mat1 in ASCII.
0x04 UInt32 S = Section size.
0x08 Byte[S] Material data.

pas1

The pas1 section indicates start of children pane data.

Offset Type Description
0x00 String Section magic. Always pas1 in ASCII.
0x04 UInt32 Section size.

pae1

The pas1 section indicates end of children pane data.

Offset Type Description
0x00 String Section magic. Always pae1 in ASCII.
0x04 UInt32 Section size.

pan1

The pan1 section contains information about a null pane, a pane that isn't visible. The root pane is always a pan1 called "RootPane". Other pane sections start with this structure and then has additional data. The only difference is that the magic is changed.

Offset Type Description
0x00 String Section magic. Always pan1 in ASCII.
0x04 UInt32 Section size.
0x08 Byte Flag 1. xxxx xxAB:

A = Influence alpha B = Visible

0x09 Byte Flag 2. AABB CCDD:

A = Origin X where 0 = center, 1 = left, 2 = right
B = Origin Y where 0 = center, 1 = top, 2 = bottom
C = Parent origin X (same values as A)
D = Parent origin Y (same values as B)

0x0A Byte Alpha.
0x0B Byte Unknown.
0x0C String Pane name. The string has a fixed length of 0x18, unused characters are set to 0.
0x24 String User information. Unknown purpose. The string has a fixed length of 8, unused character are set to 0.
0x2C Float[3] Pane translation in X, Y and Z directions.
0x38 Float[3] Pane rotation in X, Y and Z directions.
0x44 Float[2] Pane scale in X and Y directions.
0x4C Float[2] Pane size in X and Y directions.

pic1

The pic1 section contains information about a picture pane.

Offset Type Description
0x54 Byte[4] Top left vertex color in RGBA format.
0x58 Byte[4] Top right vertex color in RGBA format.
0x5C Byte[4] Bottom left vertex color in RGBA format.
0x60 Byte[4] Bottom right vertex color in RGBA format.
0x64 UInt16 Material index.
0x66 Byte Number of UV coordinates.
0x67 Byte Padding.

UV coordinates then follows with the following structures.

Offset Type Description
0x00 Float[2] Top left UV coordinates.
0x08 Float[2] Top right UV coordinates.
0x10 Float[2] Bottom left UV coordinates.
0x08 Float[2] Bottom right UV coordinates.

txt1

The txt1 section contains information about a text pane.

Offset Type Description
0x54 UInt16 Text length.
0x56 UInt16 Restricted text length.
0x58 UInt16 Material index.
0x5A UInt16 Font index.
0x5C Byte Text alignment. xxxx AABB

A = Horizontal where 0 = Center, 1 = Left, 2 = Right
B = Vertical where 0 = Center, 1 = Left, 2 = Right

0x5D Byte Line alignment.

0 = Not specified
1 = Left
2 = Center
3 = Right

0x5E Byte Flag 1. xxxA BBCD

A = Per Char Transform enabled
B = Border format where 0 = standart, 1 = Delete Border, 2 = Render in two cycles
C = Restricted text lenght enabled
D = Shadow enabled

0x5F Byte Padding.
0x60 Float Italic tilt.
0x64 UInt32 Text offset, relative to the start of this pane. Links to the pane text which is stored in UTF-16 (big endian) as a null-termined string.
0x68 Byte[4] Font top color in RGBA format.
0x6C Byte[4] Font bottom color in RGBA format.
0x70 Float[2] Font XY size.
0x78 Float Character space.
0x7C Float Line space.
0x80 UInt32 Textbox name offset, relative to the start of this pane. Links to the name of this textbox, stored in ASCII as a null-termined string.
0x84 Float[2] Shadow XY.
0x8C Float[2] Shadow XY size.
0x94 Byte[4] Shadow top color in RGBA format.
0x98 Byte[4] Shadow bottom color in RGBA format.
0x9C Float Shadow italic.
0xA0 UInt32 Per character transform offset. Links to an unknown structure.

wnd1

The wnd1 pane contains information about a window pane. It is unknown how it works.

Offset Type Description
0x54 Int16 Inflation left.
0x56 Int16 Inflation right.
0x58 Int16 Inflation top.
0x5A Int16 Inflation bottom.
0x5C Int16 Frame size left.
0x5E Int16 Frame size right.
0x60 Int16 Frame size top.
0x62 Int16 Frame size bottom.
0x64 Byte N = Number of frames.
0x65 Byte Window flag.
0x66 UInt16 Padding.
0x68 UInt32 Content offset.
0x6C UInt32 Frame offset table offset. Links to a UInt32[N} with offsets which links to window frames. All offsets are relative to the start of the pane.

Window Content

Offset Type Description
0x00 Byte[4] Top left vertex color in RGBA format.
0x04 Byte[4] Top right vertex color in RGBA format.
0x08 Byte[4] Bottom left vertex color in RGBA format.
0x0C Byte[4] Bottom right vertex color in RGBA format.
0x10 UInt16 Material index.
0x12 Byte Number of UV coordinates.
0x13 Byte Padding.

UV coordinates then follows with the following structures.

Offset Type Description
0x00 Float[2] Top left UV coordinates.
0x08 Float[2] Top right UV coordinates.
0x10 Float[2] Bottom left UV coordinates.
0x08 Float[2] Bottom right UV coordinates.

Window Frame

Offset Type Description
0x00 UInt16 Material index.
0x02 Byte Texture flip.
0x03 Byte Padding.

bnd1

The bnd1 section is a boundary pane. It has unknown purpose and no additional data follows the pane.

prt1

The prt1 section is an unknown pane. Unknown additional data follows the pane.

grs1

The grs1 section indicates start of group children data.

Offset Type Description
0x00 String Section magic. Always grs1 in ASCII.
0x04 UInt32 Section size.

gre1

The gre1 section indicates end of group children data.

Offset Type Description
0x00 String Section magic. Always gre1 in ASCII.
0x04 UInt32 Section size.

grp1

The grp1 section contains information about a group.

Offset Type Description
0x00 String Section magic. Always grp1 in ASCII.
0x04 UInt32 Section size.
if BFLYT version < 5.2.0.0
0x08 String Group name. The string has a fixed length of 0x18, unused characters are set to 0.
0x20 UInt16 Number of children.
0x22 UInt16 Padding.
0x08 String Group name. The string has a fixed length of 0x22, unused characters are set to 0.
0x2A UInt16 Number of children.

The section follows by children names. The amount is given by "Number of children". Each string has a fixed length of 0x18, unused characters are set to 0.

cnt1

Unknown.

Offset Type Description
0x00 String Section magic. Always cnt in ASCII.
0x04 UInt32 S = Section size.
0x08 Byte[S - 8] Unknown data.

usd1

The usd1 section contains user data, generic data set by the creator. User data can be attached to any pane section. The section follows directly after the section it is attached to.

Offset Type Description
0x00 String Section magic. Always usd1 in ASCII.
0x04 UInt32 S = Section size.
0x08 Byte[S - 8] Unknown data.

Tools

The following tool can handle BFLYT files: