Search In
• More options...
Find results that contain...
Find results in...

# Hashing GXT Entries in GTA SA

## Recommended Posts

"The game calculates the CRC32-value out of a given string and checks if they exist in the GXT."

But something doesnt match to me. Lets explain.

For example I chose Lanstalker text.

Car 400 uses Game Name: LANDSTK

CRC32 I calculated of LANDSTK is so: 7855A059

But you wont find such GXT Entry in american.gxt. In this file Landstalker uses 87AA5FA6 entry in MAIN table.

So, my question is - how hash of GXT Entry is calculated in GTA SA, because alone method with CRC32 isnt proper.

And do not refer me to tutorials how to name cars in GTA SA, but to informations how GTA SA hashes GXT Entries.

##### Share on other sites

Couldn't you make a worse reply?

I had the same problem but no one has answered me yet. I posted it here (look at the end).

##### Share on other sites

Probably Seeman knows, how does hashing work. Else, how would he be able to create FXT plugin for SA? I guess that his FXT support adds calculated hashes of GXT entries to memory,

Edited by fastman92

##### Share on other sites

I don't think so. He probably used some internal game routines by keeping those external GXT Entries into the memory.

##### Share on other sites

Seemann got the list from someone else. This early topic on SA GXT might be helpful.

##### Share on other sites

Wow, thanks spaceeinstein! It has been posted here but there's no luck on how to get the GXT Entry from hash string directly.

##### Share on other sites

I'm pretty sure a standard online converter should be able to translate it... Try using different bit modes.

But, if you wanna be sure to get the same result Rockstar got, I think opcode 09A9 is a safe bet. Just display the number stored to the variable on-screen... I perfer to use CLEO 4's opcodes since they let me display stuff in HEX.

##### Share on other sites
But, if you wanna be sure to get the same result Rockstar got, I think opcode 09A9 is a safe bet.

Wesser tried that opcode too, but without success

##### Share on other sites

However, it's pretty useless using 09A9. GTA uses signed integer in global/local vars and it's able to store only 0xFFFFFFFF / 2 as max, so they can contain a value within -2147483648 to 2147483647 (-0x80000000 to 0x7FFFFFFF), which is not enough.

##### Share on other sites

Obviously you've not explored CLEO 4 deeply enogh

##### Share on other sites

I will test 09A9 tommorow.

But in Sanny Builder when you see e.g this code (while editing main.scm):

0512: show_permanent_text_box 'DUAL_A'

Beside this text its written value of this GXT Entry.

Effect is so:

0512: show_permanent_text_box 'DUAL_A'  // ~k~~VEHICLE_ENTER_EXIT~ Use Videogame

This is read from american.gxt, because its doesnt work after removing this file from GTA SA\text directory.

So, if Seeman as creator of Sanny Bilder hadnt known how does hashing work, how could he build GXT value reading otherwise?

##### Share on other sites

Hashing is a one-way operation...

You can't get text out of a hash, but you can turn text into a hash...

If you were searching for a particular piece of text, you could hash that text and compare it to all the other hashes. If the hash matches, that text exists. What's more, GXT Editors use the same method when searching for a particular entry.

The hashing probably just uses a basic method. I'll see if I can figure it out.

##### Share on other sites

Yes, I know that I cant get out text from hash.

But I want hash text and know which hash in american.gxt will use GTA SA for example to CUSTOM.

Sanny Builder must after reading GXT entry be able to make name of GXT entry into hash (just like GTA SA). After Sanny Builder has known already hash, then simply reads value of this hash from american.gxt

About getting out text from hash I know, but creator of such program must just know hashing algorithm. But I not about it in this topic.

{$CLEO}0000:09A9: get_string "STRING" CRC32_to [email protected]: show_formatted_text_highpriority "%X" time 12000 [email protected]: end_custom_thread #### Share this post ##### Link to post ##### Share on other sites Deji, I've already tried it but it gives the same result as a normal CRC32 calculator. #### Share this post ##### Link to post ##### Share on other sites Really? I got a completely different result... One that matched the GXT Entries shown in the GXT Editor. #### Share this post ##### Link to post ##### Share on other sites Look at this script: {$CLEO}0000: NOP03F0: enable_text_draw 1 while true wait 0  09A9: get_string "LANDSTK" CRC32_to [email protected] 0341: unknown_text_draw_flag 0  0342: enable_text_draw_centered 1  045A: draw_text_1number 320.0 300.0 GXT 'NUMBER' number [email protected] // ~1~end

This retrieves a value which matches with a normal CRC32 result. Although, there's something weird: I got -2018877530 (0x87AA5FA6) but if I add 1 to that value and make it as an absolute integer, I get 2018877529 (0x7855A059). I believe there's nothing wrong.

##### Share on other sites

-2018877530 (0x87AA5FA6)

How did you convert this hex number to decimal? When I convert this number by myself I get 2276089766.

I want to know it.

##### Share on other sites

This does that little trick:

GXT Entry : "LANDSTK"CRC32 : 0x7855A059Hash = 0xFFFFFFFF - 0x7855A059

Now Hash will contain 0x87AA5FA6.

Unfortunately, GTA variables don't support unsigned integers but I think the game converts every hash string automatically into the effective hexes.

##### Share on other sites
However, it's pretty useless using 09A9. GTA uses signed integer in global/local vars and it's able to store only 0xFFFFFFFF / 2 as max, so they can contain a value within -2147483648 to 2147483647 (-0x80000000 to 0x7FFFFFFF), which is not enough.

So maybe writing that value to allocated memory space would help?

##### Share on other sites

Thanks very much!

So algorithm in PHP to fast calculate is:

<?phpecho strtoupper(base_convert(4294967295-crc32(	'LANDSTK'	), 10, 16));?>

Now its no problem to add new text according to current language.

##### Share on other sites

Hopefully, it'd work for each hash string.

SilentPL, only CLEO4 allows to show formatted string in whetever type without those sh*tty byte limitations.

##### Share on other sites
SilentPL, only CLEO4 allows to show formatted string in whetever type without those sh*tty byte limitations.

Silent*

But if you write that value to mamory, and add some unique text above that, then you can read that values by Cheat Engine

##### Share on other sites

I figured out 09A9 works like a charm but GTA cannot handle unsigned integers. This helps us to know more:

{ FUNCTIONS INCLUDED:-   getLabelOffset     Type: GET       Description: Get a label offset.}{\$CLEO}0000: NOP03F0: enable_text_draw 1 while true wait 0  //09A9: get_string "LANDSTK" CRC32_to [email protected]  0AB1: call_scm_func @getLabelOffset 1 label @hashString store_to [email protected]  0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0  0341: unknown_text_draw_flag 0  0342: enable_text_draw_centered 1  045A: draw_text_1number 320.0 300.0 GXT 'NUMBER' number [email protected] // ~1~end:hashStringhex A65FAA87 // LANDSTKend:getLabelOffset{ Parameters:   Passed:     [email protected] - label name   Result:     [email protected] - label offset Example:   0AB1: call_scm_func @getLabelOffset 1 label @LABEL store_to [email protected] }if  [email protected] <> 0 then 0A9F: [email protected] = current_thread_pointer [email protected] += 0x10  0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0  0062: [email protected] -= [email protected] else [email protected] = 0 end0AB2: ret 1 [email protected]

It returns the same negative value.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×