Help! Need help with modding il2cpp game

Duston

Platinian
Original poster
Nov 11, 2023
9
1
3
Hello. I am a beginner and I am sorry if my question is dumb or poorly explained.
I've been trying to mod this game using lgl mod menu:game link
I've hooked Update method to get access to instance of PlayerLife class and change playersLife.
C++:
#define targetLibName OBFUSCATE("libil2cpp.so")

void (*old_UpdatePlayerLife)(void *instance);
void UpdatePlayerLife(void *instance) {
   if (instance != NULL)
    {
        *(float *)((uint64_t) instance + 0x34) = 10;
        LOGI(OBFUSCATE("player life changed"));
    }
    return old_UpdatePlayerLife(instance);
}

void *hack_thread(void *) {
    LOGI(OBFUSCATE("pthread created"));
    //Check if target lib is loaded
    do {
        sleep(1);
    } while (!isLibraryLoaded(targetLibName));
    LOGI(OBFUSCATE("lib loaded"));
 
    HOOK_LIB("libil2cpp.so", "0x88C708", UpdatePlayerLife, old_UpdatePlayerLife);
 
    LOGI(OBFUSCATE("Done"));
    return NULL;
}
After successfully compiling apk and implementing mod menu to the game I opened game and everything worked well (player life changed). Then all I did was close the game and open again and menu wasn't working (game did not crash and floating menu didn't disappear). I tried close and open game few times, mod menu didn't work.

Log of working case:
Working.png


Log of not working case:
NotWorking.png


How do I fix that so mod menu will always work?
 
Last edited:

nowhere_222

Just Crazy
Jul 29, 2022
480
6,070
193
22
Inner Peace 🕊️
You didn't make any toggle on your hooking code, so you can't ON/OFF the feature and the feature will always works but it can stop working because there is no toggle bro
 
  • Like
Reactions: TagsX

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
Toggle or no toggle isnt the issue here, more like libbase issue. Add some sleep or enable save preference, assuming target is 64bit
 
  • Like
Reactions: TagsX