Page 1 of 1

Using AA registered symbol address in LUA script?

Posted: Tue Sep 08, 2020 4:26 pm
by SvT
I wrote a script that gets a valid address you can use to invoke a mono method.

How would I use this address in the second script below? I'm guessing I need to setup a variable in LUA and pass it to address in mono_invoke_method but I'm not sure how to do that.

Code: Select all

[ENABLE]
alloc(newmem,2048,Mdi.SRRW.UI:GameController:Awake+f9) 
label(returnhere)
label(originalcode)
label(exit)

registersymbol(instance)

newmem:
mov [instance],rax

originalcode:
movzx eax,byte ptr [rax+00000084]

exit:
jmp returnhere

instance:
dd 0

Mdi.SRRW.UI:GameController:Awake+f9:
jmp newmem
nop 2
returnhere:

[DISABLE]
unregistersymbol(instance)
dealloc(newmem)
Mdi.SRRW.UI:GameController:Awake+f9:
movzx eax,byte ptr [rax+00000084]
//Alt: db 0F B6 80 84 00 00 00

Code: Select all

[ENABLE]
{$lua}
if (syntaxcheck) then return end
local method = mono_findMethod('', 'Mdi.SRRW.AchievementProfile', 'RecordFinishTutorial2')
local class = mono_method_getClass(method)
local domain = mono_enumDomains()[1]
local hp = mono_invoke_method(domain, method, address, {})
{$asm}

[DISABLE]

Re: Using AA registered symbol address in LUA script?

Posted: Tue Sep 08, 2020 7:07 pm
by JohnFK
Use [Link]

Code: Select all

local address = getAddress('[instance]')
local hp = mono_invoke_method(domain, method, address, {})