Difference between revisions of "BFLIM (File Format)"

From MK8
Jump to navigation Jump to search
m (→‎Format: Redundant comment)
m (Inconsistent and unnecessary.)
Line 57: Line 57:
 
! Type
 
! Type
 
! Bits per pixel (bpp)
 
! Bits per pixel (bpp)
! Notes
 
 
|-
 
|-
 
|0x00
 
|0x00
Line 63: Line 62:
 
|luminance
 
|luminance
 
|8
 
|8
|^c BFLIM files
 
 
|-
 
|-
 
|0x01
 
|0x01
Line 69: Line 67:
 
|alpha
 
|alpha
 
|8
 
|8
|^d BFLIM files
 
 
|-
 
|-
 
|0x02
 
|0x02
Line 75: Line 72:
 
|luminance+alpha
 
|luminance+alpha
 
|8
 
|8
|^e BFLIM files
 
 
|-
 
|-
 
|0x03
 
|0x03
Line 81: Line 77:
 
|luminance+alpha
 
|luminance+alpha
 
|16
 
|16
|^f BFLIM files
 
 
|-
 
|-
 
|0x04
 
|0x04
Line 87: Line 82:
 
|alpha
 
|alpha
 
|16
 
|16
|^g BFLIM files
 
 
|-
 
|-
 
|0x05
 
|0x05
Line 93: Line 87:
 
|color
 
|color
 
|16
 
|16
|^h BFLIM files
 
 
|-
 
|-
 
|0x06
 
|0x06
Line 99: Line 92:
 
|color
 
|color
 
|32
 
|32
|^i BFLIM files
 
 
|-
 
|-
 
|0x07
 
|0x07
Line 105: Line 97:
 
|color+alpha  
 
|color+alpha  
 
|16
 
|16
|^j BFLIM files
 
 
|-
 
|-
 
|0x08
 
|0x08
Line 111: Line 102:
 
|color+alpha  
 
|color+alpha  
 
|16
 
|16
|^k BFLIM files
 
 
|-
 
|-
 
|0x09
 
|0x09
Line 117: Line 107:
 
|color+alpha  
 
|color+alpha  
 
|32
 
|32
|^l BFLIM files
 
 
|-
 
|-
 
|0x0A
 
|0x0A
Line 123: Line 112:
 
|color
 
|color
 
|64
 
|64
|^m BFLIM files
 
 
|-
 
|-
 
|0x0B
 
|0x0B
Line 129: Line 117:
 
|color+alpha
 
|color+alpha
 
|128
 
|128
|^n BFLIM files
 
 
|-
 
|-
 
|0x0C
 
|0x0C
Line 135: Line 122:
 
|color+alpha
 
|color+alpha
 
|64
 
|64
|^o BFLIM files
 
 
|-
 
|-
 
|0x0D
 
|0x0D
Line 141: Line 127:
 
|color+alpha
 
|color+alpha
 
|128
 
|128
|^p BFLIM files
 
 
|-
 
|-
 
|0x0E
 
|0x0E
Line 147: Line 132:
 
|color+alpha
 
|color+alpha
 
|128
 
|128
|^q BFLIM files
 
 
|-
 
|-
 
|0x0F
 
|0x0F
Line 153: Line 137:
 
|luminance
 
|luminance
 
|64
 
|64
|^r BFLIM files
 
 
|-
 
|-
 
|0x10
 
|0x10
Line 159: Line 142:
 
|alpha
 
|alpha
 
|64
 
|64
|^s BFLIM files
 
 
|-
 
|-
 
|0x11
 
|0x11
Line 165: Line 147:
 
|luminance+alpha
 
|luminance+alpha
 
|128
 
|128
|^t BFLIM files
 
 
|-
 
|-
 
|0x12
 
|0x12
Line 171: Line 152:
 
|luminance
 
|luminance
 
|4
 
|4
|^u BFLIM files
 
 
|-
 
|-
 
|0x13
 
|0x13
Line 177: Line 157:
 
|alpha
 
|alpha
 
|4
 
|4
|^v BFLIM files
 
 
|-
 
|-
 
|0x14
 
|0x14
Line 183: Line 162:
 
|color+alpha
 
|color+alpha
 
|32
 
|32
|^w BFLIM files
 
 
|-
 
|-
 
|0x15
 
|0x15
Line 189: Line 167:
 
|color+alpha
 
|color+alpha
 
|64
 
|64
|^x BFLIM files
 
 
|-
 
|-
 
|0x16
 
|0x16
Line 195: Line 172:
 
|color+alpha
 
|color+alpha
 
|128
 
|128
|^y BFLIM files
 
 
|-
 
|-
 
|0x17
 
|0x17
Line 201: Line 177:
 
|color+alpha
 
|color+alpha
 
|128
 
|128
|^z BFLIM files
 
 
|-
 
|-
 
|0x18
 
|0x18
Line 207: Line 182:
 
|color+alpha
 
|color+alpha
 
|32
 
|32
|??
 
 
|-
 
|-
 
|0x19
 
|0x19
Line 213: Line 187:
 
|color
 
|color
 
|16
 
|16
|??
 
 
|-
 
|-
 
|}
 
|}

Revision as of 22:20, 21 July 2017

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

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 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

A section containing image information comes directly after header. It is always 0x14 bytes long. 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 of the texture in pixels.
0x1E 2 UInt16 Height of the texture in pixels.
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

Format

ID Name Type Bits per pixel (bpp)
0x00 R8_UNORM / L8 luminance 8
0x01 R8_UNORM / A8 alpha 8
0x02 R4G4_UNORM / L4A4 luminance+alpha 8
0x03 R8G8_UNORM / L8A8 luminance+alpha 16
0x04 R8G8_UNORM / HILO8 alpha 16
0x05 R5G6B5_UNORM / RGB565 color 16
0x06 RGB8_UNORM / RGB888 color 32
0x07 RGB5A1_UNORM / RGB555A1 color+alpha 16
0x08 RGBA4_UNORM / RGBA4444 color+alpha 16
0x09 RGBA8_UNORM / RGBA8888 color+alpha 32
0x0A BC1_UNORM / ETC1 color 64
0x0B BC3_UNORM / ETC1A4 color+alpha 128
0x0C BC1_UNORM / DXT1 color+alpha 64
0x0D BC2_UNORM / DXT3 color+alpha 128
0x0E BC3_UNORM / DXT5 color+alpha 128
0x0F BC4_UNORM / BC4L / ATI1 (Low-End) luminance 64
0x10 BC4_UNORM / BC4A / ATI1 (High-End) alpha 64
0x11 BC5_UNORM / ATI2 luminance+alpha 128
0x12 BC4_UNORM / L4 luminance 4
0x13 BC4_UNORM / A4 alpha 4
0x14 RGBA8_SRGB / RGBA8888 color+alpha 32
0x15 BC1_SRGB / DXT1 color+alpha 64
0x16 BC2_SRGB / DXT3 color+alpha 128
0x17 BC3_SRGB / DXT5 color+alpha 128
0x18 RGB10A2_UNORM / RGB10A2 color+alpha 32
0x19 RGB565_UNORM / RGB565 color 16

Tools

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