BFLYT (File Format)

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

BFLYT (Binary caFe LaYouT) is a layout file foormat used on Wii U and Nintendo Switch. It contains 2D layout information.

Format

Header

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

Offset Type Description
0x00 Char[4] File magic. Always FLYT in ASCII.
0x04 UInt16 Byte-order-mark. FE FF for big endian, FF FE for little endian.
0x06 UInt16 Header size.
0x08 UInt32 Version number.
0x0C UInt32 Size of the file in bytes.
0x10 UInt16 Number of sections.
0x12 UInt16 Padding.

After the header comes all sections. The first section is always lyt1, and after comes optionally txl1, fnl1 and mat1. After that comes all panes, then all groups. Optionally at the end comes cnt1. Most sections can also have an usd1 section attached after.

lyt1

The lyt1 section contains general information about the layout.

Offset Type Description
0x00 Char[4] Section magic. Always lyt1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 Byte Drawn from center flag.
0x09 Byte[3] Padding.
0x0C Float Width of the layout.
0x10 Float Height of the layout.
0x14 Float Max parts width. Unknown meaning.
0x18 Float Max parts height. Unknown meaning.
0x1C StringNT Layout name.

txl1

The txl1 section is a list of external BFLIM files, or textures inside a BNTX file.

Offset Type Description
0x00 Char[4] Section magic. Always txl1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 UInt16 N = Number of textures.
0x0A UInt16 Padding.
0x0C UInt32[N] Texture string offsets. Links to null-terminated strings.

fnl1

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

Offset Type Description
0x00 Char[4] Section magic. Always fnl1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 UInt16 N = Number of fonts.
0x0A UInt16 Padding.
0x0C UInt32[N] Font string offsets. Links to null-terminated strings.

mat1

The mat1 section stores materials. It is currently unknown.

Offset Type Description
0x00 Char[4] 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 Char[4] Section magic. Always pas1 in ASCII.
0x04 UInt32 Size of this section in bytes.

pae1

The pas1 section indicates end of children pane data.

Offset Type Description
0x00 Char[4] Section magic. Always pae1 in ASCII.
0x04 UInt32 Size of this section in bytes.

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 Char[4] Section magic. Always pan1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 Byte Flag 1. xxxx xxAB:

A: Influence alpha.
B: Visible.

0x09 Byte Flag 2. AABB CCDD:

A: Origin X. 0 = center, 1 = left, 2 = right
B: Origin Y. 0 = center, 1 = top, 2 = bottom
C: Parent origin X. Same options as A.
D: Parent origin Y. Same options as B.

0x0A Byte Pane alpha.
0x0B Byte Flag ex.
0x0C String Pane name. The string has a fixed length of 0x18, unused characters are set to 0.
0x24 String User information, which can store information for developers. 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.

Picture UV Coordinate

Each entry has the following structure:

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 buffer size.
0x56 UInt16 Text string length.
0x58 UInt16 Material index.
0x5A UInt16 Font index.
0x5C Byte Text alignment. xxxx AABB

A: Horizontal alignment. 0 = Center, 1 = Left, 2 = Right
B: Vertical alignment. Same options as above.

0x5D Byte Line alignment:
Value Description
0x00 Not specified
0x01 Left
0x02 Center
0x03 Right
0x5E Byte Flag 1. xxxA BBCD

A: Per character transform enabled.
B: Border format. 0 = standard, 1 = Delete border, 2 = Render in two cycles
C: Restricted text length 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 as a null-terminated 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-terminated string.
0x84 Float[2] Shadow XY translation.
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 tilt.
If version ≥ 8.0.0.0
0xA0 UInt32 Line transform offset, relative to the start of this pane.
0xA4 UInt32 Per character transform offset, relative to the start of this pane.
Else if version ≥ 5.0.0.0
0xA0 UInt32 Per character transform offset, relative to the start of this pane.

Line Width

Unknown

Per Character Transform

Offset Type Description
0x00 Float Eval time offset.
0x04 Float Eval time width.
0x08 Byte Loop type.
0x09 Byte Origin V.
0x0A Byte Has animation info.
0x0B Byte Padding.

If the structure has animation info, this structure follows.

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, relative to the start of this pane.
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.
Window UV Coorinate

Each entry has the following structure:

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.
Value Description
0x00 None
0x01 Flip U
0x02 Flop V
0x03 Rotate 90
0x04 Rotate 180
0x05 Rotate 270
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 a part pane.

Offset Type Description
0x54 UInt32 Number of properties.
0x58 Float[2] Magnify.

The property entries follow after the header. After the entries, the part name is stored.

Part Property

Offset Type Description
0x00 Char[0x18] Property name.
0x18 Byte Usage flag.
0x19 Byte Basic usage flag.
0x1A Byte Material usage flag.
0x1B Byte Padding.
0x1C UInt32 Pane offset, relative to the start of this pane. Can link to a pic1 pane, a tx1 pane or a prt1 pane.
0x20 UInt32 User data offset, relative to the start of this pane.
0x24 UInt32 Pane basic info offset, relative to the start of this pane.
Pane Basic Info
Offset Type Description
0x00 Char[8] User data.
0x08 Float[3] Pane translation.
0x14 Float[3] Pane rotation.
0x20 Float[2] Pane scale.
0x28 Float[2] Pane size.
0x30 Byte Pane alpha.
0x31 Byte[3] Padding.

grs1

The grs1 section indicates start of group children data.

Offset Type Description
0x00 Char[4] Section magic. Always grs1 in ASCII.
0x04 UInt32 Size of this section in bytes.

gre1

The gre1 section indicates end of group children data.

Offset Type Description
0x00 Char[4] Section magic. Always gre1 in ASCII.
0x04 UInt32 Size of this section in bytes.

grp1

The grp1 section contains information about a group.

Offset Type Description
0x00 Char[4] Section magic. Always grp1 in ASCII.
0x04 UInt32 Size of this section in bytes.
If version ≥ 5.0.0.0
0x08 Char[0x21] Group name.
0x29 Byte Padding.
0x2A UInt16 Number of children.
Else
0x08 Char[0x18] Group name.
0x20 UInt16 Number of children.
0x22 UInt16 Padding.

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 Char[4] Section magic. Always cnt1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 UInt32 Control username offset, relative to the start of this pane. Points to a null-terminated string.
0x0C UInt32 Control functional panel names offset, relative to the start of this pane. Points to an array of Char[0x18]. After that, a uint[] is stored, and points to null-terminated strings, which are control functional animation names.
0x10 UInt16 Number of control functional panels.
0x12 UInt16 Number of control functional animations.
0x14 UInt32 Control functional pane parameter name offset table offset, relative to the start of this pane. Points to a uint[], which points to null-terminated strings.
0x18 UInt32 Control functional animation parameter name offset table offset, relative to the start of this pane.Points to a uint[], which points to null-terminated strings.
0x1C StringNT Control name.

usd1

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

Offset Type Description
0x00 Char[4] Section magic. Always usd1 in ASCII.
0x04 UInt32 Size of this section in bytes.
0x08 UInt16 Number of user datas.
0x0A Byte[2] Padding.

User Data

Offset Type Description
0x00 UInt32 Name offset, relative to the start of this structure.
0x04 UInt32 Data offset, relative to the start of this structure.
0x08 UInt16 Number of datas stored. For type string, this is size of the string in bytes. The string is splitted by a newline character.
0x0A Byte User data type.
Value Description
0x00 String
0x01 Int32
0x02 Float
0x03 System data (9.0.0.0)
0x0B Byte Padding.

String

The string is stored as a null-terminated UTF-8 string. Multiple strings can be stored, and in memory they are joined together by \ .

Int32

Each entry is a 32-bit signed integer.

Float

Each entry is a 32-bit floating-precision number.

System Data

System data is user data which has been added by the binary converter. Each entry has the following structure:

Offset Type Description
0x00 UInt16 Binary version.
0x02 UInt16 Number of entries.
0x04 UInt32[] Entry offsets, relative to the start of this structure.
System Data Entry

This is only the data structure for the system data which has been seen. It has the following structure.

Offset Type Description
0x00 UInt32 System data type.
0x04 UInt32 Number of entries.
0x08 UInt32[] Tage name offsets, relative to the start of this structure. All strings are null-terminated.

Version List

Version Found in
2.2.0.0
3.3.0.0
5.0.0.0
5.2.0.0
8.0.0.0
8.2.0.0
8.3.0.0
8.5.0.0
  • Nintendo Switch System BIOS (5.0.2 – 5.1.0)
8.6.0.0
9.0.0.0

Tools

The following tool can handle BFLYT files: