TPL (File Format)
From Wexos's Wiki
Jump to navigationJump to search
TPL (Texture Palette Library) is an image file format introduced on the Nintendo GameCube, but later used on Wii. The format can store multiple textures into one file, though typically one file will contain one image. It also allows mipmaps to be stored. TPL files are on Wii used together with BRLYT and BRLAN to generate 2D layout.
Header
The file starts with the following header:
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | File version. Always 0x0020AF30. |
0x04 | Int32 | Number of image tables in this file. |
0x08 | UInt32 | Image tables offset. This will always be placed after this header, thus 0x0C. |
Image Table
The image table structure stores the texture. It splits the image into two sections, image and palette, where the latter is only used if the format used is a palette format. Each entry has the following structure:
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Image offset. |
0x04 | UInt32 | Palette offset. May be 0 if this image doesn't have a palette. |
Image
Offset | Type | Description | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x00 | UInt16 | Height of image in pixels. | ||||||||||||||
0x02 | UInt16 | Width of image in pixels. | ||||||||||||||
0x04 | UInt32 | Image format. The pixel data type is determined by this value. | ||||||||||||||
0x08 | UInt32 | Image data offset. Offset to the data of the first image. The mipmaps are stored directly after the end of the first image. | ||||||||||||||
0x0C | UInt32 | Wrap S. 0 = Clamp, 1 = Repeat, 2 = Mirror | ||||||||||||||
0x10 | UInt32 | Wrap T, same enum as above. | ||||||||||||||
0x14 | UInt32 | Minification filter.
| ||||||||||||||
0x18 | UInt32 | Magnification filter. 0 = Nearest, 1 = Linear | ||||||||||||||
0x1C | Float | LOD bias. | ||||||||||||||
0x20 | Byte | Edge LOD enable. | ||||||||||||||
0x21 | Byte | Min LOD. The level of the first image stored. | ||||||||||||||
0x22 | Byte | Max LOD. The level of the last image stored. | ||||||||||||||
0x23 | Byte | Unpacked. Must be set to 0 in file, set to 1 at runtime when the TPL file has been loaded. |
Palette
Offset | Type | Description |
---|---|---|
0x00 | UInt16 | Number of palette entries. Each consist of a color of the type specified by the palette format. |
0x02 | Byte | Unpacked. Must be set to 0 in file, set to 1 at runtime when the TPL file has been loaded. |
0x03 | Byte | Padding. |
0x04 | UInt32 | Palette format. |
0x08 | UInt32 | Palette offset. Offset to the palette colors. |
Tools
The following tools can handle TPL files:
- BrawlBox, by Kryal and BlackJax96
- CTools Pack, by Chadderz
- SZS Modifier, by Chadderz
- Wexos's Toolbox, by Wexos
- Wiimms SZS Tools, by Wiimm