From 11701f81017f35495492cf320fc4f8d481ec24b3 Mon Sep 17 00:00:00 2001 From: Forever Gone <78507032+Faint0002@users.noreply.github.com> Date: Thu, 8 Dec 2022 04:28:41 -0500 Subject: [PATCH] Improve CEventNetwork and add comments sEntityDamagedData (#665) --- src/gta/net_game_event.hpp | 143 ++++++++++++++++++---- src/hooks/info/get_network_event_data.cpp | 4 +- 2 files changed, 119 insertions(+), 28 deletions(-) diff --git a/src/gta/net_game_event.hpp b/src/gta/net_game_event.hpp index 20c6f1b8..4f12b787 100644 --- a/src/gta/net_game_event.hpp +++ b/src/gta/net_game_event.hpp @@ -409,36 +409,127 @@ namespace rage }; static_assert(sizeof(rage::netConnection::InFrame) == 0x88); } - + + enum class eEventNetworkType : int64_t + { + CEventNetworkPlayerJoinScript = 153, + CEventNetworkPlayerLeftScript = 154, + CEventNetworkStorePlayerLeft = 155, + CEventNetworkStartSession = 156, + CEventNetworkEndSession = 157, + CEventNetworkStartMatch = 158, + CEventNetworkRemovedFromSessionDueToStall = 160, + CEventNetworkRemovedFromSessionDueToComplaints = 161, + CEventNetworkConnectionTimeout = 162, + CEventNetworkPedDroppedWeapon = 163, + CEventNetworkPlayerSpawn = 164, + CEventNetworkPlayerCollectedPickup = 165, + CEventNetworkPlayerCollectedAmbientPickup = 166, + CEventNetworkPlayerCollectedPortablePickup = 167, + CEventNetworkPlayerDroppedPortablePickup = 168, + CEventNetworkInviteAccepted = 170, + CEventNetworkInviteConfirmed = 171, + CEventNetworkInviteRejected = 172, + CEventNetworkSummo = 173, + CEventNetworkScriptEvent = 174, + CEventNetworkSignInStateChanged = 176, + CEventNetworkSignInChangeActioned = 177, + CEventNetworkRosChanged = 178, + CEventNetworkBail = 179, + CEventNetworkHostMigration = 180, + CEventNetworkFindSession = 181, + EventNetworkHostSession = 182, + CEventNetworkJoinSession = 183, + CEventNetworkJoinSessionResponse = 184, + CEventNetworkCheatTriggered = 185, + CEventNetworkEntityDamage = 186, + CEventNetworkPlayerArrest = 187, + CEventNetworkTimedExplosion = 188, + CEventNetworkPrimaryClanChanged = 189, + CEventNetworkClanJoined = 190, + CEventNetworkClanLeft = 191, + CEventNetworkClanInviteReceived = 192, + CEventNetworkVoiceSessionStarted = 193, + CEventNetworkVoiceSessionEnded = 194, + CEventNetworkVoiceConnectionRequested = 195, + CEventNetworkVoiceConnectionResponse = 196, + CEventNetworkVoiceConnectionTerminated = 197, + CEventNetworkTextMessageReceived = 198, + CEventNetworkCloudFileResponse = 199, + CEventNetworkPickupRespawned = 200, + CEventNetworkPresence_StatUpdate = 201, + CEventNetworkPedLeftBehind = 202, + CEventNetwork_InboxMsgReceived = 203, + CEventNetworkAttemptHostMigration = 204, + CEventNetworkIncrementStat = 205, + CEventNetworkSessionEvent = 206, + CEventNetworkTransitionStarted = 207, + CEventNetworkTransitionEvent = 208, + CEventNetworkTransitionMemberJoined = 209, + CEventNetworkTransitionMemberLeft = 210, + CEventNetworkTransitionParameterChanged = 211, + CEventNetworkClanKicked = 212, + CEventNetworkTransitionStringChanged = 213, + EventNetworkTransitionGamerInstruction = 214, + CEventNetworkPresenceInvite = 215, + EventNetworkPresenceInviteRemoved = 216, + EventNetworkPresenceInviteReply = 217, + CEventNetworkCashTransactionLog = 218, + CEventNetworkClanRankChanged = 219, + CEventNetworkVehicleUndrivable = 220, + CEventNetworkPresenceTriggerEvent = 221, + CEventNetworkEmailReceivedEvent = 222, + CEventNetworkFollowInviteReceived = 223, + CEventNetworkSpectateLocal = 225, + CEventNetworkCloudEvent = 226, + CEventNetworkShopTransaction = 227, + CEventNetworkOnlinePermissionsUpdated = 230, + CEventNetworkSystemServiceEvent = 231, + CEventNetworkRequestDelay = 232, + CEventNetworkSocialClubAccountLinked = 233, + CEventNetworkScAdminPlayerUpdated = 234, + CEventNetworkScAdminReceivedCash = 235, + CEventNetworkClanInviteRequestReceived = 236, + CEventNetworkMarketingEmailReceivedEvent = 237, + CEventNetworkStuntPerformed = 238, + CEventNetworkFiredDummyProjectile = 239, + CEventNetworkPlayerEnteredVehicle = 240, + CEventNetworkPlayerActivatedSpecialAbility = 241, + CEventNetworkPlayerDeactivatedSpecialAbility = 242, + CEventNetworkPlayerSpecialAbilityFailedActivation = 243, + CEventNetworkFiredVehicleProjectile = 244, + }; + class CEventNetwork { public: - virtual ~CEventNetwork() = default; - virtual void unk_0x8() = 0; - virtual void unk_0x10() = 0; - virtual __int64 get_type() = 0; - virtual void unk_0x20() = 0; - virtual void unk_0x28() = 0; - virtual bool get_extra_information(void* info_array, int check) = 0; - virtual void unk_0x38() = 0; - }; + virtual ~CEventNetwork() = default; //0x0000 (0) + virtual void unk_0008() = 0; //0x0008 (1) + virtual void unk_0010() = 0; //0x0010 (2) + virtual eEventNetworkType get_type() = 0; //0x0018 (3) + virtual void unk_0020() = 0; //0x0020 (4) + virtual void unk_0028() = 0; //0x0028 (5) + virtual bool get_extra_information(void* info_array, int check) = 0; //0x0030 (6) + virtual void unk_0038() = 0; //0x0038 (7) + }; //Size: 0x0008 - struct sEntityDamagedData + class sEntityDamagedData { - alignas(8) Entity m_victim_index; - alignas(8) Entity m_damager_index; - alignas(8) float m_damage; - alignas(8) float m_endurance_damage; - alignas(8) bool m_victim_incapacitated; - alignas(8) bool m_victim_destroyed; - alignas(8) int m_weapon_used; - alignas(8) float m_victim_speed; - alignas(8) float m_damager_speed; - alignas(8) bool m_is_responsible_for_collision; - alignas(8) bool m_is_headshot; - alignas(8) bool m_is_with_melee_weapon; - alignas(8) int m_hit_material; - }; + public: + alignas(8) Entity m_victim_index; //0x0000 + alignas(8) Entity m_damager_index; //0x0008 + alignas(8) float m_damage; //0x0010 + alignas(8) float m_endurance_damage; //0x0018 + alignas(8) bool m_victim_incapacitated; //0x0020 + alignas(8) bool m_victim_destroyed; //0x0028 + alignas(8) int m_weapon_used; //0x0030 + alignas(8) float m_victim_speed; //0x0038 + alignas(8) float m_damager_speed; //0x0040 + alignas(8) bool m_is_responsible_for_collision; //0x0048 + alignas(8) bool m_is_headshot; //0x0050 + alignas(8) bool m_is_with_melee_weapon; //0x0058 + alignas(8) int m_hit_material; //0x0060 + }; //Size: 0x0068 static_assert(sizeof(sEntityDamagedData) == 0x68); class netGameEvent @@ -507,4 +598,4 @@ public: Hash m_stat; // 0x30 std::uint32_t m_amount; // 0x34 }; -#pragma pack(pop) \ No newline at end of file +#pragma pack(pop) diff --git a/src/hooks/info/get_network_event_data.cpp b/src/hooks/info/get_network_event_data.cpp index d7f02832..6d744e21 100644 --- a/src/hooks/info/get_network_event_data.cpp +++ b/src/hooks/info/get_network_event_data.cpp @@ -10,12 +10,12 @@ namespace big { switch (net_event->get_type()) { - case 161: // CEventNetworkRemovedFromSessionDueToComplaints + case rage::eEventNetworkType::CEventNetworkRemovedFromSessionDueToComplaints: { g_notification_service->push_warning("Kicked", "You have been desync kicked."); break; } - case 186: // CEventNetworkEntityDamage + case rage::eEventNetworkType::CEventNetworkEntityDamage: { rage::sEntityDamagedData damage_data; net_event->get_extra_information(&damage_data, sizeof(damage_data));