diff --git a/src/core/globals.hpp b/src/core/globals.hpp index 1a2bcb04..deb0f09b 100644 --- a/src/core/globals.hpp +++ b/src/core/globals.hpp @@ -394,9 +394,11 @@ namespace big struct spoofing { bool spoof_username = false; + bool spoof_local_username = false; std::string username = ""; - bool spoof_ip = true; + // enabling this by default causes confusion and many get dropped out of their sessions + bool spoof_ip = false; std::array ip_address = { 42, 42, 42, 42 }; bool spoof_rockstar_id = false; @@ -427,10 +429,10 @@ namespace big uint64_t applied_spoof_rockstar_id = 0; NLOHMANN_DEFINE_TYPE_INTRUSIVE(spoofing, - spoof_username, username, spoof_ip, ip_address, spoof_rockstar_id, rockstar_id, spoof_cheater, - spoof_hide_god, spoof_hide_spectate, spoof_rockstar_dev, spoof_rockstar_qa, spoof_crew_data, - crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type, - spoof_session_language, session_language, spoof_session_player_count, session_player_count) + spoof_username, spoof_local_username, username, spoof_ip, ip_address, spoof_rockstar_id, rockstar_id, + spoof_cheater, spoof_hide_god, spoof_hide_spectate, spoof_rockstar_dev, spoof_rockstar_qa, spoof_crew_data, + crew_tag, rockstar_crew, square_crew_tag, spoof_session_region_type, session_region_type, spoof_session_language, + session_language, spoof_session_player_count, session_player_count) } spoofing{}; struct vehicle diff --git a/src/hooks/player_management/network_player_mgr.cpp b/src/hooks/player_management/network_player_mgr.cpp index 11a7cb97..7ec41e0f 100644 --- a/src/hooks/player_management/network_player_mgr.cpp +++ b/src/hooks/player_management/network_player_mgr.cpp @@ -1,9 +1,13 @@ #include "hooking.hpp" +#include "memory/byte_patch.hpp" +#include "pointers.hpp" #include "services/players/player_service.hpp" #include namespace big { + static memory::byte_patch* local_name_patch{}; + void hooks::network_player_mgr_init(CNetworkPlayerMgr* _this, std::uint64_t a2, std::uint32_t a3, std::uint32_t a4[4]) { if (g.notifications.network_player_mgr_init.log) @@ -11,6 +15,13 @@ namespace big if (g.notifications.network_player_mgr_init.notify) g_notification_service->push("Network Player Manager", "Entering session and initializing player data."); + // set our local spoofed name + if (g.spoofing.spoof_username && g.spoofing.spoof_local_username) + { + local_name_patch = memory::byte_patch::make(g_pointers->m_chat_gamer_info->m_name, g.spoofing.username).get(); + local_name_patch->apply(); + } + g_hooking->get_original()(_this, a2, a3, a4); g_player_service->player_join(_this->m_local_net_player); @@ -21,6 +32,12 @@ namespace big g.m_spoofed_peer_ids.clear(); g_player_service->do_cleanup(); + // restore our original name + if (strcmp(g_pointers->m_chat_gamer_info->m_name, _this->m_local_net_player->get_name()) && local_name_patch) + { + local_name_patch->remove(); + } + if (g.notifications.network_player_mgr_shutdown.log) LOG(INFO) << "CNetworkPlayerMgr#shutdown got called, we're probably leaving our session."; if (g.notifications.network_player_mgr_shutdown.notify) diff --git a/src/hooks/spoofing/send_net_info_to_lobby.cpp b/src/hooks/spoofing/send_net_info_to_lobby.cpp index 4490a256..dfd7a00a 100644 --- a/src/hooks/spoofing/send_net_info_to_lobby.cpp +++ b/src/hooks/spoofing/send_net_info_to_lobby.cpp @@ -1,4 +1,5 @@ #include "hooking.hpp" +#include "pointers.hpp" constexpr static auto advertisments = std::to_array( { @@ -20,7 +21,9 @@ namespace big if (is_local_player) { if (g.spoofing.spoof_username) + { memcpy(player->m_name, g.spoofing.username.c_str(), sizeof(player->m_name)); + } if (g.spoofing.spoof_ip) { diff --git a/src/native_hooks/all_scripts.hpp b/src/native_hooks/all_scripts.hpp index 574ea86e..a19249ec 100644 --- a/src/native_hooks/all_scripts.hpp +++ b/src/native_hooks/all_scripts.hpp @@ -10,6 +10,20 @@ namespace big { namespace all_scripts { + void GET_PLAYER_NAME(rage::scrNativeCallContext* src) + { + const auto playerId = src->get_arg(0); + src->set_return_value(PLAYER::GET_PLAYER_NAME(playerId)); + if (g.spoofing.spoof_username && g.spoofing.spoof_local_username) + { + const auto network_player_mgr = gta_util::get_network_player_mgr(); + if (network_player_mgr && network_player_mgr->m_local_net_player && playerId == network_player_mgr->m_local_net_player->m_player_id) + { + src->set_return_value(g.spoofing.username.c_str()); + } + } + } + void IS_DLC_PRESENT(rage::scrNativeCallContext* src) { const auto hash = src->get_arg(0); diff --git a/src/native_hooks/native_hooks.cpp b/src/native_hooks/native_hooks.cpp index 6520532b..e2b264cb 100644 --- a/src/native_hooks/native_hooks.cpp +++ b/src/native_hooks/native_hooks.cpp @@ -103,6 +103,7 @@ namespace big native_hooks::native_hooks() { + add_native_detour(0x6D0DE6A7B5DA71F8, all_scripts::GET_PLAYER_NAME); add_native_detour(0x812595A0644CE1DE, all_scripts::IS_DLC_PRESENT); add_native_detour(0x1CA59E306ECB80A5, all_scripts::NETWORK_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT); add_native_detour(0xD1110739EEADB592, all_scripts::NETWORK_TRY_TO_SET_THIS_SCRIPT_IS_NETWORK_SCRIPT); diff --git a/src/pointers.cpp b/src/pointers.cpp index 6e881245..47d71381 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -756,6 +756,12 @@ namespace big m_interval_check_func = ptr.add(3).rip().as(); }); + // Chat Gamer Info + main_batch.add("CGI", "E8 ? ? ? ? 48 8B CF E8 ? ? ? ? 8B E8", [this](memory::handle ptr) + { + m_chat_gamer_info = ptr.add(1).rip().add(6).rip().as(); + }); + auto mem_region = memory::module("GTA5.exe"); main_batch.run(mem_region); diff --git a/src/pointers.hpp b/src/pointers.hpp index 7afe680f..63fee357 100644 --- a/src/pointers.hpp +++ b/src/pointers.hpp @@ -19,6 +19,7 @@ namespace rage class atSingleton; class RageSecurity; class netTime; + class rlGamerInfo; } namespace big @@ -221,6 +222,8 @@ namespace big rage::netTime** m_network_time; functions::sync_network_time m_sync_network_time; + + rage::rlGamerInfo* m_chat_gamer_info; }; inline pointers* g_pointers{}; diff --git a/src/views/network/view_spoofing.cpp b/src/views/network/view_spoofing.cpp index 0f8294cc..428c457d 100644 --- a/src/views/network/view_spoofing.cpp +++ b/src/views/network/view_spoofing.cpp @@ -9,15 +9,20 @@ namespace big { void view::spoofing() { - components::small_text("To spoof any of the below credentials you need to reconnect with the lobby."); - - components::sub_title("Username"); - g_fiber_pool->queue_job([] { PAD::DISABLE_ALL_CONTROL_ACTIONS(0); }); + components::small_text("To spoof any of the below credentials you need to reconnect with the lobby.\nAll spoofed details will be only visible by other players, your game will still show your actual name, ip, rid..."); + + components::sub_title("Username"); + ImGui::Checkbox("Spoof Username", &g.spoofing.spoof_username); + if (g.spoofing.spoof_username) + { + ImGui::SameLine(); + ImGui::Checkbox("Spoof Username Locally", &g.spoofing.spoof_local_username); + } constexpr size_t name_size = RTL_FIELD_SIZE(rage::rlGamerInfo, m_name); static char name[name_size]; @@ -33,11 +38,9 @@ namespace big components::sub_title("IP Address"); - g_fiber_pool->queue_job([] { - PAD::DISABLE_ALL_CONTROL_ACTIONS(0); - }); - ImGui::Checkbox("Spoof IP", &g.spoofing.spoof_ip); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Disable this feature if you're having trouble joining sessions."); ImGui::Text("IP Address:"); ImGui::DragInt4("##ip_fields", g.spoofing.ip_address.data(), 0, 255); @@ -46,10 +49,6 @@ namespace big components::sub_title("Rockstar ID"); - g_fiber_pool->queue_job([] { - PAD::DISABLE_ALL_CONTROL_ACTIONS(0); - }); - ImGui::Checkbox("Spoof Rockstar ID", &g.spoofing.spoof_rockstar_id); ImGui::Text("Rockstar ID:"); @@ -61,10 +60,6 @@ namespace big components::sub_title("Crew"); - g_fiber_pool->queue_job([] { - PAD::DISABLE_ALL_CONTROL_ACTIONS(0); - }); - ImGui::Checkbox("Spoof Crew", &g.spoofing.spoof_crew_data); constexpr size_t crew_tag_size = RTL_FIELD_SIZE(ClanData, m_clan_tag);