Help! Hooks not working...

sekoia

Platinian
Original poster
Jan 4, 2023
12
1
3
33
Setubal
Hi guys,
I'm trying to mod an arm64-v8a android game. I used these tools: apktool and Il2CppDumper.
I already tried to hook the multiple offsets but it doesn't work.
When I used Il2CppDumper, I found that doesn't have the file Assembly-CSharp.dll, this means that's that it has some kind of protection and my hooks don't work because of that?

Does someone have any idea why this is happening?

Code:
C++:
// already tried without param_2, param_3 and param_4... I put the params because Ghidra shows them
void (*old_Update)(void *instance, float param_2, float param_3, long param_4);
void Update(void *instance, float param_2, float param_3, long param_4) {
    if(instance != NULL) {
        LOGD("Inside update...");
    }
    old_Update(instance, param_2, param_3, param_4);
}

__attribute__((constructor))
void libhook_main() {
    do {
        sleep(1);
    } while (!utils::is_library_loaded(libName));
    A64HookFunction((void*)utils::get_absolute_address(OFFSET), (void*)Update, (void**)&old_Update);
    A64HookFunction((void*)utils::get_absolute_address(OFFSET_2), (void*)Update, (void**)&old_Update);
}
Thanks
 
Last edited:

sdaslk;dksd

Solid & Active Platinian
Apr 8, 2022
50
42
18
24
U.S.A
i guess the problem is that you used void, which void is a non-returnable, and istead of just typing "
old_Update(instance, param_2, param_3, param_4);", you have used return too..
 

sekoia

Platinian
Original poster
Jan 4, 2023
12
1
3
33
Setubal
I also tried without return, doesn't work. The return in the example above is wrong, I will edit.

Do you know why I don't have the Assembly-CSharp.dll when dumping with Il2CppDumper?
 

NotALegitGuy

Solid & Active Platinian
Sep 24, 2018
69
67
18
Costa Rica
It could be due to something inside the game such as a kind of protection, you should try debugging the issue by watching the memory address you are hooking and seeing it if changes.

If it does change then check if it's being called by any address because for the hook to actually do something the function has to be called.

If it doesn't change then it could be an issue with your hook or the game.