Solved Call a pointer without update

Status
Not open for further replies.

3.Sav.Modz

Platinian
Original poster
May 19, 2021
31
87
8
23
Modding Universe
Game is FWD assault [for testing]
if we have a method like this
method.png

we can simply call it using the update offset which is this
update.png

with a code like this

C++:
bool RefillAmmoInAllWeaponsHook = false; 


 void (*RefillAmmoInAllWeapons)(void* instance); 
 
 void(*old_RefillAmmoInAllWeaponsUpdate) (void *instance); 
 void RefillAmmoInAllWeaponsUpdate(void *instance) { 
 if(instance != NULL) { 
 if (RefillAmmoInAllWeaponsHook){ 
 RefillAmmoInAllWeapons(instance); 
 } 
 } 
 old_RefillAmmoInAllWeaponsUpdate(instance); 
 }  

void *hack_thread(void *) {
    do {
        sleep(1);
    } while (!isLibraryLoaded(targetLibName));
   
#if defined(__aarch64__) 
#else 
RefillAmmoInAllWeapons = (void(*)(void *))getAbsoluteAddress(targetLibName, string2Offset(OBFUSCATE_KEY("0x687D6C", 'A'))); 

MSHookFunction((void *) getAbsoluteAddress(targetLibName, 0x6A7A38),
(void *) RefillAmmoInAllWeaponsUpdate, (void **) &old_RefillAmmoInAllWeaponsUpdate);
 
#endif

    return NULL;
}
Result for this , when the button is on the method will be called and ammo will always be refilled [tested working]
My Question is : how to call this method without the use of the update method . [in case the class itself does not have any update method.]
 

Tiahh

Solid & Active Platinian
Jan 12, 2018
75
45
18
37
Hello there,
You can use Update() from other classes too.
Hope this helps :)
 

Sevol

Retired Staff
Retired but loved <3
Jun 8, 2019
219
5,921
193
Russia
i have just tried the normal function pointer for a working method with its update , > working
used 4 more updates (random ones) and they are not working .
not all methods. this one should be called in its class
 

3.Sav.Modz

Platinian
Original poster
May 19, 2021
31
87
8
23
Modding Universe
not all methods. this one should be called in its class
ya , not all methods, but how about a pointer with 1 paramater like int such as this :
Public void AddGold (int amount) { }
and no update in its class , so how to make a pointer to it
> using another update from another class will not work at 90 % of the time .
 

Sevol

Retired Staff
Retired but loved <3
Jun 8, 2019
219
5,921
193
Russia
ya , not all methods, but how about a pointer with 1 paramater like int such as this :
Public void AddGold (int amount) { }
and no update in its class , so how to make a pointer to it
> using another update from another class will not work at 90 % of the time .
ohh i know but u must understand by yourself
 

Lop_A1254

Platinian
Oct 12, 2020
9
1
3
Belgium
ya , not all methods, but how about a pointer with 1 paramater like int such as this :
Public void AddGold (int amount) { }
and no update in its class , so how to make a pointer to it
> using another update from another class will not work at 90 % of the time .


u dont need update for this u can just hook the parameter inside the function with simple code.
 
Status
Not open for further replies.