From f4c328d3c9c3e67d8dda8e36d1e2658ad35dcb0e Mon Sep 17 00:00:00 2001 From: Ryan <80224521+Rxann@users.noreply.github.com> Date: Wed, 3 Jul 2024 18:53:49 -0400 Subject: [PATCH] Enhancements (#18) * better scriptHandlerNetComponent * new func for CNetObjectMgr --- network/CNetObjectMgr.hpp | 1 + script/scriptHandlerNetComponent.hpp | 106 ++++++++++++++++++--------- 2 files changed, 72 insertions(+), 35 deletions(-) diff --git a/network/CNetObjectMgr.hpp b/network/CNetObjectMgr.hpp index 29744a7..1833ad0 100644 --- a/network/CNetObjectMgr.hpp +++ b/network/CNetObjectMgr.hpp @@ -24,6 +24,7 @@ public: virtual void _0x58() = 0; virtual void _0x60() = 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 bool PackCloneRemove(rage::netObject *object, CNetGamePlayer *player, bool) = 0; virtual void PackCloneSync(rage::netObject *object, CNetGamePlayer *player) = 0; diff --git a/script/scriptHandlerNetComponent.hpp b/script/scriptHandlerNetComponent.hpp index 0453865..55e81f7 100644 --- a/script/scriptHandlerNetComponent.hpp +++ b/script/scriptHandlerNetComponent.hpp @@ -2,48 +2,84 @@ class CNetGamePlayer; -class CScriptParticipant +class CScriptParticipant { public: - char pad_0000[16]; //0x0000 - class CNetGamePlayer* m_net_game_player;//0x0010 - char pad_0018[2]; //0x0018 - int16_t m_participant_index; //0x001A - char pad_001C[12]; //0x001C -}; + char pad_0000[16]; // 0x0000 + class CNetGamePlayer *m_net_game_player; // 0x0010 + char pad_0018[2]; // 0x0018 + int16_t m_participant_index; // 0x001A + char pad_001C[12]; // 0x001C +}; static_assert(sizeof(CScriptParticipant) == 0x28); #pragma pack(push, 8) -namespace rage +namespace rage { - class scriptHandler; - class scriptHandlerNetComponent - { - public: - virtual ~scriptHandlerNetComponent() = default; - virtual bool _0x08(void*) = 0; - virtual void _0x10(CNetGamePlayer*) = 0; - virtual void* HandlePlayerLeft(CNetGamePlayer* player) = 0; - virtual void* SendHostMigrationEvent(CNetGamePlayer* player) = 0; +class scriptHandler; +class scriptHandlerNetComponent +{ +public: + virtual ~scriptHandlerNetComponent() = default; + virtual bool _0x08(void *) = 0; + virtual void _0x10(CNetGamePlayer *) = 0; + virtual void *HandlePlayerLeft(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: - scriptHandler* m_ScriptHandler; // 0x08 - char m_Pad[0x20]; // 0x10 - CScriptParticipant *m_Host; // 0x30 - std::uint8_t m_LocalParticipantId; // 0x38 - void* m_Pad2[4]; // 0x40 - CScriptParticipant* m_Participants[32]; // 0x60 - int m_Pad3[3]; // 0x160 - std::uint8_t m_NumParticipants; // 0x168 +public: + scriptHandler *m_ScriptHandler; // 0x08 + char m_Pad[0x20]; // 0x10 + CScriptParticipant *m_Host; // 0x30 + std::uint8_t m_LocalParticipantId; // 0x38 + void *m_Pad2[4]; // 0x40 + CScriptParticipant *m_Participants[32]; // 0x60 + int m_Pad3[3]; // 0x160 + std::uint8_t m_NumParticipants; // 0x168 - inline CNetGamePlayer* GetHost() - { - if(!m_Host) - return nullptr; - - return m_Host->m_net_game_player; - } - }; - static_assert(sizeof(rage::scriptHandlerNetComponent) == 0x170); + inline CNetGamePlayer *GetHost() const + { + if (!m_Host) + return nullptr; + + return m_Host->m_net_game_player; + } +}; +static_assert(sizeof(rage::scriptHandlerNetComponent) == 0x170); } #pragma pack(pop) \ No newline at end of file