From 22c184d6b6328c9ae9954b2e5c9dd33907750b34 Mon Sep 17 00:00:00 2001 From: Mr-X-GTA <110748953+Mr-X-GTA@users.noreply.github.com> Date: Mon, 23 Dec 2024 21:46:35 +0100 Subject: [PATCH] More fixes (#71) - Improved session multiplexer - Fixed kick from interior - Fixed explode player - Fixed force script host - Re-added null function kick - Re-added auto kick host - Removed host token spoofing --- cmake/gtav-classes.cmake | 2 +- .../player/kick/null_function_kick.cpp | 24 ++++ .../commands/player/kick/smart_kick.cpp | 5 +- .../player/toxic/kick_from_interior.cpp | 4 +- .../looped/session/spoof_host_token.cpp | 105 ------------------ src/byte_patch_manager.cpp | 2 - src/core/settings.hpp | 10 +- src/gta_pointers.hpp | 9 -- src/hooking/hooking.cpp | 2 - src/hooking/hooking.hpp | 1 - .../create_session_detail_response.cpp | 4 - src/hooks/misc/add_gamer_to_session.cpp | 19 ---- src/native_hooks/native_hooks.cpp | 16 ++- src/pointers.cpp | 63 ----------- src/services/battleye/battleye_service.cpp | 8 ++ .../matchmaking/matchmaking_service.cpp | 10 ++ src/util/explosion_anti_cheat_bypass.hpp | 3 - src/util/scripts.hpp | 36 ++++-- src/views/debug/view_debug_misc.cpp | 1 - src/views/network/view_controls.cpp | 48 +------- 20 files changed, 86 insertions(+), 286 deletions(-) create mode 100644 src/backend/commands/player/kick/null_function_kick.cpp delete mode 100644 src/backend/looped/session/spoof_host_token.cpp delete mode 100644 src/hooks/misc/add_gamer_to_session.cpp diff --git a/cmake/gtav-classes.cmake b/cmake/gtav-classes.cmake index 66e05572..2ae3d1d5 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 9ca0cb74882505d7d2c382e9a588972fd4589775 + GIT_TAG e803b20ec3d6cf20d6b254c915e088bd010f006e GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/backend/commands/player/kick/null_function_kick.cpp b/src/backend/commands/player/kick/null_function_kick.cpp new file mode 100644 index 00000000..5a833150 --- /dev/null +++ b/src/backend/commands/player/kick/null_function_kick.cpp @@ -0,0 +1,24 @@ +#include "backend/player_command.hpp" +#include "pointers.hpp" + +namespace big +{ + class null_function_kick : player_command + { + using player_command::player_command; + + virtual CommandAccessLevel get_access_level() override + { + return CommandAccessLevel::TOXIC; + } + + virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr ctx) override + { + const size_t arg_count = 16; + int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl, (int64_t)self::id, 1 << player->id(), (int64_t)(int)-1}; + g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::InteriorControl); + } + }; + + null_function_kick g_null_function_kick("nfkick", "NULL_FUNCTION_KICK", "NULL_FUNCTION_KICK_DESC", 0); +} \ No newline at end of file diff --git a/src/backend/commands/player/kick/smart_kick.cpp b/src/backend/commands/player/kick/smart_kick.cpp index 9a13cf54..193a9ea9 100644 --- a/src/backend/commands/player/kick/smart_kick.cpp +++ b/src/backend/commands/player/kick/smart_kick.cpp @@ -21,10 +21,7 @@ namespace big { if (player->is_host()) { - constexpr size_t arg_count = 16; - int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl, (int64_t)self::id, 1 << player->id(), (int64_t)(int)-1}; - - g_pointers->m_gta.m_trigger_script_event(1, args, arg_count, 1 << player->id(), (int)eRemoteEvent::InteriorControl); + player_command::get("nfkick"_J)->call(player, {}); } else { diff --git a/src/backend/commands/player/toxic/kick_from_interior.cpp b/src/backend/commands/player/toxic/kick_from_interior.cpp index efb3c2cf..c8133b07 100644 --- a/src/backend/commands/player/toxic/kick_from_interior.cpp +++ b/src/backend/commands/player/toxic/kick_from_interior.cpp @@ -23,14 +23,14 @@ namespace big if (scr_globals::gpbd_fm_1.as()->Entries[player->id()].PropertyData.Index != -1) { auto cxn = g_script_connection_service->create_connection("am_mp_property_int", player); - cxn->set_host_broadcast_size(1317); + cxn->set_host_broadcast_size(1319); // cxn->set_player_broadcast_size(1185); cxn->set_no_remote_start(true); cxn->set_wait_for_host_broadcast_data(true); cxn->set_quick_cleanup(true); cxn->set_debug_logging(true); cxn->set_broadcast_modify_callback([](rage::scrThread* thread, uint64_t* server_vars, uint64_t* client_vars) { - server_vars[677] = 1; // this changes every update + server_vars[679] = 1; // this changes every update }); g_fiber_pool->queue_job([cxn] { diff --git a/src/backend/looped/session/spoof_host_token.cpp b/src/backend/looped/session/spoof_host_token.cpp deleted file mode 100644 index 25f1204f..00000000 --- a/src/backend/looped/session/spoof_host_token.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "backend/looped_command.hpp" -#include "pointers.hpp" -#include "gta_util.hpp" -#include "util/math.hpp" -#include -#include - -namespace big -{ - void set_peer_id_upper(std::uint64_t upper) - { - *g_pointers->m_gta.m_peer_id &= 0xFFFFFFFF; - *g_pointers->m_gta.m_peer_id |= (upper << 32); - - if (gta_util::get_network()->m_game_session_ptr) - gta_util::get_network()->m_game_session_ptr->m_local_player.m_player_data.m_peer_id = *g_pointers->m_gta.m_peer_id; - if (gta_util::get_network()->m_transition_session_ptr) - gta_util::get_network()->m_transition_session_ptr->m_local_player.m_player_data.m_peer_id = *g_pointers->m_gta.m_peer_id; - - g_pointers->m_gta.m_profile_gamer_info->m_peer_id = *g_pointers->m_gta.m_peer_id; - g_pointers->m_gta.m_player_info_gamer_info->m_peer_id = *g_pointers->m_gta.m_peer_id; - if (g_pointers->m_gta.m_communications != nullptr) - (*g_pointers->m_gta.m_communications)->m_voice.m_connections[0]->m_gamer_info.m_peer_id = *g_pointers->m_gta.m_peer_id; - - if (g_local_player && g_local_player->m_player_info) - g_local_player->m_player_info->m_net_player_data.m_peer_id = *g_pointers->m_gta.m_peer_id; - } - - void set_host_token(std::uint64_t token) - { - *g_pointers->m_gta.m_host_token = token; - - if (gta_util::get_network()->m_game_session_ptr) - gta_util::get_network()->m_game_session_ptr->m_local_player.m_player_data.m_host_token = token; - if (gta_util::get_network()->m_transition_session_ptr) - gta_util::get_network()->m_transition_session_ptr->m_local_player.m_player_data.m_host_token = token; - - g_pointers->m_gta.m_profile_gamer_info->m_host_token = token; - g_pointers->m_gta.m_player_info_gamer_info->m_host_token = token; - if (g_pointers->m_gta.m_communications != nullptr) - (*g_pointers->m_gta.m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = token; - - if (g_local_player && g_local_player->m_player_info) - g_local_player->m_player_info->m_net_player_data.m_host_token = token; - - - set_peer_id_upper(token >> 32); - } - - class spoof_host_token_internal : looped_command - { - using looped_command::looped_command; - - virtual void on_enable() override - { - g.session.original_host_token = *g_pointers->m_gta.m_host_token; - } - - virtual void on_tick() override - { - if (g.session.spoof_host_token_dirty && gta_util::get_network()->m_game_session_state == 0) - { - switch (g.session.spoof_host_token_type) - { - case 0: // Disabled - { - set_host_token(g.session.original_host_token); - break; - } - case 1: // Legit - { - std::uint64_t rand_upper = math::rand(20, 230); - set_host_token(((g.session.original_host_token) & 0xFFFFFFFF) | (rand_upper << 32)); - break; - } - case 2: // Aggressive - { - set_host_token(math::rand(10, 1000)); - break; - } - case 3: // Very aggressive - { - set_host_token(0); - break; - } - case 4: // Custom - { - set_host_token(g.session.custom_host_token); - break; - } - } - g.session.spoof_host_token_dirty = false; - } - } - - virtual void on_disable() override - { - if (g.session.original_host_token) - set_host_token(g.session.original_host_token); - } - }; - - static bool true_ref = true; - spoof_host_token_internal g_spoof_host_token_internal("$$spoofhosttoken", "", "", true_ref); -} \ No newline at end of file diff --git a/src/byte_patch_manager.cpp b/src/byte_patch_manager.cpp index d3200ffd..6e88dfd3 100644 --- a/src/byte_patch_manager.cpp +++ b/src/byte_patch_manager.cpp @@ -24,8 +24,6 @@ namespace big // Patch blocked explosions explosion_anti_cheat_bypass::m_can_blame_others = memory::byte_patch::make(g_pointers->m_gta.m_blame_explode.as(), 0xE990).get(); - explosion_anti_cheat_bypass::m_set_script_flag = - memory::byte_patch::make(g_pointers->m_gta.m_blame_explode.sub(0x63).as(), 0x90909090).get(); explosion_anti_cheat_bypass::m_can_use_blocked_explosions = memory::byte_patch::make(g_pointers->m_gta.m_explosion_patch.sub(12).as(), 0x9090).get(); diff --git a/src/core/settings.hpp b/src/core/settings.hpp index 087dfa9d..bfd0b1c9 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -419,9 +419,6 @@ namespace big bool log_text_messages = false; bool decloak_players = false; bool unhide_players_from_player_list = true; - int spoof_host_token_type = 0; - std::uint64_t custom_host_token = 0x000000200235F2EA; - bool hide_token_spoofing_when_host = true; bool force_script_host = false; bool player_magnet_enabled = false; int player_magnet_count = 32; @@ -441,8 +438,7 @@ namespace big bool chat_commands = false; CommandAccessLevel chat_command_default_access_level = CommandAccessLevel::FRIENDLY; - bool kick_host_when_forcing_host = false; - bool exclude_modders_from_kick_host = false; + bool kick_host_to_stay_in_session = true; bool explosion_karma = false; bool damage_karma = false; @@ -464,8 +460,6 @@ namespace big script_block_opts script_block_opts; // not to be saved - std::atomic_bool spoof_host_token_dirty = true; - std::uint64_t original_host_token = 0; bool join_queued = false; rage::rlSessionInfo info; bool never_wanted_all = false; @@ -492,7 +486,7 @@ namespace big NLOHMANN_DEFINE_TYPE_INTRUSIVE(chat_translator, enabled, print_result, draw_result, bypass_same_language, target_language, endpoint); } chat_translator{}; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(session, log_chat_messages, log_text_messages, decloak_players, spoof_host_token_type, custom_host_token, hide_token_spoofing_when_host, force_script_host, player_magnet_enabled, player_magnet_count, is_team, join_in_sctv_slots, kick_host_when_forcing_host, exclude_modders_from_kick_host, explosion_karma, damage_karma, disable_traffic, disable_peds, force_thunder, block_ceo_money, randomize_ceo_colors, block_jobs, block_muggers, block_ceo_raids, block_ceo_creation, send_to_apartment_idx, send_to_warehouse_idx, chat_commands, chat_command_default_access_level, anonymous_bounty, lock_session, fast_join, unhide_players_from_player_list, allow_friends_into_locked_session, trust_friends, use_spam_timer, spam_timer, spam_length, chat_translator, script_block_opts) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(session, log_chat_messages, log_text_messages, decloak_players, force_script_host, player_magnet_enabled, player_magnet_count, is_team, join_in_sctv_slots, kick_host_to_stay_in_session, explosion_karma, damage_karma, disable_traffic, disable_peds, force_thunder, block_ceo_money, randomize_ceo_colors, block_jobs, block_muggers, block_ceo_raids, block_ceo_creation, send_to_apartment_idx, send_to_warehouse_idx, chat_commands, chat_command_default_access_level, anonymous_bounty, lock_session, fast_join, unhide_players_from_player_list, allow_friends_into_locked_session, trust_friends, use_spam_timer, spam_timer, spam_length, chat_translator, script_block_opts) } session{}; struct settings diff --git a/src/gta_pointers.hpp b/src/gta_pointers.hpp index 9b50295a..1a5c871e 100644 --- a/src/gta_pointers.hpp +++ b/src/gta_pointers.hpp @@ -192,13 +192,6 @@ namespace big PVOID m_init_native_tables; functions::script_vm m_script_vm; - functions::generate_uuid m_generate_uuid; - uint64_t* m_host_token; - uint64_t* m_peer_id; - rage::rlGamerInfo* m_profile_gamer_info; // per profile gamer info - rage::rlGamerInfo* m_player_info_gamer_info; // the gamer info that is applied to CPlayerInfo - CCommunications** m_communications; - PVOID m_handle_join_request; functions::write_join_response_data m_write_join_response_data; @@ -388,8 +381,6 @@ namespace big void** m_dlc_manager; PVOID m_get_dlc_hash; - PVOID m_add_gamer_to_session; - functions::set_head_blend_data m_set_head_blend_data; std::uint32_t* m_object_ids_offset; diff --git a/src/hooking/hooking.cpp b/src/hooking/hooking.cpp index ffc03bb2..64489c53 100644 --- a/src/hooking/hooking.cpp +++ b/src/hooking/hooking.cpp @@ -153,8 +153,6 @@ namespace big detour_hook_helper::add("GDLCH", g_pointers->m_gta.m_get_dlc_hash); - detour_hook_helper::add("AGTS", g_pointers->m_gta.m_add_gamer_to_session); - detour_hook_helper::add("CPI", g_pointers->m_gta.m_create_pool_item); detour_hook_helper::add("NCAM", g_pointers->m_gta.m_network_can_access_multiplayer); diff --git a/src/hooking/hooking.hpp b/src/hooking/hooking.hpp index 21037fe5..c1e91972 100644 --- a/src/hooking/hooking.hpp +++ b/src/hooking/hooking.hpp @@ -208,7 +208,6 @@ namespace big static void send_session_detail_msg(rage::netConnectionManager* mgr, rage::netConnection::InFrame* request_frame, rage::rlSessionDetailMsg* msg); static std::uint32_t get_dlc_hash(void* mgr, std::uint32_t seed); - static bool add_gamer_to_session(rage::netConnectionManager* mgr, std::uint32_t msg_id, int* req_id, RemoteGamerInfoMsg* info, int flags, void* a6); static void* create_pool_item(GenericPool* pool); diff --git a/src/hooks/matchmaking/create_session_detail_response.cpp b/src/hooks/matchmaking/create_session_detail_response.cpp index c190b585..9940261f 100644 --- a/src/hooks/matchmaking/create_session_detail_response.cpp +++ b/src/hooks/matchmaking/create_session_detail_response.cpp @@ -1,6 +1,5 @@ #include "hooking/hooking.hpp" #include "services/matchmaking/matchmaking_service.hpp" -#include namespace big { @@ -9,9 +8,6 @@ namespace big if (g_matchmaking_service) [[likely]] g_matchmaking_service->handle_session_detail_send_response(msg); - if (g.session.hide_token_spoofing_when_host) - msg->m_detail.m_host_token = g.session.original_host_token; - g_hooking->get_original()(mgr, request_frame, msg); } } \ No newline at end of file diff --git a/src/hooks/misc/add_gamer_to_session.cpp b/src/hooks/misc/add_gamer_to_session.cpp deleted file mode 100644 index a78979c1..00000000 --- a/src/hooks/misc/add_gamer_to_session.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "hooking/hooking.hpp" -#include "services/players/player_service.hpp" - -#include - -namespace big -{ - bool hooks::add_gamer_to_session(rage::netConnectionManager* mgr, std::uint32_t msg_id, int* req_id, RemoteGamerInfoMsg* info, int flags, void* a6) - { - if (g.session.hide_token_spoofing_when_host - && info->m_gamer_info.m_gamer_handle.m_rockstar_id == g_player_service->get_self()->get_rockstar_id()) - { - info->m_gamer_info.m_host_token = g.session.original_host_token; - info->m_gamer_info.m_peer_id = (info->m_gamer_info.m_peer_id & 0xFFFFFFFF) | (g.session.original_host_token & 0xFFFFFFFF00000000); // TODO: P2pSecurity info message - } - - return g_hooking->get_original()(mgr, msg_id, req_id, info, flags, a6); - } -} \ No newline at end of file diff --git a/src/native_hooks/native_hooks.cpp b/src/native_hooks/native_hooks.cpp index 9f7dc9b9..69490dce 100644 --- a/src/native_hooks/native_hooks.cpp +++ b/src/native_hooks/native_hooks.cpp @@ -144,22 +144,28 @@ namespace big add_native_detour("tuneables_processing"_J, NativeIndex::_NETWORK_GET_TUNABLES_REGISTRATION_FLOAT, tunables::_NETWORK_GET_TUNABLES_REGISTRATION_FLOAT); // TODO: is this safe? + add_native_detour("am_mp_hacker_den"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("am_mp_yacht"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("arena_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("armory_aircraft_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("base_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("business_hub_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. - add_native_detour("car_meet_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("carmod_shop"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("car_meet_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("clothes_shop_mp"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("clothes_shop_sp"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("fixer_hq_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("gunclub_shop"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("hacker_den_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("hacker_truck_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("hairdo_shop_mp"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("hairdo_shop_sp"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("hangar_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("juggalo_hideout_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("personal_carmod_shop"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. - add_native_detour("tuner_property_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. - add_native_detour("clothes_shop_mp"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. - add_native_detour("gunclub_shop"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. - add_native_detour("hairdo_shop_mp"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. add_native_detour("tattoo_shop"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("tuner_property_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. + add_native_detour("vinewood_premium_garage_carmod"_J, NativeIndex::FORCE_PED_AI_AND_ANIMATION_UPDATE, all_scripts::DO_NOTHING); //Fix jittering weapons. for (auto& entry : *g_pointers->m_gta.m_script_program_table) if (entry.m_program) diff --git a/src/pointers.cpp b/src/pointers.cpp index 1037c64b..b47fa6f9 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -636,60 +636,6 @@ namespace big g_pointers->m_gta.m_script_vm = ptr.add(1).rip().as(); } }, - // Generate UUID - { - "GU", - "E8 ? ? ? ? 84 C0 74 0C 48 8B 44 24 ? 48 89 03", - [](memory::handle ptr) - { - g_pointers->m_gta.m_generate_uuid = ptr.add(1).rip().as(); - } - }, - // Host Token - { - "HT", - "48 8B 05 ? ? ? ? 48 83 F8 FF", - [](memory::handle ptr) - { - g_pointers->m_gta.m_host_token = ptr.add(3).rip().as(); - } - }, - // Peer ID - { - "PI", - "48 83 F8 FF 74 0D", - [](memory::handle ptr) - { - g_pointers->m_gta.m_peer_id = ptr.add(9).rip().as(); - } - }, - // Profile Gamer Info - { - "PGI", - "48 8D 05 ? ? ? ? 48 8B FE", - [](memory::handle ptr) - { - g_pointers->m_gta.m_profile_gamer_info = ptr.add(3).rip().as(); - } - }, - // Player Info Gamer Info - { - "PIGI", - "E8 ? ? ? ? 48 8D 4B 20 48 8B D0 E8 ? ? ? ? 41 8A CF", - [](memory::handle ptr) - { - g_pointers->m_gta.m_player_info_gamer_info = ptr.add(1).rip().add(3).rip().as(); - } - }, - // Communications - { - "C", - "48 8B 1D ? ? ? ? 48 8D 4C 24 30", - [](memory::handle ptr) - { - g_pointers->m_gta.m_communications = ptr.add(3).rip().as(); - } - }, // Handle Join Request { "HJR", @@ -1842,15 +1788,6 @@ namespace big g_pointers->m_gta.m_get_dlc_hash = ptr.sub(0xA).rip().as(); } }, - // Add Gamer To Session - { - "AGTS", - "7C E8 EB 23", - [](memory::handle ptr) - { - g_pointers->m_gta.m_add_gamer_to_session = ptr.add(0x23).rip().as(); - } - }, // Set Head Blend Data { "SHBD", diff --git a/src/services/battleye/battleye_service.cpp b/src/services/battleye/battleye_service.cpp index bc1a4dd1..3cf80ced 100644 --- a/src/services/battleye/battleye_service.cpp +++ b/src/services/battleye/battleye_service.cpp @@ -310,6 +310,14 @@ namespace big { send_message_to_server(token, message, size); + if (g.session.kick_host_to_stay_in_session && msg[1] == 5) + { + if (auto player = g_player_service->get_by_host_token(token)) + { + player_command::get("nfkick"_J)->call(player, {}); + } + } + break; } case REQUEST: diff --git a/src/services/matchmaking/matchmaking_service.cpp b/src/services/matchmaking/matchmaking_service.cpp index aca55389..67f846e9 100644 --- a/src/services/matchmaking/matchmaking_service.cpp +++ b/src/services/matchmaking/matchmaking_service.cpp @@ -307,6 +307,16 @@ namespace big { if (msg->m_status == 5) { + if (g.spoofing.multiplex_session) + { + msg->m_detail.m_player_count = std::max(25, (int)msg->m_detail.m_player_count); + } + + if (g.spoofing.spoof_session_player_count) + { + msg->m_detail.m_player_count = g.spoofing.session_player_count; + } + if (g.spoofing.increase_player_limit) { msg->m_detail.m_player_count = std::min(29, diff --git a/src/util/explosion_anti_cheat_bypass.hpp b/src/util/explosion_anti_cheat_bypass.hpp index d996567b..2a08a70f 100644 --- a/src/util/explosion_anti_cheat_bypass.hpp +++ b/src/util/explosion_anti_cheat_bypass.hpp @@ -7,18 +7,15 @@ namespace big { inline static memory::byte_patch* m_can_blame_others; inline static memory::byte_patch* m_can_use_blocked_explosions; - inline static memory::byte_patch* m_set_script_flag; inline static void apply() { explosion_anti_cheat_bypass::m_can_blame_others->apply(); explosion_anti_cheat_bypass::m_can_use_blocked_explosions->apply(); - explosion_anti_cheat_bypass::m_set_script_flag->apply(); } inline static void restore() { - explosion_anti_cheat_bypass::m_set_script_flag->restore(); explosion_anti_cheat_bypass::m_can_use_blocked_explosions->restore(); explosion_anti_cheat_bypass::m_can_blame_others->restore(); } diff --git a/src/util/scripts.hpp b/src/util/scripts.hpp index 366bc69d..b02158c0 100644 --- a/src/util/scripts.hpp +++ b/src/util/scripts.hpp @@ -6,6 +6,7 @@ #include "gta_util.hpp" #include "misc.hpp" #include "natives.hpp" +#include "packet.hpp" #include "script.hpp" #include "script_local.hpp" #include "services/players/player_service.hpp" @@ -63,21 +64,34 @@ namespace big::scripts { if (auto launcher = gta_util::find_script_thread(hash); launcher && launcher->m_net_component) { - for (int i = 0; !((CGameScriptHandlerNetComponent*)launcher->m_net_component)->is_local_player_host(); i++) + auto net_component = reinterpret_cast(launcher->m_net_component); + + if (net_component->is_local_player_host()) { - if (i > 200) - return false; - - ((CGameScriptHandlerNetComponent*)launcher->m_net_component) - ->send_host_migration_event(g_player_service->get_self()->get_net_game_player()); - script::get_current()->yield(10ms); - - if (!launcher->m_stack || !launcher->m_net_component) - return false; + return true; } + + net_component->do_host_migration(g_player_service->get_self()->get_net_game_player(), 0xFFFF, true); + + packet pack; + pack.write_message(rage::eNetMessage::MsgScriptVerifyHostAck); + net_component->m_script_handler->get_id()->serialize(&pack.m_buffer); + pack.write(true, 1); + pack.write(true, 1); + pack.write(0xFFFF, 16); + + for (auto& player : g_player_service->players()) + { + if (player.second->get_net_game_player()) + { + pack.send(player.second->get_net_game_player()->m_msg_id); + } + } + + return true; } - return true; + return false; } inline int launcher_index_from_hash(rage::joaat_t script_hash) diff --git a/src/views/debug/view_debug_misc.cpp b/src/views/debug/view_debug_misc.cpp index 0b45fa75..00c66a0f 100644 --- a/src/views/debug/view_debug_misc.cpp +++ b/src/views/debug/view_debug_misc.cpp @@ -18,7 +18,6 @@ namespace big { if (ImGui::BeginTabItem("DEBUG_TAB_MISC"_T.data())) { - components::command_checkbox<"battleyeserver">(); components::command_checkbox<"external_console">(); components::command_checkbox<"windowhook">("VIEW_DEBUG_MISC_DISABLE_GTA_WINDOW_HOOK"_T); diff --git a/src/views/network/view_controls.cpp b/src/views/network/view_controls.cpp index 16f9b0c1..d3c285d2 100644 --- a/src/views/network/view_controls.cpp +++ b/src/views/network/view_controls.cpp @@ -127,52 +127,8 @@ namespace big { ImGui::BeginGroup(); components::small_text("FORCE_HOST"_T); - - static constexpr auto token_spoof_types = std::to_array({"SPOOF_HOST_TOKEN_OFF", "SPOOF_HOST_TOKEN_TYPE_LEGIT", "SPOOF_HOST_TOKEN_TYPE_AGGRESSIVE", "SPOOF_HOST_TOKEN_TYPE_EXTRA_AGGRESSIVE", "SPOOF_HOST_TOKEN_TYPE_CUSTOM"}); - - ImGui::BeginDisabled(gta_util::get_network()->m_game_session_state != 0); - - ImGui::SetNextItemWidth(300); - if (ImGui::BeginCombo("HOST_TOKEN_SPOOFING"_T.data(), - g_translation_service.get_translation(token_spoof_types[g.session.spoof_host_token_type]).data())) - { - for (int i = 0; i < token_spoof_types.size(); i++) - { - if (ImGui::Selectable(g_translation_service.get_translation(token_spoof_types[i]).data(), i == g.session.spoof_host_token_type)) - { - g.session.spoof_host_token_type = i; - g_fiber_pool->queue_job([] { - g.session.spoof_host_token_dirty = true; - }); // this part gets a bit racy so we're setting it in a fiber pool - } - - if (i == 0) - ImGui::EndDisabled(); - - if (i == g.session.spoof_host_token_type) - { - ImGui::SetItemDefaultFocus(); - } - } - - ImGui::EndCombo(); - } - - if (g.session.spoof_host_token_type != 0) - { - ImGui::Checkbox("HIDE_TOKEN_SPOOFING_WHEN_HOST"_T.data(), &g.session.hide_token_spoofing_when_host); - } - - if (g.session.spoof_host_token_type == 4) - { - ImGui::SetNextItemWidth(200); - if (ImGui::InputScalar("##token_input", ImGuiDataType_U64, &g.session.custom_host_token, nullptr, nullptr, "%p", ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase)) - { - g.session.spoof_host_token_dirty = true; - } - } - - ImGui::EndDisabled(); + + ImGui::Checkbox("KICK_HOST_TO_STAY_IN_SESSION"_T.data(), &g.session.kick_host_to_stay_in_session); ImGui::Checkbox("FORCE_SCRIPT_HOST"_T.data(), &g.session.force_script_host); if (ImGui::IsItemHovered())