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 Jit and invoke a method in auto assembler?

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

Joined: 14 Jun 2023
Posts: 2

PostPosted: Wed Jun 14, 2023 3:55 am    Post subject: How to Jit and invoke a method in auto assembler? Reply with quote

Hello. I have a game where I always find a given method using mono dissector, JIT it and then invoke the method with a boolean parameter. I'd like to automate this process in an AA script. You can see where the method is in the attachment.

Now I assume that I should first call

Code:
LaunchMonoDataCollector()


then in order to Jit the methond I need to call

Code:
address=mono_compile_method(methodId)


So I need to find Method ID, presumably by calling

Code:
methodId=mono_class_findMethod(classId, "set_RunInBackground")


But to do that I need to get classID, which I can probably obtain by calling

Code:
classId=mono_findClass(namespace, "UnityEngine.Application")


Here i run into a problem, because I am not sure what namespace should be. is it the "UnityEngine.CoreModule" in the image? If it isn't, where do I get it?

In the end I would like to call
Code:
mono_invoke_method(domainId, methodId, address, args...)


Where I am not sure how to get the domainId argument and how to set up the "args" in order to pass one true boolean value (I am new at lua, but I believe I can eventually figure out the latter. Though I am at loss with the domainId).

So I would like to ask how to get namespace, domainId and properly set up the args Smile A pointer to a suitable tutorial would also be appreciated!



mono dissector.png
 Description:
 Filesize:  6.11 KB
 Viewed:  2662 Time(s)

mono dissector.png


Back to top
View user's profile Send private message
YoucefHam
Cheater
Reputation: 5

Joined: 19 Mar 2015
Posts: 39
Location: Algeria

PostPosted: Wed Jun 14, 2023 3:37 pm    Post subject: Re: How to Jit and invoke a method in auto assembler? Reply with quote

korbealad wrote:

.......


See this code, from JohnFK
Code:

{$lua}
[ENABLE]
if syntaxcheck then return end
if not monopipe then if LaunchMonoDataCollector() == 0 then  error(MessageDialog('Failed to Launch Mono Data Collector', mtError, mbClose)) end end
local method = mono_findMethod('UnityEngine', 'Application', 'set_runInBackground')
local domain = mono_enumDomains()[1]
local args={}
args[1]={}
args[1].type=vtByte
args[1].value=1
mono_invoke_method(domain, method, 0, args)
[DISABLE]
local method = mono_findMethod('UnityEngine', 'Application', 'set_runInBackground')
local domain = mono_enumDomains()[1]
local args={}
args[1]={}
args[1].type=vtByte
args[1].value=0
mono_invoke_method(domain, method, 0, args)
--https://fearlessrevolution.com/viewtopic.php?p=114720#p114720
Back to top
View user's profile Send private message Send e-mail
korbealad
How do I cheat?
Reputation: 0

Joined: 14 Jun 2023
Posts: 2

PostPosted: Wed Jun 14, 2023 4:51 pm    Post subject: Reply with quote

Thank you so much! I tried searching before of course but didn't find the particular linked post. The code answered all of my questions Smile
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 Lua Scripting 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