Help! Array hook errors

·҉ dollaz·҉. .

Approved iModder
Original poster
Approved iModder
Mar 26, 2021
159
1,819
193
Somewhere
Im trying to get the playerlist...
here's the array struct, (found in some unity.h file on github)
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;
    }
};
heres my pointer to the photon array:

C++:
monoArray<void *> *(*PhotonNetwork_get_OtherPlayers)() = (monoArray<void *> *(*)())getRealOffset(0x1018291A8);
Heres my hook code:
C++:
monoArray<void **> *photonplayers = PhotonNetwork_get_OtherPlayers();

for (int i = 0; i < photonplayers->getLength(); ++i)
{
    void *ePlayerr = photonplayers->getPointer()[i];

      //do some shit. (set positions, scale objects ect.)
}
Heres my console error:
Code:
Tweak.xm:482:21: error: cannot initialize a variable of type
      'monoArray<void **> *' with an rvalue of type 'monoArray<void *> *'
monoArray<void **> *photonplayers = PhotonNetwork_get_OtherPlayers();
                    ^               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tweak.xm:486:11: error: unused variable 'ePlayerr' [-Werror,-Wunused-variable]
    void *ePlayerr = photonplayers->getPointer()[i];
          ^
//ignore the 2nd error, thats just because I didnt use the variable in anything cuz I removed my mod code using it
I tried the method on this forum that tiuu posted but I would get this error:
Code:
Tweak.xm:486:48: error: subscript of pointer to incomplete type 'void'
    auto ePlayerr = photonplayers->getPointer()[i];
How do I get this shit working?
 
Last edited: