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

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

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

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Sign in to follow this  
ikt

Getting vehicle model name from hash?

Recommended Posts

ikt

So far I think it's impossible, but I hope I'm wrong here.

 

I have a bunch of hashes I want to get the model name of. There's GET_DISPLAY_NAME_FROM_VEHICLE_MODEL, but it shows the gameName. So far, I think all I can get is that (and the pretty version of that if it's in <language>.gxt, but nothing to get the model name when you have the hash.

 

Is all that's loaded in the game hashes irreversibly without some internal lookup table to go back?

 

Best result I'm getting now is hashing folder names and variants thereof and comparing them to a real hash.

Edited by ikt

Share this post


Link to post
Share on other sites
JustAnotherComplexKid

Aside from the fact as long as you know your listed native only works on vehicles. To get the 'normal name' instead of the game label. Just use UI::_GET_LABEL_TEXT //0x7B5280EBA9840C72 and put what your listed native returned value as the argument.

A comment that was put on that native was, 'Gets a string literal from a label name.' if you'd care to know lol.

Edited by JustAnotherComplexKid

Share this post


Link to post
Share on other sites
ikt

That returns the GXT name. Pretty, but sadly not the model name you can use for spawning models :p

Share this post


Link to post
Share on other sites
jedijosh920

Unfortunately, I'm pretty sure it's impossible unless there was some sort of function like in GTA IV where it would convert a hash to a string from a table. You'd have to do it manually and make dictionaries/arrays/lists depending on what you want to do.

Share this post


Link to post
Share on other sites
ikt

Yeah, I suppose the game doesn't keep a table of loaded models internally then. I don't know how to reverse things properly either so it stops here in that case.

Share this post


Link to post
Share on other sites
foxtail

You can go from textureName/ModelName to hash if you wanted. You could rip the game models with openIV, create an index for them and then build a dictionary, { hash , textureName }

Edited by foxtail

Share this post


Link to post
Share on other sites
adam10603

OpenIV can convert model names to/from hashes, so it's not a lookup table thing, but rather some two way algorithm. Idk the specifics though :/

Share this post


Link to post
Share on other sites
unknown modder

OpenIV can convert model names to/from hashes, so it's not a lookup table thing, but rather some two way algorithm. Idk the specifics though :/

open iv cant convert hashes to model names. It may use a lookup table (I know thats how it handles gxt entries), but its literally impossible to extract the input to a hash from its output. Best you can do is brute force collisions(which openiv is definitely not doing)

Share this post


Link to post
Share on other sites
adam10603

open iv cant convert hashes to model names. It may use a lookup table (I know thats how it handles gxt entries), but its literally impossible to extract the input to a hash from its output. Best you can do is brute force collisions(which openiv is definitely not doing)

Oh right, my bad. I remembered incorrectly. It can only generate hashes from model names. So these are in fact hashes. Good to know

Edited by adam10603

Share this post


Link to post
Share on other sites
Unknown_Modder

Not sure if there's a way to get the model name from the model but I use this to get the name from the vehicle itself:

// put this in your CVehicle classchar* GetModelName() const{    __int64 addr1 = (*(__int64(__thiscall**)(__int64))(*(__int64*)this + 0x58))((__int64)this);    if (addr1)    {	__int64 addr2 = *(__int64*)(addr1 + 0x68);	if (addr2 && *(__int64*)(addr1 + 0x78))	{	    return *(char**)(addr2 + 0x38);	}    }    return "UNKNOWN";}

This doesn't solve your problem as of now. Just wanted to share this as it might be useful for something else.

Share this post


Link to post
Share on other sites
ikt

crsWE4D.png

 

So I found the make and model name in CVehicleModelInfo:

 

(1.0.1103.2)

 

 

 

[s]char *MemoryAccess::GetVehicleModelName(int modelHash) {    int index = 0xFFFF;    uint64_t modelInfo = GetModelInfo(modelHash, &index);    return (char*)(modelInfo + 0x270);}char *MemoryAccess::GetVehicleMakeName(int modelHash) {    int index = 0xFFFF;    uint64_t modelInfo = GetModelInfo(modelHash, &index);    return (char*)(modelInfo + 0x27C);}[/s]
Not sure if the offsets have changed. GetModelInfo was taken from Unknown Modder's piece of code to get the mod kits from the CVehicleModelInfo:

 

 

[s]typedef __int64(*GetModelInfo_t)(unsigned int modelHash, int* index);GetModelInfo_t GetModelInfo = (GetModelInfo_t)MemoryAccess::FindPattern("\x0F\xB7\x05\x00\x00\x00\x00\x45\x33\xC9\x4C\x8B\xDA\x66\x85\xC0\x0F\x84\x00\x00\x00\x00\x44\x0F\xB7\xC0\x33\xD2\x8B\xC1\x41\xF7\xF0\x48\x8B\x05\x00\x00\x00\x00\x4C\x8B\x14\xD0\xEB\x09\x41\x3B\x0A\x74\x54",																		"xxx????xxxxxxxxxxx????xxxxxxxxxxxxxx????xxxxxxxxxxx");[/s]
This will return a valid modelName for any vehicle I've tested (all official vehicles, all add-ons) and a vehicleMakeName if it has one.

 

Scratch that. Celebrated too early, it's gameName after all :(

vehicleMakeName is still correct though.

Edited by ikt

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.