Help! How to hook a method with a parameter of PhotonMessageInfo?

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
167
29
28
UK
Hi, this is the method I'm trying to hook...

void OnRequestRespawn(PhotonPlayer, PhotonMessageInfo)

Previously it used to be like this...

void OnRequestRespawn(PhotonPlayer)

I was able to use it fine in the last update no problems, but now they've added this extra parameter and I've no clue what it does or how to use it. Thanks.
 
  • Like
Reactions: kkimkim

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
167
29
28
UK
It's a struct that contains 3 parameters...

PhotonMessageInfo(PhotonPlayer player, int timestamp, PhotonView view)
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
167
29
28
UK
hook this and save the instance pointer
How?

public PhotonMessageInfo(PhotonPlayer, player, int timestamp, PhotonView view)

How to hook it when it doesn't say what the data type is? It's not a bool or a void function so idk
 

Daleon228_09

Solid & Active Platinian
Aug 19, 2022
63
9
8
Poland
How?

public PhotonMessageInfo(PhotonPlayer, player, int timestamp, PhotonView view)

How to hook it when it doesn't say what the data type is? It's not a bool or a void function so idk
void (*OnRequestSpawn)(void *instance, void *PhotonPlayer, void *PhotonMessageInfo);

and save Photonmessageinfo as void *
 

frc7400

Platinian
Jul 11, 2023
8
0
3
Us
C++:
struct PhotonMessageInfo
{
    void *player;
    int  timestamp;
    void *view;
};
void (*OnRequestSpawn)(void *instance, void *PhotonPlayer, PhotonMessageInfo Info);
PhotonMessageInfo info = {PhotonPlayer, Num, PhotonView};
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
167
29
28
UK
C++:
struct PhotonMessageInfo
{
    void *player;
    int  timestamp;
    void *view;
};
void (*OnRequestSpawn)(void *instance, void *PhotonPlayer, PhotonMessageInfo Info);
PhotonMessageInfo info = {PhotonPlayer, Num, PhotonView};
Thanks but I'm not sure what the value of "num" needs to be for this to work, unfortunately it's crashing the game
 

libModz

Awesome Active Platinian
Original poster
Jun 2, 2022
167
29
28
UK
This is the code I have but it's just crashing the game. Idk what I'm doing wrong

C++:
void (*old_RoomMaster_Update)(void *instance);
void RoomMaster_Update(void *instance) {
    if(instance!=nullptr) {
        void *photonView = *(void **) ((uint64_t) instance + 0xC);
        if(RespawnAll) {
            if(PhotonNetwork_get_player!=nullptr && PhotonNetwork_get_PlayerList!=nullptr) {
                auto PhotonPlayers = PhotonNetwork_get_PlayerList();
                for (int i = 0; i < PhotonPlayers->getLength(); ++i) {
                    auto PhotonPlayer = PhotonPlayers->getPointer()[i];
                    if(PhotonPlayer!=nullptr) {
                        PhotonMessageInfo info = {PhotonNetwork_get_player(), 3059293, photonView};
                        RoomMaster_OnRequestRespawn(instance, PhotonPlayer, info);
                        RespawnAll=false;
                    }
                }
            }
        }
    }
    old_RoomMaster_Update(instance);
}