BTI (File Format)

From Custom Mario Kart
(Redirected from BTI)
Jump to: navigation, search

BTI is an image file format similar to TEX0, TPL and BREFT file formats. The only difference is the file header.


Appearance in Mario Kart Wii

BTI files are used rarely in Mario Kart Wii. They can be found in some tracks with 3 different file names:

File Format

The file format is very simple and starts with a file header followed by the image data. All data is written in big endian.

File Header

The following table shows the file header. It is 0x20 bytes long. There is no magic to identify BTI files, so tools may do some plausibility checks to identify them.

File Header
Offset Type Description
0x00 Byte Image format.
0x01 Byte Enable alpha (0x00 means alpha is disabled, anything higher means alpha is enabled).
0x02 UInt16 Width of the image in pixels.
0x04 UInt16 Height of the image in pixels.
0x06 Byte Wrap S[1] (0x01 for posteffect.bti, 0x00 for others). Probably repeat, clamp or mirror wraps for U projection maps.
0x07 Byte Wrap T[2] (0x01 for posteffect.bti, 0x00 for others). Probably repeat, clamp or mirror wraps for V projection maps.
0x08 UInt16 Palette format (not used in Mario Kart Wii).
0x0A UInt16 Number of palette entries.
0x0C UInt32 Offset to palette data, relative to the start of the file header.
0x10 UInt32 Unknown. Always 0 in Mario Kart Wii.
0x14 Byte Magnification filter type (0x00 means nearest, 0x01 means linear).
0x15 Byte Minification filter type.
0x16 UInt16 Unknown. Always 0 in Mario Kart Wii.
0x18 Byte Total number of images, thus number of mipmaps + 1.
0x19 Byte Unknown. Always 0 in Mario Kart Wii.
0x1A UInt16 Unknown. Always 0 in Mario Kart Wii.
0x1C UInt32 Offset to image data, relative to the start of the file header.
0x20 End of file header

Image and Palette Data

The image and palette data starts at the given data offset in the file header. The data depends on the image and palette formats format. The image format values are listed below.

Image Formats
ID Name Bits per pixel Block width Block height Block size Type
0x00 I4 4 8 8 32 bytes Gray
0x01 I8 8 8 4 32 bytes Gray
0x02 IA4 8 8 4 32 bytes Gray + Alpha
0x03 IA8 16 4 4 32 bytes Gray + Alpha
0x04 RGB565 16 4 4 32 bytes Color
0x05 RGB5A3 16 4 4 32 bytes Color + Alpha
0x06 RGBA32 (RGBA8) 32 4 4 64 bytes Color + Alpha
0x08 C4 (CI4) 4 8 8 32 bytes Palette (IA8, RGB565, RGB5A3)
0x09 C8 (CI8) 8 8 4 32 bytes Palette (IA8, RGB565, RGB5A3)
0x0A C14X2 (CI14x2) 16 4 4 32 bytes Palette (IA8, RGB565, RGB5A3)
0x0E CMPR 4 8 8 32 bytes Color + 1 bit Alpha (compressed)

Tools