fix(CNetGamePlayer & rlGamerInfo): Split classes and fixed small regression. (#31)

This commit is contained in:
Reece Watson 2022-08-28 04:40:56 -04:00 committed by GitHub
parent 099204f8a6
commit 36434d7c7f
10 changed files with 142 additions and 56 deletions

View File

@ -3,7 +3,9 @@
#include "../player/CPlayerInfo.hpp" #include "../player/CPlayerInfo.hpp"
#include "../player/CNonPhysicalPlayerData.hpp" #include "../player/CNonPhysicalPlayerData.hpp"
#include "ClandData.hpp" #include "../rage/rlSessionInfo.hpp"
#include "ClanData.hpp"
#include "netPlayer.hpp" #include "netPlayer.hpp"
#include <cstdint> #include <cstdint>
@ -12,24 +14,50 @@
class CNetGamePlayer : public rage::netPlayer class CNetGamePlayer : public rage::netPlayer
{ {
public: public:
char pad_00A0[8]; //0x00A0 CPlayerInfo* m_player_info; //0x00A0
uint32_t m_matchmaking_group; //0x00A8 uint32_t m_matchmaking_group; //0x0008
CPlayerInfo* m_player_info; //0x00B0 bool m_is_spectating; //0x000C
char pad_00B0[16]; //0x00B0 char pad_00AD[3]; //0x000AD
class ClanData m_clan_data; //0x00C8 uint64_t unk_00B0; //0x00B0
char unk_00B8; //0x00B8
char pad_00B9[3]; //0x00B9
uint32_t unk_00BC; //0x00BC
uint32_t unk_00C0; //0x00C0
char pad_00C4[4]; //0x00C4
ClanData m_clan_data; //0x00C8
char m_crew_rank_title[25]; //0x0180 char m_crew_rank_title[25]; //0x0180
bool m_is_rockstar_dev; //0x0199 bool m_is_rockstar_dev; //0x0199
bool m_is_rockstar_qa; //0x019A bool m_is_rockstar_qa; //0x019A
bool m_is_cheater; //0x019B bool m_is_cheater; //0x019B
char pad_019C[14]; //0x019C uint32_t unk_019C; //0x019C
uint16_t unk_01A0; //0x01A0
char unk_01A2; //0x01A2
char pad_01A3; //0x01A3
uint32_t m_phone_explosion_vehicle_net_id; //0x01A4
uint16_t unk_01A8; //0x01A8
bool m_has_started_transition; //0x01AA bool m_has_started_transition; //0x01AA
char pad_01AB[5]; //0x01AB char pad_01AB[5]; //0x01AB
char m_transition_info_buffer[125]; //0x01B0 rage::rlSessionInfo m_transition_session_info; //0x01A3
char pad_022D[19]; //0x022D char pad_022D[16]; //0x022D
uint64_t unk_0230; //0x0230
uint64_t unk_0238; //0x0238
uint32_t m_mute_count; //0x0240 uint32_t m_mute_count; //0x0240
uint32_t m_mute_talkers_count; //0x0244 uint32_t m_mute_talkers_count; //0x0244
char pad_0248[112]; //0x0248 char pad_0248[5]; //0x0248
uint32_t unk_02B8; //0x02B8 bool m_have_communication_privileges; //0x024D
uint16_t unk_024E; //0x024E
uint16_t unk_0250; //0x0250
char pad_0252[2]; //0x0252
uint32_t m_cheat_report_ids[20]; //0x0254
uint32_t m_num_cheat_reports; //0x02A4
uint8_t unk_02A8; //0x02A8
char pad_02A9[3]; //0x02A9
uint32_t unk_02AC; //0x02AC
char unk_02B0; //0x02B0
char pad_02B1[3]; //0x02B1
uint32_t unk_02B4; //0x02B4
uint32_t m_account_id; //0x02B4
uint32_t m_unk_02BC; //0x02BC
}; //Size: 0x02C0 }; //Size: 0x02C0
static_assert(sizeof(CNetGamePlayer) == 0x2C0); static_assert(sizeof(CNetGamePlayer) == 0x2C0);
#pragma pack(pop) #pragma pack(pop)

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "netPlayerData.hpp" #include "../rage/rlGamerInfo.hpp"
#include "../player/CNonPhysicalPlayerData.hpp" #include "../player/CNonPhysicalPlayerData.hpp"
namespace rage namespace rage
@ -15,7 +15,7 @@ namespace rage
virtual const char* get_name(); virtual const char* get_name();
virtual void _0x20(); virtual void _0x20();
virtual bool is_host(); virtual bool is_host();
virtual netPlayerData* get_net_data(); virtual rage::rlGamerInfo* get_net_data();
virtual void _0x38(); virtual void _0x38();
char pad_0008[8]; //0x0008 char pad_0008[8]; //0x0008

View File

@ -1,39 +0,0 @@
#pragma once
#include <cstdint>
namespace rage
{
class netAddress
{
public:
uint8_t m_field4; //0x0000
uint8_t m_field3; //0x0001
uint8_t m_field2; //0x0002
uint8_t m_field1; //0x0003
}; //Size: 0x0004
static_assert(sizeof(netAddress) == 0x4);
class netPlayerData
{
public:
char pad_0000[8]; //0x0000
uint64_t m_rockstar_id; //0x0008
char pad_0010[52]; //0x0010
class netAddress m_relay_ip; //0x0044
uint16_t m_relay_port; //0x0048
char pad_004A[2]; //0x004A
class netAddress m_external_ip; //0x004C
uint16_t m_external_port; //0x0050
char pad_0052[2]; //0x0052
class netAddress m_internal_ip; //0x0054
uint16_t m_internal_port; //0x0058
char pad_005A[6]; //0x005A
uint64_t m_host_token; //0x0060
uint64_t m_peer_id; //0x0068
uint64_t m_rockstar_id2; //0x0070
char pad_0078[12]; //0x0078
char m_name[20]; //0x0084
}; //Size: 0x0098
static_assert(sizeof(netPlayerData) == 0x98);
}

View File

@ -15,10 +15,10 @@ namespace rage
virtual void Initialize() = 0; virtual void Initialize() = 0;
virtual void Shutdown() = 0; virtual void Shutdown() = 0;
virtual void unk_0x18() = 0; virtual void unk_0x18() = 0;
virtual CNetGamePlayer* AddPlayer_raw(void* a1, void* a2, void* a3, rage::netPlayerData* net_player_data, CNonPhysicalPlayerData* non_physical_player_data) = 0; virtual CNetGamePlayer* AddPlayer_raw(void* a1, void* a2, void* a3, rage::rlGamerInfo* gamer_info, CNonPhysicalPlayerData* non_physical_player_data) = 0;
virtual void RemovePlayer(CNetGamePlayer* net_game_player) = 0; virtual void RemovePlayer(CNetGamePlayer* net_game_player) = 0;
virtual void UpdatePlayerListsForPlayer(CNetGamePlayer* net_game_player) = 0; virtual void UpdatePlayerListsForPlayer(CNetGamePlayer* net_game_player) = 0;
virtual CNetGamePlayer* AddPlayer(void* a1, void* a2, void* a3, rage::netPlayerData* net_player_data, CNonPhysicalPlayerData* non_physical_player_data) = 0; virtual CNetGamePlayer* AddPlayer(void* a1, void* a2, void* a3, rage::rlGamerInfo* gamer_info, CNonPhysicalPlayerData* non_physical_player_data) = 0;
char pad_0008[8]; //0x0008 char pad_0008[8]; //0x0008
uint64_t *m_network_bandwidth_manager; //0x0010 uint64_t *m_network_bandwidth_manager; //0x0010

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "../network/netPlayerData.hpp" #include "../rage/rlGamerInfo.hpp"
#include <cstdint> #include <cstdint>
@ -21,7 +21,7 @@ class CPlayerInfo
{ {
public: public:
char pad_0000[32]; //0x0000 char pad_0000[32]; //0x0000
class rage::netPlayerData m_net_player_data; //0x0020 class rage::rlGamerInfo m_net_player_data; //0x0020
char pad_00B8[184]; //0x00B8 char pad_00B8[184]; //0x00B8
float m_swim_speed; //0x0170 float m_swim_speed; //0x0170
char pad_0174[20]; //0x0174 char pad_0174[20]; //0x0174

21
rage/rlGamerHandle.hpp Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include <cstdint>
namespace rage
{
#pragma pack(push,8)
class rlGamerHandle
{
public:
uint64_t m_rockstar_id;
uint64_t m_unk;
inline rlGamerHandle(uint64_t rockstar_id) :
m_rockstar_id(rockstar_id),
m_unk(3)
{
}
};
#pragma pack(pop)
}

20
rage/rlGamerInfo.hpp Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#include <cstdint>
#include "rlGamerInfoBase.hpp"
namespace rage
{
#pragma pack(push,8)
class rlGamerInfo : public rlGamerInfoBase
{
public:
uint64_t m_host_token;
uint64_t m_platform_data;
rlGamerHandle m_gamer_handle_2;
uint32_t m_ros_privilege;
char m_name[20];
}; //Size: 0x0098
static_assert(sizeof(rlGamerInfo) == 0x98);
#pragma pack(pop)
}

40
rage/rlGamerInfoBase.hpp Normal file
View File

@ -0,0 +1,40 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include "rlGamerHandle.hpp"
union netAddress {
uint32_t m_packed; //0x0000
struct {
uint8_t m_field4; //0x0000
uint8_t m_field3; //0x0001
uint8_t m_field2; //0x0002
uint8_t m_field1; //0x0003
};
}; //Size: 0x0004
static_assert(sizeof(netAddress) == 0x04);
namespace rage
{
#pragma pack(push,8)
class rlGamerInfoBase
{
public:
uint64_t m_peer_id;
rlGamerHandle m_gamer_handle;
char unk_0018[32];
uint8_t unk_0038;
netAddress m_unk_ip;
uint16_t m_unk_port;
netAddress m_relay_ip;
uint16_t m_relay_port;
netAddress m_external_ip;
uint16_t m_external_port;
netAddress m_internal_ip;
uint16_t m_internal_port;
uint32_t unk_005C;
};
static_assert(sizeof(rlGamerInfoBase) == 0x60);
#pragma pack(pop)
}

16
rage/rlSessionInfo.hpp Normal file
View File

@ -0,0 +1,16 @@
#pragma once
#include <cstdint>
#include "../rage/rlGamerInfoBase.hpp"
namespace rage
{
class rlSessionInfo
{
public:
uint64_t m_unk; //0x0000
uint64_t m_session_token; //0x0008
rlGamerInfoBase m_net_player_data; //0x0010
};
static_assert(sizeof(rlSessionInfo) == 0x70);
}