Help! Hooking on real device and emulator

HolaAmigos27

Platinian
Original poster
Oct 9, 2021
28
4
3
29
Moscow
Hi all. About LGL mod menu... Hooks work on LDplayer (android 7) but don't work on real phone (android 9). At the same time hexpatches work everywhere. Here is example of my hook:
Code:
int base_attack = 0, base_defense = 0, base_health = 0, sliderValue1 = 1, sliderValue2 = 1, sliderValue3 = 1;
int (*old_Base_attack)(void *instance);
int Base_attack(void *instance) {
    if (instance != NULL && sliderValue1 > 1) {
        return (int) sliderValue1;
    }
    return old_Base_attack(instance);
}

int (*old_Base_defense)(void *instance);
int Base_defense(void *instance) {
    if (instance != NULL && sliderValue2 > 1) {
        return (int) sliderValue2;
    }
    return old_Base_defense(instance);
}

int (*old_Base_health)(void *instance);
int Base_health(void *instance) {
    if (instance != NULL && sliderValue3 > 1) {
        return (int) sliderValue3;
    }
    return old_Base_health(instance);
}

HOOK_LIB("libil2cpp.so", "0x1D54248", Base_attack, old_Base_attack);

HOOK_LIB("libil2cpp.so", "0x1D54300", Base_defense, old_Base_defense);

HOOK_LIB("libil2cpp.so", "0x1D543B8", Base_health, old_Base_health);

case 0:
            if (value >= 1) {
                sliderValue1 = value;
            }
            break;
        case 1:
            if (value >= 1) {
                sliderValue2 = value;
            }
            break;
        case 2:
            if (value >= 1) {
                sliderValue3 = value;
            }
            break;