Solved How to hook Static int

Status
Not open for further replies.

Exequel

Platinian
Original poster
Jan 14, 2024
41
5
8
15
When I test The offset Tester in Patch Offset it Work Very well but when I use this hooking it doesn't work:

Code:
bool isUpgrade = false

int (*old_Gold)(void *instance);
int gold(void *instance) {
if (instance != NULL) {
if (isUpgrade) {
return 0;
}
}           
return old_Gold(instance);
}
MSHookFunction((void *) getAbsoluteAddress("libil2cpp.so", 0x163D878), (void *) &upgrade, (void **) &old_Upgrade);

OBFUSCATE("17_Toggle_Free Upgrade"),

case 17:
isUpgrade = boolean;
break;
 

Exequel

Platinian
Original poster
Jan 14, 2024
41
5
8
15
I mistake Putting code At old gold and gold it should be Upgrade but still Doesn't work
 

Hiyall360

Awesome Active Platinian
Jan 14, 2018
132
3,950
193
Mr.Pringlez
Static functions don't require instance

C++:
bool isUpgrade = false

int (*old_Gold)();
int Gold() {
if (isUpgrade) {
    return 0;
    }     
return old_Gold();
}

MSHookFunction((void *) getAbsoluteAddress("libil2cpp.so", 0x163D878), (void *) &Gold, (void **) &old_Gold);


OBFUSCATE("17_Toggle_Free Upgrade"),

case 17:
isUpgrade = boolean;
break;
 

DaRealPanDa

Co-Administrator
Staff member
Supporting-Team
Global Moderator
Social Media
Mar 12, 2018
6,774
15,660
2,120
27
Skyrim
Thread will be set to "solved" and closed.
When you're not happy with that just send me a message and i will re-open the thread for you.

Thanks.
 
Status
Not open for further replies.