Enhancements (#18)

* better scriptHandlerNetComponent

* new func for CNetObjectMgr
This commit is contained in:
Ryan 2024-07-03 18:53:49 -04:00 committed by GitHub
parent 722e327633
commit f4c328d3c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 72 additions and 35 deletions

View File

@ -24,6 +24,7 @@ public:
virtual void _0x58() = 0; virtual void _0x58() = 0;
virtual void _0x60() = 0; virtual void _0x60() = 0;
virtual int _0x68() = 0; virtual int _0x68() = 0;
virtual void RegisterNetworkObject(rage::netObject *object) = 0;
virtual void PackCloneCreate(rage::netObject *object, CNetGamePlayer *player, rage::datBitBuffer *buffer) = 0; virtual void PackCloneCreate(rage::netObject *object, CNetGamePlayer *player, rage::datBitBuffer *buffer) = 0;
virtual bool PackCloneRemove(rage::netObject *object, CNetGamePlayer *player, bool) = 0; virtual bool PackCloneRemove(rage::netObject *object, CNetGamePlayer *player, bool) = 0;
virtual void PackCloneSync(rage::netObject *object, CNetGamePlayer *player) = 0; virtual void PackCloneSync(rage::netObject *object, CNetGamePlayer *player) = 0;

View File

@ -5,45 +5,81 @@ class CNetGamePlayer;
class CScriptParticipant class CScriptParticipant
{ {
public: public:
char pad_0000[16]; //0x0000 char pad_0000[16]; // 0x0000
class CNetGamePlayer* m_net_game_player;//0x0010 class CNetGamePlayer *m_net_game_player; // 0x0010
char pad_0018[2]; //0x0018 char pad_0018[2]; // 0x0018
int16_t m_participant_index; //0x001A int16_t m_participant_index; // 0x001A
char pad_001C[12]; //0x001C char pad_001C[12]; // 0x001C
}; };
static_assert(sizeof(CScriptParticipant) == 0x28); static_assert(sizeof(CScriptParticipant) == 0x28);
#pragma pack(push, 8) #pragma pack(push, 8)
namespace rage namespace rage
{ {
class scriptHandler; class scriptHandler;
class scriptHandlerNetComponent class scriptHandlerNetComponent
{ {
public: public:
virtual ~scriptHandlerNetComponent() = default; virtual ~scriptHandlerNetComponent() = default;
virtual bool _0x08(void*) = 0; virtual bool _0x08(void *) = 0;
virtual void _0x10(CNetGamePlayer*) = 0; virtual void _0x10(CNetGamePlayer *) = 0;
virtual void* HandlePlayerLeft(CNetGamePlayer* player) = 0; virtual void *HandlePlayerLeft(CNetGamePlayer *player) = 0;
virtual void* SendHostMigrationEvent(CNetGamePlayer* player) = 0; virtual void *SendHostMigrationEvent(CNetGamePlayer *player) = 0;
virtual void PlayerJoined(void **, void *msg_ctx) = 0;
virtual void PlayerJoinedAck(void **, void *msg_ctx) = 0;
virtual void PlayerJoinedHostAck(void *, void *) = 0;
virtual void *_0x40(void *, void *) = 0;
virtual void *_0x48(void *, void *, void *) = 0;
virtual void *_0x50(void *, void *) = 0;
virtual void *_0x58(void *, void *) = 0;
virtual void *_0x60(void *, void *) = 0;
virtual void *_0x68(void *, void *) = 0;
virtual void _0x70(void *, void *) = 0;
virtual void _0x78(void *, void *) = 0;
virtual short _0x80(void *, void *) = 0;
virtual void *_0x88(void *, void *) = 0;
virtual void *_0x90(void *, void *) = 0;
virtual bool _0x98(void *, void *) = 0;
virtual void *_0xA0(void *, void *) = 0;
virtual void *_0xA8(void *, void *) = 0;
virtual short _0xB0(void *, void *) = 0;
virtual short _0xB8(void *, void *) = 0;
virtual short _0xC0(void *, void *) = 0;
virtual bool RegisterHostBroadcastData(void *data, int size, char *a3) = 0;
virtual bool RegisterPlayerBroadcastData(int a1, int size, bool a3) = 0;
virtual bool CanStartJoining() = 0;
virtual bool _0xE0() = 0;
virtual bool AddPlayerToScript(CNetGamePlayer *player,
short *out_participant_id,
short *out_slot_number,
int *out_fail_reason) = 0;
virtual bool AddPlayerToScriptImpl(CNetGamePlayer *player,
short participant_id,
short slot_number) = 0;
virtual bool RemovePlayerFromScript(CNetGamePlayer *player) = 0;
virtual void *PlayerLeftImpl(CNetGamePlayer *, bool) = 0;
virtual bool DoHostMigration(CNetGamePlayer *player, short host_token,
bool unk) = 0;
virtual void *LeaveFromScript() = 0;
public: public:
scriptHandler* m_ScriptHandler; // 0x08 scriptHandler *m_ScriptHandler; // 0x08
char m_Pad[0x20]; // 0x10 char m_Pad[0x20]; // 0x10
CScriptParticipant *m_Host; // 0x30 CScriptParticipant *m_Host; // 0x30
std::uint8_t m_LocalParticipantId; // 0x38 std::uint8_t m_LocalParticipantId; // 0x38
void* m_Pad2[4]; // 0x40 void *m_Pad2[4]; // 0x40
CScriptParticipant* m_Participants[32]; // 0x60 CScriptParticipant *m_Participants[32]; // 0x60
int m_Pad3[3]; // 0x160 int m_Pad3[3]; // 0x160
std::uint8_t m_NumParticipants; // 0x168 std::uint8_t m_NumParticipants; // 0x168
inline CNetGamePlayer* GetHost() inline CNetGamePlayer *GetHost() const
{ {
if(!m_Host) if (!m_Host)
return nullptr; return nullptr;
return m_Host->m_net_game_player; return m_Host->m_net_game_player;
} }
}; };
static_assert(sizeof(rage::scriptHandlerNetComponent) == 0x170); static_assert(sizeof(rage::scriptHandlerNetComponent) == 0x170);
} }
#pragma pack(pop) #pragma pack(pop)