TXD

From GTAMods Wiki
Revision as of 02:52, 19 April 2006 by Thumps (talk | contribs)
Jump to navigation Jump to search

Copyed from Spooky, just to make a start..: Please note that this is the Vice City format, although it doesnt differ that much.. Copied from here


The TXD Format

a TXD file is a Renderware texture dictionary.

TXD files have the same basic format as DFF files and consist of sections with different purpose. See KCows dff documentation for more infos. Every section has a 12 byte section header, containing type, size and ver id. Here are some version id's along with the renderware api version they are associated with and the gta game they're found in:

 File Tag   API version 
 0x00000302 0x30200
 0x00000310 0x31000
 0x0800FFFF 0x32000 for GTA3,
 0x0C02FFFF 0x33002 for VC PS2 and
 0x1003FFFF 0x34003 for VC PC
 0x1400FFFF 0x35000
 0x1803FFFF 0x36003 for SA
 0x1c020001 0x37002


The (usual) txd format looks like this:

 (22) Texture Dictionary
 |
 +--> (1) Data ( Specific to the Texture Dictionary )
 |
 +-+ (21) Texture Native No. 1
 | |-+ (1) Data (all the texture information and the image itself)
 | |
 | +-- (3) Extension (always empty - size=0) --> MISSING
 |
 +-+ (21) Texture Native No. 2
 | |-- ... (same as above)
 |
 +-+ (21) Texture Native No. 3
 |-- ...

(The number in brackets stands for the section type - dword)

The break down for each section is as follows

Texture Dictionary Data

4 bytes nbrTextures

This section only contains the number of textures in this texture dictionary.

Texture Native Data

Size      Name
4 bytes   unknown
4 bytes   flags
32 bytes  name
32 bytes  alpha name
4 bytes   raster format
4 bytes   has alpha (why you need a whole 4 bytes for a flag is beyond me)
2 bytes   width
2 bytes   height
1 byte    bpp
1 byte    mipmaps
1 byte    rastertype
1 byte    dxt
4 bytes   raster size
followed by "raster size" of bytes for the actual raster image.

These are the raster formats:

DEFAULT    = 0x0000
FORMAT1555 = 0x0100
FORMAT565  = 0x0200
FORMAT4444 = 0x0300
FORMATLUM8 = 0x0400
FORMAT8888 = 0x0500
FORMAT888  = 0x0600
FORMAT16   = 0x0700
FORMAT24   = 0x0800
FORMAT32   = 0x0900
FORMAT555  = 0x0a00
FORMATAUTOMIPMAP = 0x1000
FORMATPAL8       = 0x2000
FORMATPAL4       = 0x4000
FORMATMIPMAP     = 0x8000