Difference between revisions of "GXT"

From GTAMods Wiki
Jump to navigation Jump to search
(CRC32 Calculation)
m (CRC32 Calculation)
Line 81: Line 81:
 
===CRC32 Calculation===
 
===CRC32 Calculation===
  
Here is a simple CRC32 calculation class written in C++:
+
Here is a simple CRC32 calculation class written in C++:  
<source lang="cpp-qt">class Checksum
+
<div class="NavFrame collapsed"><div class="NavHead"></div><div class="NavContent"><source lang="cpp-qt">class Checksum
 
{
 
{
 
private:
 
private:
Line 168: Line 168:
 
}
 
}
 
}
 
}
};</source>
+
};</source></div>
 
 
It is impossible to get a string out of an CRC32-value. The game only checks if two values are identical. However this is not a very reliably way because there can be more than two CRC32 Values for one string. But the probability for this is not very high!
 
  
 
==GTA III / GTA Vice City Format==
 
==GTA III / GTA Vice City Format==

Revision as of 19:51, 5 February 2009

A GXT file contains almost all text that are displayed on the screen of GTA2 and above. The files are located in the text folder. An entire list of all entries between GTA3 and VCS is available with Sanny Builder. A list for GTA4 is available here.

File Stub

Each GXT-File can contain certain tables with subtables and entries. The entries are stored in ASCII standart. Just some special characters got some different bitsets.

GTA San Andreas / GTA IV Format

Header

The header contains data about the tables and their subtables.

INT32   - 4b   - Version? (Always 0x080004)
CHAR[4] - 4b   - TABL

Table Block

The Table Block contains data about the subtables and their offsets.

INT32   - 4b   - Blocksize

//Array of [Blocksize / 12 Entries]
CHAR[8] - 8b   - Subtablename
INT32   - 4b   - Offset

The Offset of the subtable points to an 8-byte Char Array with the subtable's name, followed by TKEY. For the MAIN Table this points directly to TKEY!

TKEY and TDAT

TKEY

The TKEY Block of an subtable contains the CRC32-values of the entrytitles. The game calculates the CRC32-value out of a given string and checks if they exist in the GXT.

CHAR[4] - 4b   - TKEY
INT32   - 4b   - Blocksize

//Array of [Blocksize / 8]
INT32   - 4b   - Entryoffset
INT32   - 4b   - CRC32 (Entrytitle)

The TKEY block is directly followed by the TDAT Block which contains the contents of the entries. The Entryoffset is relative to the TDAT + 4 offset.

TDAT

CHAR[4] - 4b   - TDAT
INT32   - 4b   - Blocksize

From here the Entryoffset of each entry points to the content. The content can have different size. However it always ends in '\0'! For Example "Hello!" needs to be "Hello!\0" here and this gives a size of 6 bytes. If this is the 1st content in TDAT the next got an offset of 0x06!

Special Characters

Here is a list of special characters for german language sets and their UINT8 Values:

Character Value
Ä 131
ä 154
Ö 145
ö 168
Ü 149
ü 172
ß 150

CRC32 Calculation

Here is a simple CRC32 calculation class written in C++: