View previous topic :: View next topic |
Author |
Message |
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat May 05, 2018 5:55 am Post subject: Get Mono Namespace from address. |
|
|
I have tried using "mono_object_getClass" but this seems to always return nil, so I'm not sure I'm using it correctly.
Code: | local cID, cName = mono_object_getClass(getAddress('PlayerStatsManager:TakeDamage'))
print(mono_class_getNamespace(cID)) |
Even after JITing the method, "cID" and "cName" are still "nil".
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sat May 05, 2018 6:16 am Post subject: |
|
|
mono_object_* take the start address of an instanced object, you are giving it a method address
you probably want to use mono_getJitInfo(address)
mono_method_getClass can then be used on the method it returns snd from that the namespace
_________________
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 |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat May 05, 2018 6:29 am Post subject: |
|
|
edit: looks like DB sneaked in
Why are you passing a method address to a function designed for objects (an instance of a class)?
A little test and it seems that a mono "method" isn't the same as the address of the code, there doesn't seem to be a mono_findMethod(address) but you can use mono_getJitInfo
Code: | LaunchMonoDataCollector()
local name = 'PlayerStatsManager:TakeDamage'
local addr = getAddress(name)
local method = mono_getJitInfo(addr).method
local klass = mono_method_getClass(method)
-- namespace tends to be empty string ''
return mono_class_getNamespace(klass), mono_class_getName(klass) |
_________________
|
|
Back to top |
|
|
TheyCallMeTim13 Wiki Contributor Reputation: 50
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Sat May 05, 2018 6:49 am Post subject: |
|
|
FreeER wrote: | ...
Why are you passing a method address to a function designed for objects (an instance of a class)?... |
Best I could come up with, I thought may be it being under "PlayerStatsManager" it might work, but yeah hence the "I'm not sure I'm using it correctly" part. But mostly didn't spot the "mono_method_getClass" it seems.
So this gets me a blank Namespace:
Code: | local addr = 'PlayerStatsManager:TakeDamage'
addr = getAddress('PlayerStatsManager:TakeDamage')
print(addr)
local mID = mono_getJitInfo(addr).method
print(mID)
local cID = mono_method_getClass(mID)
print(cID)
print(type(mono_class_getNamespace(cID)), mono_class_getNamespace(cID)) |
And it does work with this:
Code: | local mId = mono_findMethod('', 'PlayerStatsManager', 'TakeDamage')
mono_compile_method(mId) |
But this also works, and I thought this is what was needed:
Code: | local mId = mono_findMethod('Assembly-CSharp', 'PlayerStatsManager', 'TakeDamage')
mono_compile_method(mId) |
Why or how is it working with the empty namespace, does CE just search and use the first NS that has "PlayerStatsManager:TakeDamage"?
EDIT:
Was asked for a Mono tut and I have been wanting to do some messing around with it, basically this is where I'm at:
https://wiki.cheatengine.org/index.php?title=Tutorial:Mono:Basic
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sat May 05, 2018 8:19 am Post subject: |
|
|
mono_getJitInfo returns a table with fields
Code: |
jitinfo
method
code_start
code_size
|
the method field should get you further
often namespace is '' so it's not necesary to specify
_________________
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 |
|
|
|