Difference between revisions of "TXD"

From GTAMods Wiki
Jump to navigation Jump to search
Line 4: Line 4:
  
  
== The (Vice City) TXD Format ==
+
== 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 [http://www.chronetal.co.uk/gta/index.php?page=dff 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:
 
The (usual) txd format looks like this:
Line 10: Line 27:
 
   (22) Texture Dictionary
 
   (22) Texture Dictionary
 
   |
 
   |
   +-+ (1) Data
+
   +--> (1) Data ( Specific to the Texture Dictionary )
  | |--> Number of Textures (dword)
 
 
   |
 
   |
   +-+ (21) Texture No. 1
+
   +-+ (21) Texture Native No. 1
   | |-+ (1) Data
+
   | |-+ (1) Data (all the texture information and the image itself)
  | | |--> (all the texture information and the image itself)
 
 
   | |
 
   | |
 
   | +-- (3) Extension (always empty - size=0) --> MISSING
 
   | +-- (3) Extension (always empty - size=0) --> MISSING
 
   |
 
   |
   +-+ (21) Texture No. 2
+
   +-+ (21) Texture Native No. 2
 
   | |-- ... (same as above)
 
   | |-- ... (same as above)
 
   |
 
   |
   +-+ (21) Texture No. 3
+
   +-+ (21) Texture Native No. 3
 
   |-- ...
 
   |-- ...
  
 
(The number in brackets stands for the section type - dword)
 
(The number in brackets stands for the section type - dword)
  
These are just the alpha flags and (hopefully) depend on the image type:
+
The break down for each section is as follows
  
8bit without alpha: 9728
+
===Texture Dictionary Data===
8bit with alpha: 9472
+
4 bytes nbrTextures
  
32bit without alpha: 1536
+
This section only contains the number of textures in this texture dictionary.
32bit with alpha: 1280
 
  
DXT1 without alpha: 512
+
===Texture Native Data===
DXT1 with alpha: 256
+
Size      Name
DXT3 with alpha: 768
+
4 bytes  unknown
 
+
4 bytes  flags
The first dword is section type, second section size and third the version id of the renderware file.
+
32 bytes  name
TXD files have the same basic format as DFF files and consist of sections with different purpose.
+
32 bytes  alpha name
See [http://www.chronetal.co.uk/gta/index.php?page=dff KCows dff documentation] for more infos.
+
4 bytes  raster format
Every section has a 12 byte section header, containing type, size and ver id.
+
4 bytes  has alpha (why you need a whole 4 bytes for a flag is beyond me)
The version id's are:
+
2 bytes  width
  0x0800FFFF for GTA3,
+
2 bytes  height
   0x0C02FFFF for VC PS2 and
+
1 byte    bpp
  0x1003FFFF for VC PC
+
1 byte   mipmaps
(in the most cases).
+
1 byte    rastertype
 +
1 byte    dxt
 +
4 bytes   raster size
 +
followed by "raster size" of bytes for the actual raster image.
  
(Just the second byte of the dword changes, that's why all values are divisible by 256)
+
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

Revision as of 02:52, 19 April 2006

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