Tutorial How to unlink functions in IL2CPP and other native games

Brabodoshack

Platinian
Jun 2, 2022
8
16
3
brasil
Estou com uma duvida nesse exemplo abaixo, minha offset isBot é 0x8DA1AC, teria como fazer um exemplo com esse tipo de offset.

int(*old_get_ammoInClip)(void *instance);
int get_ammoInClip(void *instance)
{
if(instance != NULL)
{
void *AccessCharacterController = *(void**)((uint64_t)instance + 0x32); // Use the field and make a pointer to get access to CharacterController
if(AccessCharacterController != NULL) // Since we use a pointer for the field 0x32 to get access to the CharacterController class, we have to check if it isn't null
{
bool IsBot = *(bool*)((uint64_t)AccessCharacterController + 0x24); // use it to access the field isBot in the class CharacterController
if(!IsBot) // Check if it's not a bot
{
return 99999; // Now only you get 99999 ammo
}
}
}
return old_get_ammoInClip(instance); // Return original value for bots
}
MsHookFunction((void*)getAbsoluteAddress(0x34287), (void*)get_ammoInClip, (void**)&old_get_ammoInClip);
 

jagjigjug

Platinian
Oct 6, 2022
10
0
1
33
US
Very great tutorial 👏👌👍

Btw is it possible to hack field of array, List<>, enum, and Game object as well?
 

SleepyCatto

Rookie
Jun 9, 2023
3
0
1
Germany
Thank you so much for this tutorial!
This helped me find a solution for field hooking outside class (i already got a var poitining to the target class but didnt know which datatype it was :>)
Its been 3 days since i started modding and i already can hook and make mod menus for mono- or il2cpp games.
Thank you
 

Ditch532

Rookie
Sep 15, 2023
1
0
1
19
Can this be used? I want to edit something in the football club that I use but in the club class it is for all clubs and there is a club ID method and I know the list of club IDs, can anyone help me, I am a beginner and have never learned CC, I just followed the tutorial

// RVA: 0x6864C0 Offset: 0x6864C0 VA: 0x6864C0
public short get__clubID() { }
 

Mukul21

Platinian
Jun 8, 2022
5
1
3
24
Singapore
Can anyone help me, I want to change the player's defending rating

C++:
// RVA: 0x6B8E30 Offset: 0x6B8E30 VA: 0x6B8E30
    public float get__defending() { }
But it doesn't work because there is player ID

C++:
// RVA: 0x6B8CB0 Offset: 0x6B8CB0 VA: 0x6B8CB0
    public short get__pID() { }
Can this be like unlinking? I know the player ID that I want to edit, but I don't know how and I can only follow the existing tutorial, I tried this unlink tutorial but there is no value Short

C++:
short (*get__pID)(void *instance);

float(*old_get__defending)(void *instance);
float get__defending(void *instance) {
    if(instance != NULL) {
short PlayerID = get__pID(instance);
if(PlayerID = 4254)
    }
return 99.0;
    }
    }
    return old_get__defending(instance);
}

MsHookFunction((void*)getAbsoluteAddress(targetLibName, 0x6B8E30), (void*)get__defending, (void**)&old_get__defending);
get__pID = (short (*)(void*))getAbsoluteAddress(targetLibName, 0x6B8CB0);
I've only been modding for a few weeks, and I'm just following tutorials
 

ajiq9999

Rookie
Feb 22, 2021
4
0
1
25
Malaysia
public void MissionSuccessComplete()

How to hook something like this

public void MissionSuccessComplete()


void *old_missionsucess(void *instance) {
void new_missionsucess(void *instance);
if (missiond) {

return ;

}

old_missionsucess;
}
 

Sami1980

Solid & Active Platinian
May 15, 2021
64
10
8
43
Europe
This is for a dll-based game right? How can I unlink functions if I don't have a dll. I can't edit instructions in dnSpy. I just have a dump.cs file and I'm modding the game by changing the hex codes of the offsets in the libil2cpp.so file.
 

Sami1980

Solid & Active Platinian
May 15, 2021
64
10
8
43
Europe
This is SUPER helpful. Couldn't have enjoyed infinite health without it because the function was shared by AI in my game. Thank you so much it worked like a charm!