Help! How can i hook a field that has no update function?

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
My Field Doenst have an update function but i analysed it in dnspy and found related classes that have an update function, how can i hook the update function from that related class to modify the fields?

C#:
class Item //Does not have an update function
//field
Money = 0x30
//Method
//nothing intresting

   
class NetworkPlayer //this is a class related to the class :Item , and it has an update function
//field
etc = etc

//Method

//Offset = 0x114A120
private void Update()
 

·҉ dollaz·҉. .

Approved iModder
Approved iModder
Mar 26, 2021
159
1,824
193
Somewhere
Well if the class got access to that item class, it should also have access to the field too. Just hook the update normally and call the field normally too. You shouldn’t needa do anything extra
 
  • Like
Reactions: enzo funny gamer

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Well if the class got access to that item class, it should also have access to the field too. Just hook the update normally and call the field normally too. You shouldn’t needa do anything extra
Well if the class got access to that item class, it should also have access to the field too. Just hook the update normally and call the field normally too. You shouldn’t needa do anything extra
This on the rigth side is class Item i on the rigth side beneath you see that its used by NetworkPlayer
 

Attachments

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Now i went to the the suposed Item field in NetworPlayer and the field offset in NetworkPlayer is 0x58 should i still hook Class Item normally with the update function of Class NetworkPlayer?
 

Attachments

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Well if the class got access to that item class, it should also have access to the field too. Just hook the update normally and call the field normally too. You shouldn’t needa do anything extra
It cant be hooked directly since it will go to the fields in class NetworkPlayer and edit the fields only
 

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Well if the class got access to that item class, it should also have access to the field too. Just hook the update normally and call the field normally too. You shouldn’t needa do anything extra
the class NetworkPlayer has 2 fields with "Item" the first image is field one wich field offset is "0x10" the second one is = 0x58
 

Attachments

·҉ dollaz·҉. .

Approved iModder
Approved iModder
Mar 26, 2021
159
1,824
193
Somewhere
the class NetworkPlayer has 2 fields with "Item" the first image is field one wich field offset is "0x10" the second one is = 0x58
Okay so just do something like this
C++:
void (*PointerToClass)(void *instance); // the pointer of the class field

void (*old_Update)(void *instance);
void Update(void *instance)
{
    if(instance != NULL)
    {
        if(EnableCheat)
        {
            if(MyPointer != NULL)
            {
            void *OtherClass = *(void *)((uint64_t)PointerToClass + 0x10);//i think te 0x10 one would be better to use
                 if(OtherClass != NULL)
                 {
                 *(void *)((uint64_t)OtherClass + 0x224); //modify the other field here
                 }
            }
        }
    }
    old_Update(instance);
}
 

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Okay so just do something like this
C++:
void (*PointerToClass)(void *instance); // the pointer of the class field

void (*old_Update)(void *instance);
void Update(void *instance)
{
    if(instance != NULL)
    {
        if(EnableCheat)
        {
            if(MyPointer != NULL)
            {
            void *OtherClass = *(void *)((uint64_t)PointerToClass + 0x10);//i think te 0x10 one would be better to use
                 if(OtherClass != NULL)
                 {
                 *(void *)((uint64_t)OtherClass + 0x224); //modify the other field here
                 }
            }
        }
    }
    old_Update(instance);
}
ok ill try
 

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Okay so just do something like this
C++:
void (*PointerToClass)(void *instance); // the pointer of the class field

void (*old_Update)(void *instance);
void Update(void *instance)
{
    if(instance != NULL)
    {
        if(EnableCheat)
        {
            if(MyPointer != NULL)
            {
            void *OtherClass = *(void *)((uint64_t)PointerToClass + 0x10);//i think te 0x10 one would be better to use
                 if(OtherClass != NULL)
                 {
                 *(void *)((uint64_t)OtherClass + 0x224); //modify the other field here
                 }
            }
        }
    }
    old_Update(instance);
}
my hook should be like
A64hookfunction((void*)getAbsoluteAddress(UpdateOffset), (void*)Update, (void**)&old_Update);
 

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Okay so just do something like this
C++:
void (*PointerToClass)(void *instance); // the pointer of the class field

void (*old_Update)(void *instance);
void Update(void *instance)
{
    if(instance != NULL)
    {
        if(EnableCheat)
        {
            if(MyPointer != NULL)
            {
            void *OtherClass = *(void *)((uint64_t)PointerToClass + 0x10);//i think te 0x10 one would be better to use
                 if(OtherClass != NULL)
                 {
                 *(void *)((uint64_t)OtherClass + 0x224); //modify the other field here
                 }
            }
        }
    }
    old_Update(instance);
}
MyPointer gives an eror
 

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
Okay so just do something like this
C++:
void (*PointerToClass)(void *instance); // the pointer of the class field

void (*old_Update)(void *instance);
void Update(void *instance)
{
    if(instance != NULL)
    {
        if(EnableCheat)
        {
            if(MyPointer != NULL)
            {
            void *OtherClass = *(void *)((uint64_t)PointerToClass + 0x10);//i think te 0x10 one would be better to use
                 if(OtherClass != NULL)
                 {
                 *(void *)((uint64_t)OtherClass + 0x224); //modify the other field here
                 }
            }
        }
    }
    old_Update(instance);
}
All this code gives an eror
 

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
dont worry
Okay so just do something like this
C++:
void (*PointerToClass)(void *instance); // the pointer of the class field

void (*old_Update)(void *instance);
void Update(void *instance)
{
    if(instance != NULL)
    {
        if(EnableCheat)
        {
            if(MyPointer != NULL)
            {
            void *OtherClass = *(void *)((uint64_t)PointerToClass + 0x10);//i think te 0x10 one would be better to use
                 if(OtherClass != NULL)
                 {
                 *(void *)((uint64_t)OtherClass + 0x224); //modify the other field here
                 }
            }
        }
    }
    old_Update(instance);
}
dont worry i found a code similar to urs
 

enzo funny gamer

Platinian
Original poster
Apr 28, 2021
12
0
1
16
Suriname
C++:
void (*old_update)(void* _this);
void update(void* _this) {
if(_this != NULL) {
void *MoneyClass = *(void**)((uint64_t)_this + 0x20);
{
if(Coin != NULL) {
*(int *) ((uint64_t) MoneyClass + 0x10) = 999;
}
}
}
        old_update(_this);
}
 

BlackKitten22

Rookie
Jun 20, 2023
2
0
1
22
Philippines
i need help how can i hook i field offsets using update in another class, reason there is no update in the class of the field offset

1687245146896.png
1687245170148.png
1687245248150.png


can you help me how to hook field.