Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Check whether a symbol/label/pointer is properly iniialized.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Tue Apr 10, 2018 8:22 am    Post subject: Check whether a symbol/label/pointer is properly iniialized. Reply with quote

I wonder if there is a simply test to check whether a symbol or label is properly initialized. Basically: when starting CE, it will already assign memory addresses to any labels/symbols it finds (taken from the table itself?!). In this situation - when the script in question has not yet been enabled at least once - you'll find '????' at those locations (well, at least most of the time). I'm not sure if one can test on this in a safe way (one can check for '??' strings though).
Practical situation: one script initializes the (global) label, which is then used in another script for "test~cmp" purposes.
One solution: 'pre-initialize' those labels in a main script, with all other scripts categorized below...
Another solution: do the "same" aobscan in this script (if possible), or maybe create a 'function' which is called in both scripts.

ps: in that respect: how can one detect if a ponter is actually a valid pointer, even if its value is not '00000xxx' or NULL. Based on the articles I've read sofar, no clear solution...?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Tue Apr 10, 2018 9:18 am    Post subject: Reply with quote

assuming AA scripts, then use the lua command getAddressSafe("symbol") to verify it's been loaded or not. It returns nil if not

As for pointers you have to follow the whole path and if you end up with a valid address it may be correct. Just check the bytes around the final address to confirm it is actually what you want

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Tue Apr 10, 2018 12:34 pm    Post subject: Initial testing... Reply with quote

see here: [ https://imgur.com/a/igqdy ]

Perhaps a small observation first: in my (past) researching, I found out that CE will take/show/give any labels/symbols used in the table an "initial" memory address location as written down in the table itself (like shown in pic1). This will not necessarily be the effective address once the script is enabled...!

That said: because of the above effect, CE will (always?) return a (ptr)address; be it un-initialized (hence the '?'). Once I realized that, I read the addresses value, which - in this case - will return a "nil" value (the print statement confirms that).

So: after some cleanup, one can see on the next pic2 that it does execute the 'IF' statement (prints address now) - but will not write to the label's address for some reason (perhaps because a 'globalalloc' or 'alloc/registersymbol' has not been performed yet ?)... Iow CE has not effectively allocated the appropriate memory/address to the label/symbol yet? (I'm guessing here)

Anyways: the result can be seen in pic3.
(if I enable the 'Health' script first, then no probs)

ps: as I said earlier, I can place/categorize all these scripts below a 'main' script, which can initialize those 'globalalloc's upfront. With this exercise I'm just trying to get a better grip on something so omnipresent as pointers/symbols/labels...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites