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.
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:
Log of not working case:
How do I fix that so mod menu will always work?
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;
}
Log of working case:
Log of not working case:
How do I fix that so mod menu will always work?
Last edited: