Difference between revisions of "BFLIM (File Format)"

From MK8
Jump to: navigation, search
m (Format)
Line 88: Line 88:
|^h BFLIM files
|^h BFLIM files

Revision as of 15:14, 29 June 2017

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


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 Size Type Description
0x00 4 Char[4] File magic. Always FLIM in ASCII.
0x04 2 UInt16 Byte order mark (BOM): 0xFEFF for big endian and 0xFFFE for little endian. Not handled on consoles, so the file data must be stored in the endianness of the target console (e.g. big endian for the Wii U).
0x06 2 UInt16 Header size, always 0x14.
0x08 4 UInt32 Version of this file.
0x0C 4 UInt32 File size in bytes.
0x10 2 UInt16 Number of data blocks, always 0x01.
0x12 2 UInt16 Padding. Seems to reflect upper 2 bytes of filesize (apparently uninitialized memory garbage from file generator).
0x14 End of FLIM header

Image Information

Comes directly after header, always 0x14 bytes. The formats are not the same in games like New Super Mario Bros U, be sure to use filename if possible (EG: ^l).

Offset Size Type Description
0x14 4 Char[4] Section magic. Always imag in ASCII.
0x18 4 UInt32 Parse information size (total block size), always 0x10 (this and next 0xC bytes).
0x1C 2 UInt16 Width.
0x1E 2 UInt16 Height.
0x20 2 UInt16 File alignment, always a power of 2. Usually 0x800, 0x1000 or 0x2000.
0x22 1 Byte Format, how the data is stored.
0x23 1 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 swizzle value shifted right by 8.
0x24 4 UInt32 Raw data size, always 0xC minus 0x28 (the header).
0x28 End of Image header


ID Name Type Bits per pixel Notes
0x00 R8_UNORM / L8 luminance 8 ^c BFLIM files
0x01 R8_UNORM / A8 alpha 8 ^d BFLIM files
0x02 R4_G4_UNORM / L4A4 luminance+alpha 8 ^e BFLIM files
0x03 R8_G8_UNORM / L8A8 luminance+alpha 16 ^f BFLIM files
0x05 RGB565 color 16 ^h BFLIM files
0x06 RGBA4_UNORM / RGBA4444 color+alpha 16
0x07 RGB5A1_UNORM / RGB555A1 color+alpha 16 ^j BFLIM files
0x09 RGBA32_UNORM / RGBA8888 color+alpha 32 ^l BFLIM files
0x0C BC1_UNORM / DXT1 Compressed 16 ^i / ^o BFLIM files
0x0D BC2_UNORM / DXT3 Compressed ^p BFLIM files
0x0E BC3_UNORM / DXT5 Compressed 16 ^k / ^q BFLIM files
0x0F I4? / BC4_UNORM / ATI1 (Low-End) color ^r / +r BFLIM files
0x10 IA4? / BC4_UNORM / ATI1 (High-End) color+alpha ^s BFLIM files
0x11 I8? / BC5_UNORM / ATI2 color ^t / +t BFLIM files
0x12 IA8? / BC1_UNORM / DXT1 color+alpha ^i BFLIM files
0x14 RGBA32_UNORM / RGBA8888 color+alpha 32 ^l BFLIM files
0x15 BC1_UNORM / DXT1 Compressed 32 ^o BFLIM files
0x16 BC2_UNORM / DXT3 Compressed 32 ^p BFLIM files
0x17 BC3_UNORM / DXT5 Compressed 32 ^q BFLIM files


The following tools can extract (and generate) BFLIM files: