Texture format: Difference between revisions
No edit summary |
|||
Line 34: | Line 34: | ||
=== Version 2 (PS2) === | === Version 2 (PS2) === | ||
* | * Paletted image. Instead of first uncompressed pixel at 0xA it have short with number of paletted colours, than list of colours (argb, 4 bytes per colour), and uncompressed paletted image (1 byte per pixel) | ||
=== Version 3 (PC) === | === Version 3 (PC) === |
Revision as of 19:40, 3 January 2021
Engine supports maximum size of 256x256 pixels. On Windows textures use .pc extension, on Dreamcast they use .DC extension, and on Playstation2 they use .ps2 extension
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | Magic, T54 4D 21 1A (TM!\x1A )
|
0x4 | 0x2 | version, set to 2 for .ps2 files, 3 for .pc, 4 for .dc, 5 for .ps2 (w. aplha?) |
0x6 | 0x2 | width |
0x8 | 0x2 | height |
0xA | 0x2 | first pixel |
0xC | ?? | Compressed data, until EOF |
- compressed image data starts at 0xA, see pc_unpack.py for implementation details
Version 2 (PS2)
- Paletted image. Instead of first uncompressed pixel at 0xA it have short with number of paletted colours, than list of colours (argb, 4 bytes per colour), and uncompressed paletted image (1 byte per pixel)
Version 3 (PC)
- Each pixel is written on 2 bytes, little endian, after converting to big endian the algorithm looks like this:
- If the 15th bit is 1, then stream data as long as each compressed pixel 15th bit is set
- Else
- If 14th bit is set copy previously unpacked data
- bits 11-13 - number of pixels to repeat - 2, so if this number is set to 7, then repeat 9 pixels, minimum 2 pixels
- bits 0-10 - offset - back head for copying that many pixels
- else - add transparent pixels
- bits 0-13 - how many transparent pixels to add
- If 14th bit is set copy previously unpacked data
- Else
00 00
marks the end of compressed data
Version 4 (DC)
- Uses the same compression as version 3, but the resulting files are swizzled for Dreamcast GPU, so untwiddling is needed
Version 5(PS2)
- Same as version 3, with red and blue channels swapped
Unpacked image data (PC and DC)
Uncompressed image data uses 2 bytes for each pixel, in A1 R5 G5 B5 format. In some places game uses additional file with greyscale alpha channel to compensate for 1bit alpha (5 bits instead of 1).