Format:TIM (PlayStation texture)
Appearance
| Platforms | Platform:PlayStation |
|---|---|
| Magic | 10 00 00 00 at 0x0 |
| Extensions | .TIM (also .PXL/.CLT) |
| Endianness | little |
| On this wiki | Facts · Code · Notes · Topics |
Sony's PlayStation texture/bitmap file (.tim): ID byte 0x10, version 0, a flags word (bits 0-2 pixel mode, bit 3 CLUT present) and one or two VRAM data blocks (CLUT, then pixels) that are DMAed to the GPU frame buffer as they are.
Overview
A TIM holds a rectangle of 16-bit VRAM words, optionally preceded by a colour lookup table (CLUT), together with the VRAM coordinates where each block belongs. The pixel type in the flags is only a hint for viewers: the data is copied to VRAM unchanged. Games often store TIMs inside their own archives, sometimes compressed, so look for the magic 10 00 00 00 followed by a flags word.
Header
All values are little endian.
| Offset | Size | Meaning |
|---|---|---|
| 0x00 | 1 | ID, always 0x10 |
| 0x01 | 1 | version, always 0 |
| 0x02 | 2 | reserved, 0 (1 or 2 in the customised compressed TIMs of Ape Escape) |
| 0x04 | 4 | flags: bits 0-2 type (0 = 4bpp, 1 = 8bpp, 2 = 16bpp, 3 = 24bpp, 4 = mixed), bit 3 = CLUT block present |
Then, only if bit 3 is set, a CLUT block, then the pixel block. Both blocks have the same layout:
| Offset | Size | Meaning |
|---|---|---|
| 0x00 | 4 | block size in bytes, including these 12 header bytes |
| 0x04 | 2+2 | VRAM X and Y destination (X counted in 16-bit words) |
| 0x08 | 2+2 | width and height (width counted in 16-bit words, so a 4bpp image is 4x as many pixels wide, 8bpp 2x) |
| 0x0C | n | VRAM data |
Pitfalls
- Width is in VRAM halfwords, not pixels.
- Block sizes are usually but not always multiples of 4; a few games ship TIMs with odd sizes, which misaligns a following block.
- Some games prefix texture data with a dummy 20-byte TIM header, or compress TIMs; do not trust the magic alone.
- Separate .PXL and .CLT files exist (rare): the Sony documentation gives 0x11 = PXL and 0x12 = CLT, but the files seen in games use 0x11 for the CLT and 0x12 for the PXL. Unverified: which games these are beyond the three named in the psx-spx document.
Evidence & references
- psx-spx, section "CDROM File Video Texture Image TIM/PXL/CLT (Sony)" (docs/cdromfileformats.md in the psx-spx mirror).