Difference between revisions of "GXT"

From GTAMods Wiki
Jump to navigation Jump to search
(rewriting file format for vc)
Line 61: Line 61:
 
|0x04 ||dword ||Size of TABL block
 
|0x04 ||dword ||Size of TABL block
 
|-
 
|-
|0x08 ||TABL[n] ||Array of TABL entries, where n is the number of entries. All entries are sorted in alphabetical order.
+
|0x08 ||TABL[n] ||Array of TABL entries, where n is the number of entries. All entries are sorted in alphabetical order except the first one, <code>MAIN</code>.
 
|}
 
|}
 
<div style="margin-left: 3em;">
 
<div style="margin-left: 3em;">
Line 726: Line 726:
  
 
==External links==
 
==External links==
*{{Icon}} [http://public.sannybuilder.com/GXT/ List of all GXT entries]
+
*{{Icon}} [http://public.sannybuilder.com/GXT/ List of all English GXT entries]
 +
*{{Icon|3}} {{Icon|VC}} [http://spaceeinstein.altervista.org/gxt/ List of non-English GXT entries]
 
*{{Icon|3}} [http://pastebin.com/raw.php?i=HwDP132U american.gxt source] - original code found by {{U|Wesser}}
 
*{{Icon|3}} [http://pastebin.com/raw.php?i=HwDP132U american.gxt source] - original code found by {{U|Wesser}}
 
*{{Icon|4}} [http://public.sannybuilder.com/GTA4/american.gxt.reversed.rar Some of GTA IV GXT text entry names]
 
*{{Icon|4}} [http://public.sannybuilder.com/GTA4/american.gxt.reversed.rar Some of GTA IV GXT text entry names]

Revision as of 05:19, 23 September 2015

40px-Ambox rewrite orange.svg.png This article may need to be rewritten.
Please help improve this article. The discussion page may contain suggestions.

A GTA Text (GXT) file contains almost all texts that are displayed on the screen of GTA2 and above. The location of those files may differ between the various game versions, but they are usualy located in a text\ folder inside the games installation directory. Except for GTA 2 There is one GXT file for each language, but the number of gxt files does not define the number of supported languages by the game.

File format

GTA III

GTA III begins with a TKEY block followed by a TDAT block. Within the TKEY block is an array of TKEY entries containing the offset to and the name of the TDAT entry. A TDAT entry contains the text to be displayed in the game.

Block 1 (TKEY)
Offset Type Description
0x00 char[4] "TKEY"
0x04 dword Size of TKEY block
0x08 TKEY[n] Array of TKEY entries, where n is the number of entries. All entries are sorted in alphabetical order.
TKEY (0xC bytes):
Offset Type Description
0x00 dword TDAT entry offset. The value is relative to the location of the first entry of the array, which is, in absolute term, size of TKEY block + 16.
0x04 char[8] TDAT entry name

The absolute location of the TDAT block is the size of TKEY block + 8.

Block 2 (TDAT)
Offset Type Description
0x00 char[4] "TDAT"
0x04 dword Size of TDAT block
0x08 TDAT[n] Array of TDAT entries, where n is the number of entries. Entries are not sorted in alphabetical order but their order comes from the order of their entry in the GXT source file.
TDAT (m * 2 bytes):
Offset Type Description
0x00 wchar_t[m] An array of wide characters (2 bytes per character) to be displayed in the game, where m is the number of characters. The array is terminated by a null character (0x0000). The characters are based on the character table in the fonts.txd file, which mostly follows ASCII. The location of the entry in absolute term is TDAT entry offset + size of TKEY block + 16.

Vice City

Vice City begins with a TABL block, first introduced in this game, followed by an array of TKEY blocks. Within each TKEY block is an array of TKEY entries containing the offset to and the name of the TDAT entry. A TDAT entry contains the text to be displayed in the game.

Block 1 (TABL)
Offset Type Description
0x00 char[4] "TABL"
0x04 dword Size of TABL block
0x08 TABL[n] Array of TABL entries, where n is the number of entries. All entries are sorted in alphabetical order except the first one, MAIN.
TABL (0xC bytes):
Offset Type Description
0x00 char[8] TKEY entry name
0x04 dword TKEY entry offset. The value is absolute.

The absolute location of the TKEY block is simply the TKEY entry offset. The TKEY block format is slightly different for the first block named MAIN. Hover over the dotted lines for information specific to that block. All other blocks follow the format shown below.

Block 2 (TKEY)
Offset Type Description
0x00 char[8] TKEY entry name
0x08 char[4] "TKEY"
0x0C dword Size of TKEY block
0x10 TKEY[n] Array of TKEY entries, where n is the number of entries. All entries are sorted in alphabetical order.
TKEY (0xC bytes):
Offset Type Description
0x00 dword TDAT entry offset. The value is relative to the location of the first entry of the array, which is, in absolute term, TKEY entry offset + size of TKEY block + 16.
0x04 char[8] TDAT entry name

The absolute location of the TDAT block is the TKEY entry offset + size of TKEY block + 16.

Block 3 (TDAT)
Offset Type Description
0x00 char[4] "TDAT"
0x04 dword Size of TDAT block
0x08 TDAT[n] Array of TDAT entries, where n is the number of entries. Entries are not sorted in alphabetical order but their order comes from the order of their entry in the GXT source file.
TDAT (m bytes):
Offset Type Description
0x00 wchar_t[m] An array of wide characters (2 bytes per character) to be displayed in the game, where m is the number of characters. The array is terminated by a null character (0x0000). The characters are based on the character table in the fonts.txd file, which mostly follows ASCII. The location of the entry in absolute term is TDAT entry offset + size of TKEY block + 16.

GTA San Andreas / GTA IV Format

Each GXT file contains certain tables with entries. And each entry has a unique CRC identifier and a normal text.

Header

The header contains information about the GXT version.

INT32   - 4b   - Version (0x080004 for ASCII, 0x100004 for UTF-16)

Table Block

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

CHAR[4] - 4b   - TABL
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!

GTA San Andreas has a limit of max 200 tables to be stored per GXT file.

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 (Entryname)

The TKEY block is directly followed by the TDAT Block which contains the contents of the entries. The Entryoffset is relative to the TDAT + 8 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 sizes. However it always ends in '\0'! For Example "Hello!" needs to be transformed to "Hello!\0" here and this gives a size of 6 bytes (To tell it in a short form content is a null-terminated string). If this is the 1st content in TDAT the next got an offset of 0x06!

Encodings
GTA SA          : Windows-1252 always.
GTA IV(8 bits)  : Custom Encoding
GTA IV(16 bits) : Well, its a fake 16 bits encoding, all you need to take care about first 8 bits(1 byte). 
                  Eg. A3F4 C2DD E922, read only A3, C2, E9.


Sorting

The sorting method for TABL, TKEY, TDAT is as follow:

Section Sorting method
TABL Sorted in alphabetical order
TKEY GTA SA: Sorted from the lowest crc32 to the highest crc32,

GTA IV: Unknown. Perhaps randomized order.

TDAT Not sorted. The data is stored from the first line to the last line in the GXT source file

GTA2 Format

Except for additional header at beginning GTA2 GXT files are identical to GTA3 format.

The first 4 bytes can be one of following, and identify the language for the file: GBLE - english GBLF - french GBLG - german GBLI - italian GBLS - spanish GBLJ - japanese

A uint16 file version follows which is always 100 (decimal)

Text is stored with some specialities, characters are 16 bit while only one of these bytes is actual character the other may store special data such as gang message icon id, etc.. the text is zero-terminated.

The rest of file is same as gta3 with familiar tkey & tdat sections.

GTA 1 Format

GTA 1 language files have .fxt extension, and it's different from other games' format. Except the first 8 byte it uses very simple encryption. To get text, just substract 1 from every byte. First 8 bytes have different encryption, probably just to confuse modders. For every byte substract a value returned from left shifting 99.

GXT Editing

Symbols & Colorcodes (Control Character)

Symbol Description
GTA III Vice City San Andreas
~1~ number within a text
~a~ text within a text
~A~ L3 icon (PS2) / LStick icon (XBOX)
~b~ blue text blue text blue text
~c~ R3 icon (PS2) / RStick icon (XBOX)
~d~ ▼-icon
~g~ green text hot pink text green text
~h~ white text highlight
~j~ R1 icon (PS2) / RT icon (XBOX)
~k~ key (followed by keypresses)
~K~ L1 icon (PS2) / LT icon (XBOX)
~l~ black text forces text to default color
and ignores set colors
black text
~n~ newline
~m~ L2 icon (PS2) / WHITE icon (XBOX)
~o~ pink text Circle icon (PS2) / B icon (XBOX)
~p~ purple text purple text purple text
~q~ plum pink text Square icon (PS2) / X icon (XBOX)
~r~ red text hot pink text red text
~s~ reset color to standard
~t~ green text Triangle icon (PS2) / Y icon (XBOX)
~u~ ▲-icon
~v~ R2 icon (PS2) / BLACK icon (XBOX)
~w~ gray text gray text white text
~x~ light blue text Cross icon (PS2) / A icon (XBOX)
~y~ yellow text yellow text yellow text
~z~ subtitle (doesn't shown when
the Subtitles option is off)
~<~ ◄-icon
~>~ ►-icon
Special symbols (otherwise normal or blank)
" triangle icon
< ◄ icon armor icon
> ► icon wanted level (star) icon
@
^
_
{ heart icon
| circle icon
} dollar sign icon (not "$")

Note that using "~" by itself will crash the game when the game attempts to display it.

Keypresses

You can use opcode 00E1 to check if these keys are being pressed.

Foot Controls

Key Game Entry
Fire GTA III Vice City San Andreas ~PED_FIREWEAPON~
Next Weapon / Target GTA III Vice City San Andreas ~PED_CYCLE_WEAPON_RIGHT~
Previous Weapon / Target GTA III Vice City San Andreas ~PED_CYCLE_WEAPON_LEFT~
Group Ctrl Foward San Andreas ~GROUP_CONTROL_FWD~
Group Ctrl Back San Andreas ~GROUP_CONTROL_BWD~
Conversation - No San Andreas ~CONVERSATION_NO~
Conversation - Yes San Andreas ~CONVERSATION_YES~
Foward GTA III Vice City San Andreas ~GO_FORWARD~
Backwards GTA III Vice City San Andreas ~GO_BACK~
Left GTA III Vice City San Andreas ~GO_LEFT~
Right GTA III Vice City San Andreas ~GO_RIGHT~
Zoom In GTA III Vice City San Andreas ~PED_SNIPER_ZOOM_IN~
Zoom Out GTA III Vice City San Andreas ~PED_SNIPER_ZOOM_OUT~
Enter+Exit GTA III Vice City San Andreas ~VEHICLE_ENTER_EXIT~
Change Camera GTA III Vice City San Andreas ~CAMERA_CHANGE_VIEW_ALL_SITUATIONS~
Jump GTA III Vice City San Andreas ~PED_JUMPING~
Sprint GTA III Vice City San Andreas ~PED_SPRINT~
Target / Aim Weapon GTA III Vice City San Andreas ~PED_LOCK_TARGET~
Crouch Vice City San Andreas ~PED_DUCK~
Action Vice City San Andreas ~PED_ANSWER_PHONE~
Walk San Andreas ~SNEAK_ABOUT~
Look Behind GTA III Vice City San Andreas ~PED_LOOKBEHIND~
Look Left GTA III Vice City[1] ~PED_1RST_PERSON_LOOK_LEFT~
Look Right GTA III Vice City[1] ~PED_1RST_PERSON_LOOK_RIGHT~
Look Up GTA III Vice City[1] ~PED_1RST_PERSON_LOOK_UP~
Look Down GTA III Vice City[1] ~PED_1RST_PERSON_LOOK_DOWN~
Next Target GTA III Vice City[1] ~PED_CYCLE_TARGET_LEFT~
Previous Target GTA III Vice City[1] ~PED_CYCLE_TARGET_RIGHT~
Center Camera GTA III Vice City[1] ~PED_CENTER_CAMERA_BEHIND_PLAYER~

Vehicle Controls

Key Game Entry
Fire GTA III Vice City San Andreas ~VEHICLE_FIREWEAPON~
Secondary Fire San Andreas ~VEHICLE_FIREWEAPON_ALT~
Accelerate GTA III Vice City San Andreas ~VEHICLE_ACCELERATE~
Brake / Reverse GTA III Vice City San Andreas ~VEHICLE_BRAKE~
Left GTA III Vice City San Andreas ~VEHICLE_STEERLEFT~
Right GTA III Vice City San Andreas ~VEHICLE_STEERRIGHT~
Steer Foward / Down GTA III Vice City San Andreas ~VEHICLE_STEERDOWN~
Steer Back / Up GTA III Vice City San Andreas ~VEHICLE_STEERUP~
Enter+Exit GTA III Vice City San Andreas ~VEHICLE_ENTER_EXIT~
Trip Skip San Andreas ~CONVERSATION_YES~
Change Radio Station GTA III Vice City ~VEHICLE_CHANGE_RADIO_STATION~
Next Radio Station San Andreas ~VEHICLE_RADIO_STATION_UP~
Previous Radio Station San Andreas ~VEHICLE_RADIO_STATION_DOWN~
User Track Skip San Andreas none
Horn GTA III Vice City San Andreas ~VEHICLE_HORN~
Sub-mission GTA III Vice City San Andreas ~TOGGLE_SUBMISSIONS~
Change Camera GTA III Vice City San Andreas ~CAMERA_CHANGE_VIEW_ALL_SITUATIONS~
Handbrake GTA III Vice City San Andreas ~VEHICLE_HANDBRAKE~
Mouse Look San Andreas ~VEHICLE_MOUSELOOK~
Look Left GTA III Vice City San Andreas ~VEHICLE_LOOKLEFT~
Look Right GTA III Vice City San Andreas ~VEHICLE_LOOKRIGHT~
Turret Left / Special Ctrl Left GTA III Vice City San Andreas ~VEHICLE_TURRETLEFT~
Turret Right / Special Ctrl Right GTA III Vice City San Andreas ~VEHICLE_TURRETRIGHT~
Turret Up / Special Ctrl Up GTA III Vice City San Andreas ~VEHICLE_TURRETUP~
Turret Down / Special Ctrl Down GTA III Vice City San Andreas ~VEHICLE_TURRETDOWN~
Look Behind GTA III Vice City San Andreas[2] ~VEHICLE_LOOKBEHIND~
1. ^ Classic controls key only
2. ^ Hardcoded key in III and VC, unavailable in SA

Unused

Here are some keypress codes only used during development stage. They were removed or replaced later but probably they are still working. Maybe this is useful for further research. Some are only used in PS2 Version.

~TAKE_SCREEN_SHOT~
~SWITCH_DEBUG_CAM_ON~
~TOGGLE_DPAD~
~NETWORK_TALK~

Tools

GTA 2
GTA2 GXT Editor v2.0 - by Delfi
GTA III Vice City San Andreas Liberty City Stories Vice City Stories
Grand Theft Auto GXT Editor v1.3 - by Zverik, retrieved from archive.org
GTA III Vice City San Andreas Liberty City Stories Vice City Stories GTA IV
SAGE v0.9.7 - by AleX AciD
GTA III Vice City Liberty City Stories Vice City Stories
GTA Texter v0.93 - by feroCT5
GTA III
GTA Net GTAGarage: GXT Editor 1.3 - by Jevon
Vice City Liberty City Stories Vice City Stories
GTA: Vice City GXT Editor v1.2 - by CyQ
San Andreas
GTA San Andreas Text Editor - by JernejL
San Andreas
GTA: San Andreas GXT Editor v1.3 - by Hammer83
San Andreas
A-GXT Editor v1.0a - by Aschratt
San Andreas GTA IV
X GXT Editor v2.1 - by xmen
GTA IV
OpenIV - Have Inbuilt GXT file viewer

External links