Help! HOOK VOID WITHOUT UPDATE

Rishz745

Platinian
Original poster
Nov 13, 2022
7
0
1
20
Maharashtra
Hey there friends! this is first time I'm seeking for help on this forum.
I wanted to hook a function in such a way, so that my beyblade technique will charge instantly, and here's is the function of it.

// RVA: 0x2CFEAD4 Offset: 0x2CFEAD4 VA: 0x2CFEAD4
public void Charge(TileColor chargeColor, int amount) { }

As you guys can see here in curly brackets there's something mentioned like TileColor, ChargeColor, int amount so here's this tile color which I want to charge instantly

public enum TileColor // TypeDefIndex: 1903
{
// Fields
public int value__; // 0x0
public const TileColor purple = 4;
}

The purple one and it's value is 4 and for charge color here

public enum TileTags // TypeDefIndex: 1904
{
// Fields
public int value__; // 0x0
public const TileTags purpleCharge = 132;
}

And it's value is 132 and remaining int amount if I make int amount to 0 then it will get charged instantly, so anyone can help me with hooking for it? @libModz I hope you will help me, if you're watching this thread!!
 

libModz

Awesome Active Platinian
Jun 2, 2022
169
30
28
UK
AFAIK you need an Update or similar function to hook void to. Since you're hooking a method and not a field offset you could use an update function from a different class. It really depends on the game. Is there not an update function in the same class as public void Charge?
It could be LateUpdate or FixedUpdate.

Anyway this is how you'd hook void Charge...

C++:
void (*Charge)(void *instance, int chargeColor, int amount);



void (*old_Update)(void *instance);
void Update(void *instance) {
    if(instance!=NULL) {
        Charge(instance, 4, 0);    // Type whatever int values you like here
    }
    old_Update(instance);
}




// Then under hackthread this...



Charge = (void(*)(void*, int, int)) getAbsoluteAddress(targetLibName, 0x2CFEAD4);


HOOK("0xOFFSET", Update, old_Update);
 
  • Like
Reactions: Rishz745

Rishz745

Platinian
Original poster
Nov 13, 2022
7
0
1
20
Maharashtra
AFAIK you need an Update or similar function to hook void to. Since you're hooking a method and not a field offset you could use an update function from a different class. It really depends on the game. Is there not an update function in the same class as public void Charge?
It could be LateUpdate or FixedUpdate.

Anyway this is how you'd hook void Charge...

C++:
void (*Charge)(void *instance, int chargeColor, int amount);



void (*old_Update)(void *instance);
void Update(void *instance) {
    if(instance!=NULL) {
        Charge(instance, 4, 0);    // Type whatever int values you like here
    }
    old_Update(instance);
}




// Then under hackthread this...



Charge = (void(*)(void*, int, int)) getAbsoluteAddress(targetLibName, 0x2CFEAD4);


HOOK("0xOFFSET", Update, old_Update);
Thanks alot for this hook but there's no update offset in the same class
 

Attachments

bkR57

Platinian
Jan 21, 2024
16
3
3
34
I'm maybe wrong, but hooking a void function does not necessarly means you need to hook an update to call it via a pointer.
It is the case only if the void function is not called, otherwise, if the game call it regularly to charge the skill (eg: each seconde to update the animation bar), u can hook it directly and edit params given to it.

using frida for example you can quickly see if the void function is called or not.

But check also for other function, this one may only be for the "bar animation", and using it will only show you that the skill is ready, but still not able to use it.
Look for function that are triggered on "skill-use", or on "skill-ready" for example like "bool isSkillReady()", "float GetSkillCooldown()" etc
 

Sbyky

Approved Modder
Approved Modder
Oct 4, 2022
76
2,676
183
Pakistan
you can find some answers here

 
  • Like
Reactions: Rishz745