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 


Refreshing cheat table after dealloc + unregisterSymbol

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Wed Dec 21, 2022 10:56 pm    Post subject: Refreshing cheat table after dealloc + unregisterSymbol Reply with quote

Hi there, is there a way to update the addresses after calling dealloc + unregisterSymbol?

I have pointers, let's say: "123Data +8" or whatever and it populates with a value when i register the symbol and all that, but after i dealloc and unregister, it keeps the value, i would like it to reflect the invalid value.

If i click the entry and open it, the label [123Data] shows red, and when i close it/ok, it shows the correct invalid value "??????"
How can i make it so it changes to ????? after i unregister symbol and dealloc?

Thanks in advance?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4302

PostPosted: Wed Dec 21, 2022 11:08 pm    Post subject: Reply with quote

Maybe call `reinterpret()` of the memrec class. (total guess, haven't tested this)

Every time I do that I don't show bad symbols at all. Append every memory record using that symbol to the script that defines the symbol as a child, right click on the parent script, and set the dropdown option for "hide children when disabled" or something.

globalalloc is also sometimes an option, but be weary of RIP-relative addressing problems

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Wed Dec 21, 2022 11:24 pm    Post subject: Reply with quote

Hi, thanks for reply, i tried reinterpret(), did not find anything about it in wiki, sadly, it did not produce the wanted effect. (used after the unregister and dealloc in Lua)
As far as "hide children when disabled" won't apply for this situation.
I need to have the values show up in the second monitor and want to leave it open at all times.
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Sat Dec 24, 2022 9:54 am    Post subject: Reply with quote

bump
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4302

PostPosted: Sat Dec 24, 2022 2:54 pm    Post subject: Reply with quote

I vaguely remember encountering this problem a while ago. Looking through CE's source code, I couldn't find anything accessible to Lua and gave up. If no one has answered at this point, you're probably not going to get an answer.

careca777 wrote:
I need to have the values show up in the second monitor and want to leave it open at all times.
If the symbol isn't defined, the value won't show up. I can't think of any good reason why you would want to show an invalid address instead of hiding it.

And what's wrong with globalalloc?

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

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

PostPosted: Sat Dec 24, 2022 6:19 pm    Post subject: Reply with quote

use pointers using the pointer checkbox, not using [[xxx+xxx]+xxx]+xxx notations

if the records are under the script they should update to invalid as soon as it gets disabled

in lua you can use memrec.reinterpret() on each entry you wish to reinterpret. Not on the record you just disabled

_________________
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
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Sun Dec 25, 2022 1:51 pm    Post subject: Reply with quote

Thank you for your inputs.
A few things i need to explain i think, maybe i should've done it from the start, but didn't think what i want to achieve would be so hard.

I have a lua script that checks continuously for pointer's values.

Example:
Code:
autoAssemble'globalalloc(explosionstats,4)'
autoAssemble'globalalloc(ExplosionsPTR,4)'
local ExplosionsPTRAddr = getAddress'["game.exe"+291BEE0]'
if ExplosionsPTRAddr ~= nil then
  writePointer("ExplosionsPTR", ExplosionsPTRAddr)
end


but for some specific cases i added a response to the condition like so:

Code:
else
autoAssemble'dealloc(CInfo)'
autoAssemble'unregisterSymbol(CInfo)'
end


So in the case that the condition fails, the symbol should be deregistered, why? because i also have a couple hotkeys that activate scripts to define values and if the symbol is active the table shows values that correspond to nothing, which makes me think the hotkey will work, when it wont.

To be as clear as possible consider this:
You have a bunch of entries and they are organized/nested, some will have a symbol let's say "CData".

There is a script that writes values into "CData"+8, "CData"+20 etc
a bunch of them, there are other scripts that write to pointers with symbols in a similar manner.

Now consider that the values under "CData" no longer are valid, because you are in a different place of the map or whatever the case may be.
The last valid values still show up, making me think the hotkey will act uppon these values.

All im looking for is to make all these values that i got with the code above, like "getAddress'["game.exe"+291BEE0]'" become invalid and show up as invalid in the table if that is the case. Of course, as soon as the value exists, the table should update, and that it does, the only thing it doesnt is revert once the value doesn't exist.

Why is it that if the value exists i get a value, but if it is invalid or inexistent, it still shows the last?

I hope this makes the query clearer.
Thank you for your help.

PS: i tried using that code memrec.reinterpret(), but unfortunately, until i open the address/entry in the cheat table and close it back, it doesn't update the value, it simply will not refresh.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4302

PostPosted: Sun Dec 25, 2022 2:47 pm    Post subject: Reply with quote

careca777 wrote:
Code:
local ExplosionsPTRAddr = getAddress'["game.exe"+291BEE0]'
if ExplosionsPTRAddr ~= nil then
  ...

...
...like "getAddress'["game.exe"+291BEE0]'" become invalid...
It will never become invalid.
`ExplosionsPTRAddr` will never be nil. getAddress raises an error if it fails. You probably meant getAddressSafe.
Even if you did use getAddressSafe, the only way it could be nil is if "game.exe" isn't a valid symbol (e.g. not attached to the correct process) or the offset 291BEE0 is beyond the exe. Even if the value at that address is 0, getAddress / getAddressSafe will return 0.
Basically, it will always be valid, and that if statement is worthless.
careca777 wrote:
Code:
autoAssemble'dealloc(CInfo)'

This will never work.
If `CInfo` is a globalalloc, you can't dealloc a globalalloc (unregistersymbol leaks memory).
If it's not, you need to pass the disableinfo to autoAssemble for CE to know where CInfo is.

Get a single auto assembler script that works. Then incorporate it in Lua. Don't try to split it up into several AA scripts.

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Sun Dec 25, 2022 3:21 pm    Post subject: Reply with quote

You are correct, i pasted the wrong example, i did use getAddressSafe., coupled with something like
"if readInteger(DriveOffset) == 0 then"
So essentially checking the value itself.

But... i do have some errors just like the one you pointed out, thank you for pointing that out, will correct.

I didn't know i cannot dealloc a globalalloc, can you please elaborate some more on this? "If it's not, you need to pass the disableinfo to autoAssemble for CE to know where CInfo is."

This is going above my head. I am confused but i think you mean the optional flag that corresponds to the [Disable] section of a script, which this one does not have, it runs continuously, or maybe i am reading this completely off.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 140

Joined: 06 Jul 2014
Posts: 4302

PostPosted: Sun Dec 25, 2022 3:55 pm    Post subject: Reply with quote

celua.txt:
Quote:
autoAssemble(text, targetself OPTIONAL, disableInfo OPTIONAL) : runs the auto assembler with the given text. Returns true on success, with as secondary a table you can use when disabling (if targetself is set it will assemble into Cheat Engine itself). If disableInfo is provided the [Disable] section will be handled
autoAssemble(text, disableInfo OPTIONAL)

Also see:
https://forum.cheatengine.org/viewtopic.php?p=5767333

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
careca777
Expert Cheater
Reputation: 0

Joined: 27 Jul 2013
Posts: 121

PostPosted: Mon Dec 26, 2022 3:47 pm    Post subject: Reply with quote

Thanks for the reply.

I read the thread and i am failing to see how this disableinfo flag helps to update the values in the table, but i will look into it, maybe i am missing something. I don't even have a [Disable] section in these scripts, they should run at all times, and even if i disable the script, the latest values are still there.
Back to top
View user's profile Send private message
beetecaste
How do I cheat?
Reputation: 0

Joined: 10 Jan 2023
Posts: 1

PostPosted: Tue Jan 10, 2023 4:37 am    Post subject: Reply with quote

Hi, thanks for reply, i tried reinterpret(), did not find anything about it in wiki, sadly, it did not produce the wanted effect. (used after the unregister and dealloc in Lua)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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