Help! How Hook Array?

TimeToTime

Platinian
Original poster
Jun 30, 2023
7
1
1
17
Russia
Class hero{
piblic void Update - 0x6C287C
[FieldOffset(Offset = "0x94")]
public int[] SpellTimeReload;
or
[FieldOffset(Offset = "0x1C")]
public int[] TimeReload;
}
How Hook 1 or 2 field offset?
i have this:
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;
}
};

and make this
...
void func(void* instance) {
auto Spell = (monoArray<int*>*)(instance + 0x94);

for (int i = 0; i < Spell->getLength(); i++) {
auto Spel = Spell->getPointer();
// ...
// Spel - array element int[] SpellTimeReload
*Spel = 100.f;
// or
Spel = 100.f;
}
...
} (and hook_lib libil2cpp.so offset update func old_func...._

Hoowwwwwwwwww hookkk this arrray????????