Help! Help

Viktorovich31

Platinian
Original poster
Sep 16, 2022
38
0
6
42
Russian
Tell me please! Through the game guardian, I found out that this value is responsible for the number of coins "int _coinCount; // 0x3C"
There is no update method in this class, tried all methods in this class. Can you tell me how to find the correct update method?
Screenshot_20221125-031048_MT Manager.jpg
 

Attachments

Last edited:

Zen0ns

Solid & Active Platinian
Sep 10, 2019
70
1,828
183
Indonesia
you can hook the getter method

// RVA: 0x1B82438 Offset: 0x1B82438 VA: 0x1B82438
public int get_coinCount() { }
 

Viktorovich31

Platinian
Original poster
Sep 16, 2022
38
0
6
42
Russian
you can hook the getter method

// RVA: 0x1B82438 Offset: 0x1B82438 VA: 0x1B82438
public int get_coinCount() { }
Thank you. I did not manage to break through this method. Got through the method
"public void set_coinCount(int value) { }"
This class has the required fields, they are only in this class. I want to break through the update, but I don’t know how to find the update method!
Tell me please.
 

Attachments

Zen0ns

Solid & Active Platinian
Sep 10, 2019
70
1,828
183
Indonesia
try this :
C++:
bool UnlimitedCoin;


void (*set_coinCount)(void *instance, int value);
//the void *instance is a self-created variable.
int (*old_get_coinCount)(void *instance);
int get_coinCount(void *instance) {
    //Check if instance is NULL to prevent CRASH
    if (instance != NULL && UnlimitedCoin)
    {
        set_coinCount(instance, 999999); //Function Pointer mod
    }
    return old_get_coinCount(instance);
}
call the function pointer just like calling your MSHooks to make your mods work.
C++:
MSHookFunction((void*)getAbsoluteAddress("libil2cpp.so", 0x1B82438), (void*)get_coinCount, (void **)&old_get_coinCount);
set_coinCount = (void(*)(void *, int))getAbsoluteAddress("libil2cpp.so", 0x1B82440);
C++:
case 1:
    UnlimitedCoin = boolean;
    break;
 

Viktorovich31

Platinian
Original poster
Sep 16, 2022
38
0
6
42
Russian
try this :
C++:
bool UnlimitedCoin;


void (*set_coinCount)(void *instance, int value);
//the void *instance is a self-created variable.
int (*old_get_coinCount)(void *instance);
int get_coinCount(void *instance) {
    //Check if instance is NULL to prevent CRASH
    if (instance != NULL && UnlimitedCoin)
    {
        set_coinCount(instance, 999999); //Function Pointer mod
    }
    return old_get_coinCount(instance);
}
call the function pointer just like calling your MSHooks to make your mods work.
C++:
MSHookFunction((void*)getAbsoluteAddress("libil2cpp.so", 0x1B82438), (void*)get_coinCount, (void **)&old_get_coinCount);
set_coinCount = (void(*)(void *, int))getAbsoluteAddress("libil2cpp.so", 0x1B82440);
C++:
case 1:
    UnlimitedCoin = boolean;
    break;
Thanks a lot! Please tell me, how can I hook these fields correctly? This class does not have an update method.
 

Attachments

HekaHeka709

Solid & Active Platinian
Dec 29, 2021
57
9
8
20
Phillipines
Thanks a lot! Please tell me, how can I hook these fields correctly? This class does not have an update method.
Don't hook the fields if hooking getter function works.
getter function returns value from fields. setter function set value to a field.
To understand more clear

public int get_coin() {
return this.<_coinCount>k__BackingField;
}

public void set_coin(int value) {
this.<_coinCount>k__BackingField = value;

}
 

Viktorovich31

Platinian
Original poster
Sep 16, 2022
38
0
6
42
Russian
Don't hook the fields if hooking getter function works.
getter function returns value from fields. setter function set value to a field.
To understand more clear

public int get_coin() {
return this.<_coinCount>k__BackingField;
}

public void set_coin(int value) {
this.<_coinCount>k__BackingField = value;

}
Thank you!