I've tried with the LGL Menu's HOOK_LIB and BNM's BNM::HOOK but neither has worked and both will crash when this method is hooked.
My Hook code:
The hooking methods I've tried (of course I wouldn't use both at the same time):
The game is Fate/Grand Order (Japanese version) ver. 2.85.2 (but I think the ENG version has the same issue with the same method).
What the method looks like in dnSpy:
I have about 30 other hooks for this game yet only this one crashes. On top of which the game crashes before even reaching/printing the LOGD line...
Does anyone know what is wrong and how I can overcome this?
My Hook code:
C++:
void *(*old_getClassPassive)(void *instance);
void *getClassPassive(void *instance) {
LOGD("Return getClassPassive");
return old_getClassPassive(instance);
}
C++:
HOOK_LIB("libil2cpp.so", "0x1546698", getClassPassive, old_getClassPassive);
C++:
auto BattleUserServantDataClass = LoadClass(OBFUSCATE_BNM(""),OBFUSCATE_BNM("BattleUserServantData"));
BNM::HOOK(BattleUserServantDataClass.GetMethodByName(OBFUSCATE_BNM("getClassPassive")), getClassPassive, old_getClassPassive);
What the method looks like in dnSpy:
I have about 30 other hooks for this game yet only this one crashes. On top of which the game crashes before even reaching/printing the LOGD line...
Does anyone know what is wrong and how I can overcome this?