Tutorial Basic Hooking Tutorial

LEIIKUN

Retired Staff
Retired but loved <3
Oct 13, 2019
500
11,002
1,193
20
Davao
i find the hooking example from the original lgl mod menu and i think i already find it out, but i have feeling it will be a million of trial and error. ty for your response
Yeah, try and try until you success. Before I became a modder, I faced a lot-of-million of trial and errors.

Levi said "Give up on your dream and die"
 

Numark

Awesome Active Platinian
Original poster
May 23, 2017
116
929
193
and how to edit this ?
public partial class ActorMonster : ActorBase
{
// Token: 0x060000AF RID: 175 RVA: 0x00002050 File Offset: 0x00000250
[Token(Token = "0x60000A2")]
[Address(RVA = "0xBDAF90", Offset = "0xBDAF90", VA = "0xBDAF90", Slot = "33")]
protected virtual void Attack()
{
}
}

i want the monster become unable to attack me but instead edit it on hex editor ( i already do that and yes it work ) that can't be turned off, i want this function have a switch
It's not hard to do. I suggest you to learn cpp more before getting into this a bit. It's fine that you're doing this without some knowledge, but it'll be way better after you learned it.


Anyways since you're in a class of the monster. You can just NOP the function.

NOP = 00 F0 20 E1
To end the value is BX LR = 1E FF 2F E1
Basically = 00 F0 20 E1 1E FF 2F E1

Or you can probably hook the Attack() and make it do something else.
 

DawnBreaker

Platinian
Nov 4, 2018
39
3,834
183
24
Earth
It's not hard to do. I suggest you to learn cpp more before getting into this a bit. It's fine that you're doing this without some knowledge, but it'll be way better after you learned it.


Anyways since you're in a class of the monster. You can just NOP the function.

NOP = 00 F0 20 E1
To end the value is BX LR = 1E FF 2F E1
Basically = 00 F0 20 E1 1E FF 2F E1

Or you can probably hook the Attack() and make it do something else.
well,, i'm actually using nop function to make the monster stop attacking me. and you say i can hook the attack() to make it do something else... i think i'm start to understand it. ty for your response btw
 
  • Like
Reactions: BernardSoft

MalikRayyan263

Platinian
Aug 27, 2020
6
1
3
36
Pakistan
void _Player_update(void *player){
if(player != NULL){
bool isMine = *(int *)((uint64_t)player + 0x30);

if(isMine){
//ammo
*(int *)((uint64_t)player + 0x1c) = 999;

//health
*(float *)((uint64_t)player + 0x18) = 100.0f;
 

DawnBreaker

Platinian
Nov 4, 2018
39
3,834
183
24
Earth
void _Player_update(void *player){
if(player != NULL){
bool isMine = *(int *)((uint64_t)player + 0x30);

if(isMine){
//ammo
*(int *)((uint64_t)player + 0x1c) = 999;

//health
*(float *)((uint64_t)player + 0x18) = 100.0f;
this one is more easy for me, why ? because the Player_update , Player, Mine, ammo, and health is in the same class ( public class Player : MonoBehaviour ) . what make it hard, is the function that you wanna modify are in the different class. like modifying a shared function.
 

MalikRayyan263

Platinian
Aug 27, 2020
6
1
3
36
Pakistan
Why it is hard to find correct offset for the mod menu
image_2021-05-07_035128.png

what is difference between fields and methods. There are some offsets which are encrypted like [ public void LKSFJSAJSNE ]
 

jkof

Platinian
Mar 28, 2020
36
5
8
23
France
@Tiuu
Hey,
Is it possible to Hook a class without any Update function ?

For ex:
private void Start()
public void OnUpdate()
private void LateUpdate()
private void FiedUpdate()
...

or even without any ?
Thanks
 

Numark

Awesome Active Platinian
Original poster
May 23, 2017
116
929
193
@Tiuu
Hey,
Is it possible to Hook a class without any Update function ?

For ex:
private void Start()
public void OnUpdate()
private void LateUpdate()
private void FiedUpdate()
...

or even without any ?
Thanks
LateUpdate works as well, but I don't know about the others. Just try it, it's trial and error anyways. I mean try, if it doesn't work, then use another method.
 
  • Like
Reactions: jkof

jkof

Platinian
Mar 28, 2020
36
5
8
23
France
LateUpdate works as well, but I don't know about the others. Just try it, it's trial and error anyways. I mean try, if it doesn't work, then use another method.
So instead of the "private void Update()" offset in the HOOK part, i replace it with the LateUpdate one ? (example)
 

ggfghjh

Platinian
Nov 15, 2021
10
1
3
25
japan
i have a question how do i know the numbers of the additional parameters today i made a hook using int get_currentPATK but i dont kown how many parameter it has i using (void* instance) it didnt work im very appreciate if you can give me a reply

屏幕截图 2022-02-22 222138.png