mockba.the.borg Posted April 30, 2016 Share Posted April 30, 2016 Hi there all, I am writing a garage mod, but instead of using my own text messages, I want to use the ones from the game (hash based), so they would appear on the correct languages to people from different countries. I have found may useful messages inside the american_rel.rpf file, on the global.gxt2 file inside it. However, those messages do seem to be relate to a hash (also present there), which I don't know how to access from inside the code. Does anyone have experience using the game's text messages? This would be very useful for people writing mods, as it would allow automated language specific menus. I know I would be stuck with whatever messages the game has, but this is basically all I need for my mods. For example: 0xBCECF0C2 = This vehicle is too hot to modify. Purchase high-end vehicles online. I have searched this hash inside the decompiled scripts and couldn't find it. Maybe someone could share some ideas, or maybe examples of usage inside the scripts. I am already researching on it, but if someone already knows it would save me the time. Thanks, The Borg. Link to comment Share on other sites More sharing options...
Kryo4lex Posted May 1, 2016 Share Posted May 1, 2016 Hi there all, I am writing a garage mod, but instead of using my own text messages, I want to use the ones from the game (hash based), so they would appear on the correct languages to people from different countries. I have found may useful messages inside the american_rel.rpf file, on the global.gxt2 file inside it. However, those messages do seem to be relate to a hash (also present there), which I don't know how to access from inside the code. Does anyone have experience using the game's text messages? This would be very useful for people writing mods, as it would allow automated language specific menus. I know I would be stuck with whatever messages the game has, but this is basically all I need for my mods. For example: 0xBCECF0C2 = This vehicle is too hot to modify. Purchase high-end vehicles online. I have searched this hash inside the decompiled scripts and couldn't find it. Maybe someone could share some ideas, or maybe examples of usage inside the scripts. I am already researching on it, but if someone already knows it would save me the time. Thanks, The Borg. Share the code you have so far and then I can help you, because accessing hashes is normally easy Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 2, 2016 Author Share Posted May 2, 2016 Hi Kryo4lex, I don't have any code yet. I have found the library which contains the message files: american_rel.rpf (in my case), and inside this file there's global.gxt2, which contains the text messages and their hashes. However, I have searched on the decompiled scripts for an example of usage of those hashes and couldn't find it. So I am asking if someone has had the experience or printing such messages before. Thanks, Mockba the Borg Link to comment Share on other sites More sharing options...
jedijosh920 Posted May 2, 2016 Share Posted May 2, 2016 Use this: void DISPLAY_HELP_TEXT_THIS_FRAME(char *message, BOOL p1) // 960C9FF8F616E41C 18E3360A Where the message is the name of the string in american_rel.rpf Jitnaught and mockba.the.borg 2 Link to comment Share on other sites More sharing options...
qiangqiang101 Posted May 2, 2016 Share Posted May 2, 2016 Game.GetGXTEntry("ROOSEVELT2") result: Roosevelt Valor Link to comment Share on other sites More sharing options...
Skorpro Posted May 3, 2016 Share Posted May 3, 2016 Hi, known GXT labels are not the problem Example: //...EMSTR_683 = Automated Response – Wild Amateur Picschar* _GET_LABEL_TEXT(char* labelName) // 0x7B5280EBA9840C72 But what if the label is unknown (like mockba.the.borg's example)!? 0x00371714 = Daddy's Little Girl We need s.t. like this GTA IV native: char* GET_STRING_FROM_HASH_KEY(Hash hashKey) Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 3, 2016 Author Share Posted May 3, 2016 Hi Skopro, Yeah, that's exactly my problem. I am also researching the messages there to try and find out which script calls them, for example: 0xBCECF0C2 = This vehicle is too hot to modify. Purchase high-end vehicles online. I can't find which script displays this message. Maybe it is not being displayed with its hash, but a name that would then turn into this hash. So far I couldn't find it. I believe there must be a native somewhere that would receive this hash as a parameter, still searching. Cheers, Mockba. Link to comment Share on other sites More sharing options...
Skorpro Posted May 4, 2016 Share Posted May 4, 2016 Hi, I was bored to browse through the scripts every time to find the right label for unknown hash-sums... Maybe there is a native for this or maybe not... Anyway! I made a small tool today that extracts the strings (incl. calculated hash-sums) out of C4 mission files, so it's easier now to find unknown hash-sums. It's NOT a perfect solution for this problem but it works DOWNLOAD With this tool I found the requested hash 0xBCECF0C2 (= "CMOD_FTRIG3" in carmod_shop.c4) within a minute PS: I coded this prog today afternoon, so it's very simple and without any extras (no double sort out, no nothing). I haven't time for more GRAX and mockba.the.borg 2 Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 4, 2016 Author Share Posted May 4, 2016 Cool man ... awesome!!! I will download it once I am back from work and give it a spin. Thanks a lot for spending time on this. I will definitely replay that on any collaboration I can provide (as I learn and discover more) Cheers, Mockba. Link to comment Share on other sites More sharing options...
mockba.the.borg Posted May 5, 2016 Author Share Posted May 5, 2016 Hi Skopro, The app worked nicely and helped me a lot. Thank you so much. I can consider this one solved. Cheers, Mockba. Link to comment Share on other sites More sharing options...
uNiverselEgacy Posted June 20, 2016 Share Posted June 20, 2016 (edited) Hi, I was bored to browse through the scripts every time to find the right label for unknown hash-sums... Maybe there is a native for this or maybe not... Anyway! I made a small tool today that extracts the strings (incl. calculated hash-sums) out of C4 mission files, so it's easier now to find unknown hash-sums. It's NOT a perfect solution for this problem but it works DOWNLOAD With this tool I found the requested hash 0xBCECF0C2 (= "CMOD_FTRIG3" in carmod_shop.c4) within a minute PS: I coded this prog today afternoon, so it's very simple and without any extras (no double sort out, no nothing). I haven't time for more This is great! However I can't seem to use it to find labels for weapons and some other stuff. nvm. Thank you so much! Do you mind sharing the algorithm used by the game to compute hash values? Edited June 20, 2016 by uNiverselEgacy Link to comment Share on other sites More sharing options...
Fireboyd78 Posted June 20, 2016 Share Posted June 20, 2016 (edited) Do you mind sharing the algorithm used by the game to compute hash values? It's Bob Jenkin's "One-At-A-Time" hash: static int OneAtATimeHash(string key){ int hash, i; for (hash = i = 0; i < key.Length; i++) { hash += char.ToLower(key[i]); hash += (hash << 10); hash ^= (hash >> 6); } hash += (hash << 3); hash ^= (hash >> 11); hash += (hash << 15); return hash;} Edited June 20, 2016 by Fireboyd78 Link to comment Share on other sites More sharing options...
unknown modder Posted June 20, 2016 Share Posted June 20, 2016 Hi, I was bored to browse through the scripts every time to find the right label for unknown hash-sums... Maybe there is a native for this or maybe not... Anyway! I made a small tool today that extracts the strings (incl. calculated hash-sums) out of C4 mission files, so it's easier now to find unknown hash-sums. It's NOT a perfect solution for this problem but it works DOWNLOAD With this tool I found the requested hash 0xBCECF0C2 (= "CMOD_FTRIG3" in carmod_shop.c4) within a minute PS: I coded this prog today afternoon, so it's very simple and without any extras (no double sort out, no nothing). I haven't time for more Kind of wish i saw this when I build mine, though mine was designed to find all gxt hashes that open iv hasnt defined but appear in scripts Link to comment Share on other sites More sharing options...
alloc8or Posted December 14, 2016 Share Posted December 14, 2016 Hi, known GXT labels are not the problem Example: //...EMSTR_683 = Automated Response – Wild Amateur Picschar* _GET_LABEL_TEXT(char* labelName) // 0x7B5280EBA9840C72 But what if the label is unknown (like mockba.the.borg's example)!? 0x00371714 = Daddy's Little Girl We need s.t. like this GTA IV native: char* GET_STRING_FROM_HASH_KEY(Hash hashKey) You can create your own: auto funcAddress = Pattern::Scan("48 89 5C 24 08 48 89 6C 24 18 89 54 24 10 56 57 41 56 48 83 EC 20");typedef LPSTR(__fastcall *GetLabelTextByHashFunc_t)(__int64 address, unsigned int hash);GetLabelTextByHashFunc_t GetLabelTextByHashFunc = (GetLabelTextByHashFunc_t)funcAddress;auto patternAddress = Pattern::Scan("84 C0 74 34 48 8D 0D ?? ?? ?? ?? 48 8B D3");auto address = patternAddress + *(int *)(patternAddress + 7) + 11;inline LPSTR GetLabelTextByHash(unsigned int labelHash){ return GetLabelTextByHashFunc(address, labelHash);} jedijosh920 and Jitnaught 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now