Solved Hooking getAbsoluteAddress return an error on LGL 2.9

Status
Not open for further replies.

GODS

Solid & Active Platinian
Original poster
Aug 20, 2019
52
792
83
25
Isekai
I'll be straight forward here is the code.

C++:
int (*old_get_Coin)(void *instance);
int get_Coin(void *instance) {
    if (instance != NULL && coin){  //check if instance not null and coin is true
        return 888888;  //if instance not null and coin is true then return 888888
    }
    return old_get_Coin(instance); //if NULL and/or coin is false then return old value
}
Here is my MShook look like
C++:
 MSHookFunction((void*)getAbsoluteAddress(0x436BC7), (void*)get_Coin, (void**)&old_get_Coin);
generated error :
"No matching function for call to (getAbsoluteAddress) "

"candidate function not viable: requires 2 arguments but 1 was provided "

Then I clicked on second error, it show me these code in Utils.h

Code:
DWORD getAbsoluteAddress(const char *libraryName, DWORD relativeAddr) {
    libBase = findLibrary(libraryName);
    if (libBase == 0)
        return 0;
    return (reinterpret_cast<DWORD>(libBase + relativeAddr));
}
Idk what I'm doing wrong but the last time I was using lgl was on version 2.8 and everything was fine.
 

GODS

Solid & Active Platinian
Original poster
Aug 20, 2019
52
792
83
25
Isekai
Anyway if you encountered min sdk error or tool theme error because you update everything in the project,
Simply go to gradle scripts - build.gradle (module:.....app) change minSdkVersion to 21 or above.

sdk 19 is for kitkat and 21 is for lolipop.
just mention in your mod thread that min supported android is 5
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
177
63
28
G
Anyway why u bother use that, 2.9 alrd have macros.
Just use this more easy

HOOK("0x123456", FunctionExample, old_FunctionExample);
 
  • Like
Reactions: GODS

GODS

Solid & Active Platinian
Original poster
Aug 20, 2019
52
792
83
25
Isekai
getAbsoluteAddress take 2 params you only provided 1 it should be
MSHookFunction((void*)getAbsoluteAddress("il2cpp.so", 0x436BC7), (void*)get_Coin, (void**)&old_get_Coin);
I figured it out last night before sleep, and i was like bruh I'm so dumb. Utils.h clearly show what's missing in my code.

Anyway why u bother use that, 2.9 alrd have macros.
Just use this more easy

HOOK("0x123456", FunctionExample, old_FunctionExample);
I deleted every single example when the project loaded, guess that's why I didn't see it.

btw I noticed that there are 3 smali files instead of 1 when I decompile debug apk.
Do I need to copy all that into game file?
 
Status
Not open for further replies.