vfsfitvnm / frida-il2cpp-bridge

A Frida module to dump, trace or hijack any Il2Cpp application at runtime, without needing the global-metadata.dat file.
https://github.com/vfsfitvnm/frida-il2cpp-bridge/wiki
MIT License
918 stars 191 forks source link

Invoke doesn't work #436

Closed Spiritcow closed 7 months ago

Spiritcow commented 8 months ago
 DynamicActionButtonSeparate.method("OnPress").implementation = function (value: boolean) {
        console.log('OnPress called');
        console.log(value);
        console.log((this as Il2Cpp.Object).method("OnPress").virtualAddress);
        this.method("OnPress").invoke(value);
    }
    Il2Cpp.gc.choose(DynamicActionButtonSeparate).forEach((instance: Il2Cpp.Object) => {
        console.log('Captured');
        console.log(instance.method("OnPress").virtualAddress);
        instance.method("OnPress").invoke(true);

    });

This is the signature.

[Token(Token = "0x60041ED")]
[Address(RVA = "0x1A59C14", Offset = "0x1A59C14", VA = "0x1A59C14", Slot = "6")]
protected override void OnPress(bool bPressed)
{
}

When i am doing this action from game, my hook works.

I have this hook. Inside hook OnPress method works fine. I can change the value and will see the effect. But then I try to invoke it - it doesn't work. But these methods have the same memory address.