Help! Edit Hex code specific

UnrealSkill

Platinian
I need to edit a specific function in HEX for mod 2lcpp.
but in the conventional way it crashes because I think I'm editing it wrong, what's the correct way to edit the area below:

1111.PNG


ORIGINAL CODE HEX

1111.PNG


if I edit by putting the value "F0 41 2D E9 40 D0 4D E2" to "01 0A A0 E3 1E FF 2F E1" = 1000 the game crashes then what is the correct way to edit a function that does not return in INT format but in your parameter?
 
bool AddCoin = false;

void (*old_addcoin)(void *instance, int coin);
void addcoin(void *instance, int coin) {
if (instance != NULL) {
if (AddCoin) {
old_addcoin(instance, 1000000);
return;
}
}
old_addcoin(instance, coin);
}

MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", 0x5E5BD4), (void *) addcoin, (void **) &old_addcoin);

OBFUSCATE("0_Toggle_Add Coins"),

case 0:
AddCoin = boolean;
break;
 
bool AddCoin = false;

void (*old_addcoin)(void *instance, int coin);
void addcoin(void *instance, int coin) {
if (instance != NULL) {
if (AddCoin) {
old_addcoin(instance, 1000000);
return;
}
}
old_addcoin(instance, coin);
}

MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", 0x5E5BD4), (void *) addcoin, (void **) &old_addcoin);

OBFUSCATE("0_Toggle_Add Coins"),

case 0:
AddCoin = boolean;
break;
thanks for the immense help, although I still don't know how to use the hook, I think that from here I can go alone and learn thanks for the help friends
 
is there a different thing between dnspy and dump.cs?
No, there isn't any difference when it comes to offsets the same offsets you'll see in dump.cs file will be same in dnspy, in fact looking and searching in dnspy is even better since it give better structural view, the only time you might want to check dump.cs is if there isn't a dummy dlls
 
Back
Top Bottom