mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 12:07:46 +08:00
Auto kick host and more (#33)
This commit is contained in:
parent
56b12ffc42
commit
b7f5729a78
@ -534,7 +534,7 @@ enum class KickReason : uint8_t
|
||||
NAT_TYPE,
|
||||
SCADMIN,
|
||||
SCADMIN_BLACKLIST,
|
||||
UNK,
|
||||
ROS_BAN,
|
||||
BATTLEYE_KICK,
|
||||
BATTLEYE_BAN,
|
||||
NUM_REASONS
|
||||
|
@ -745,6 +745,11 @@ namespace big
|
||||
bool client = buffer.Read<bool>(1);
|
||||
buffer.SeekForward(4); // normalize before we read
|
||||
|
||||
if (size > 1028 || player && player->is_host() == client)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
buffer.ReadArray(&data, size * 8);
|
||||
|
||||
if (client && player)
|
||||
@ -753,15 +758,12 @@ namespace big
|
||||
}
|
||||
else if (player)
|
||||
{
|
||||
g_battleye_service.send_message_to_server(player->get_net_game_player()->get_host_token(), &data, size);
|
||||
g_battleye_service.on_receive_message_from_server(player->get_net_game_player()->get_host_token(), &data, size);
|
||||
}
|
||||
|
||||
if (player && !player->bad_host && player->is_host())
|
||||
{
|
||||
player->bad_host = true;
|
||||
g_fiber_pool->queue_job([player] {
|
||||
entity::force_remove_network_entity(g_local_player, player, false);
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -672,9 +672,15 @@ namespace big
|
||||
{
|
||||
auto p1 = buffer->Read<int>(32);
|
||||
auto p2 = buffer->Read<int>(32);
|
||||
|
||||
LOGF(stream::net_events, VERBOSE, "Received REPORT_MYSELF_EVENT from {} with parameters ({}, {})", plyr->get_name(), p1, p2);
|
||||
session::add_infraction(plyr, Infraction::TRIGGERED_ANTICHEAT);
|
||||
g.reactions.game_anti_cheat_modder_detection.process(plyr);
|
||||
|
||||
if (p1 != 6) // false positives when telemetry endpoint is unreachable
|
||||
{
|
||||
session::add_infraction(plyr, Infraction::TRIGGERED_ANTICHEAT);
|
||||
g.reactions.game_anti_cheat_modder_detection.process(plyr);
|
||||
}
|
||||
|
||||
buffer->Seek(0);
|
||||
break;
|
||||
}
|
||||
|
@ -116,7 +116,6 @@ namespace big
|
||||
{
|
||||
node->m_free_cam_pos_x += 50.0f;
|
||||
node->m_free_cam_pos_y -= 50.0f;
|
||||
node->m_camera_x -= 50.0f;
|
||||
node_updated = true;
|
||||
}
|
||||
break;
|
||||
|
@ -281,4 +281,54 @@ namespace big
|
||||
|
||||
m_battleye_api.m_receive_message(token, const_cast<const void*>(message), size);
|
||||
}
|
||||
|
||||
void battleye_service::on_receive_message_from_server(std::uint64_t token, void* message, int size)
|
||||
{
|
||||
if (size == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto msg = reinterpret_cast<unsigned char*>(message);
|
||||
auto op = msg[0];
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case INIT:
|
||||
{
|
||||
std::uint8_t payload[] = {0x0, 0x5};
|
||||
send_message_to_server(token, payload, sizeof(payload));
|
||||
break;
|
||||
}
|
||||
case START:
|
||||
{
|
||||
LOG(INFO) << "BattlEye: Our GUID: " << (char*)&msg[3];
|
||||
send_message_to_server(token, message, 2);
|
||||
break;
|
||||
}
|
||||
case HEARTBEAT:
|
||||
{
|
||||
send_message_to_server(token, message, size);
|
||||
|
||||
if (g.session.kick_host_when_forcing_host && msg[1] == 5)
|
||||
{
|
||||
if (auto player = g_player_service->get_by_host_token(token); player && !player->is_modder)
|
||||
{
|
||||
player_command::get("battleupdate"_J)->call(player, {});
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case REQUEST:
|
||||
{
|
||||
if (size == 1028)
|
||||
{
|
||||
break;
|
||||
}
|
||||
send_message_to_server(token, message, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -39,6 +39,15 @@ namespace big
|
||||
|
||||
using init_t = bool (*)(int api_level, CUserData* data, CApi* api);
|
||||
|
||||
enum packet_id : std::uint8_t
|
||||
{
|
||||
INIT = 0x00,
|
||||
START = 0x02,
|
||||
REQUEST = 0x04,
|
||||
RESPONSE = 0x05,
|
||||
HEARTBEAT = 0x09,
|
||||
};
|
||||
|
||||
std::mutex m_mutex{};
|
||||
|
||||
bool is_running();
|
||||
@ -51,6 +60,7 @@ namespace big
|
||||
void add_player(std::uint64_t token, std::uint64_t rockstar_id, const char* name);
|
||||
void remove_player(std::uint64_t token);
|
||||
void receive_message(std::uint64_t token, void* message, int size);
|
||||
void on_receive_message_from_server(std::uint64_t token, void* message, int size);
|
||||
void send_message_to_client(std::uint64_t token, void* message, int size);
|
||||
void send_message_to_server(std::uint64_t token, void* message, int size);
|
||||
void kick_player(std::uint64_t token, const char* reason);
|
||||
|
@ -174,20 +174,9 @@ namespace big
|
||||
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (g.session.spoof_host_token_type != 0)
|
||||
{
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::Checkbox("KICK_HOST_ON_JOIN"_T.data(), &g.session.kick_host_when_forcing_host);
|
||||
ImGui::EndDisabled();
|
||||
|
||||
if (g.session.kick_host_when_forcing_host)
|
||||
{
|
||||
ImGui::SameLine();
|
||||
ImGui::Checkbox("EXCLUDE_MODDERS_FROM_KICK_HOST"_T.data(), &g.session.exclude_modders_from_kick_host);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("EXCLUDE_MODDERS_FROM_KICK_HOST_DESC"_T.data());
|
||||
}
|
||||
}
|
||||
ImGui::Checkbox("Auto Kick Host", &g.session.kick_host_when_forcing_host);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("Kicks the host every few minutes until you become host to avoid being kicked");
|
||||
|
||||
ImGui::Checkbox("FORCE_SCRIPT_HOST"_T.data(), &g.session.force_script_host);
|
||||
if (ImGui::IsItemHovered())
|
||||
|
Loading…
Reference in New Issue
Block a user