Hey guys, it's SliceCast here. This tutorial is for Advanced Modders who wants to step up their games to get better! Could be for newbies too.
I will show you some basics examples on how to hook a function.
Now let's say our Type Functions are (int, float, bool, double) and that we're doing a int/integer type.
Also make sure to call your hooks with MsHook or your mod won't work.
Example:
Field Hooking with Class
Call the GameMode Update with MSHook
If it's a bool, then simple. Just return/put "true" or "false".
If it's a float, then return a 99.0 or whatever.
This is way better than Patching. We don't need to use Hex Values for hooking. Hooking is way better, you can return any value you want.
I might make tutorial on how to do Function Pointers and Strings, but as of now just learn this.
:)
I will show you some basics examples on how to hook a function.
Now let's say our Type Functions are (int, float, bool, double) and that we're doing a int/integer type.
C++:
//the void *instance is a self-created variable.
int (*old_Kills)(void *instance);
int Kills(void *instance) {
//Check if instance is NULL to prevent CRASH
if (instance != NULL)
{
return 99999; //Return how many value
}
//return the original value (this code isn't really needed if you have a toggle/switch)
return old_Kills(instance);
}
Example:
C++:
MsHookFunction((void*)getAbsoluteAddress(OFFSETS), (void*)Kills, (void**)&old_Kills);
C++:
void(*old_GameMode_Update)(void *instance);
void GameMode_Update(void *instance) {
if(instance != NULL) {
if (xpPerKill) { //if Toggle
*(int *) ((uint64_t) instance + 0x30) = 5000;
}
}
old_GameMode_Update(instance);
}
C++:
MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", 0x00000), (void *) GameMode_Update, (void **) &old_GameMode_Update);
If it's a float, then return a 99.0 or whatever.
This is way better than Patching. We don't need to use Hex Values for hooking. Hooking is way better, you can return any value you want.
I might make tutorial on how to do Function Pointers and Strings, but as of now just learn this.
:)
Last edited: