Okay, so apparently I've been asked many times on how to modify arrays, not gonna get deep into this, but here we go.
First of all, you need a monoArray struct, which I will provide.
Let's say you wanted to modify a Player List in a photon game, like getting other players?
When you use this Array, you need to make a hook for this.
To access players as an example, you can use this code to get a vector to the players.
If whatever type the method is, change it if it's a void, int, bool, float, whatever it is.
Credits: Toshiro and Slice Cast
First of all, you need a monoArray struct, which I will provide.
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;
}
};
Let's say you wanted to modify a Player List in a photon game, like getting other players?
When you use this Array, you need to make a hook for this.
C++:
monoArray<void *> *(*PhotonNetwork_get_OtherPlayers)() = (monoArray<void *> *(*)())il2cppAddress + 0x84EB8C;
C++:
auto photonplayers = PhotonNetwork_getOtherPlayers();
for (int i = 0; i < photonplayers->getLength(); ++i)
{
auto photonplayer = photonplayers->getPointer()[i];
}
Credits: Toshiro and Slice Cast