From 2692d9aa0e1735a8ea5c131f10a02c2483a6da55 Mon Sep 17 00:00:00 2001 From: Reece Watson <45642596+SkiddyToast@users.noreply.github.com> Date: Sun, 30 Oct 2022 13:26:20 -0400 Subject: [PATCH] feat/fix(Random): Update and add a bunch of classes (#51) --- base/CBaseModelInfo.hpp | 37 ++++-------- base/fwArchetype.hpp | 36 ++++++++++++ base/fwArchetypeDef.hpp | 43 ++++++++++++++ datanodes/ped/CPedAIDataNode.hpp | 12 ++++ datanodes/ped/CPedGameStateDataNode.hpp | 78 +++++++++++++++++++++++++ datanodes/ped/CPedHealthDataNode.hpp | 29 +++++++++ misc/CTunables.hpp | 17 +++++- network/CNetGamePlayerDataMsg.hpp | 38 ++++++++++++ network/netPlayerMgrBase.hpp | 5 +- player/CNonPhysicalPlayerData.hpp | 6 +- rage/rlGamerHandle.hpp | 11 ++-- rage/rlGamerInfoBase.hpp | 26 ++++----- 12 files changed, 287 insertions(+), 51 deletions(-) create mode 100644 base/fwArchetype.hpp create mode 100644 base/fwArchetypeDef.hpp create mode 100644 datanodes/ped/CPedAIDataNode.hpp create mode 100644 datanodes/ped/CPedGameStateDataNode.hpp create mode 100644 datanodes/ped/CPedHealthDataNode.hpp create mode 100644 network/CNetGamePlayerDataMsg.hpp diff --git a/base/CBaseModelInfo.hpp b/base/CBaseModelInfo.hpp index 56faad1..f5acebd 100644 --- a/base/CBaseModelInfo.hpp +++ b/base/CBaseModelInfo.hpp @@ -1,8 +1,7 @@ #pragma once -#include "../rage/vector.hpp" - #include +#include "fwArchetype.hpp" enum class eModelType : std::uint8_t { @@ -28,32 +27,18 @@ enum class eModelType : std::uint8_t }; #pragma pack(push, 8) -class CBaseModelInfo +class CBaseModelInfo : public rage::fwArchetype { public: - char pad_0000[24]; //0x0000 - uint32_t m_model_hash; //0x0018 - char pad_001C[20]; //0x001C - rage::fvector4 m_axis_aligned_bounding_box_min; //0x0030 - rage::fvector4 m_axis_aligned_bounding_box_max; //0x0040 - uint32_t m_flags; - char pad_0054[4]; - uint16_t unk_0x58; - char pad_005A[6]; - uint8_t m_drawable_type; - char pad_0061; - uint16_t m_drawable_index; - char pad_0064[6]; - uint16_t unk_0x6A; - char pad_006C[12]; - uint64_t unk_0x78; - uint64_t unk_0x80; - char pad_0088[8]; - uint64_t unk_0x90; - char pad_0098[5]; - eModelType m_model_type; - char pad_009E[6]; - uint64_t unk_0xA8; + char pad_0070[8]; //0x0070 + uint64_t unk_0078; //0x0078 + uint64_t unk_0080; //0x0080 + char pad_0088[8]; //0x0088 + uint64_t unk_0090; //0x0090 + char pad_0098[5]; //0x0098 + eModelType m_model_type; //0x009D + char pad_009E[6]; //0x009E + uint64_t unk_00A8; //0x00A8 }; //Size: 0x00B0 static_assert(sizeof(CBaseModelInfo) == 0xB0); #pragma pack(pop) diff --git a/base/fwArchetype.hpp b/base/fwArchetype.hpp new file mode 100644 index 0000000..33b1fc2 --- /dev/null +++ b/base/fwArchetype.hpp @@ -0,0 +1,36 @@ +#pragma once + +#include +#include "../rage/vector.hpp" +#include "datBase.hpp" +#include "fwArchetypeDef.hpp" + +namespace rage { + #pragma pack(push,8) + class fwArchetype : public datBase + { + public: + virtual void Initialize() = 0; + virtual void InitializeFromArchetypeDef(uint32_t mapTypeStoreIdx, fwArchetypeDef* archetypeDef, bool) = 0; + virtual class fwEntity* CreateEntity() = 0; + + char pad_0008[16]; //0x0008 + int32_t m_hash; //0x0018 + char unk_001C[4]; //0x001C + fvector3 m_bounding_sphere_center; //0x0020 + float m_bounding_sphere_radius; //0x002C + fvector3 m_aabbMin; //0x0030 + float m_lod_dist; //0x003C + fvector3 m_aabbMax; //0x0040 + float m_hd_texture_dist; //0x004C + uint32_t m_flags; //0x0050 + char unk_0054[4]; //0x0054 + uint64_t unk_0058; //0x0058 + char unk_0060[4]; //0x0060 + uint32_t m_asset_index; //0x0064 + uint16_t unk_0068; //0x0068 + uint16_t unk_006A; //0x006A + }; + static_assert(sizeof(fwArchetype) == 0x70); + #pragma pack(pop) +} \ No newline at end of file diff --git a/base/fwArchetypeDef.hpp b/base/fwArchetypeDef.hpp new file mode 100644 index 0000000..ee5d052 --- /dev/null +++ b/base/fwArchetypeDef.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include +#include "../rage/vector.hpp" + +namespace rage { +#pragma pack(push,8) + class fwArchetypeDef + { + public: + virtual ~fwArchetypeDef() = 0; + virtual int GetTypeIdentifier() = 0; + + float m_lod_dist; //0x0008 + uint32_t m_flags; //0x000C + uint32_t m_special_attribute; //0x0010 + char pad_0014[12]; //0x0014 + fvector4 m_bounding_box_min; //0x0020 + fvector4 m_bounding_box_max; //0x0030 + fvector4 m_bounding_sphere_center; //0x0040 + float m_bounding_sphere_radius; //0x0050 + float m_hd_texture_dist; //0x0054 + uint32_t m_name_hash; //0x0058 + uint32_t m_texture_dictionary; //0x005C + uint32_t m_clip_dictionary_hash; //0x0060 + uint32_t m_drawable_dictionary_hash; //0x0064 + uint32_t m_physics_dictionary_hash; //0x0068 + enum eAssetType : uint32_t + { + ASSET_TYPE_UNINITIALIZED = 0, + ASSET_TYPE_FRAGMENT = 1, + ASSET_TYPE_DRAWABLE = 2, + ASSET_TYPE_DRAWABLEDICTIONARY = 3, + ASSET_TYPE_ASSETLESS = 4, + } m_asset_type; //0x006C + uint32_t m_asset_name_hash; //0x0070 + uint64_t *m_extensions; //0x0078 + uint16_t unk_0080; //0x0080 + char pad_0082[12]; //0x0082 + }; //Size: 0x0090 + static_assert(sizeof(fwArchetypeDef) == 0x90); +#pragma pack(pop) +} diff --git a/datanodes/ped/CPedAIDataNode.hpp b/datanodes/ped/CPedAIDataNode.hpp new file mode 100644 index 0000000..2caa8e0 --- /dev/null +++ b/datanodes/ped/CPedAIDataNode.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include + +class CPedAIDataNode +{ +public: + char pad_0000[192]; //0x0000 + uint32_t m_relationship_group; //0x00C0 + uint32_t m_decision_maker_type; //0x00C4 +}; //Size: 0x00C8 +static_assert(sizeof(CPedAIDataNode) == 0xC8); diff --git a/datanodes/ped/CPedGameStateDataNode.hpp b/datanodes/ped/CPedGameStateDataNode.hpp new file mode 100644 index 0000000..6d2015e --- /dev/null +++ b/datanodes/ped/CPedGameStateDataNode.hpp @@ -0,0 +1,78 @@ +#pragma once + +#include + +#pragma pack(push,2) +class CPedGameStateDataNode +{ +public: + char pad_0000[192]; //0x0000 + bool m_weapon_component_something[11]; //0x0C0 + uint32_t m_weapon_component_hash[11]; //0x0CC + uint32_t m_gadget_hash[3]; //0x0F8 + uint32_t unk_0104; // 0x0104 + uint32_t unk_0108; // 0x0108 + uint32_t unk_010C; // 0x010C + float unk_0110; // 0x0110 + float unk_0114; // 0x0114 + float unk_0118; // 0x0118 + bool unk_011C; // 0x011C + char pad_011D[3]; //0x011D + uint32_t m_arrest_state; //0x0120 + uint32_t m_death_state; //0x0124 + uint32_t m_weapon_hash; //0x0128 + uint32_t m_num_weapon_components; //0x012C + uint32_t m_num_equiped_gadgets; //0x0130 + uint32_t m_seat; //0x0134 + uint32_t m_action_mode_override; //0x0138 + uint32_t unk_013C; // 0x013C + uint16_t m_vehicle; //0x0140 + uint16_t m_mount_id; //0x0142 + uint16_t m_custodian_id; //0x0144 + uint16_t unk_0146; // 0x0146 + bool m_tint_index; //0x0148 + char pad_0149; //0x0149 + uint8_t unk_014A; // 0x014A + bool m_is_handcuffed; //0x014B + bool m_can_preform_arrest; //0x014C + bool m_can_preform_uncuff; //0x014D + bool m_can_be_arrested; //0x014E + bool m_is_in_custody; //0x014F + char pad_0150; //0x0150 + bool m_weapon_exists; //0x0151 + bool m_weapon_visible; //0x0152 + bool m_weapon_has_ammo; //0x0153 + bool m_weapon_attach_left; //0x0154 + char pad_0155; //0x0155 + bool m_in_seat; //0x0156 + bool m_in_vehicle; //0x0157 + bool m_on_mount; //0x0158 + bool m_has_custodian_or_arrest_flags; //0x0159 + char pad_015A; //0x015A + bool m_action_mode_enabled; //0x015B + bool m_stealth_mode_enabled; //0x015C + bool unk_015D; // 0x015D + bool unk_015E; // 0x015E + bool unk_015F; // 0x015F + bool unk_0160; // 0x0160 + bool unk_0161; // 0x0161 + bool unk_0162; // 0x0162 + bool unk_0163; // 0x0163 + bool unk_0164; // 0x0164 + bool unk_0165; // 0x0165 + bool unk_0166; // 0x0166 + bool unk_0167; // 0x0167 + bool unk_0168; // 0x0168 + bool unk_0169; // 0x0169 + bool unk_016A; // 0x016A + bool unk_016B; // 0x016B + bool unk_016C; // 0x016C + bool unk_016D; // 0x016D + bool unk_016E; // 0x016E + bool unk_016F; // 0x016F + bool unk_0170; // 0x0170 + bool unk_0171; // 0x0171 + bool unk_0172; // 0x0172 +}; //Size: 0x0174 +static_assert(sizeof(CPedGameStateDataNode) == 0x174); +#pragma pack(pop) \ No newline at end of file diff --git a/datanodes/ped/CPedHealthDataNode.hpp b/datanodes/ped/CPedHealthDataNode.hpp new file mode 100644 index 0000000..41d16a0 --- /dev/null +++ b/datanodes/ped/CPedHealthDataNode.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include + +#pragma pack(push,2) +class CPedHealthDataNode +{ +public: + char pad_0000[192]; //0x0000 + uint32_t unk_00C0; //0x00C0 + uint32_t m_health; //0x00C4 + uint32_t m_armor; //0x00C8 + uint32_t unk_00CC; //0x00CC + uint32_t unk_00D0; //0x00D0 + uint32_t m_weapon_damage_hash; //0x00D4 + uint32_t m_hurt_end_time; //0x00D8 + uint32_t m_weapon_damage_component; //0x00DC + uint16_t m_weapon_damage_entity; //0x00E0 + bool m_has_max_health; //0x00E2 + bool m_has_default_armor; //0x00E3 + bool unk_00E4; //0x00E4 + bool m_killed_with_headshot; //0x00E5 + bool m_killed_with_melee; //0x00E6 + char m_hurt_started; //0x00E7 + bool unk_00E8; //0x00E8 + bool unk_00E9; //0x00E9 +}; //Size: 0x0EA +static_assert(sizeof(CPedHealthDataNode) == 0xEA); +#pragma pack(pop) \ No newline at end of file diff --git a/misc/CTunables.hpp b/misc/CTunables.hpp index 82c4e5a..c3c60de 100644 --- a/misc/CTunables.hpp +++ b/misc/CTunables.hpp @@ -1,11 +1,22 @@ #pragma once #include +#include "../base/datBase.hpp" -class CTunables +enum eTunableType +{ + TunableType_DONTCARE = -1, + TunableType_UNK0, + TunableType_4BYTE, + TunableType_1BYTE, +}; + +class CTunables : public rage::datBase { public: - char pad_0000[112]; //0x0000 + char pad_0000[104]; //0x0008 uint64_t m_bPtr; //0x0070 uint16_t m_bCount; //0x0078 -}; //Size: 0x007A + char pad_007A[0x4E]; //0x007A +}; //Size: 0x00C8 +static_assert(sizeof(CTunables) == 0xC8); diff --git a/network/CNetGamePlayerDataMsg.hpp b/network/CNetGamePlayerDataMsg.hpp new file mode 100644 index 0000000..18179ed --- /dev/null +++ b/network/CNetGamePlayerDataMsg.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include + +class datBitBuffer; + +#pragma pack(push,8) +namespace rage { + class playerDataMsg + { + public: + virtual ~playerDataMsg() = 0; + virtual int GetBufferSize() = 0; + virtual void Log() = 0; + virtual bool Serialize(datBitBuffer* buffer) = 0; + virtual bool Deserialize(datBitBuffer* buffer) = 0; + + uint32_t m_game_version; //0x0008 + uint32_t m_nat_type; //0x000C + }; //Size: 0x0010 + static_assert(sizeof(playerDataMsg) == 0x10); +} + +class CNetGamePlayerDataMsg : public rage::playerDataMsg +{ +public: + uint32_t m_player_type; //0x0010 + uint32_t m_matchmaking_group; //0x0014 + uint32_t m_flags; //0x0018 + uint32_t m_team; //0x001C + uint64_t m_crew_id; //0x0020 + uint32_t m_aim_preference; //0x0028 + uint16_t m_rank; //0x002C + uint16_t unk_002E; //0x002E + uint16_t unk_0030; //0x0030 +}; //Size: 0x0038 +static_assert(sizeof(CNetGamePlayerDataMsg) == 0x38); +#pragma pack(pop) \ No newline at end of file diff --git a/network/netPlayerMgrBase.hpp b/network/netPlayerMgrBase.hpp index 8362ab3..ede960c 100644 --- a/network/netPlayerMgrBase.hpp +++ b/network/netPlayerMgrBase.hpp @@ -1,6 +1,7 @@ #pragma once #include "CNetGamePlayer.hpp" +#include "CNetGamePlayerDataMsg.hpp" #include "../player/CNonPhysicalPlayerData.hpp" #include @@ -15,10 +16,10 @@ namespace rage virtual void Initialize() = 0; virtual void Shutdown() = 0; virtual void unk_0x18() = 0; - virtual CNetGamePlayer* AddPlayer_raw(void* a1, void* a2, void* a3, rage::rlGamerInfo* gamer_info, CNonPhysicalPlayerData* non_physical_player_data) = 0; + virtual CNetGamePlayer* AddPlayer_raw(rage::rlGamerInfo* gamer_info, uint32_t a2, CNetGamePlayerDataMsg* player_data, CNonPhysicalPlayerData* non_physical_player_data) = 0; virtual void RemovePlayer(CNetGamePlayer* net_game_player) = 0; virtual void UpdatePlayerListsForPlayer(CNetGamePlayer* net_game_player) = 0; - virtual CNetGamePlayer* AddPlayer(void* a1, void* a2, void* a3, rage::rlGamerInfo* gamer_info, CNonPhysicalPlayerData* non_physical_player_data) = 0; + virtual CNetGamePlayer* AddPlayer(rage::rlGamerInfo* gamer_info, uint32_t a3, CNetGamePlayerDataMsg* player_data, CNonPhysicalPlayerData* non_physical_player_data) = 0; char pad_0008[8]; //0x0008 uint64_t *m_network_bandwidth_manager; //0x0010 diff --git a/player/CNonPhysicalPlayerData.hpp b/player/CNonPhysicalPlayerData.hpp index 617f36d..245a71c 100644 --- a/player/CNonPhysicalPlayerData.hpp +++ b/player/CNonPhysicalPlayerData.hpp @@ -10,9 +10,9 @@ namespace rage { public: virtual ~nonPhysicalPlayerDataBase(); - virtual void _0x08(); - virtual void _0x10(); - virtual void _0x18(); + virtual void read(); + virtual void write(); + virtual void calculate_size(); virtual void log(); }; //Size: 0x0008 static_assert(sizeof(nonPhysicalPlayerDataBase) == 0x8); diff --git a/rage/rlGamerHandle.hpp b/rage/rlGamerHandle.hpp index 53bf817..3feebdd 100644 --- a/rage/rlGamerHandle.hpp +++ b/rage/rlGamerHandle.hpp @@ -8,16 +8,19 @@ namespace rage class rlGamerHandle { public: - uint64_t m_rockstar_id; - uint64_t m_unk; + uint64_t m_rockstar_id; //0x0000 + uint8_t m_platform; //0x0008 + uint8_t unk_0009; //0x0009 inline rlGamerHandle() = default; inline rlGamerHandle(uint64_t rockstar_id) : m_rockstar_id(rockstar_id), - m_unk(3) + m_platform(3), + unk_0009(0) { } - }; + }; //Size: 0x0010 + static_assert(sizeof(rlGamerHandle) == 0x10); #pragma pack(pop) } \ No newline at end of file diff --git a/rage/rlGamerInfoBase.hpp b/rage/rlGamerInfoBase.hpp index 974d637..0dc3397 100644 --- a/rage/rlGamerInfoBase.hpp +++ b/rage/rlGamerInfoBase.hpp @@ -21,19 +21,19 @@ namespace rage class rlGamerInfoBase { public: - uint64_t m_peer_id; - rlGamerHandle m_gamer_handle; - char m_aes_key[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; + uint64_t m_peer_id; //0x0000 + rlGamerHandle m_gamer_handle; //0x008 + char m_aes_key[32]; //0x0018 + uint8_t unk_0038; //0x0038 + netAddress m_unk_ip; //0x003C + uint16_t m_unk_port; //0x0040 + netAddress m_relay_ip; //0x0044 + uint16_t m_relay_port; //0x0048 + netAddress m_external_ip; //0x004C + uint16_t m_external_port; //0x0050 + netAddress m_internal_ip; //0x0054 + uint16_t m_internal_port; //0x0058 + uint32_t unk_005C; //0x005C }; static_assert(sizeof(rlGamerInfoBase) == 0x60); #pragma pack(pop)