TEX0 (File Format)
Overview
This page describes the Mario Kart Wii TEX0 file format, as found within BRRES files. They are a type of texture files.
File Format
File Header
Offset | Type | Description |
---|---|---|
0x00 | String | The magic "TEX0" to identify the sub file. See »BRRES Sub Files« for other magics. |
0x04 | UInt32 | Length of the sub file. |
0x08 | UInt32 | Sub file version number. The number of sections (N) is dependent of this version number. See »BRRES Sub Files« for details. |
0x0C | Int32 | Offset to outer BRRES File. |
0x10 | Int32[N] | N section offsets. N is implied in the version number (offset 0x08). |
0x10+N*4 | Int32 | String offset to the name of this sub file. This name equal to the name of the entry name of the BRRES Index Group pointing to this data. |
0x14+N*4 | End of this header |
TEX0 Header
The TEX0 header follows direct behind the file header. For TEX0 version 3 it starts at offset 0x18 and has the following layout:
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Flag (0x01 - Interpret it as CI format). |
0x04 | UInt16 | Pixel width of the image. |
0x06 | UInt16 | Pixel height of the image. |
0x08 | UInt32 | Image format |
0x0c | UInt32 | Number of mipmaps. |
0x10 | Float | Minimal mipmap used. Always 0. |
0x14 | Float | Maximum mipmap used. |
0x18 | UInt32 | Unused. Offset to absolute path of intermediate file. |
0x1c | End of header/Start of a filler |
Image Data (Section 0)
The start of section 0 is defined in the file header. It contains the image data (see TPL and Image Formats for details).
Most TEX0 files contain additional mipmaps after the main image. These mipmaps have the same image format as the main image. Each mipmap has half the width and height of the previous image rounded down.
During rendering, the mipmaps are used for textures that are distant. To render a given texture, the Wii generally computes how big it appears on screen, and then interpolates between the mipmap bigger and smaller than this size to produce texture information quickly. This behavior can be controlled by the materials sections within BRRES files. See Mipmap on Wikipedia for more details.
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
The following tools can handle TEX0 files:
- BrawlBox, by Kryal and BlackJax.
- BrawlCrate, by soopercool101.
- CTools Pack, by Chadderz.
- SZS Modifier, by Chadderz.
- Wiimms SZS Tools, by Wiimm.