Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Diamond Casino Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

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

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA 6

      1. St Andrews Cathedral
    3. GTA V

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

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

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    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. DYOM
      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
    3. Gangs

    1. Announcements

    2. Support

    3. Suggestions

Sign in to follow this  
fastman92

Hashing GXT Entries in GTA SA

Recommended Posts

fastman92

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.

Share this post


Link to post
Share on other sites
iLiR

Go ask R* rahkstar2.gif

Share this post


Link to post
Share on other sites
Wesser

 

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

Share this post


Link to post
Share on other sites
fastman92

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 this post


Link to post
Share on other sites
Wesser

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

Share this post


Link to post
Share on other sites
Wesser

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

Share this post


Link to post
Share on other sites
Deji

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 this post


Link to post
Share on other sites
Silent
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

Share this post


Link to post
Share on other sites
Wesser

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 this post


Link to post
Share on other sites
Deji

Obviously you've not explored CLEO 4 deeply enogh wink.gif

Share this post


Link to post
Share on other sites
fastman92

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?

Share this post


Link to post
Share on other sites
Deji

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 this post


Link to post
Share on other sites
fastman92

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.

Share this post


Link to post
Share on other sites
Wesser

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

Share this post


Link to post
Share on other sites
Deji

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
Wesser

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

Share this post


Link to post
Share on other sites
fastman92

 

-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 this post


Link to post
Share on other sites
Wesser

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

Share this post


Link to post
Share on other sites
Silent
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 this post


Link to post
Share on other sites
fastman92

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.

Share this post


Link to post
Share on other sites
Wesser

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.

Share this post


Link to post
Share on other sites
Silent
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

Share this post


Link to post
Share on other sites
Wesser

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

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

Sign in to follow this  

  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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