So I found two fields:
I wrote hooks using these fields and the update function, but only one of the hooks is in the game. If you remove one hook code, the second one will start working. How can I get both hooks to work? (I'm using lgl mod menu 3.2)
My code:
If you do this, everything works, but I would like to run hacks on two different buttons
Code:
public Int32 Damage; // 0x24
public Int32 Mana; // 0x28
RVA: 0x64e368 VA: 0xc024e368
public Void Update() { }
My code:
Code:
bool Damage = false;
bool Mana = false;
void (*old_Dmg)(void *instance);
void Dmg(void *instance) {
if (instance != NULL) {
if (Damage) {
*(int *) ((uint64_t) instance + 0x24) = 999999999;
}
}
return old_Dmg(instance);
}
void (*old_InfiniteMana)(void *instance);
void InfiniteMana(void *instance) {
if (instance != NULL) {
if (Mana) {
*(int *) ((uint64_t) instance + 0x28) = 999999999;
}
}
return old_InfiniteMana(instance);
}
HOOK_LIB("libil2cpp.so", "0x64e368", Dmg, old_Dmg);
HOOK_LIB("libil2cpp.so", "0x64e368", InfiniteMana, old_InfiniteMana);
OBFUSCATE("Toggle_Hit Kill"),
OBFUSCATE("Toggle_Infinite Mana"),
switch (featNum) {
case 0:
Damage = boolean;
break;
case 1:
Mana = boolean;
break;
}
}
If you do this, everything works, but I would like to run hacks on two different buttons
Code:
void (*old_DmgMana)(void *instance);
void DmgMana(void *instance) {
if (instance != NULL) {
if (Toggle) {
*(int *) ((uint64_t) instance + 0x24) = 999999999;
*(int *) ((uint64_t) instance + 0x28) = 999999999;
}
}
return old_DmgMana(instance);
}