Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Hashing GXT Entries in GTA SA


fastman92
 Share

Recommended Posts

On this page I read this information:

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

But something doesn`t match to me. Let`s explain.

For example I chose Lanstalker text.

Car 400 uses Game Name: LANDSTK

CRC32 I calculated of LANDSTK is so: 7855A059

But you won`t 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 isn`t proper.

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

Link to comment
Share on other sites

 

Go ask R* rahkstar2.gif

Couldn't you make a worse reply? whatsthat.gif

 

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

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
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
Link to comment
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.

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
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. suicidal.gif

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
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.

Link to comment
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 sad.gif

Link to comment
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.

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
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 it`s 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 it`s doesn`t work after removing this file from GTA SA\text directory.

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

Link to comment
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.

Link to comment
Share on other sites

Yes, I know that I can`t 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.

Link to comment
Share on other sites

Deji, I've already tried it but it gives the same result as a normal CRC32 calculator. sad.gif

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
Share on other sites

Really? I got a completely different result... One that matched the GXT Entries shown in the GXT Editor.

Link to comment
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. tounge2.gif

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
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.

Link to comment
Share on other sites

This does that little trick:

 

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

 

Now Hash will contain 0x87AA5FA6. wink.gif

 

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

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
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?

Link to comment
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 it`s no problem to add new text according to current language.

Link to comment
Share on other sites

Hopefully, it'd work for each hash string. lol.gif

 

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

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
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 colgate.gif

Link to comment
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. biggrin.gif

012          345
678   9A   BCD
EFG HIJK LMN
OPQR  STUV
WX    YZ

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.