From 7052c5e91b85a2fa668afc50269be86557ada84c Mon Sep 17 00:00:00 2001 From: Reece Watson <45642596+SkiddyToast@users.noreply.github.com> Date: Sat, 20 Aug 2022 13:17:32 -0400 Subject: [PATCH] feat(Classes): Updated CBaseModelInfo, CPlayerGameStateDataNode and fwEntity (#24) * Fixed eModelType enum value names * CBaseModelInfo: Changed min/max dimension types from fvector3 to fvector4 * CBaseModelInfo: Adjusted to actual size * Added datBase, fwRefAwareBase, fwRefAwareBaseImpl, fwExtensibleBase, fwExtension, fwExtensionContainer and pgBase classes * CPlayerGameStateDataNode: Updated fields and resized to actual size * CVehicleModelInfo: Resized because of modified CBaseModelInfo --- base/CBaseModelInfo.hpp | 42 ++++++++++++------- base/datBase.hpp | 13 ++++++ base/fwExtensibleBase.hpp | 29 +++++++++++++ base/fwExtension.hpp | 18 ++++++++ base/fwExtensionContainer.hpp | 16 +++++++ base/fwRefAwareBase.hpp | 14 +++++++ base/fwRefAwareBaseImpl.hpp | 13 ++++++ base/pgBase.hpp | 15 +++++++ datanodes/player/CPlayerGameStateDataNode.hpp | 36 ++++++++-------- rage/fwEntity.hpp | 6 +-- vehicle/CVehicleModelInfo.hpp | 2 +- 11 files changed, 168 insertions(+), 36 deletions(-) create mode 100644 base/datBase.hpp create mode 100644 base/fwExtensibleBase.hpp create mode 100644 base/fwExtension.hpp create mode 100644 base/fwExtensionContainer.hpp create mode 100644 base/fwRefAwareBase.hpp create mode 100644 base/fwRefAwareBaseImpl.hpp create mode 100644 base/pgBase.hpp diff --git a/base/CBaseModelInfo.hpp b/base/CBaseModelInfo.hpp index 0a3334e..5b9bcda 100644 --- a/base/CBaseModelInfo.hpp +++ b/base/CBaseModelInfo.hpp @@ -8,8 +8,8 @@ enum class eModelType : std::uint8_t { Invalid, Object, - Interior, - Window, + MLO, + Time, Weapon, Vehicle, Ped, @@ -27,19 +27,33 @@ enum class eModelType : std::uint8_t Unk193 = 193 }; -#pragma pack(push, 1) +#pragma pack(push, 8) class CBaseModelInfo { public: - char pad_0000[24]; //0x0000 - uint32_t m_model_hash; //0x0018 - char pad_001C[20]; //0x001C - rage::fvector3 m_min_dimensions; //0x0030 - char pad_003C[4]; //0x003C - rage::fvector3 m_max_dimensions; //0x0040 - char pad_004C[81]; //0x004C - eModelType m_model_type; //0x009D - char pad_009E[6]; //0x009E -}; //Size: 0x00A4 -static_assert(sizeof(CBaseModelInfo) == 0xA4); + 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; +}; //Size: 0x00B0 +static_assert(sizeof(CBaseModelInfo) == 0xB0); #pragma pack(pop) diff --git a/base/datBase.hpp b/base/datBase.hpp new file mode 100644 index 0000000..d79d690 --- /dev/null +++ b/base/datBase.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace rage +{ + + class datBase + { + public: + virtual ~datBase() = default; + }; //Size: 0x0008 + static_assert(sizeof(datBase) == 0x8); + +} \ No newline at end of file diff --git a/base/fwExtensibleBase.hpp b/base/fwExtensibleBase.hpp new file mode 100644 index 0000000..f7a7f3b --- /dev/null +++ b/base/fwExtensibleBase.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include "fwRefAwareBase.hpp" +#include "fwExtensionContainer.hpp" + +namespace rage +{ + + class fwExtensibleBase : public fwRefAwareBase + { + public: + virtual bool is_of_type(std::uint32_t hash) = 0; + virtual uint32_t const &get_type() = 0; + + fwExtensionContainer* m_extension_container; // 0x0010 + void *m_extensible_unk; // 0x0018 + + template + bool is_of_type() + { + static auto name = (typeid(T).name()) + 6; // Skip "class " + static auto name_hash = joaat(name); + + return is_of_type(name_hash); + } + }; //Size: 0x0020 + static_assert(sizeof(fwExtensibleBase) == 0x20); + +} \ No newline at end of file diff --git a/base/fwExtension.hpp b/base/fwExtension.hpp new file mode 100644 index 0000000..4fe5c79 --- /dev/null +++ b/base/fwExtension.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace rage +{ + + class fwExtension + { + public: + virtual ~fwExtension() = default; + virtual void unk_0x08() = 0; + virtual void unk_0x10() = 0; + virtual uint32_t get_id() = 0; + }; //Size: 0x0008 + static_assert(sizeof(fwExtension) == 0x8); + +} \ No newline at end of file diff --git a/base/fwExtensionContainer.hpp b/base/fwExtensionContainer.hpp new file mode 100644 index 0000000..e65b30b --- /dev/null +++ b/base/fwExtensionContainer.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include "fwExtension.hpp" + +namespace rage +{ + + class fwExtensionContainer + { + public: + fwExtension *m_entry; //0x0000 + fwExtensionContainer* m_next; //0x0008 + }; //Size: 0x0010 + static_assert(sizeof(fwExtensionContainer) == 0x10); + +} \ No newline at end of file diff --git a/base/fwRefAwareBase.hpp b/base/fwRefAwareBase.hpp new file mode 100644 index 0000000..c4cf797 --- /dev/null +++ b/base/fwRefAwareBase.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "datBase.hpp" +#include "fwRefAwareBaseImpl.hpp" + +namespace rage +{ + + class fwRefAwareBase : public fwRefAwareBaseImpl + { + }; + static_assert(sizeof(fwRefAwareBase) == 0x10); + +} \ No newline at end of file diff --git a/base/fwRefAwareBaseImpl.hpp b/base/fwRefAwareBaseImpl.hpp new file mode 100644 index 0000000..22dee21 --- /dev/null +++ b/base/fwRefAwareBaseImpl.hpp @@ -0,0 +1,13 @@ +#pragma once + +namespace rage +{ + + template + class fwRefAwareBaseImpl : public T + { + private: + void *m_ref; // 0x08 + }; + +} \ No newline at end of file diff --git a/base/pgBase.hpp b/base/pgBase.hpp new file mode 100644 index 0000000..9619054 --- /dev/null +++ b/base/pgBase.hpp @@ -0,0 +1,15 @@ +#pragma once + +namespace rage +{ + + class pgBase + { + public: + virtual ~pgBase() = default; + + void *unk_0000; // 0x0000 + }; //Size: 0x0008 + static_assert(sizeof(pgBase) == 0x10); + +} \ No newline at end of file diff --git a/datanodes/player/CPlayerGameStateDataNode.hpp b/datanodes/player/CPlayerGameStateDataNode.hpp index 2f92dbe..fefbfbb 100644 --- a/datanodes/player/CPlayerGameStateDataNode.hpp +++ b/datanodes/player/CPlayerGameStateDataNode.hpp @@ -15,16 +15,16 @@ public: bool m_is_antagonistic_to_another_player; //0x00C8 bool m_never_target; //0x00C9 bool m_use_kinematic_physics; //0x00CA - bool unk_000CB; //0x00CB - bool unk_00CC; //0x00CC + bool m_has_tutorial_data; //0x00CB + bool m_pending_tutorial_change; //0x00CC bool unk_00CD; //0x00CD - bool unk_00CE; //0x00CE - bool unk_00CF; //0x00CF - bool unk_00D0; //0x00D0 - bool unk_00D1; //0x00D1 + bool m_respawning; //0x00CE + bool m_will_jack_any_player; //0x00CF + bool m_will_jack_wanted_players; //0x00D0 + bool m_dont_drag_from_car; //0x00D1 bool m_random_peds_flee; //0x00D2 bool m_every_ped_back_away; //0x00D3 - bool unk_00D4; //0x00D4 + bool m_has_microphone; //0x00D4 bool m_is_invincible; //0x00D5 bool unk_00D6; //0x00D6 bool unk_00D7; //0x00D7 @@ -70,8 +70,8 @@ public: float m_air_drag_multiplier; //0x0108 uint32_t m_max_health; //0x010C uint32_t m_max_armor; //0x0110 - uint32_t unk_0114; //0x0114 - uint16_t unk_0118; //0x0118 + uint32_t m_jack_speed; //0x0114 + uint16_t m_player_is_targetable_by_team; //0x0118 uint32_t m_override_receive_chat; //0x011C uint32_t m_override_send_chat; //0x0120 bool unk_0124; //0x0124 @@ -83,8 +83,8 @@ public: uint8_t m_tutorial_index; //0x012B uint8_t m_tutorial_instance_id; //0x012C char pad_012D[2]; //0x012D - uint32_t unk_0130; //0x0130 - uint32_t unk_0134; //0x0134 + float m_microphone_volume; //0x0130 + uint32_t m_voice_channel; //0x0134 bool m_is_overriding_voice_proximity; //0x0138 char pad_0139[7]; //0x0139 float m_voice_proximity_x; //0x0140 @@ -92,8 +92,8 @@ public: float m_voice_proximity_z; //0x0148 float m_voice_proximity_radius_maybe; //0x014C uint32_t unk_0150; //0x0150 - uint32_t unk_0154; //0x0154 - bool unk_0158; //0x0158 + uint32_t m_vehicle_weapon_index; //0x0154 + bool m_has_vehicle_weapon_index; //0x0158 uint32_t m_decor_count; //0x015C uint32_t m_decor_type[3]; // 0x0160 uint32_t m_decor_value[3]; // 0x016C @@ -104,8 +104,8 @@ public: uint8_t m_current_property_id; //0x0187 uint8_t unk_0188; //0x0188 uint8_t unk_0189; //0x0189 - bool unk_018A; //0x018A - bool unk_018B; //0x018B + bool m_battle_aware; //0x018A + bool m_vehicle_jump_down; //0x018B float m_weapon_defence_modifier; //0x018C float m_weapon_defence_modifier_2; //0x0190 bool m_is_overriding_population_control_sphere; //0x0194 @@ -140,6 +140,8 @@ public: uint8_t unk_01F1; //0x01F1 bool unk_01F2; //0x01F2 uint8_t unk_01F3; //0x01F3 -}; //Size: 0x01F4 -static_assert(sizeof(CPlayerGameStateDataNode) == 0x1F4); + bool unk_01F4; //0x01F4 + bool unk_01F5; //0x01F5 +}; //Size: 0x01F8 +static_assert(sizeof(CPlayerGameStateDataNode) == 0x1F8); #pragma pack(pop) \ No newline at end of file diff --git a/rage/fwEntity.hpp b/rage/fwEntity.hpp index 16c27e3..2e5cfbd 100644 --- a/rage/fwEntity.hpp +++ b/rage/fwEntity.hpp @@ -2,6 +2,7 @@ #include "base/CBaseModelInfo.hpp" #include "base/CNavigation.hpp" +#include "base/fwExtensibleBase.hpp" #include "rage/fwDrawData.hpp" #include "network/netObject.hpp" @@ -11,12 +12,9 @@ namespace rage { #pragma pack(push, 4) - class fwEntity + class fwEntity : public fwExtensibleBase { public: - char pad_0000[25]; //0x0000 - uint8_t m_mission_bits; // 0x0019 - char pad_001A[6]; // 0x001A class CBaseModelInfo *m_model_info; //0x0020 char pad_0028[1]; //0x0028 int8_t m_entity_type; //0x0029 diff --git a/vehicle/CVehicleModelInfo.hpp b/vehicle/CVehicleModelInfo.hpp index 3a7b5dc..63c7ca6 100644 --- a/vehicle/CVehicleModelInfo.hpp +++ b/vehicle/CVehicleModelInfo.hpp @@ -27,7 +27,7 @@ enum class eVehicleType : std::uint32_t class CVehicleModelInfo : public CBaseModelInfo { public: - char pad_00A4[84]; //0x00A4 + char pad_00B0[76]; //0x00B0 uint8_t m_primary_color_combinations[25]; //0x00F8 uint8_t m_secondary_color_combinations[25]; //0x0111 uint8_t m_unk_color_combos1[25]; //0x012A