Help! Help with adding coins

A.Flores

Platinian
Original poster
Apr 28, 2024
12
354
48
Hi everyone. In dump.cs, I found this method:
Code:
// RVA: 0x16657f8 VA: 0x77a6ad07f8
 public Void AddCoins(Int32 amount, CoinsEarnedMethod earnedMthod, Boolean storeBackup) { }
I tried to hook it using different methods to call it, and it works; coins are added under certain conditions.

But I'm interested in whether it's possible to call such methods in the LGL menu when a switch is pressed in the running game. That is, I want the balance to be increased by, for example, 5000 coins when the button is pressed
 

A.Flores

Platinian
Original poster
Apr 28, 2024
12
354
48
How did you hook?
Something like this:
Code:
void (*AddCoins)(void *instance, int amount, int earnedMthod, bool storeBackup);
bool (*_SpendCoins)(void *instance, int amount);
bool SpendCoins(void *instance, int amount) {
    if(instance != NULL) {
    
    AddCoins(instance, 5000, 1, true);
    
    }
    return _SpendCoins(instance, amount);
}

DobbyHook((void *)getAbsoluteAddress("libil2cpp.so", 0x1668ec4), (void *) SpendCoins, (void **) &_SpendCoins);
AddCoins = (void(*)(void *, int, int, bool))getAbsoluteAddress(targetLibName, 0x16657f8);

/*dump.cs:
 // RVA: 0x16657f8 VA: 0x77a6ad07f8
 public Void AddCoins(Int32 amount, CoinsEarnedMethod earnedMthod, Boolean storeBackup) { }
 // RVA: 0x1668ec4 VA: 0x77a6ad3ec4
 public Boolean SpendCoins(Int32 amount) { }
*/