Difference between revisions of "GXT2"

From GTAMods Wiki
Jump to navigation Jump to search
(Improve documentation to make it more clear. I don't know what 32 bit byte swapped means, probably means little endian :P)
Line 1: Line 1:
{{Incomplete}}
+
'''GXT2''' is a new text format used in GTA 5 and files are usually located in <code>\x64b.rpf\data\lang\</code> and <code>\update\update.rpf\x64\data\lang</code>. Previous analogue of this format used in the past GTA Series is '''[[GXT]]'''.
  
'''GXT2''' is a new text format used in GTA 5 and files are usually located in <code>\x64b.rpf\data\lang\</code> and <code>\update\update.rpf\x64\data\lang</code>. Previous analogue of this format used in the past GTA Series is '''[[GXT]]'''.
+
== File format ==
 +
 
 +
Start of the file contains a list of all the GXT entries present in the file.
 +
{|class="wikitable" style="max-width: 64em;"
 +
!colspan="3" |Key Entries
 +
|-
 +
!Offset ||Type ||Description
 +
|-
 +
|0x00 ||char[4] ||style="width: 100%;" |<code>2GXT</code>
 +
|-
 +
|0x04 ||uint32_t || Number of GXT Key Entries
 +
|-
 +
|0x08 ||KEY[n] ||Array of GXT key entries, where n is the number of entries.
 +
All entries must be sorted by their hash. Game uses binary search to find a GXT entry, so this is important.
 +
|}
 +
<div style="margin-left: 3em;">
 +
{|class="wikitable" style="max-width: 64em;"
 +
|+ style="text-align: left;" |KEY (8 bytes):
 +
!Offset ||Type ||style="width: 100%;" |Description
 +
|-
 +
|0x00 ||uint32_t || Key hash
 +
|-
 +
|0x04 ||uint32_t || Offset of the key relative to the start of the file.
 +
|}
 +
</div>
  
 +
This block starts right after the keys block. It contains the data for all of the GXT key entries.
 +
{|class="wikitable" style="max-width: 64em;"
 +
!colspan="3" |Key Data
 +
|-
 +
!Offset ||Type ||Description
 +
|-
 +
|0x00 ||char[4] ||style="width: 100%;" |<code>2GXT</code>
 +
|-
 +
|0x04 ||uint32_t || End of the file offset
 +
|-
 +
|0x0E || char[n] || Contains the text data for all the keys. Each entry is null terminated.
 +
|}
  
== File format ==
 
{{Incomplete}}
 
0x00 - "2TXG" - Header (32bit byte swapped)
 
0x04 - Number of entries (32bit byte swapped)
 
0x08 - Hashed name (32bit byte swapped)
 
0x0C - Hashed name's entries' offset (32bit byte swapped)
 
...
 
Second "2TXG" - Header - end of name block  (32bit byte swapped)
 
4-bytes following second "2TXG" - End of file offset (32bit byte swapped)
 
Start of entries
 
Names are hashed using [[Cryptography#One_At_A_Time_Hash|One At A Time Hash]]
 
 
==Tools==
 
==Tools==
 
{|
 
{|

Revision as of 20:35, 14 August 2020

GXT2 is a new text format used in GTA 5 and files are usually located in \x64b.rpf\data\lang\ and \update\update.rpf\x64\data\lang. Previous analogue of this format used in the past GTA Series is GXT.

File format

Start of the file contains a list of all the GXT entries present in the file.

Key Entries
Offset Type Description
0x00 char[4] 2GXT
0x04 uint32_t Number of GXT Key Entries
0x08 KEY[n] Array of GXT key entries, where n is the number of entries.

All entries must be sorted by their hash. Game uses binary search to find a GXT entry, so this is important.

KEY (8 bytes):
Offset Type Description
0x00 uint32_t Key hash
0x04 uint32_t Offset of the key relative to the start of the file.

This block starts right after the keys block. It contains the data for all of the GXT key entries.

Key Data
Offset Type Description
0x00 char[4] 2GXT
0x04 uint32_t End of the file offset
0x0E char[n] Contains the text data for all the keys. Each entry is null terminated.

Tools

GTA V
OpenIV - Inbuilt GXT2 file viewer/editor