From 8425cae0f662f9504135468a7269dac8ce0762ec Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Sun, 31 Mar 2024 15:11:52 -0400 Subject: [PATCH] Refactor m_rockstar_id into its proper type of a 64-bit signed integer. (#2901) --- cmake/gtav-classes.cmake | 2 +- src/gta/net_game_event.hpp | 8 ++++++-- src/hooks/protections/receive_net_message.cpp | 2 +- src/util/chat.hpp | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/gtav-classes.cmake b/cmake/gtav-classes.cmake index 5b2ffdfa..7ed10660 100644 --- a/cmake/gtav-classes.cmake +++ b/cmake/gtav-classes.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( gtav_classes GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git - GIT_TAG a3031a89788141f292a83d18587277e04d367c4a + GIT_TAG ddd118410c5ede28e3a5978ebda93b83634d3293 GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/gta/net_game_event.hpp b/src/gta/net_game_event.hpp index f7214075..8006f8ee 100644 --- a/src/gta/net_game_event.hpp +++ b/src/gta/net_game_event.hpp @@ -91,9 +91,9 @@ namespace rage { return big::g_pointers->m_gta.m_read_bitbuf_bool(this, boolean, 1); } - bool ReadPeerId(uint64_t* peer_id) + bool ReadRockstarId(int64_t* rockstar_id) { - return this->ReadQWord(peer_id, 0x40); + return this->ReadInt64(rockstar_id, sizeof(rockstar_id) * 8); } uint64_t ReadBits(size_t numBits) { @@ -207,6 +207,10 @@ namespace rage { return big::g_pointers->m_gta.m_write_bitbuf_int64(this, integer, bits); } + bool WriteRockstarId(int64_t rockstar_id) + { + return big::g_pointers->m_gta.m_write_bitbuf_int64(this, rockstar_id, sizeof(rockstar_id) * 8); + } bool ReadInt64(int64_t* integer, int bits) { uint32_t v8; diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 4860435c..67c71da4 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -22,7 +22,7 @@ inline void gamer_handle_deserialize(rage::rlGamerHandle& hnd, rage::datBitBuffe if ((hnd.m_platform = buf.Read(sizeof(hnd.m_platform) * 8)) != rage::rlPlatforms::PC) return; - buf.ReadPeerId(&hnd.m_rockstar_id); + buf.ReadRockstarId(&hnd.m_rockstar_id); hnd.m_padding = buf.Read(sizeof(hnd.m_padding) * 8); } diff --git a/src/util/chat.hpp b/src/util/chat.hpp index f02cbd96..992a4f67 100644 --- a/src/util/chat.hpp +++ b/src/util/chat.hpp @@ -21,7 +21,7 @@ namespace buf.Write(hnd.m_platform, sizeof(hnd.m_platform) * 8); if (hnd.m_platform == rage::rlPlatforms::PC) { - buf.WriteInt64(hnd.m_rockstar_id, sizeof(hnd.m_rockstar_id) * 8); + buf.WriteRockstarId(hnd.m_rockstar_id); buf.Write(hnd.m_padding, sizeof(hnd.m_padding) * 8); } }