feat(Network): Send Chat Message (#594)
This commit is contained in:
parent
32839fb9b1
commit
69d636f065
@ -195,6 +195,7 @@ namespace big
|
|||||||
bool log_text_messages = false;
|
bool log_text_messages = false;
|
||||||
bool decloak_players = false;
|
bool decloak_players = false;
|
||||||
bool force_session_host = false;
|
bool force_session_host = false;
|
||||||
|
bool is_team = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct settings {
|
struct settings {
|
||||||
@ -602,6 +603,7 @@ namespace big
|
|||||||
this->session.disable_chat_filter = j["session"]["disable_chat_filter"];
|
this->session.disable_chat_filter = j["session"]["disable_chat_filter"];
|
||||||
this->session.decloak_players = j["session"]["decloak_players"];
|
this->session.decloak_players = j["session"]["decloak_players"];
|
||||||
this->session.force_session_host = j["session"]["force_session_host"];
|
this->session.force_session_host = j["session"]["force_session_host"];
|
||||||
|
this->session.is_team = j["session"]["is_team"];
|
||||||
|
|
||||||
this->settings.dev_dlc = j["settings"]["dev_dlc"];
|
this->settings.dev_dlc = j["settings"]["dev_dlc"];
|
||||||
this->settings.hotkeys.menu_toggle = j["settings"]["hotkeys"]["menu_toggle"];
|
this->settings.hotkeys.menu_toggle = j["settings"]["hotkeys"]["menu_toggle"];
|
||||||
@ -918,7 +920,8 @@ namespace big
|
|||||||
{ "log_text_messages", this->session.log_text_messages },
|
{ "log_text_messages", this->session.log_text_messages },
|
||||||
{ "disable_chat_filter", this->session.disable_chat_filter },
|
{ "disable_chat_filter", this->session.disable_chat_filter },
|
||||||
{ "decloak_players", this->session.decloak_players },
|
{ "decloak_players", this->session.decloak_players },
|
||||||
{ "force_session_host", this->session.force_session_host }
|
{ "force_session_host", this->session.force_session_host },
|
||||||
|
{ "is_team", this->session.is_team }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "datanodes/player/CPlayerGameStateDataNode.hpp"
|
#include "datanodes/player/CPlayerGameStateDataNode.hpp"
|
||||||
|
#include "rage/rlGamerInfo.hpp"
|
||||||
|
|
||||||
namespace big::functions
|
namespace big::functions
|
||||||
{
|
{
|
||||||
@ -67,4 +68,6 @@ namespace big::functions
|
|||||||
using join_session_by_info = bool(*)(Network* network, rage::rlSessionInfo* info, int unk, int flags, rage::rlGamerHandle* handles, int handlecount);
|
using join_session_by_info = bool(*)(Network* network, rage::rlSessionInfo* info, int unk, int flags, rage::rlGamerHandle* handles, int handlecount);
|
||||||
|
|
||||||
using generate_uuid = bool(*)(std::uint64_t* uuid);
|
using generate_uuid = bool(*)(std::uint64_t* uuid);
|
||||||
|
|
||||||
|
using send_chat_message = bool(*)(int64_t* send_chat_ptr, rage::rlGamerInfo* game_info, char* message, bool is_team);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "gta/tls_context.hpp"
|
#include "gta/tls_context.hpp"
|
||||||
#include "ped/CPedFactory.hpp"
|
#include "ped/CPedFactory.hpp"
|
||||||
#include "pointers.hpp"
|
#include "pointers.hpp"
|
||||||
|
#include "network/CNetworkPlayerMgr.hpp"
|
||||||
|
|
||||||
namespace big::gta_util
|
namespace big::gta_util
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ namespace big
|
|||||||
buffer.ReadString(message, 256);
|
buffer.ReadString(message, 256);
|
||||||
buffer.ReadQWord(&unk, 64);
|
buffer.ReadQWord(&unk, 64);
|
||||||
buffer.ReadBool(&is_team);
|
buffer.ReadBool(&is_team);
|
||||||
LOG(INFO) << "[CHAT] from " << player->get_name() << ": " << message << (is_team) ? " [TEAM]" : " [ALL]";
|
LOG(INFO) << "[CHAT] from " << player->get_name() << ": " << message << (is_team ? " [TEAM]" : " [ALL]");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -410,6 +410,18 @@ namespace big
|
|||||||
m_invalid_mods_crash_detour = ptr.add(1).rip().as<PVOID>();
|
m_invalid_mods_crash_detour = ptr.add(1).rip().as<PVOID>();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Send Chat Ptr
|
||||||
|
main_batch.add("SCP", "41 83 7F ? ? 4C 8B 35", [this](memory::handle ptr)
|
||||||
|
{
|
||||||
|
m_send_chat_ptr = ptr.add(8).rip().as<int64_t**>();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Send Chat Message
|
||||||
|
main_batch.add("SCM", "48 83 EC 20 48 8B F9 48 8B CA 45 8A F1", [this](memory::handle ptr)
|
||||||
|
{
|
||||||
|
m_send_chat_message = ptr.sub(21).as<functions::send_chat_message>();
|
||||||
|
});
|
||||||
|
|
||||||
// Format Metric For Sending
|
// Format Metric For Sending
|
||||||
main_batch.add("FMFS", "48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 4C 89 70 ? 55 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 83 3D", [this](memory::handle ptr)
|
main_batch.add("FMFS", "48 8B C4 48 89 58 ? 48 89 70 ? 48 89 78 ? 4C 89 70 ? 55 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 48 83 3D", [this](memory::handle ptr)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +138,9 @@ namespace big
|
|||||||
|
|
||||||
PVOID m_invalid_mods_crash_detour{};
|
PVOID m_invalid_mods_crash_detour{};
|
||||||
|
|
||||||
|
int64_t** m_send_chat_ptr{};
|
||||||
|
functions::send_chat_message m_send_chat_message{};
|
||||||
|
|
||||||
PVOID m_init_native_tables{};
|
PVOID m_init_native_tables{};
|
||||||
PVOID m_script_vm{};
|
PVOID m_script_vm{};
|
||||||
|
|
||||||
@ -147,8 +150,8 @@ namespace big
|
|||||||
rage::rlGamerInfo* m_player_info_gamer_info{}; // the gamer info that is applied to CPlayerInfo
|
rage::rlGamerInfo* m_player_info_gamer_info{}; // the gamer info that is applied to CPlayerInfo
|
||||||
CCommunications** m_communications{};
|
CCommunications** m_communications{};
|
||||||
|
|
||||||
PVOID m_update_presence_attribute_int;
|
PVOID m_update_presence_attribute_int{};
|
||||||
PVOID m_update_presence_attribute_string;
|
PVOID m_update_presence_attribute_string{};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline pointers* g_pointers{};
|
inline pointers* g_pointers{};
|
||||||
|
@ -53,4 +53,15 @@ namespace big::notify
|
|||||||
std::format("<C>{}</C> joined.", net_game_player->get_name())
|
std::format("<C>{}</C> joined.", net_game_player->get_name())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void draw_chat(char* msg, const char* player_name, bool is_team)
|
||||||
|
{
|
||||||
|
int scaleform = GRAPHICS::REQUEST_SCALEFORM_MOVIE("MULTIPLAYER_CHAT");
|
||||||
|
GRAPHICS::BEGIN_SCALEFORM_MOVIE_METHOD(scaleform, "ADD_MESSAGE");
|
||||||
|
GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_PLAYER_NAME_STRING(player_name); // player name
|
||||||
|
GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_LITERAL_STRING(msg); // content
|
||||||
|
GRAPHICS::SCALEFORM_MOVIE_METHOD_ADD_PARAM_TEXTURE_NAME_STRING(HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(is_team ? "MP_CHAT_TEAM" : "MP_CHAT_ALL")); // scope
|
||||||
|
GRAPHICS::DRAW_SCALEFORM_MOVIE_FULLSCREEN(scaleform, 255, 255, 255, 255, 0);
|
||||||
|
GRAPHICS::END_SCALEFORM_MOVIE_METHOD();
|
||||||
|
}
|
||||||
}
|
}
|
@ -2,6 +2,8 @@
|
|||||||
#include "fiber_pool.hpp"
|
#include "fiber_pool.hpp"
|
||||||
#include "util/session.hpp"
|
#include "util/session.hpp"
|
||||||
#include "core/data/region_codes.hpp"
|
#include "core/data/region_codes.hpp"
|
||||||
|
#include "gta_util.hpp"
|
||||||
|
#include "util/notify.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -44,6 +46,19 @@ namespace big
|
|||||||
ImGui::Checkbox("Disable Filter", &g->session.disable_chat_filter);
|
ImGui::Checkbox("Disable Filter", &g->session.disable_chat_filter);
|
||||||
ImGui::Checkbox("Log Chat Messages", &g->session.log_chat_messages);
|
ImGui::Checkbox("Log Chat Messages", &g->session.log_chat_messages);
|
||||||
ImGui::Checkbox("Log Text Messages", &g->session.log_text_messages);
|
ImGui::Checkbox("Log Text Messages", &g->session.log_text_messages);
|
||||||
|
static char msg[256];
|
||||||
|
ImGui::InputText("##message", msg, sizeof(msg));
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Checkbox("Is Team", &g->session.is_team);
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::button("Send", []
|
||||||
|
{
|
||||||
|
if(const auto net_game_player = gta_util::get_network_player_mgr()->m_local_net_player; net_game_player)
|
||||||
|
{
|
||||||
|
if(g_pointers->m_send_chat_message(*g_pointers->m_send_chat_ptr, net_game_player->get_net_data(), msg, g->session.is_team))
|
||||||
|
notify::draw_chat(msg, net_game_player->get_name(), g->session.is_team);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
components::sub_title("Decloak");
|
components::sub_title("Decloak");
|
||||||
components::script_patch_checkbox("Reveal OTR Players", &g->session.decloak_players);
|
components::script_patch_checkbox("Reveal OTR Players", &g->session.decloak_players);
|
||||||
|
Reference in New Issue
Block a user