BFLIM (File Format)

From Wexos's Wiki
Jump to navigationJump to search

The BFLIM file format (Binary caFe Layout IMage) is used to store layout images on Wii U.

File Format

Header

The header is at the end of the file (to align the image data without the need for additional padding). It is always 0x14 bytes.

Offset Type Description
0x00 Char[4] File magic. Always FLIM in ASCII.
0x04 UInt16 Byte-order-mark. FE FF for big endian, FF FE for little endian.
0x06 UInt16 Header size, always 0x14.
0x08 UInt32 Version of this file.
0x0C UInt32 File size in bytes.
0x10 UInt16 Number of data blocks, always 0x01.
0x12 UInt16 Padding. Seems to reflect upper 2 bytes of filesize (apparently uninitialized memory garbage from file generator).

Image Information

A section containing image information comes directly after header. It is always 0x14 bytes long.

Offset Type Description
0x00 Char[4] Section magic. Always imag in ASCII.
0x04 UInt32 Parse information size (total block size), always 0x10 (this and next 0xC bytes).
0x08 UInt16 Width of the texture in pixels.
0x0A UInt16 Height of the texture in pixels.
0x0C UInt16 File alignment, always a power of 2.
0x0E Byte Image format.
0x0F Byte Tile mode and Swizzle, packed as bits SSSTTTTT.
  • TTTTT maps to GX2TileMode (line 795 here). Typically GX2_TILE_MODE_2D_TILED_THIN1 (4).
  • SSS is the initial swizzle value. Could be anything from 0 to 7.
0x10 UInt32 Raw data size, always 0x0C minus 0x28 (the header).

Format

ID Name Type Bits Per Pixel Suffix
0x00 L8_UNORM Luminance 8 ^c
0x01 A8_UNORM Alpha 8 ^d
0x02 LA4_UNORM Luminance + Alpha 8 ^e
0x03 LA8_UNORM Luminance + Alpha 16 ^f
0x04 HILO8 ? 16 ^g
0x05 RGB565_UNORM Color 16 ^h
0x06 RGBX8_UNORM Color 32 ^i
0x07 RGB5A1_UNORM Color + Alpha 16 ^j
0x08 RGBA4_UNORM Color + Alpha 16 ^k
0x09 RGBA8_UNORM Color + Alpha 32 ^l
0x0A ETC1_UNORM Color 4 ^m
0x0B ETC1A4_UNORM Color + Alpha 8 ^n
0x0C BC1_UNORM Color + Alpha 4 ^o
0x0D BC2_UNORM Color + Alpha 8 ^p
0x0E BC3_UNORM Color + Alpha 8 ^q
0x0F BC4L_UNORM Luminance 4 ^r
0x10 BC4A_UNORM Alpha 4 ^s
0x11 BC5_UNORM Red + Green + Alpha 8 ^t
0x12 L4_UNORM Luminance 4 ^u
0x13 A4_UNORM Alpha 4 ^v
0x14 RGBA8_SRGB Color + Alpha 32 ^w
0x15 BC1_SRGB Color + Alpha 4 ^x
0x16 BC2_SRGB Color + Alpha 8 ^y
0x17 BC3_SRGB Color + Alpha 8 ^z
0x18 RGB10A2_UNORM Color + Alpha 32 ?
0x19 RGB565_INDIRECT_UNORM Color? 16 ?

Tools

The following tools can handle BFLIM files: