Help! Edit Hex code specific

UnrealSkill

Platinian
Original poster
Apr 8, 2018
15
10
8
30
BR
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?
 
  • Like
Reactions: dartangnham

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
Patching in param you need to open IDA, you cant simply blxr without see the structure of the whole code
 
  • Like
Reactions: UnrealSkill

Poison Modz

Approved Modder
Approved Modder
Aug 27, 2020
155
10,891
1,193
India
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;
 
  • Like
Reactions: UnrealSkill

UnrealSkill

Platinian
Original poster
Apr 8, 2018
15
10
8
30
BR
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
 

CodeJutsu

Platinian
Oct 1, 2023
47
24
8
30
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