vfsfitvnm / frida-il2cpp-bridge

A Frida module to dump, trace or hijack any Il2Cpp application at runtime, without needing the global-metadata.dat file.

Home Page:https://github.com/vfsfitvnm/frida-il2cpp-bridge/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does `decorate` also works for single function?

commonuserlol opened this issue · comments

Just an internal question, as title says. I saw that it works for interfaces (or how const something = {...} called?), but seems it not work for single function, e.g

function asd() {...}
decorate(asd, cache); 

decorators can't be applied to single functions (only for class methods/properties) so it will be great to get kinda hack without deps.

You are correct, you can't decorate a top level function.
You could achieve a similar result by:

function foo() {
    return 1;
}

function decorate(target) {
    const impl = globalThis[target];
    globalThis[target] = function () {
        return impl() + 1;
    }
}

decorate("foo");

Now im dealing with applying real decorator to it. My ts knowledge is bad and i didnt found anything in google. For example your lazy, how i can apply it to single function? I did workaround for my cache
img
but it requires separate functions. i know that its kinda offtop but any idea?