TXD
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 (usually 8 or 9) 2 byte Texture Filter 1 byte Texture Wrap V 1 byte Texture Wrap U 32 bytes Name 32 bytes Alpha Name 4 bytes Raster Format 4 bytes Alpha/FOURCC 2 bytes Width 2 bytes Height 1 byte BPP 1 byte MipMaps 1 byte Raster Type 1 byte DXT [1024 bytes of Palette Data if Raster Format has FORMAT_EXT_PAL8 set] 4 bytes Raster Size followed by "Raster Size" of bytes for the actual Raster image. [ if Raster Format has FORMAT_EXT_MIPMAP and MipMaps > 0] There are "MipMaps" number of MapMips data each containing 4 bytes Raster Size followed by Raster Size of mipmap data - it is possible for some mipmaps to be too small and therefore have 0 length.
These are the Raster Formats and extensions:
FORMAT_DEFAULT 0x0000 FORMAT_1555 0x0100 FORMAT_565 0x0200 FORMAT_4444 0x0300 FORMAT_8888 0x0500 FORMAT_888 0x0600 FORMAT_MASK 0x0F00 FORMAT_EXT_AUTO_MIPMAP 0x1000 FORMAT_EXT_PAL8 0x2000 FORMAT_EXT_MIPMAP 0x8000 FORMAT_EXT_MASK 0xF000
These are the Texture Filters:
FILTER_NONE 0x0 FILTER_NEAREST 0x1 FILTER_LINEAR 0x2 FILTER_MIP_NEAREST 0x3 FILTER_MIP_LINEAR 0x4 FILTER_LINEAR_MIP_NEAREST 0x5 FILTER_LINEAR_MIP_LINEAR 0x6
These are the Texture Wrap:
WRAP_NONE 0x0 WRAP_WRAP 0x1 WRAP_MIRROR 0x2 WRAP_CLAMP 0x3