Unify rlGamerHandle code and fix chat inaccuracies. (#2883)
This commit is contained in:
parent
0fb17b668e
commit
4636ef8346
@ -3,7 +3,7 @@ include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
gtav_classes
|
||||
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
||||
GIT_TAG 09a586011a296cf8ce3ffb9c15db7ce474ea4363
|
||||
GIT_TAG a3031a89788141f292a83d18587277e04d367c4a
|
||||
GIT_PROGRESS TRUE
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
|
@ -9,14 +9,6 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
inline void gamer_handle_serialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf)
|
||||
{
|
||||
constexpr int PC_PLATFORM = 3;
|
||||
buf.Write<uint8_t>(PC_PLATFORM, 8);
|
||||
buf.WriteInt64(*(int64_t*)&hnd.m_rockstar_id, 64);
|
||||
buf.Write<uint8_t>(hnd.unk_0009, 8);
|
||||
}
|
||||
|
||||
bool hooks::send_chat_message(void* team_mgr, rage::rlGamerInfo* local_gamer_info, char* message, bool is_team)
|
||||
{
|
||||
if (g.session.chat_commands && message[0] == g.session.chat_command_prefix)
|
||||
|
@ -716,13 +716,9 @@ namespace big
|
||||
case sync_node_id("CPlayerExtendedGameStateNode"):
|
||||
LOG_FIELD(CPlayerExtendedGameStateNode, waypoint_x);
|
||||
LOG_FIELD(CPlayerExtendedGameStateNode, waypoint_y);
|
||||
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk1);
|
||||
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk2);
|
||||
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk3);
|
||||
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk4);
|
||||
LOG_FIELD_B(CPlayerExtendedGameStateNode, unk5);
|
||||
LOG_FIELD_B(CPlayerExtendedGameStateNode, has_waypoint_data);
|
||||
LOG_FIELD_B(CPlayerExtendedGameStateNode, is_waypoint_set);
|
||||
LOG_FIELD(CPlayerExtendedGameStateNode, waypoint_entity);
|
||||
LOG_FIELD(CPlayerExtendedGameStateNode, has_active_waypoint);
|
||||
LOG_FIELD(CPlayerExtendedGameStateNode, owns_waypoint);
|
||||
break;
|
||||
case sync_node_id("CPlayerGameStateDataNode"):
|
||||
LOG_FIELD(CPlayerGameStateDataNode, m_player_state);
|
||||
|
@ -19,12 +19,11 @@
|
||||
|
||||
inline void gamer_handle_deserialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf)
|
||||
{
|
||||
constexpr int PC_PLATFORM = 3;
|
||||
if ((hnd.m_platform = buf.Read<uint8_t>(8)) != PC_PLATFORM)
|
||||
if ((hnd.m_platform = buf.Read<uint8_t>(sizeof(hnd.m_platform))) != rage::rlPlatforms::PC)
|
||||
return;
|
||||
|
||||
buf.ReadInt64((int64_t*)&hnd.m_rockstar_id, 64);
|
||||
hnd.unk_0009 = buf.Read<uint8_t>(8);
|
||||
buf.ReadPeerId(&hnd.m_rockstar_id);
|
||||
hnd.m_padding = buf.Read<uint8_t>(sizeof(hnd.m_padding));
|
||||
}
|
||||
|
||||
inline bool is_kick_instruction(rage::datBitBuffer& buffer)
|
||||
@ -107,8 +106,10 @@ namespace big
|
||||
case rage::eNetMessage::MsgTextMessage2:
|
||||
{
|
||||
char message[256];
|
||||
buffer.ReadString(message, 256);
|
||||
rage::rlGamerHandle handle{};
|
||||
bool is_team;
|
||||
buffer.ReadString(message, sizeof(message));
|
||||
gamer_handle_deserialize(handle, buffer);
|
||||
buffer.ReadBool(&is_team);
|
||||
|
||||
if (player->is_spammer)
|
||||
@ -146,15 +147,8 @@ namespace big
|
||||
|
||||
if (msgType == rage::eNetMessage::MsgTextMessage && g_pointers->m_gta.m_chat_data && player->get_net_data())
|
||||
{
|
||||
rage::rlGamerHandle temp{};
|
||||
gamer_handle_deserialize(temp, buffer);
|
||||
|
||||
g_pointers->m_gta.m_handle_chat_message(*g_pointers->m_gta.m_chat_data,
|
||||
nullptr,
|
||||
&player->get_net_data()->m_gamer_handle,
|
||||
message,
|
||||
is_team);
|
||||
return true;
|
||||
buffer.Seek(0);
|
||||
return g_hooking->get_original<hooks::receive_net_message>()(netConnectionManager, a2, frame); // Call original function since we can't seem to handle it
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -16,12 +16,14 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
inline void gamer_handle_serialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf)
|
||||
static void gamer_handle_serialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf)
|
||||
{
|
||||
constexpr int PC_PLATFORM = 3;
|
||||
buf.Write<uint8_t>(PC_PLATFORM, 8);
|
||||
buf.WriteInt64(*(int64_t*)&hnd.m_rockstar_id, 64);
|
||||
buf.Write<uint8_t>(hnd.unk_0009, 8);
|
||||
buf.Write<uint8_t>(hnd.m_platform, sizeof(hnd.m_platform));
|
||||
if (hnd.m_platform == rage::rlPlatforms::PC)
|
||||
{
|
||||
buf.WriteQWord(hnd.m_rockstar_id, sizeof(hnd.m_rockstar_id));
|
||||
buf.Write<uint8_t>(hnd.m_padding, sizeof(hnd.m_padding));
|
||||
}
|
||||
}
|
||||
|
||||
static const char* spam_texts[] =
|
||||
|
@ -24,16 +24,6 @@
|
||||
|
||||
namespace big::session
|
||||
{
|
||||
static void gamer_handle_serialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf)
|
||||
{
|
||||
buf.Write<uint8_t>(*reinterpret_cast<uint8_t*>(&hnd.m_platform), 8);
|
||||
if (*reinterpret_cast<uint8_t*>(&hnd.m_platform) == 3)
|
||||
{
|
||||
buf.WriteInt64(*(int64_t*)&hnd.m_rockstar_id, 64);
|
||||
buf.Write<uint8_t>(*reinterpret_cast<uint8_t*>(reinterpret_cast<__int64>(&hnd) + 9), 8);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool join_type(eSessionType session)
|
||||
{
|
||||
SCRIPT::REQUEST_SCRIPT_WITH_NAME_HASH("pausemenu_multiplayer"_J);
|
||||
|
Reference in New Issue
Block a user