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 


How to get the address of an instanced class?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
fearless123456
How do I cheat?
Reputation: 0

Joined: 13 Nov 2017
Posts: 5

PostPosted: Tue Sep 17, 2019 6:03 am    Post subject: How to get the address of an instanced class? Reply with quote

I would like to invoke a mono method using AA. So instead clicking on dissect mono and find instances of class every time, I would like to implement something like the code below but without having to using an arbitrary value for the address variable (which doesn't work after resetting the game anyway). Just note that I know next to nothing about lua. Thank you.

[code]
[enable]

{$lua}

if (syntaxcheck) then return end

local method = mono_findMethod('', 'CCheatsScreen', 'Toggle')

local class = mono_method_getClass(method)

local domain = mono_enumDomains()[1]

local address = 0x1BA15340


local args = {}

local r = mono_invoke_method(domain, method, address, args)

if r then

print(r)

end

{$asm}

[disable]
[/code]
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3328

PostPosted: Tue Sep 17, 2019 2:59 pm    Post subject: Reply with quote

I usually find a place where the object is frequently accessed (not too frequently though and only the object I want).
Then, I use an AA script with and AOB scan to tap into the code where I register a pointer and expose the pointer in the address list.
This is without using any LUA.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Wed Sep 18, 2019 1:31 am    Post subject: Reply with quote

You can use the mono functions to get the vtable value of the class and then scan the memory for that
Then on every result check if the fields contain valid values according to the fieldtype etc...
And then pick the one you believe is the best match (there can be multiple, like if you died and a new player got created, but the old player hasn't been overwritten with crap)

_________________
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
t328163
!BEWARE! Deletes post on answer
Reputation: 2

Joined: 19 Dec 2017
Posts: 73

PostPosted: Wed Sep 18, 2019 3:22 am    Post subject: Reply with quote

ask the computer "what is the memory addr of this class?" Smile
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 97

Joined: 14 Jul 2007
Posts: 3328

PostPosted: Wed Sep 18, 2019 6:16 am    Post subject: Reply with quote

t328163 wrote:
ask the computer "what is the memory addr of this class?" Smile

I am curious what would Cocktanya say to that question.
Did you try?
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