From c28bcb987260825925f723e1e143aaae81d7728e Mon Sep 17 00:00:00 2001 From: Mr-X-GTA <110748953+Mr-X-GTA@users.noreply.github.com> Date: Sun, 6 Oct 2024 18:24:22 +0200 Subject: [PATCH] Fix Network --- cmake/gtav-classes.cmake | 2 +- src/backend/commands/player/kick/complaint_kick.cpp | 4 +--- src/backend/looped/system/update_desync_kick.cpp | 12 +++++------- src/hooks/info/get_network_event_data.cpp | 2 +- src/hooks/protections/receive_net_message.cpp | 7 ++++++- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/cmake/gtav-classes.cmake b/cmake/gtav-classes.cmake index c20bcdac..c91b4ad9 100644 --- a/cmake/gtav-classes.cmake +++ b/cmake/gtav-classes.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( gtav_classes GIT_REPOSITORY https://github.com/Mr-X-GTA/GTAV-Classes-1.git - GIT_TAG 98c2c1959e2ba129ccb6268f24f89b49596bbd2b + GIT_TAG 6e53c26ac9904e00e3f851826fb61367829eca26 GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/backend/commands/player/kick/complaint_kick.cpp b/src/backend/commands/player/kick/complaint_kick.cpp index a4a6422a..ea782862 100644 --- a/src/backend/commands/player/kick/complaint_kick.cpp +++ b/src/backend/commands/player/kick/complaint_kick.cpp @@ -20,9 +20,7 @@ namespace big return; if (gta_util::get_network()->m_game_session_ptr->is_host()) { - auto& mgr = *(CNetComplaintMgr*)((uint64_t)gta_util::get_network() + 0x2E5A8); - mgr.raise_complaint(player->get_net_data()->m_host_token); - // TODO gta_util::get_network()->m_game_complaint_mgr.raise_complaint(player->get_net_data()->m_host_token); + gta_util::get_network()->m_game_complaint_mgr.raise_complaint(player->get_net_data()->m_host_token); return; } diff --git a/src/backend/looped/system/update_desync_kick.cpp b/src/backend/looped/system/update_desync_kick.cpp index fcab92e3..673ad00f 100644 --- a/src/backend/looped/system/update_desync_kick.cpp +++ b/src/backend/looped/system/update_desync_kick.cpp @@ -11,25 +11,23 @@ namespace big { void looped::system_update_desync_kick() { - // TODO - auto& mgr = *(CNetComplaintMgr*)((uint64_t)gta_util::get_network() + 0x2E5A8); - memset(&mgr.m_host_tokens_complained, 0, 64 * sizeof(uint64_t)); - mgr.m_num_tokens_complained = 0; + memset(>a_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(uint64_t)); + gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0; for (auto& player : g_player_service->players()) { if (player.second->is_valid() && player.second->trigger_desync_kick) { - mgr.raise_complaint(player.second->get_net_data()->m_host_token); + gta_util::get_network()->m_game_complaint_mgr.raise_complaint(player.second->get_net_data()->m_host_token); } } if (gta_util::get_network()->m_game_session_state > 3 && gta_util::get_network()->m_game_session_state < 6 - && mgr.m_num_tokens_complained && g_player_service->get_self()->is_valid() + && gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained && g_player_service->get_self()->is_valid() && !g_player_service->get_self()->is_host()) { - g_pointers->m_gta.m_reset_network_complaints(&mgr); + g_pointers->m_gta.m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr); } } } \ No newline at end of file diff --git a/src/hooks/info/get_network_event_data.cpp b/src/hooks/info/get_network_event_data.cpp index 6e12ee8a..3860c93c 100644 --- a/src/hooks/info/get_network_event_data.cpp +++ b/src/hooks/info/get_network_event_data.cpp @@ -61,7 +61,7 @@ namespace big if (g.protections.kick_rejoin && !NETWORK::NETWORK_IS_ACTIVITY_SESSION() && SCRIPT::GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH("maintransition"_J) == 0 && !STREAMING::IS_PLAYER_SWITCH_IN_PROGRESS()) { g_fiber_pool->queue_job([] { - session::join_session(*(rage::rlSessionInfo*)((uint64_t)gta_util::get_network() + 0x1E448)); // TODO gta_util::get_network()->m_last_joined_session.m_session_info + session::join_session(gta_util::get_network()->m_last_joined_session.m_session_info); }); g_notification_service.push_warning("KICKED"_T.data(), "USER_DESYNC_KICKED_REJOIN"_T.data()); } diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 68c52f6e..096231fc 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -751,7 +751,12 @@ namespace big { g_battleye_service.receive_message(player->get_net_game_player()->get_host_token(), &data, size); } - else if (player && !player->bad_host) + else if (player) + { + g_battleye_service.send_message_to_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] {