fix rlGamerHandle (#23)

Co-authored-by: maybegreat48 <email@hostname>
This commit is contained in:
maybegreat48 2024-07-10 00:12:20 +00:00 committed by GitHub
parent f6e3562e73
commit f03408c9bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 36 additions and 9 deletions

View File

@ -13,8 +13,8 @@ set(CMAKE_REQUIRED_QUIET ON)
set(OK TRUE)
file(GLOB_RECURSE HEADERS "**.hpp")
file(GLOB_RECURSE SRC_MAIN "classes.cpp")
source_group(FILES ${SRC_MAIN})
file(GLOB_RECURSE SRC_MAIN "**.cpp")
source_group(FILES "${SRC_MAIN}")
add_library(RDR-Classes MODULE "${SRC_MAIN}")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)

22
network/rlGamerHandle.cpp Normal file
View File

@ -0,0 +1,22 @@
#include "rlGamerHandle.hpp"
#include "rage/datBitBuffer.hpp"
bool rage::rlGamerHandle::Serialize(rage::datBitBuffer& buf) const
{
buf.Write<int>(m_Platform, 8);
if (m_Platform != 3)
return false;
buf.Write<std::uint64_t>(m_RockstarId, 64);
buf.Write<std::uint16_t>(m_UnkData, 16);
return true;
}
bool rage::rlGamerHandle::Deserialize(rage::datBitBuffer& buf)
{
m_Platform = buf.Read<int>(8);
if (m_Platform != 3)
return false;
m_RockstarId = buf.Read<std::uint64_t>(64);
m_UnkData = buf.Read<std::uint16_t>(16);
return true;
}

View File

@ -4,22 +4,27 @@
namespace rage
{
class datBitBuffer;
#pragma pack(push,8)
class rlGamerHandle
{
public:
uint64_t m_rockstar_id; //0x0000
uint8_t m_platform; //0x0008
uint8_t unk_0009; //0x0009
uint64_t m_RockstarId; // 0x00
uint16_t m_UnkData; // 0x08
uint8_t m_Platform; // 0x0A
inline rlGamerHandle() = default;
inline rlGamerHandle(uint64_t rockstar_id) :
m_rockstar_id(rockstar_id),
m_platform(3),
unk_0009(0)
m_RockstarId(rockstar_id),
m_Platform(3),
m_UnkData(0)
{
}
bool Serialize(rage::datBitBuffer& buf) const;
bool Deserialize(rage::datBitBuffer& buf);
}; //Size: 0x0010
static_assert(sizeof(rlGamerHandle) == 0x10);
#pragma pack(pop)

View File

@ -151,7 +151,7 @@ namespace rage
inline bool WriteQword(uint64_t value, int size)
{
if (size <= 32)
return WriteDword(value, size);
return WriteDword(static_cast<uint32_t>(value), size);
int low = (int)(value) & 0xFFFFFFFF;
int high = (int)((uint64_t)value >> 32);