diff --git a/src/gta/enums.hpp b/src/gta/enums.hpp index 4884e77e..9a798eb7 100644 --- a/src/gta/enums.hpp +++ b/src/gta/enums.hpp @@ -534,7 +534,7 @@ enum class KickReason : uint8_t NAT_TYPE, SCADMIN, SCADMIN_BLACKLIST, - UNK, + ROS_BAN, BATTLEYE_KICK, BATTLEYE_BAN, NUM_REASONS diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 096231fc..bf1ca728 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -745,6 +745,11 @@ namespace big bool client = buffer.Read(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; diff --git a/src/hooks/protections/received_event.cpp b/src/hooks/protections/received_event.cpp index ffad0b67..b7c9552d 100644 --- a/src/hooks/protections/received_event.cpp +++ b/src/hooks/protections/received_event.cpp @@ -672,9 +672,15 @@ namespace big { auto p1 = buffer->Read(32); auto p2 = buffer->Read(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; } diff --git a/src/hooks/spoofing/write_node_data.cpp b/src/hooks/spoofing/write_node_data.cpp index 0d7cfe3e..353bae1c 100644 --- a/src/hooks/spoofing/write_node_data.cpp +++ b/src/hooks/spoofing/write_node_data.cpp @@ -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; diff --git a/src/services/battleye/battleye_service.cpp b/src/services/battleye/battleye_service.cpp index 0a34ff70..d3f4923b 100644 --- a/src/services/battleye/battleye_service.cpp +++ b/src/services/battleye/battleye_service.cpp @@ -281,4 +281,54 @@ namespace big m_battleye_api.m_receive_message(token, const_cast(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(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; + } + } + } } \ No newline at end of file diff --git a/src/services/battleye/battleye_service.hpp b/src/services/battleye/battleye_service.hpp index 1a54758e..2b7d11d3 100644 --- a/src/services/battleye/battleye_service.hpp +++ b/src/services/battleye/battleye_service.hpp @@ -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); diff --git a/src/views/network/view_controls.cpp b/src/views/network/view_controls.cpp index 134e2edb..b800abe3 100644 --- a/src/views/network/view_controls.cpp +++ b/src/views/network/view_controls.cpp @@ -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())