Mono dissect + get pointer for .net generic class

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
Pekar
Novice Cheater
Novice Cheater
Posts: 22
Joined: Mon Feb 01, 2021 6:20 pm
Reputation: 40

Mono dissect + get pointer for .net generic class

Post by Pekar »

Hello everyone.

After mono disscection we have reflected .net names for addresses.
And we can do some operation with names, for example
aobscanregion(pointer1, Controller:Update, Controller:Update+1000, 0F ** 0F)
But due to .net structure we may get a huge string
Controller+<Coroutine>d__42:MoveNext
is it possible to use this generic named adrres some how in variables or with aobscanregion?

ofc, this is not working
aobscanregion(pointer1, Controller+<Coroutine>d__42:MoveNext, Controller+<Coroutine>d__42:MoveNext+1000, 0F ** 0F)

GreenHouse
Expert Cheater
Expert Cheater
Posts: 852
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 896

Re: Mono dissect + get pointer for .net generic class

Post by GreenHouse »

I don't think so. Your best bet is either to use a normal AOBScan, or to make a LUA script which gets all classes and does search for the name you input. Which is pretty much what I do.

Pekar
Novice Cheater
Novice Cheater
Posts: 22
Joined: Mon Feb 01, 2021 6:20 pm
Reputation: 40

Re: Mono dissect + get pointer for .net generic class

Post by Pekar »

GreenHouse wrote:
Sun May 08, 2022 3:10 pm
I don't think so. Your best bet is either to use a normal AOBScan, or to make a LUA script which gets all classes and does search for the name you input. Which is pretty much what I do.
Attempting to do
local Controller_ClassID = mono_findClass('Assembly-CSharp', 'Controller+<Coroutine>d__42')
is also nil
what the heck? why?

GreenHouse
Expert Cheater
Expert Cheater
Posts: 852
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 896

Re: Mono dissect + get pointer for .net generic class

Post by GreenHouse »

Pekar wrote:
Tue May 17, 2022 9:36 pm
what the heck? why?
You should get the last monoscript, which works with those. Just copy/paste the "mono_image_findClassSlow" function into a main script that is enabled before the rest do, and then use "mono_findClass" the same way.
Last monoscript: [Link]

Pekar
Novice Cheater
Novice Cheater
Posts: 22
Joined: Mon Feb 01, 2021 6:20 pm
Reputation: 40

Re: Mono dissect + get pointer for .net generic class

Post by Pekar »

found the reason and how it works.

I've used github repo to investigate how it works...
There is no simple methrods, so i've done as
enum images -> select image by assemblyid -> enum classes
due to tracing I found that there is no combination as
Controller+<Coroutine>d__42
but with
print(string.format("%x : %s:%s", classes[i].class, classes[i].namespace, classes[i].classname))
got
22c5af5d5a8 : :Controller
22d6dd8df50 : :<Coroutine>d__42

that means

if I use
local Controller_ClassID = mono_findClass('Assembly-CSharp', '<Coroutine>d__42')
and just
<Coroutine>d__42:MoveNext
in memory view or in a aobscan
and the final form
local Coroutine_MethodID = mono_findMethod('Assembly-CSharp', '<Coroutine>d__42', 'MoveNext')

it's working!!!

it's really not obvious :shock:
and no where described :(

Post Reply

Who is online

Users browsing this forum: No registered users