TPI

From FIFA Manager Modding Wiki
Jump to navigation Jump to search

TPI is an internal image type in FIFA Manager. It was first seen in TCM 2005. It supports DXT-compression and mipmapping.

Image in TPI file is divided into tiles. The size of tile (width and height) is a power of two (from 4x4 to 256x256).

Structure[edit | edit source]

The file starts with a 16-byte header:

CHAR[4] - signature - 'TPI1' (32-bit low-endian integer)
CHAR[4] - pixel format - example: "DXT1".
CHAR[4] - compression method - "Refp" for compressed files (Refp compression), "None" for non-compressed files.
UINT16  - image width
UINT16  - image height
UINT16  - tiles count
UINT16  - unknown (usually 0)

After the header, tiles are placed. Each tile has such structure:

UINT32  - data size
CHAR[data size] - data

The data is compressed if compression is used in the file (defined in the header). When not compressed (or decompressed), the data has following structure (similar to FSH sections):

---- section header (tag) ----
UINT8   - tag: section ID (also used as pixel internal format for image section)
UIN24   - tag: next section offset
---- section data (specific for each section type (ID)) ----
UINT16  - tile width
UINT16  - tile height
UINT16  - tile center - x
UINT16  - tile center - y
UINT12  - tile position - left
UINT1   - internal flag
UINT3   - unknown
UINT12  - tile position - top
UINT4   - mipmap count
CHAR[]  - pixels data

Pixel formats[edit | edit source]

Name Internal Format (Hex) Description
8888 7D 32-bit image with alpha channel (8 bit)
0888 7F 24-bit image without alpha channel
4444 6D 16-bit image with alpha channel (4 bit)
1555 7E 16-bit image with alpha channel (1 bit)
0565 78 16-bit image without alpha channel
DXT1 60 compressed image (DXT1)
DXT3 61 compressed image (DXT3)
DXT5 62 compressed image (DXT5)