Help! How To Hook Field List Offset

imls01245

Platinian
C#:
public int[] statUpgradeCost; // 0x90

I was searching a Hook using MonoArray in Field But I can't find one, please help me!

Here is The Struct I found in Numark Tutorial but i dont know how to use it


C++:
template <typename T>
struct monoArray
{
    void* klass;
    void* monitor;
    void* bounds;
    int   max_length;
    void* vector [1];
    int getLength()
    {
        return max_length;
    }
    T getPointer()
    {
        return (T)vector;
    }
};
 
You get that array like this:
C++:
monoArray<int> *statUpgradeCost = *(monoArray<int>**)((uint64_t)your_instance+ 0x90);
Depending on what type of array it is, you'll put the type inside the <> brakets. Here it's int, can also be <float>, or <void**> if it's an array of class objects.
 
Sorry i'm new to this type of hook but it says error: in statCost = 0; subscripted value is not array , pointer or vector

Reference: How to hook Array?


C++:
monoArray<int> *statUpgradeCost = *(monoArray<int>**)((uint64_t) instance + 0x90);
            
for (int i = 0; i < statUpgradeCost->getLength(); i++) {
   auto statCost = statUpgradeCost->getPointer();
   statCost[i] = 0;
}
 
Sorry i'm new to this type of hook but it says error: in statCost = 0; subscripted value is not array , pointer or vector

Reference: How to hook Array?


C++:
monoArray<int> *statUpgradeCost = *(monoArray<int>**)((uint64_t) instance + 0x90);
           
for (int i = 0; i < statUpgradeCost->getLength(); i++) {
   auto statCost = statUpgradeCost->getPointer();
   statCost[i] = 0;
}
Just cast it to int and now you're good to go:
C++:
 auto statCost = (int*) statUpgradeCost->getPointer();
 
Can you show what "Boards" is exactly? From dump or dll
It is a struct

C#:
public struct Boards // TypeDefIndex: 4262
{
 // Fields
 public string description; // 0x0
 public string boardTex; // 0x4
 public int coinCost; // 0x8
 public int sodaCost; // 0xC
 public bool isAvailableToPlayers; // 0x10
 public PerkType perkType; // 0x14
 public float perkAmount; // 0x18
}
 
Back
Top Bottom