BTI (File Format)

From Custom Mario Kart
Revision as of 09:25, 20 November 2016 by Wexos (talk | contribs)
Jump to navigation Jump to search

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


Appearance in MKW

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

File Format

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

File Header

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

File Header
Offset Size Description
0x00 1 Image format.
0x01 1 Enable alpha (0x00 means alpha is disabled, anything higher means alpha is enabled).
0x02 2 Width of image in pixels.
0x04 2 Height of image in pixels.
0x06 1 wrap_s[1] (0x01 for posteffect.bti, 0x00 for others). Probably Repeat, Clamp or Mirror wraps for U Projection Maps.
0x07 1 wrap_t[2] (0x01 for posteffect.bti, 0x00 for others). Probably Repeat, Clamp or Mirror wraps for V Projection Maps.
0x08 2 Palette Format (palette formats not used in MKWii).
0x0a 2 Number of palette entries.
0x0c 4 Offset of palette data relative to file header.
0x10 4 Unknown. Always 0 in MKWii.
0x14 1 Magnification filter type (0x00 means nearest, 0x01 means linear).
0x15 1 Minification filter type.
0x16 2 Unknown. Always 0 in MKWii.
0x18 1 Number of images (= number_of_mipmaps + 1).
0x19 1 Unknown. Always 0 in MKWii.
0x1a 2 Unknown. Always 0 in MKWii.
0x1c 4 Offset of image data relative to 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 + optional Alpha (compressed)

Tools