Texture Native Struct

From GTAMods Wiki
Revision as of 17:04, 21 November 2006 by Steve-m (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
{{{NAME}}}
RenderWare Stream Section
Vendor {{{VENDORNAME}}}
Module {{{MODULENAME}}}
Module ID 0x{{{MODULEID}}}
Identifier 0x{{{IDENTIFIER}}}
Chunk ID 0x{{{MODULEID}}}{{{IDENTIFIER}}}
Versions All
Hierarchy
Parents:
None
Children:
None
Extensions:
None
File Format

This article is about the Struct section accompanied by a Texture Native parent section.

The Texture Native Struct section can usually be found in texture archives used by the PC and XBOX versions of the GTA III game trilogy. They are the most important sections inside a

.txd

file since they contain the names, dimensions and the actual image data for textures. The typical location in the file's section hierarchy is Texture Dictionary > Texture Native > Struct.

Header

There is a 88 byte header with general image information:

 4b - DWORD    - Platform ID
 4b - DWORD    - Filter Flags
32b - CHAR[32] - Diffuse Texture Name (null-terminated string)
32b - CHAR[32] - Alpha Texture Name (null-terminated string)
 4b - DWORD    - Image Flags
 4b - DWORD    - Is alpha used? (0: no, 1: yes); Platform 9 uses DXT* codes here
 2b - WORD     - Image Width
 2b - WORD     - Image Height
 1b - BYTE     - Bit Depth
 1b - BYTE     - Mipmap Count
 1b - BYTE     - unknown, always 4
 1b - BYTE     - Compression Type
Platform ID
This is 8 for GTA3 and VC on the PC, 9 for GTA SA on the PC, and 5 for GTA3/VC/SA on the XBOX.
Filter Flags
- todo -
Image Flags
- todo -
// 512 = 16bpp no alpha
// 768 = 16bpp with alpha

// 9728= 8bpp no alpha
// 9472= 8bpp with alpha

// 1536= 32bpp no alpha   < -+- SET IF ANY XBOX
// 1280= 32bpp with alpha < /

// 512? = dxt1 no alpha
// 768 = dxt3 with alpha
// ? = dxt3 no alpha

// 256 = used in generic.txd (first of 2 duplicates in img file)
// and in hud.txd too

// 6 = was used for body in ashdexx's sample
// custom xbox working txd
Bit Depth
8, 16 or 32; 8 comes with palette
Compression Type
- todo -

Image Data

The header is followed by image data.

- todo (size, palette, pixels, mipmaps) -