Hello,
I am having an annoying difficult time getting the LGL menu to properly hook and patch Unity games I am modding.
The LGL menu works just fine. I can use toggles and inputs in the menu to create custom Toasts for the game, so the LGL framework is working correctly.
However, every time I use the PATCH_LIB_SWITCH macro to modify a function (usually to make it return early with 00 00 00 E3 1E FF 2F E1) it causes the game to crash on the function call.
At the very least that means i am targeting the right offset, since it crashes only on the patched function call.
Additionally, my use of the HOOK macro doesn't appear to work at all. the functions supposed to be replaced using the HOOK macro are never called, and the original function runs normally. I've already checked and made certain the HOOK and PATCH macros are being called.
Here is an example code snippet of my attempt at hooking a function that opens an Equipment window UI.
the toggleEnable just caused a Toast to trigger, signaling the method was called, but the toggleEnable stayed at false.
later on I used the PATCH_SWITCH on the same code (after disabling the hook) to immediately return. This caused the game to stall then crash after I tried opening the equipment menu. (though this might have been because the function performed a necessary function that caused a crash on interruption.)
I was hoping someone with more experience with HOOKs on Android could help me figure out how to best bugfix this issue.
Just to reiterate, it isnt an issue with LGL itself most likely, but an issue with how im handling the HOOK/PATCHing. I just dont have the experience with Android modding to easily diagnose the exact problem.
I am having an annoying difficult time getting the LGL menu to properly hook and patch Unity games I am modding.
The LGL menu works just fine. I can use toggles and inputs in the menu to create custom Toasts for the game, so the LGL framework is working correctly.
However, every time I use the PATCH_LIB_SWITCH macro to modify a function (usually to make it return early with 00 00 00 E3 1E FF 2F E1) it causes the game to crash on the function call.
At the very least that means i am targeting the right offset, since it crashes only on the patched function call.
Additionally, my use of the HOOK macro doesn't appear to work at all. the functions supposed to be replaced using the HOOK macro are never called, and the original function runs normally. I've already checked and made certain the HOOK and PATCH macros are being called.
Here is an example code snippet of my attempt at hooking a function that opens an Equipment window UI.
the toggleEnable just caused a Toast to trigger, signaling the method was called, but the toggleEnable stayed at false.
Code:
void (*old_OpenEquipment)(void* instance, bool pause);
void OpenEquipment(void* instance, bool pause){
toggleEnable = true;
old_OpenEquipment(instance,pause);
}
void *hack_thread(void *) {
...
HOOK( "0x929C18", OpenEquipment, old_OpenEquipment);
...
}
I was hoping someone with more experience with HOOKs on Android could help me figure out how to best bugfix this issue.
Just to reiterate, it isnt an issue with LGL itself most likely, but an issue with how im handling the HOOK/PATCHing. I just dont have the experience with Android modding to easily diagnose the exact problem.