From 7f37def248d5287e0e78569cbb6924c6f2f407a2 Mon Sep 17 00:00:00 2001 From: maybegreat48 <96936658+maybegreat48@users.noreply.github.com> Date: Sat, 4 Feb 2023 16:35:18 +0000 Subject: [PATCH] More fixes for 1.66 (#944) * fix(Menu): more update fixes * fix(Spoofing): remove spoofing * fix(Globals): update globals * fix(Classes): upstream classes * fix(Misc): remove debug code * fix(Merge) --- scripts/gtav-classes.cmake | 2 +- .../player/kick/gamer_instruction_kick.cpp | 47 ------- .../player/kick/lost_connection_kick.cpp | 6 +- src/backend/looped/self/dance_mode.cpp | 3 + src/backend/reactions/reaction.cpp | 2 +- src/backend/script_patches.hpp | 2 + src/core/scr_globals.hpp | 2 +- .../assign_physical_index.cpp | 12 +- .../protections/add_player_to_session.cpp | 2 +- src/hooks/protections/handle_join_request.cpp | 2 +- src/hooks/protections/receive_net_message.cpp | 12 +- .../protections/script_event_handler.cpp | 14 +- src/pointers.cpp | 4 +- src/services/friends/friends_service.cpp | 2 +- .../player_database_service.cpp | 8 +- src/services/players/player.cpp | 27 +++- src/services/players/player.hpp | 2 + src/util/notify.hpp | 2 +- src/util/session.hpp | 131 ------------------ src/util/spam.hpp | 2 +- src/views/debug/view_debug_misc.cpp | 41 ++++++ src/views/network/view_player_database.cpp | 5 - src/views/network/view_session.cpp | 14 +- src/views/network/view_spoofing.cpp | 12 +- src/views/players/player/player_info.cpp | 27 ++-- src/views/players/player/player_kick.cpp | 6 +- src/views/players/player/player_misc.cpp | 1 + 27 files changed, 139 insertions(+), 251 deletions(-) delete mode 100644 src/backend/commands/player/kick/gamer_instruction_kick.cpp diff --git a/scripts/gtav-classes.cmake b/scripts/gtav-classes.cmake index 251763da..a15ebe83 100644 --- a/scripts/gtav-classes.cmake +++ b/scripts/gtav-classes.cmake @@ -3,7 +3,7 @@ include(FetchContent) FetchContent_Declare( gtav_classes GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git - GIT_TAG f155790d38c131f4df0933283a577423e0ddd2da + GIT_TAG 4f93aec221704c74daefab2362b88429ac2dc6bc GIT_PROGRESS TRUE CONFIGURE_COMMAND "" BUILD_COMMAND "" diff --git a/src/backend/commands/player/kick/gamer_instruction_kick.cpp b/src/backend/commands/player/kick/gamer_instruction_kick.cpp deleted file mode 100644 index 59d478f4..00000000 --- a/src/backend/commands/player/kick/gamer_instruction_kick.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "backend/player_command.hpp" -#include "natives.hpp" -#include "pointers.hpp" -#include "core/scr_globals.hpp" -#include "packet.hpp" -#include "gta_util.hpp" - -#include - -namespace big -{ - class gamer_instruction_kick : player_command - { - using player_command::player_command; - - void gamer_handle_serialize(rage::rlGamerHandle& hnd, rage::datBitBuffer& buf) - { - buf.Write(*reinterpret_cast(&hnd.m_platform), 8); - if (*reinterpret_cast(&hnd.m_platform) == 3) - { - buf.WriteInt64(*(int64_t*)&hnd.m_rockstar_id, 64); - buf.Write(*reinterpret_cast(reinterpret_cast<__int64>(&hnd) + 9), 8); - } - } - - virtual CommandAccessLevel get_access_level() - { - return CommandAccessLevel::TOXIC; - } - - virtual void execute(player_ptr player, const std::vector& _args, const std::shared_ptr ctx) - { - packet msg; - msg.write_message(rage::eNetMessage::MsgTransitionGamerInstruction); - gamer_handle_serialize(g_player_service->get_selected()->get_net_data()->m_gamer_handle_2, msg.m_buffer); // src - gamer_handle_serialize(g_player_service->get_selected()->get_net_data()->m_gamer_handle_2, msg.m_buffer); // target - msg.write(false, 1); // string extend - msg.write(0, 7); // string length - msg.write(8, 32); // instruction type - msg.write(0, 32); - msg.write(0, 32); - msg.send(g_player_service->get_selected(), gta_util::get_network()->m_transition_session.m_connection_identifier); - } - }; - - gamer_instruction_kick g_gamer_instruction_kick("gikick", "Gamer Instruction Kick", "This is unlikely to kick menus that block NETWORK_BAIL", 0); -} \ No newline at end of file diff --git a/src/backend/commands/player/kick/lost_connection_kick.cpp b/src/backend/commands/player/kick/lost_connection_kick.cpp index 4e6d6844..41362da0 100644 --- a/src/backend/commands/player/kick/lost_connection_kick.cpp +++ b/src/backend/commands/player/kick/lost_connection_kick.cpp @@ -19,7 +19,7 @@ namespace big if (*reinterpret_cast(&hnd.m_platform) == 3) { buf.WriteInt64(*(int64_t*)&hnd.m_rockstar_id, 64); - buf.Write(*reinterpret_cast(reinterpret_cast<__int64>(&hnd) + 9), 8); + buf.Write(hnd.unk_0009, 8); } } @@ -39,12 +39,12 @@ namespace big packet msg{}; msg.write_message(rage::eNetMessage::MsgLostConnectionToHost); msg.write(gta_util::get_network()->m_game_session_ptr->m_rline_session.m_session_id, 64); - gamer_handle_serialize((*(rage::rlGamerHandle*)(&player->get_net_data()->m_gamer_handle_2.m_rockstar_id)), msg); + gamer_handle_serialize(player->get_net_data()->m_gamer_handle, msg); for (auto& [_, plyr] : g_player_service->players()) { if (plyr->is_host()) { - msg.send(plyr, gta_util::get_network()->m_game_session_ptr->m_connection_identifier); + msg.send(plyr->get_session_player()->m_msg_id); break; } } diff --git a/src/backend/looped/self/dance_mode.cpp b/src/backend/looped/self/dance_mode.cpp index 9f73364b..cf05a75d 100644 --- a/src/backend/looped/self/dance_mode.cpp +++ b/src/backend/looped/self/dance_mode.cpp @@ -3,6 +3,7 @@ #include "util/entity.hpp" #include "util/scripts.hpp" #include "script_function.hpp" +#include "services/script_patcher/script_patcher_service.hpp" namespace big { @@ -14,6 +15,7 @@ namespace big if (g.self.dance_mode && g.self.dance_mode != bLastDanceMode) { + g_script_patcher_service->update(); scripts::request_script(RAGE_JOAAT("am_mp_nightclub")); if (!scripts::wait_till_loaded(RAGE_JOAAT("am_mp_nightclub"))) return; @@ -51,6 +53,7 @@ namespace big g.m_dance_thread = nullptr; g.m_dance_program = nullptr; + g_script_patcher_service->update(); bLastDanceMode = false; return; } diff --git a/src/backend/reactions/reaction.cpp b/src/backend/reactions/reaction.cpp index d53b85f8..c0a24c48 100644 --- a/src/backend/reactions/reaction.cpp +++ b/src/backend/reactions/reaction.cpp @@ -20,7 +20,7 @@ namespace big { if (log) { - uint64_t rockstar_id = player->get_net_data() == nullptr ? 0 : player->get_net_data()->m_gamer_handle_2.m_rockstar_id; + uint64_t rockstar_id = player->get_net_data() == nullptr ? 0 : player->get_net_data()->m_gamer_handle.m_rockstar_id; LOG(WARNING) << std::format("Received {} from {} ({})", m_event_name, player->get_name(), rockstar_id); } diff --git a/src/backend/script_patches.hpp b/src/backend/script_patches.hpp index e659aeff..53e48434 100644 --- a/src/backend/script_patches.hpp +++ b/src/backend/script_patches.hpp @@ -17,6 +17,8 @@ namespace big g_script_patcher_service->add_patch({ RAGE_JOAAT("freemode"), "2D 00 CF 00 00 ", 5, { 0x2E, 0x00, 0x00 }, &g.session.block_ceo_raids }); g_script_patcher_service->add_patch({ RAGE_JOAAT("shop_controller"), "2D 01 04 00 00 2C ? ? ? 56 ? ? 71", 5, { 0x71, 0x2E, 0x01, 0x01 }, nullptr }); // despawn bypass g_script_patcher_service->add_patch({ RAGE_JOAAT("shop_controller"), "38 00 5D ? ? ? 38 00 5D ? ? ? 38 00 41", 0, std::vector(12, 0x0), nullptr}); // godmode/invisibility detection bypass + g_script_patcher_service->add_patch({ RAGE_JOAAT("am_mp_nightclub"), "2D 01 03 00 00 2C ? ? ? 56 ? ? 72 2E ? ? 38 00", 5, { 0x72, 0x2E, 0x01, 0x01 }, &g.self.dance_mode }); + g_script_patcher_service->add_patch({ RAGE_JOAAT("am_mp_nightclub"), "20 56 ? ? 4F ? ? 46 ? ? 41 ? 71", 0, { 0x2B, 0x55 }, &g.self.dance_mode }); for (auto& entry : *g_pointers->m_script_program_table) { diff --git a/src/core/scr_globals.hpp b/src/core/scr_globals.hpp index e4a76235..e5a58b94 100644 --- a/src/core/scr_globals.hpp +++ b/src/core/scr_globals.hpp @@ -37,7 +37,7 @@ namespace big::scr_globals static inline script_global vehicle_global = script_global(1586468); static inline script_global mechanic_global = script_global(2793046); - static inline script_global spawn_global = script_global(2694560); + static inline script_global spawn_global = script_global(2694562); } namespace big::scr_locals diff --git a/src/hooks/player_management/assign_physical_index.cpp b/src/hooks/player_management/assign_physical_index.cpp index b9f8971d..fba2b595 100644 --- a/src/hooks/player_management/assign_physical_index.cpp +++ b/src/hooks/player_management/assign_physical_index.cpp @@ -23,12 +23,12 @@ namespace big if (g.notifications.player_leave.log) LOG(INFO) << "Player left '" << net_player_data->m_name << "' freeing slot #" << (int)player->m_player_id - << " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id; + << " with Rockstar ID: " << net_player_data->m_gamer_handle.m_rockstar_id; if (g.notifications.player_leave.notify) { g_notification_service->push("PLAYER_LEFT"_T.data(), - std::vformat("PLAYER_LEFT_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id))); + std::vformat("PLAYER_LEFT_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle.m_rockstar_id))); } } @@ -45,12 +45,12 @@ namespace big if (g.notifications.player_join.log) LOG(INFO) << "Player joined '" << net_player_data->m_name << "' allocating slot #" << (int)player->m_player_id - << " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id; + << " with Rockstar ID: " << net_player_data->m_gamer_handle.m_rockstar_id; if (g.notifications.player_join.notify) { g_notification_service->push("PLAYER_JOINED"_T.data(), - std::vformat("PLAYER_JOINED_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id))); + std::vformat("PLAYER_JOINED_INFO"_T, std::make_format_args(net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle.m_rockstar_id))); } auto id = player->m_player_id; @@ -58,9 +58,9 @@ namespace big { if (auto plyr = g_player_service->get_by_id(id)) { - if (plyr->get_net_data()->m_gamer_handle_2.m_rockstar_id != 0) + if (plyr->get_net_data()->m_gamer_handle.m_rockstar_id != 0) { - if (auto entry = g_player_database_service->get_player_by_rockstar_id(plyr->get_net_data()->m_gamer_handle_2.m_rockstar_id)) + if (auto entry = g_player_database_service->get_player_by_rockstar_id(plyr->get_net_data()->m_gamer_handle.m_rockstar_id)) { plyr->is_modder = entry->is_modder; plyr->block_join = entry->block_join; diff --git a/src/hooks/protections/add_player_to_session.cpp b/src/hooks/protections/add_player_to_session.cpp index b1d47eed..6de055dd 100644 --- a/src/hooks/protections/add_player_to_session.cpp +++ b/src/hooks/protections/add_player_to_session.cpp @@ -31,7 +31,7 @@ namespace big { bool hooks::add_player_to_session(rage::netConnectionManager* mgr, int receiver_msg_id, int* out_command_hndl, RemoteGamerInfoMsg* msg, int flags, void* unk) { - if (msg->m_gamer_info.m_gamer_handle_2.m_rockstar_id == g_local_player->m_player_info->m_net_player_data.m_gamer_handle_2.m_rockstar_id && gta_util::get_network()->m_game_session_ptr->is_host() && g.protections.lessen_breakups) + if (msg->m_gamer_info.m_gamer_handle.m_rockstar_id == g_local_player->m_player_info->m_net_player_data.m_gamer_handle.m_rockstar_id && gta_util::get_network()->m_game_session_ptr->is_host() && g.protections.lessen_breakups) { std::uint64_t host_token = -1; diff --git a/src/hooks/protections/handle_join_request.cpp b/src/hooks/protections/handle_join_request.cpp index 02104fe5..d13e0c32 100644 --- a/src/hooks/protections/handle_join_request.cpp +++ b/src/hooks/protections/handle_join_request.cpp @@ -9,7 +9,7 @@ namespace big { bool hooks::handle_join_request(Network* network, rage::snSession* session, rage::rlGamerInfo* player_info, CJoinRequestContext* ctx, BOOL is_transition_session) { - if (auto player = g_player_database_service->get_player_by_rockstar_id(player_info->m_gamer_handle_2.m_rockstar_id); player && player->block_join) + if (auto player = g_player_database_service->get_player_by_rockstar_id(player_info->m_gamer_handle.m_rockstar_id); player && player->block_join) { CMsgJoinResponse response{}; response.m_status_code = player->block_join_reason; diff --git a/src/hooks/protections/receive_net_message.cpp b/src/hooks/protections/receive_net_message.cpp index 7e9187b0..0cf37d0c 100644 --- a/src/hooks/protections/receive_net_message.cpp +++ b/src/hooks/protections/receive_net_message.cpp @@ -225,7 +225,7 @@ namespace big gamer_handle_deserialize(handle, buffer); auto self = g_player_service->get_self(); - if (self->get_net_data() && self->get_net_data()->m_gamer_handle_2.m_rockstar_id == handle.m_rockstar_id) + if (self->get_net_data() && self->get_net_data()->m_gamer_handle.m_rockstar_id == handle.m_rockstar_id) { session::add_infraction(player, Infraction::TRIED_KICK_PLAYER); g.reactions.lost_connection_kick.process(player); @@ -234,7 +234,7 @@ namespace big for (auto& [_, plyr] : g_player_service->players()) { - if (plyr->get_net_data() && plyr != player && plyr->get_net_data()->m_gamer_handle_2.m_rockstar_id == handle.m_rockstar_id) + if (plyr->get_net_data() && plyr != player && plyr->get_net_data()->m_gamer_handle.m_rockstar_id == handle.m_rockstar_id) { session::add_infraction(player, Infraction::LOST_CONNECTION_KICK_DETECTED); g.reactions.lost_connection_kick_others.process(player, plyr); @@ -246,7 +246,7 @@ namespace big } } - if (player->get_net_data() && player->get_net_data()->m_gamer_handle_2.m_rockstar_id == handle.m_rockstar_id) + if (player->get_net_data() && player->get_net_data()->m_gamer_handle.m_rockstar_id == handle.m_rockstar_id) break; else return true; @@ -262,7 +262,7 @@ namespace big gamer_handle_deserialize(handle, buffer); if (session_id == gta_util::get_network()->m_game_session_ptr->m_rline_session.m_session_id) { - if (handle.m_rockstar_id != player->get_net_data()->m_gamer_handle_2.m_rockstar_id) + if (handle.m_rockstar_id != player->get_net_data()->m_gamer_handle.m_rockstar_id) { session::add_infraction(player, Infraction::SPOOFED_ROCKSTAR_ID); // TODO: store this RID } @@ -349,7 +349,7 @@ namespace big gamer_handle_deserialize(handle, buffer); auto self = g_player_service->get_self(); - if (self->get_net_data() && self->get_net_data()->m_gamer_handle_2.m_rockstar_id == handle.m_rockstar_id) + if (self->get_net_data() && self->get_net_data()->m_gamer_handle.m_rockstar_id == handle.m_rockstar_id) { g_notification_service->push_error("KICK"_T.data(), "REMOTE_KICK_LOST_CONNECTION"_T.data()); return true; @@ -357,7 +357,7 @@ namespace big for (auto& [_, plyr] : g_player_service->players()) { - if (plyr->get_net_data() && plyr->get_net_data()->m_gamer_handle_2.m_rockstar_id == handle.m_rockstar_id) + if (plyr->get_net_data() && plyr->get_net_data()->m_gamer_handle.m_rockstar_id == handle.m_rockstar_id) { g_notification_service->push_error("KICK"_T.data(), std::vformat("REMOTE_KICK_LOST_CONNECTION_PLAYER"_T, std::make_format_args(plyr->get_name()))); diff --git a/src/hooks/protections/script_event_handler.cpp b/src/hooks/protections/script_event_handler.cpp index 893812b5..7d7f4ff3 100644 --- a/src/hooks/protections/script_event_handler.cpp +++ b/src/hooks/protections/script_event_handler.cpp @@ -367,10 +367,18 @@ namespace big return true; } - case eRemoteEvent::StartScriptBegin: + case eRemoteEvent::StartScriptProceed: { - g.reactions.start_script.process(plyr); - return true; + // TODO: Breaks stuff + if (auto script = gta_util::find_script_thread(RAGE_JOAAT("freemode"))) + { + if (script->m_net_component && script->m_net_component->m_host && script->m_net_component->m_host->m_net_game_player != player) + { + g.reactions.start_script.process(plyr); + return true; + } + } + break; } } diff --git a/src/pointers.cpp b/src/pointers.cpp index 673141a3..3e394e93 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -665,9 +665,9 @@ namespace big }); // Encode Session Info - main_batch.add("ESI", "48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 20 57 48 81", [this](memory::handle ptr) + main_batch.add("ESI", "E8 ? ? ? ? C6 83 94 01 00 00 01", [this](memory::handle ptr) { - m_encode_session_info = ptr.as(); + m_encode_session_info = ptr.add(1).rip().as(); }); // Decode Session Info diff --git a/src/services/friends/friends_service.cpp b/src/services/friends/friends_service.cpp index 2fc91b8b..0250ea59 100644 --- a/src/services/friends/friends_service.cpp +++ b/src/services/friends/friends_service.cpp @@ -20,7 +20,7 @@ namespace big if (net_player == nullptr) return false; - const auto rockstar_id = net_player->get_net_data()->m_gamer_handle_2.m_rockstar_id; + const auto rockstar_id = net_player->get_net_data()->m_gamer_handle.m_rockstar_id; for (std::uint32_t i = 0; i < g_pointers->m_friend_registry->m_friend_count; i++) if (rockstar_id == g_pointers->m_friend_registry->get(i)->m_rockstar_id) return true; diff --git a/src/services/player_database/player_database_service.cpp b/src/services/player_database/player_database_service.cpp index d8ab6b31..7075fbc8 100644 --- a/src/services/player_database/player_database_service.cpp +++ b/src/services/player_database/player_database_service.cpp @@ -60,13 +60,13 @@ namespace big persistent_player* player_database_service::get_or_create_player(player_ptr player) { - if (m_players.contains(player->get_net_data()->m_gamer_handle_2.m_rockstar_id)) - return &m_players[player->get_net_data()->m_gamer_handle_2.m_rockstar_id]; + if (m_players.contains(player->get_net_data()->m_gamer_handle.m_rockstar_id)) + return &m_players[player->get_net_data()->m_gamer_handle.m_rockstar_id]; else { - m_players[player->get_net_data()->m_gamer_handle_2.m_rockstar_id] = { player->get_name(), player->get_net_data()->m_gamer_handle_2.m_rockstar_id }; + m_players[player->get_net_data()->m_gamer_handle.m_rockstar_id] = { player->get_name(), player->get_net_data()->m_gamer_handle.m_rockstar_id }; save(); - return &m_players[player->get_net_data()->m_gamer_handle_2.m_rockstar_id]; + return &m_players[player->get_net_data()->m_gamer_handle.m_rockstar_id]; } } diff --git a/src/services/players/player.cpp b/src/services/players/player.cpp index 8ace661d..e61bbaed 100644 --- a/src/services/players/player.cpp +++ b/src/services/players/player.cpp @@ -3,6 +3,7 @@ #include "services/friends/friends_service.hpp" #include "gta_util.hpp" #include +#include namespace big { @@ -70,7 +71,7 @@ namespace big { for (std::uint32_t i = 0; i < gta_util::get_network()->m_game_session_ptr->m_peer_count; i++) { - if (gta_util::get_network()->m_game_session_ptr->m_peers[i]->m_peer_data.m_gamer_handle_2.m_rockstar_id == get_net_data()->m_gamer_handle_2.m_rockstar_id) + if (gta_util::get_network()->m_game_session_ptr->m_peers[i]->m_peer_data.m_gamer_handle.m_rockstar_id == get_net_data()->m_gamer_handle.m_rockstar_id) { return gta_util::get_network()->m_game_session_ptr->m_peers[i]; } @@ -79,6 +80,30 @@ namespace big return nullptr; } + netAddress player::get_ip_address() + { + if (this == g_player_service->get_self().get() && get_net_data()) + return get_net_data()->m_external_ip; + + if (auto session_player = get_session_player()) + if (auto peer = g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, (int)get_session_player()->m_player_data.m_peer_id_2)) + return netAddress{ ((netConnectionPeer*)peer)->m_external_ip }; + + return { 0 }; + } + + uint16_t player::get_port() + { + if (this == g_player_service->get_self().get() && get_net_data()) + return get_net_data()->m_external_port; + + if (auto session_player = get_session_player()) + if (auto peer = g_pointers->m_get_connection_peer(gta_util::get_network()->m_game_session_ptr->m_net_connection_mgr, (int)get_session_player()->m_player_data.m_peer_id_2)) + return ((netConnectionPeer*)peer)->m_external_port; + + return 0; + } + uint8_t player::id() const { return m_net_game_player == nullptr ? -1 : m_net_game_player->m_player_id; diff --git a/src/services/players/player.hpp b/src/services/players/player.hpp index 3f52a906..872692a2 100644 --- a/src/services/players/player.hpp +++ b/src/services/players/player.hpp @@ -44,6 +44,8 @@ namespace big [[nodiscard]] CPlayerInfo* get_player_info() const; [[nodiscard]] class rage::snPlayer* get_session_player(); [[nodiscard]] class rage::snPeer* get_session_peer(); + [[nodiscard]] netAddress get_ip_address(); + [[nodiscard]] uint16_t get_port(); [[nodiscard]] uint8_t id() const; diff --git a/src/util/notify.hpp b/src/util/notify.hpp index daf65b26..30a313d8 100644 --- a/src/util/notify.hpp +++ b/src/util/notify.hpp @@ -21,7 +21,7 @@ namespace big::notify if (player) { g_notification_service->push_error("Protections", std::format("Blocked {} crash from {}", crash, player->get_name())); - LOG(WARNING) << "Blocked " << crash << " crash from " << player->get_name() << " (" << (player->get_net_data() ? player->get_net_data()->m_gamer_handle_2.m_rockstar_id : 0) << ")"; + LOG(WARNING) << "Blocked " << crash << " crash from " << player->get_name() << " (" << (player->get_net_data() ? player->get_net_data()->m_gamer_handle.m_rockstar_id : 0) << ")"; } else { diff --git a/src/util/session.hpp b/src/util/session.hpp index 9ec309a7..ca9935e2 100644 --- a/src/util/session.hpp +++ b/src/util/session.hpp @@ -122,120 +122,6 @@ namespace big::session g_notification_service->push_error("RID Joiner", "Target player is offline?"); } - inline void kick_by_rockstar_id(uint64_t rid) - { - rage::rlGamerHandle player_handle(rid); - rage::rlScHandle socialclub_handle(rid); - rage::rlSessionByGamerTaskResult get_session_result; - bool get_session_success = false; - rage::rlTaskStatus get_session_state{}; - - rage::snConnectToPeerTaskData connect_to_peer_data{}; - rage::snConnectToPeerTaskResult connect_to_peer_result{}; - rage::rlTaskStatus connect_to_peer_status{}; - - rage::rlQueryPresenceAttributesContext query_presence_attributes_context{}; - rage::rlTaskStatus query_presence_attributes_status{}; - rage::rlGamerInfoBase peer_address{}; - - query_presence_attributes_context.m_presence_attibute_type = 3; // string - strcpy(query_presence_attributes_context.m_presence_attribute_key, "peeraddr"); - - if (!g_pointers->m_start_get_presence_attributes(0, &socialclub_handle, &query_presence_attributes_context, 1, &query_presence_attributes_status)) - { - g_notification_service->push_error("RID Kick", "Cannot start the query presence attributes rline task"); - return; - } - - while (query_presence_attributes_status.status == 1) - script::get_current()->yield(); - - if (query_presence_attributes_status.status != 3) - { - g_notification_service->push_error("RID Kick", "Querying presence attributes failed"); - return; - } - - g_pointers->m_decode_peer_info(&peer_address, query_presence_attributes_context.m_presence_attribute_value, nullptr); - - if (!g_pointers->m_start_get_session_by_gamer_handle(0, &player_handle, 1, &get_session_result, 1, &get_session_success, &get_session_state)) - { - g_notification_service->push_error("RID Kick", "Cannot start the get session by gamer handle task"); - return; - } - - while (get_session_state.status == 1) - script::get_current()->yield(); - - if (get_session_state.status != 3 || !get_session_success) - { - g_notification_service->push_error("RID Kick", "Getting session info failed"); - return; - } - - connect_to_peer_data.m_unk = 0; - connect_to_peer_data.m_reason = 5; - connect_to_peer_data.m_session_token = 0; // get_session_result.m_session_info.m_session_token; still works? - - if (!g_pointers->m_connect_to_peer(gta_util::get_network()->m_game_session.m_net_connection_mgr, &peer_address, &connect_to_peer_data, &connect_to_peer_result, &connect_to_peer_status)) - { - g_notification_service->push_error("RID Kick", "Failed to start a connection with player"); - return; - } - - g_notification_service->push("RID Kick", "Connecting to player..."); - - while (connect_to_peer_status.status == 1) - script::get_current()->yield(); - - if (connect_to_peer_status.status != 3) - { - g_notification_service->push_warning("RID Kick", "Failed to connect to player, not attempting to send gamer instruction kick"); - } - else - { - // you can send a MsgTransitionLaunchNotify with an invalid connection ID to crash the player instead (remove the session obtaining code above to make it work in SP) - packet msg; - msg.write_message(rage::eNetMessage::MsgTransitionGamerInstruction); - gamer_handle_serialize(player_handle, msg.m_buffer); // src - gamer_handle_serialize(player_handle, msg.m_buffer); // target - msg.write(false, 1); // string extend - msg.write(0, 7); // string length - msg.write(8, 32); // instruction type - msg.write(0, 32); - msg.write(0, 32); - msg.send(connect_to_peer_result.m_peer_id, gta_util::get_network()->m_transition_session_ptr->m_connection_identifier); - g_notification_service->push("RID Kick", "Sent gamer instruction kick"); - } - - memset(&connect_to_peer_result, 0, sizeof(connect_to_peer_result)); - connect_to_peer_status.status = 0; - - if (!g_pointers->m_connect_to_peer(gta_util::get_network()->m_game_session.m_net_connection_mgr, &get_session_result.m_session_info.m_net_player_data, &connect_to_peer_data, &connect_to_peer_result, &connect_to_peer_status)) - { - g_notification_service->push_error("RID Kick", "Failed to start a connection with the host"); - return; - } - - g_notification_service->push("RID Kick", "Connecting to host..."); - - while (connect_to_peer_status.status == 1) - script::get_current()->yield(); - - if (connect_to_peer_status.status != 3) - { - g_notification_service->push_error("RID Kick", "Failed to connect to the host"); - return; - } - - packet msg{}; - msg.write_message(rage::eNetMessage::MsgLostConnectionToHost); - msg.write(get_session_result.m_session_info.m_unk, 64); - gamer_handle_serialize(player_handle, msg); - msg.send(connect_to_peer_result.m_peer_id, gta_util::get_network()->m_game_session_ptr->m_connection_identifier); - g_notification_service->push("RID Kick", "Sent lost connection kick"); - } - inline void join_by_username(std::string username) { g_thread_pool->push([username] @@ -253,23 +139,6 @@ namespace big::session }); } - inline void kick_by_username(std::string username) - { - g_thread_pool->push([username] - { - uint64_t rid; - if (g_api_service->get_rid_from_username(username, rid)) - { - g_fiber_pool->queue_job([rid] - { - kick_by_rockstar_id(rid); - }); - return; - } - g_notification_service->push_error("RID Kick", "Target player is offline?"); - }); - } - inline void add_infraction(player_ptr player, Infraction infraction) { auto plyr = g_player_database_service->get_or_create_player(player); diff --git a/src/util/spam.hpp b/src/util/spam.hpp index fc3a5aef..6f961c18 100644 --- a/src/util/spam.hpp +++ b/src/util/spam.hpp @@ -59,7 +59,7 @@ namespace big::spam auto& plData = *player->get_net_data(); - spam_log << player->get_name() << " (" << plData.m_gamer_handle_2.m_rockstar_id << ") <" + spam_log << player->get_name() << " (" << plData.m_gamer_handle.m_rockstar_id << ") <" << (int)plData.m_external_ip.m_field1 << "." << (int)plData.m_external_ip.m_field2 << "." << (int)plData.m_external_ip.m_field3 << "." << (int)plData.m_external_ip.m_field4 << ">: " << msg << std::endl; diff --git a/src/views/debug/view_debug_misc.cpp b/src/views/debug/view_debug_misc.cpp index f210721f..49bc97cc 100644 --- a/src/views/debug/view_debug_misc.cpp +++ b/src/views/debug/view_debug_misc.cpp @@ -52,6 +52,47 @@ namespace big components::command_button<"fastquit">(); + if (ImGui::TreeNode("Addresses")) + { + uint64_t local_cped = (uint64_t)g_local_player; + ImGui::InputScalar("Local CPed", ImGuiDataType_U64, &local_cped, NULL, NULL, "%p", ImGuiInputTextFlags_CharsHexadecimal); + + if (g_local_player) + { + uint64_t local_playerinfo = (uint64_t)g_local_player->m_player_info; + ImGui::InputScalar("Local CPlayerInfo", ImGuiDataType_U64, &local_playerinfo, NULL, NULL, "%p", ImGuiInputTextFlags_CharsHexadecimal); + + uint64_t local_vehicle = (uint64_t)g_local_player->m_vehicle; + ImGui::InputScalar("Local CAutomobile", ImGuiDataType_U64, &local_vehicle, NULL, NULL, "%p", ImGuiInputTextFlags_CharsHexadecimal); + } + + if (auto mgr = *g_pointers->m_network_player_mgr) + { + uint64_t local_netplayer = (uint64_t)mgr->m_local_net_player; + ImGui::InputScalar("Local CNetGamePlayer", ImGuiDataType_U64, &local_netplayer, NULL, NULL, "%p", ImGuiInputTextFlags_CharsHexadecimal); + + if (mgr->m_local_net_player) + { + uint64_t local_netplayer = (uint64_t)mgr->m_local_net_player->get_net_data(); + ImGui::InputScalar("Local netPlayerData", ImGuiDataType_U64, &local_netplayer, NULL, NULL, "%p", ImGuiInputTextFlags_CharsHexadecimal); + } + } + + if (auto network = *g_pointers->m_network) + { + uint64_t nw = (uint64_t)network; + ImGui::InputScalar("Network", ImGuiDataType_U64, &nw, NULL, NULL, "%p", ImGuiInputTextFlags_CharsHexadecimal); + } + + if (auto omgr = *g_pointers->m_network_object_mgr) + { + uint64_t nw = (uint64_t)omgr; + ImGui::InputScalar("Network Object Mgr", ImGuiDataType_U64, &nw, NULL, NULL, "%p", ImGuiInputTextFlags_CharsHexadecimal); + } + + ImGui::TreePop(); + } + ImGui::EndTabItem(); } } diff --git a/src/views/network/view_player_database.cpp b/src/views/network/view_player_database.cpp index a89dc7d6..9f2e55c4 100644 --- a/src/views/network/view_player_database.cpp +++ b/src/views/network/view_player_database.cpp @@ -123,11 +123,6 @@ namespace big } } - components::button("KICK"_T, [] - { - session::kick_by_rockstar_id(current_player.rockstar_id); - }); - components::button("JOIN_SESSION"_T, [] { session::join_by_rockstar_id(current_player.rockstar_id); diff --git a/src/views/network/view_session.cpp b/src/views/network/view_session.cpp index bfbfab4b..96fd968d 100644 --- a/src/views/network/view_session.cpp +++ b/src/views/network/view_session.cpp @@ -24,11 +24,6 @@ namespace big { session::join_by_rockstar_id(rid); }); - ImGui::SameLine(); - components::button("KICK_BY_RID"_T, [] - { - session::kick_by_rockstar_id(rid); - }); static char username[20]; components::input_text("INPUT_USERNAME"_T, username, sizeof(username)); @@ -36,11 +31,6 @@ namespace big { session::join_by_username(username); }; - ImGui::SameLine(); - if (components::button("KICK_BY_USERNAME"_T)) - { - session::kick_by_username(username); - }; static char base64[500]{}; components::input_text("SESSION_INFO"_T, base64, sizeof(base64)); @@ -53,8 +43,8 @@ namespace big ImGui::SameLine(); components::button("COPY_SESSION_INFO"_T, [] { - char buf[0x100]; - g_pointers->m_encode_session_info(>a_util::get_network()->m_game_session.m_rline_session.m_session_info, buf, 0x7D, nullptr); + char buf[0x100]{}; + g_pointers->m_encode_session_info(>a_util::get_network()->m_game_session.m_rline_session.m_session_info, buf, 0xA9, nullptr); ImGui::SetClipboardText(buf); }); diff --git a/src/views/network/view_spoofing.cpp b/src/views/network/view_spoofing.cpp index 0362fa61..d03625ff 100644 --- a/src/views/network/view_spoofing.cpp +++ b/src/views/network/view_spoofing.cpp @@ -11,7 +11,9 @@ namespace big { components::small_text("SPOOFING_DESCRIPTION"_T); - ImGui::Text("!!!!! Spoofing options like name and RID have become impossible to spoof with update 1.66 !!!!!"); + components::sub_title("SPOOFING_HIDE_FEATURES"_T); + ImGui::Checkbox("SPOOFING_HIDE_GOD_MODE"_T.data(), &g.spoofing.spoof_hide_god); + ImGui::Checkbox("SPOOFING_HIDE_SPECTATE"_T.data(), &g.spoofing.spoof_hide_spectate); components::sub_title("CREW"_T); @@ -31,14 +33,6 @@ namespace big ImGui::Checkbox("SPOOFING_CREW_SQUARE_TAG"_T.data(), &g.spoofing.square_crew_tag); - components::sub_title("SPOOFING_EXTRA"_T); - - ImGui::Checkbox("SPOOFING_IS_CHEATER"_T.data(), &g.spoofing.spoof_cheater); - - // Can't spoof RID anymore - //ImGui::Checkbox("SPOOFING_IS_DEV"_T.data(), &g.spoofing.spoof_rockstar_dev); - //ImGui::Checkbox("SPOOFING_IS_QA"_T.data(), &g.spoofing.spoof_rockstar_qa); - components::sub_title("SPOOFING_SESSION_ATTRIBUTES"_T); components::small_text("SPOOFING_ONLY_WORKS_AS_HOST"_T); diff --git a/src/views/players/player/player_info.cpp b/src/views/players/player/player_info.cpp index 38a4fa26..c46aa9a1 100644 --- a/src/views/players/player/player_info.cpp +++ b/src/views/players/player/player_info.cpp @@ -108,31 +108,34 @@ namespace big if (auto net_player_data = g_player_service->get_selected()->get_net_data(); net_player_data != nullptr) { - ImGui::Text("PLAYER_INFO_RID"_T.data(), net_player_data->m_gamer_handle_2.m_rockstar_id); + ImGui::Text("PLAYER_INFO_RID"_T.data(), net_player_data->m_gamer_handle.m_rockstar_id); ImGui::SameLine(); ImGui::PushID("##rid"); - if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::to_string(net_player_data->m_gamer_handle_2.m_rockstar_id).data()); + if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::to_string(net_player_data->m_gamer_handle.m_rockstar_id).data()); ImGui::PopID(); + auto ip = g_player_service->get_selected()->get_ip_address(); + auto port = g_player_service->get_selected()->get_port(); + ImGui::Text( "PLAYER_INFO_IP"_T.data(), - net_player_data->m_external_ip.m_field1, - net_player_data->m_external_ip.m_field2, - net_player_data->m_external_ip.m_field3, - net_player_data->m_external_ip.m_field4, - net_player_data->m_external_port + ip.m_field1, + ip.m_field2, + ip.m_field3, + ip.m_field4, + port ); ImGui::SameLine(); ImGui::PushID("##ip"); - if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::format("{}.{}.{}.{}:{}", net_player_data->m_external_ip.m_field1, - net_player_data->m_external_ip.m_field2, - net_player_data->m_external_ip.m_field3, - net_player_data->m_external_ip.m_field4, - net_player_data->m_external_port).data()); + if (ImGui::Button("COPY"_T.data())) ImGui::SetClipboardText(std::format("{}.{}.{}.{}:{}", ip.m_field1, + ip.m_field2, + ip.m_field3, + ip.m_field4, + port).data()); ImGui::PopID(); } diff --git a/src/views/players/player/player_kick.cpp b/src/views/players/player/player_kick.cpp index d0c2fc6e..81d64d05 100644 --- a/src/views/players/player/player_kick.cpp +++ b/src/views/players/player/player_kick.cpp @@ -17,15 +17,17 @@ namespace big { components::player_command_button<"lckick">(g_player_service->get_selected()); }); + components::player_command_button<"bailkick">(g_player_service->get_selected()); ImGui::SameLine(); components::player_command_button<"nfkick">(g_player_service->get_selected()); + components::player_command_button<"oomkick">(g_player_service->get_selected()); ImGui::SameLine(); - components::player_command_button<"gikick">(g_player_service->get_selected()); components::player_command_button<"shkick">(g_player_service->get_selected()); - ImGui::SameLine(); + components::player_command_button<"endkick">(g_player_service->get_selected()); + ImGui::SameLine(); components::player_command_button<"desync">(g_player_service->get_selected()); ImGui::TreePop(); diff --git a/src/views/players/player/player_misc.cpp b/src/views/players/player/player_misc.cpp index 207e79b4..33df2a7a 100644 --- a/src/views/players/player/player_misc.cpp +++ b/src/views/players/player/player_misc.cpp @@ -1,5 +1,6 @@ #include "views/view.hpp" #include "util/scripts.hpp" +#include "script/globals/GPBD_FM_3.hpp" namespace big {