diff --git a/.gitignore b/.gitignore index 7c8a0b79..ae31d738 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ # Precompiled Headers *.gch *.pch +*.ipch # Compiled Dynamic libraries *.so diff --git a/BigBaseV2/src/api/api.hpp b/BigBaseV2/src/api/api.hpp index 474bb252..c0e8ae4a 100644 --- a/BigBaseV2/src/api/api.hpp +++ b/BigBaseV2/src/api/api.hpp @@ -50,12 +50,12 @@ namespace big::api http::Request request(domain + path); - CPlayerInfo* player_info = g_local_player->m_player_info; - rage::netPlayerData& netData = player_info->m_net_player_data; + auto player_info = g_local_player->m_player_info; + auto& netData = player_info->m_net_player_data; nlohmann::json body = { { "username", std::string(netData.m_name) }, - { "rockstar_id", netData.m_rockstar_id } + { "rockstar_id", netData.m_gamer_handle_2.m_rockstar_id } }; try diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index 7feab993..45044e9b 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -13,6 +13,7 @@ namespace big g->attempt_save(); looped::system_self_globals(); looped::system_update_pointers(); + looped::system_desync_kick_protection(); if (g_local_player != nullptr && !api::util::signed_in()) { diff --git a/BigBaseV2/src/backend/looped/looped.hpp b/BigBaseV2/src/backend/looped/looped.hpp index 4f568b1f..772c44c1 100644 --- a/BigBaseV2/src/backend/looped/looped.hpp +++ b/BigBaseV2/src/backend/looped/looped.hpp @@ -37,6 +37,7 @@ namespace big static void system_self_globals(); static void system_update_pointers(); + static void system_desync_kick_protection(); static void vehicle_auto_drive(); static void vehicle_boost_behavior(); diff --git a/BigBaseV2/src/backend/looped/system/desync_kick_protection.cpp b/BigBaseV2/src/backend/looped/system/desync_kick_protection.cpp new file mode 100644 index 00000000..b99db055 --- /dev/null +++ b/BigBaseV2/src/backend/looped/system/desync_kick_protection.cpp @@ -0,0 +1,37 @@ +#include "backend/looped/looped.hpp" +#include "fiber_pool.hpp" +#include "natives.hpp" +#include "script.hpp" +#include "services/players/player_service.hpp" +#include "gta_util.hpp" + +namespace big +{ + void looped::system_desync_kick_protection() + { + memset(>a_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(std::uint64_t)); + gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0; + + auto old = gta_util::get_network()->m_game_complaint_mgr.m_host_token; + + if (gta_util::get_network()->m_game_session_state > 3 && gta_util::get_network()->m_game_session_state < 6) + { + for (auto& [_, plyr] : g_player_service->players()) + { + if (plyr->get_net_data()) + { + gta_util::get_network()->m_game_complaint_mgr.m_host_token = plyr->get_net_data()->m_host_token; + g_pointers->m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr); + } + } + + if (g_player_service->get_self() && g_player_service->get_self()->get_net_data()) + { + gta_util::get_network()->m_game_complaint_mgr.m_host_token = g_player_service->get_self()->get_net_data()->m_host_token; + g_pointers->m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr); + } + } + + gta_util::get_network()->m_game_complaint_mgr.m_host_token = old; + } +} \ No newline at end of file diff --git a/BigBaseV2/src/common.hpp b/BigBaseV2/src/common.hpp index 0aa78547..286ea6f1 100644 --- a/BigBaseV2/src/common.hpp +++ b/BigBaseV2/src/common.hpp @@ -68,6 +68,7 @@ namespace big inline HANDLE g_main_thread{}; inline DWORD g_main_thread_id{}; inline std::atomic_bool g_running{ false }; + inline bool g_is_steam{ false }; inline CPed* g_local_player; } diff --git a/BigBaseV2/src/core/data/bullet_impact_types.hpp b/BigBaseV2/src/core/data/bullet_impact_types.hpp index d94c7e33..ae0b2da7 100644 --- a/BigBaseV2/src/core/data/bullet_impact_types.hpp +++ b/BigBaseV2/src/core/data/bullet_impact_types.hpp @@ -26,7 +26,7 @@ std::map BULLET_IMPACTS = { { eImpactType::BZGAS, "BZGAS" }, { eImpactType::FLARE, "FLARE" }, { eImpactType::GAS_CANISTER, "GAS_CANISTER" }, - { eImpactType::EXTINGUISHER_1, "EXTINGUISHER_1" }, + { eImpactType::EXTINGUISHER, "EXTINGUISHER_1" }, { eImpactType::PROGRAMMABLEAR, "PROGRAMMABLEAR" }, { eImpactType::TRAIN, "TRAIN" }, { eImpactType::BARREL, "BARREL" }, @@ -78,11 +78,11 @@ std::map BULLET_IMPACTS = { { eImpactType::RCTANK_ROCKET, "RCTANK_ROCKET" }, { eImpactType::BOMB_WATER, "BOMB_WATER" }, { eImpactType::BOMB_WATER_SECONDARY, "BOMB_WATER_SECONDARY" }, - { eImpactType::EXTINGUISHER_2, "EXTINGUISHER_2" }, - { eImpactType::EXTINGUISHER_3, "EXTINGUISHER_3" }, - { eImpactType::EXTINGUISHER_4, "EXTINGUISHER_4" }, - { eImpactType::EXTINGUISHER_5, "EXTINGUISHER_5" }, - { eImpactType::EXTINGUISHER_6, "EXTINGUISHER_6" }, + { eImpactType::UNK76, "UNK76" }, + { eImpactType::UNK77, "UNK77" }, + { eImpactType::FLASH_GRENADE, "FLASH_GRENADE" }, + { eImpactType::STUN_GRENADE, "STUN_GRENADE" }, + { eImpactType::Unk80, "UNK80" }, { eImpactType::SCRIPT_MISSILE_LARGE, "SCRIPT_MISSILE_LARGE" }, { eImpactType::SUBMARINE_BIG, "SUBMARINE_BIG" }, { eImpactType::EMPLAUNCHER_EMP, "EMPLAUNCHER_EMP" }, diff --git a/BigBaseV2/src/function_types.hpp b/BigBaseV2/src/function_types.hpp index 1c14e55a..4a132c89 100644 --- a/BigBaseV2/src/function_types.hpp +++ b/BigBaseV2/src/function_types.hpp @@ -4,6 +4,7 @@ #include "gta/player.hpp" #include "gta/natives.hpp" #include "gta/replay.hpp" +#include "network/CNetComplaintMgr.hpp" namespace big::functions { @@ -49,4 +50,6 @@ namespace big::functions using get_net_object = rage::netObject*(*)(CNetworkObjectMgr* mgr, int16_t id, bool unk3); //Sync signatures END + + using reset_network_complaints = void(*)(CNetComplaintMgr* mgr); } \ No newline at end of file diff --git a/BigBaseV2/src/gta/base.hpp b/BigBaseV2/src/gta/base.hpp index 59afeaaf..7d41bef5 100644 --- a/BigBaseV2/src/gta/base.hpp +++ b/BigBaseV2/src/gta/base.hpp @@ -1,18 +1,4 @@ #pragma once -namespace rage -{ - class datBase - { - public: - virtual ~datBase() = default; - }; - - class pgBase - { - public: - virtual ~pgBase() = default; - private: - void *m_pgunk; - }; -} +#include "base/datBase.hpp" +#include "base/pgBase.hpp" \ No newline at end of file diff --git a/BigBaseV2/src/gta/extensible.hpp b/BigBaseV2/src/gta/extensible.hpp index 918a5118..15808182 100644 --- a/BigBaseV2/src/gta/extensible.hpp +++ b/BigBaseV2/src/gta/extensible.hpp @@ -2,43 +2,6 @@ #include #include "ref_aware.hpp" -namespace rage -{ - class fwExtension - { - public: - virtual ~fwExtension() = default; - virtual void unk_0x08() = 0; - virtual void unk_0x10() = 0; - virtual std::uint32_t get_id() = 0; - }; - - class fwExtensionContainer - { - public: - fwExtension *m_entry; - fwExtensionContainer* m_next; - }; - - class fwExtensibleBase : public fwRefAwareBase - { - public: - virtual bool is_of_type(std::uint32_t hash) = 0; - virtual std::uint32_t const &get_type() = 0; - public: - fwExtensionContainer* m_extension_container; // 0x10 - private: - void *m_extensible_unk; // 0x18 - public: - template - bool is_of_type() - { - static auto name = (typeid(T).name()) + 6; // Skip "class " - static auto name_hash = util::joaat(name); - - return is_of_type(name_hash); - } - }; - - static_assert(sizeof(fwExtensibleBase) == 0x20); -} +#include "base/fwExtension.hpp" +#include "base/fwExtensibleBase.hpp" +#include "base/fwExtensionContainer.hpp" \ No newline at end of file diff --git a/BigBaseV2/src/gta/joaat.hpp b/BigBaseV2/src/gta/joaat.hpp index 5b40d364..28bcd013 100644 --- a/BigBaseV2/src/gta/joaat.hpp +++ b/BigBaseV2/src/gta/joaat.hpp @@ -4,11 +4,10 @@ #include #include +#include "../../vendor/GTAV-Classes/rage/joaat.hpp" + namespace rage { - using joaat_t = std::uint32_t; - inline constexpr char joaat_to_lower(char c) { return (c >= 'A' && c <= 'Z') ? c + ('a' - 'A') : c; } - template struct constexpr_joaat { char data[CharCount]; @@ -28,20 +27,6 @@ namespace rage return hash; } }; - - inline joaat_t joaat(std::string_view str) - { - joaat_t hash = 0; - for (auto c : str) { - hash += joaat_to_lower(c); - hash += (hash << 10); - hash ^= (hash >> 6); - } - hash += (hash << 3); - hash ^= (hash >> 11); - hash += (hash << 15); - return hash; - } } #define RAGE_JOAAT_IMPL(str) (::rage::constexpr_joaat((str), std::make_index_sequence())()) diff --git a/BigBaseV2/src/gta/net_game_event.hpp b/BigBaseV2/src/gta/net_game_event.hpp index 0cf27f07..e7dd94f9 100644 --- a/BigBaseV2/src/gta/net_game_event.hpp +++ b/BigBaseV2/src/gta/net_game_event.hpp @@ -271,21 +271,31 @@ namespace rage class InFrame { public: + enum class EventType + { + ConnectionClosed = 3, + FrameReceived = 4, + BandwidthExceeded = 6, + OutOfMemory = 7 + }; + virtual ~InFrame() = default; virtual void destroy() = 0; - virtual uint32_t get_type() = 0; + virtual EventType get_event_type() = 0; virtual uint32_t _0x18() = 0; char pad_0008[56]; //0x0008 uint32_t m_msg_id; //0x0040 - char pad_0044[4]; //0x0044 + uint32_t m_connection_identifier; //0x0044 InFrame* m_this; //0x0048 - char pad_0050[40]; //0x0050 + uint32_t m_peer_id; //0x0050 + char pad_0050[36]; //0x0058 uint32_t m_length; //0x0078 char pad_007C[4]; //0x007C void* m_data; //0x0080 }; + static_assert(sizeof(rage::netConnection::InFrame) == 0x88); } class CEventNetwork diff --git a/BigBaseV2/src/gta/ref_aware.hpp b/BigBaseV2/src/gta/ref_aware.hpp index 38578c48..3eff1cd4 100644 --- a/BigBaseV2/src/gta/ref_aware.hpp +++ b/BigBaseV2/src/gta/ref_aware.hpp @@ -1,18 +1,4 @@ #pragma once #include "base.hpp" -namespace rage -{ - template - class fwRefAwareBaseImpl : public T - { - private: - void *m_ref; // 0x08 - }; - - class fwRefAwareBase : public fwRefAwareBaseImpl - { - }; - - static_assert(sizeof(fwRefAwareBase) == 0x10); -} +#include "gta/ref_aware.hpp" \ No newline at end of file diff --git a/BigBaseV2/src/gta/vector.hpp b/BigBaseV2/src/gta/vector.hpp index 40ed0c0e..b94af94b 100644 --- a/BigBaseV2/src/gta/vector.hpp +++ b/BigBaseV2/src/gta/vector.hpp @@ -2,12 +2,6 @@ namespace rage { - struct vector2 - { - float x{}; - float y{}; - }; - #pragma pack(push, 1) class scrVector { diff --git a/BigBaseV2/src/gta_util.hpp b/BigBaseV2/src/gta_util.hpp index 4af9b997..e1573a72 100644 --- a/BigBaseV2/src/gta_util.hpp +++ b/BigBaseV2/src/gta_util.hpp @@ -35,6 +35,14 @@ namespace big::gta_util return *g_pointers->m_network_player_mgr; } + inline Network* get_network() + { + __int64 network = (__int64)(*g_pointers->m_network); + if (g_is_steam) + network += sizeof(rage::rlSessionInfo); + return (Network*)network; + } + template void execute_as_script(rage::joaat_t script_hash, F &&callback, Args &&...args) { diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_brakes.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_brakes.cpp index 051d533b..388002db 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_brakes.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_brakes.cpp @@ -7,15 +7,15 @@ namespace big if (ImGui::BeginTabItem("Brakes")) { ImGui::Text("Brake Force"); - ImGui::DragFloat("##brake force", &g_local_player->m_vehicle->m_handling->m_brake_force, .01f, 0.f, 10.f); + ImGui::DragFloat("##brake force", &g_local_player->m_vehicle->m_handling_data->m_brake_force, .01f, 0.f, 10.f); ImGui::Text("Brake Bias (1.0 = front, 0.0 = rear, 0.5 = balanced)"); - float fBrakeBias = g_local_player->m_vehicle->m_handling->m_brake_bias_front / 2; + float fBrakeBias = g_local_player->m_vehicle->m_handling_data->m_brake_bias_front / 2; if (ImGui::SliderFloat("##brake bias front", &fBrakeBias, 0.f, 1.f)) - g_local_player->m_vehicle->m_handling->m_brake_bias_front = fBrakeBias * 2; + g_local_player->m_vehicle->m_handling_data->m_brake_bias_front = fBrakeBias * 2; ImGui::Text("Hand Brake Force"); - ImGui::DragFloat("##hand brake force", &g_local_player->m_vehicle->m_handling->m_handbrake_force, .01f, 0.f, 10.f); + ImGui::DragFloat("##hand brake force", &g_local_player->m_vehicle->m_handling_data->m_handbrake_force, .01f, 0.f, 10.f); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_gearing.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_gearing.cpp index dd26024a..fa2480ea 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_gearing.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_gearing.cpp @@ -7,15 +7,15 @@ namespace big if (ImGui::BeginTabItem("Gearing")) { ImGui::Text("Initial Drive Gears"); - int initial_drive_gears = g_local_player->m_vehicle->m_handling->m_initial_drive_gears; + int initial_drive_gears = g_local_player->m_vehicle->m_handling_data->m_initial_drive_gears; if (ImGui::DragInt("###handling_drive_gears", &initial_drive_gears, .1f, 1, 16)) - g_local_player->m_vehicle->m_handling->m_initial_drive_gears = initial_drive_gears; + g_local_player->m_vehicle->m_handling_data->m_initial_drive_gears = initial_drive_gears; ImGui::Text("Upshift Multiplier"); - ImGui::DragFloat("###handling_upshift", &g_local_player->m_vehicle->m_handling->m_upshift, .01f, 0.f, 10.f); + ImGui::DragFloat("###handling_upshift", &g_local_player->m_vehicle->m_handling_data->m_upshift, .01f, 0.f, 10.f); ImGui::Text("Downshift Multiplier"); - ImGui::DragFloat("###handling_downshift", &g_local_player->m_vehicle->m_handling->m_downshift, .01f, 0.f, 10.f); + ImGui::DragFloat("###handling_downshift", &g_local_player->m_vehicle->m_handling_data->m_downshift, .01f, 0.f, 10.f); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_general.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_general.cpp index 67acd2b3..b8f2b7aa 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_general.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_general.cpp @@ -10,22 +10,22 @@ namespace big ImGui::SliderFloat("##Gravity", &g_local_player->m_vehicle->m_gravity, -50.f, 50.f); ImGui::Text("Mass"); - ImGui::SliderFloat("##Mass", &g_local_player->m_vehicle->m_handling->m_mass, 0.f, 50000.f); + ImGui::SliderFloat("##Mass", &g_local_player->m_vehicle->m_handling_data->m_mass, 0.f, 50000.f); ImGui::Text("Centre of mass"); float fCenterOfMass[3]; - fCenterOfMass[0] = g_local_player->m_vehicle->m_handling->m_centre_of_mass.x; - fCenterOfMass[1] = g_local_player->m_vehicle->m_handling->m_centre_of_mass.y; - fCenterOfMass[2] = g_local_player->m_vehicle->m_handling->m_centre_of_mass.z; + fCenterOfMass[0] = g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.x; + fCenterOfMass[1] = g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.y; + fCenterOfMass[2] = g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.z; if (ImGui::SliderFloat3("##centre_of_mass", fCenterOfMass, -10.f, 10.f)) { - g_local_player->m_vehicle->m_handling->m_centre_of_mass.x = fCenterOfMass[0]; - g_local_player->m_vehicle->m_handling->m_centre_of_mass.y = fCenterOfMass[1]; - g_local_player->m_vehicle->m_handling->m_centre_of_mass.z = fCenterOfMass[2]; + g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.x = fCenterOfMass[0]; + g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.y = fCenterOfMass[1]; + g_local_player->m_vehicle->m_handling_data->m_centre_of_mass.z = fCenterOfMass[2]; } ImGui::Text("Buoyancy"); - ImGui::SliderFloat("##buoyancy", &g_local_player->m_vehicle->m_handling->m_buoyancy, .01f, 99.f); + ImGui::SliderFloat("##buoyancy", &g_local_player->m_vehicle->m_handling_data->m_buoyancy, .01f, 99.f); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_other.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_other.cpp index 7be6f7c1..8035100e 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_other.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_other.cpp @@ -7,21 +7,21 @@ namespace big if (ImGui::BeginTabItem("Other")) { ImGui::Text("Acceleration Multiplier"); - ImGui::DragFloat("###handling_acceleration", &g_local_player->m_vehicle->m_handling->m_acceleration, 1.f, .01f, 10.f); + ImGui::DragFloat("###handling_acceleration", &g_local_player->m_vehicle->m_handling_data->m_acceleration, 1.f, .01f, 10.f); ImGui::Text("Downforce Multiplier"); - ImGui::DragFloat("###handling_downforce", &g_local_player->m_vehicle->m_handling->m_downforce_multiplier, 1.f, 0.f, 10.f); + ImGui::DragFloat("###handling_downforce", &g_local_player->m_vehicle->m_handling_data->m_downforce_multiplier, 1.f, 0.f, 10.f); ImGui::Text("Inertia Multiplier"); float fInertiaMult[3]; - fInertiaMult[0] = g_local_player->m_vehicle->m_handling->m_inertia_mult.x; - fInertiaMult[1] = g_local_player->m_vehicle->m_handling->m_inertia_mult.y; - fInertiaMult[2] = g_local_player->m_vehicle->m_handling->m_inertia_mult.z; + fInertiaMult[0] = g_local_player->m_vehicle->m_handling_data->m_inertia_mult.x; + fInertiaMult[1] = g_local_player->m_vehicle->m_handling_data->m_inertia_mult.y; + fInertiaMult[2] = g_local_player->m_vehicle->m_handling_data->m_inertia_mult.z; if (ImGui::SliderFloat3("##inertia_multiplier", fInertiaMult, -10.f, 10.f)) { - g_local_player->m_vehicle->m_handling->m_inertia_mult.x = fInertiaMult[0]; - g_local_player->m_vehicle->m_handling->m_inertia_mult.y = fInertiaMult[1]; - g_local_player->m_vehicle->m_handling->m_inertia_mult.z = fInertiaMult[2]; + g_local_player->m_vehicle->m_handling_data->m_inertia_mult.x = fInertiaMult[0]; + g_local_player->m_vehicle->m_handling_data->m_inertia_mult.y = fInertiaMult[1]; + g_local_player->m_vehicle->m_handling_data->m_inertia_mult.z = fInertiaMult[2]; } ImGui::EndTabItem(); diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp index 12b67685..45b44022 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_roll_centre_height.cpp @@ -11,10 +11,10 @@ namespace big ImGui::Separator(); ImGui::Text("Roll Centre Height Front"); - ImGui::SliderFloat("##roll centre height front", &g_local_player->m_vehicle->m_handling->m_roll_centre_height_front, -1.f, 1.f); + ImGui::SliderFloat("##roll centre height front", &g_local_player->m_vehicle->m_handling_data->m_roll_centre_height_front, -1.f, 1.f); ImGui::Text("Roll Centre Height Back"); - ImGui::SliderFloat("##roll centre height back", &g_local_player->m_vehicle->m_handling->m_roll_centre_height_rear, -1.f, 1.f); + ImGui::SliderFloat("##roll centre height back", &g_local_player->m_vehicle->m_handling_data->m_roll_centre_height_rear, -1.f, 1.f); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_rollbars.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_rollbars.cpp index 491c38d8..e088381e 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_rollbars.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_rollbars.cpp @@ -7,12 +7,12 @@ namespace big if (ImGui::BeginTabItem("Rollbars")) { ImGui::Text("Anti-Roll Bar force"); - ImGui::SliderFloat("##anti rollbar force", &g_local_player->m_vehicle->m_handling->m_anti_rollbar_force, 0.f, 10.f); + ImGui::SliderFloat("##anti rollbar force", &g_local_player->m_vehicle->m_handling_data->m_anti_rollbar_force, 0.f, 10.f); ImGui::Text("Anti-Roll Bar Bias front (0 = front, 1 = rear)"); - float fAntiRollBarBiasFront = g_local_player->m_vehicle->m_handling->m_anti_rollbar_bias_front / 2; + float fAntiRollBarBiasFront = g_local_player->m_vehicle->m_handling_data->m_anti_rollbar_bias_front / 2; if (ImGui::SliderFloat("##anti rollbar bias", &fAntiRollBarBiasFront, 0.f, 1.f)) - g_local_player->m_vehicle->m_handling->m_anti_rollbar_bias_front = fAntiRollBarBiasFront * 2; + g_local_player->m_vehicle->m_handling_data->m_anti_rollbar_bias_front = fAntiRollBarBiasFront * 2; ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_steering.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_steering.cpp index 1c5f6d82..2a10bd48 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_steering.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_steering.cpp @@ -7,7 +7,7 @@ namespace big if (ImGui::BeginTabItem("Steering")) { ImGui::Text("Steering Lock (degrees)"); - ImGui::SliderAngle("##steering lock", &g_local_player->m_vehicle->m_handling->m_steering_lock, -90.f, 90.f); + ImGui::SliderAngle("##steering lock", &g_local_player->m_vehicle->m_handling_data->m_steering_lock, -90.f, 90.f); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_suspension.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_suspension.cpp index 68dff117..31f544f3 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_suspension.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_suspension.cpp @@ -7,27 +7,27 @@ namespace big if (ImGui::BeginTabItem("Suspension")) { ImGui::Text("Suspension Force (General Suspension Strength)"); - ImGui::SliderFloat("##suspension force", &g_local_player->m_vehicle->m_handling->m_suspension_force, 0.f, 5.f); + ImGui::SliderFloat("##suspension force", &g_local_player->m_vehicle->m_handling_data->m_suspension_force, 0.f, 5.f); ImGui::Text("Suspension Compression Damp (Higher = Less Compression)"); - ImGui::SliderFloat("##suspension comp", &g_local_player->m_vehicle->m_handling->m_suspension_comp_damp, 0.f, 5.f); + ImGui::SliderFloat("##suspension comp", &g_local_player->m_vehicle->m_handling_data->m_suspension_comp_damp, 0.f, 5.f); ImGui::Text("Suspension Rebound Damp (Higher = Less Decompression)"); - ImGui::SliderFloat("##suspension rebound", &g_local_player->m_vehicle->m_handling->m_suspension_rebound_damp, 0.f, 5.f); + ImGui::SliderFloat("##suspension rebound", &g_local_player->m_vehicle->m_handling_data->m_suspension_rebound_damp, 0.f, 5.f); ImGui::Text("Suspension Upper Limit (mostly visual)"); - ImGui::SliderFloat("##suspension upper", &g_local_player->m_vehicle->m_handling->m_suspension_upper_limit, -1.f, 1.f); + ImGui::SliderFloat("##suspension upper", &g_local_player->m_vehicle->m_handling_data->m_suspension_upper_limit, -1.f, 1.f); ImGui::Text("Suspension Lower Limit (mostly visual)"); - ImGui::SliderFloat("##suspension lower", &g_local_player->m_vehicle->m_handling->m_suspension_lower_limit, -1.f, 1.f); + ImGui::SliderFloat("##suspension lower", &g_local_player->m_vehicle->m_handling_data->m_suspension_lower_limit, -1.f, 1.f); ImGui::Text("Suspension Raise (Ride Height)"); - ImGui::SliderFloat("##suspension raise", &g_local_player->m_vehicle->m_handling->m_suspension_raise, -1.f, 1.f); + ImGui::SliderFloat("##suspension raise", &g_local_player->m_vehicle->m_handling_data->m_suspension_raise, -1.f, 1.f); ImGui::Text("Suspension Bias Front (Strength Bias, 1 = front, 0 = rear)"); - float fSuspensionBiasFront = g_local_player->m_vehicle->m_handling->m_suspension_bias_front / 2; + float fSuspensionBiasFront = g_local_player->m_vehicle->m_handling_data->m_suspension_bias_front / 2; if (ImGui::SliderFloat("##suspension bias", &fSuspensionBiasFront, 0.f, 1.f)) - g_local_player->m_vehicle->m_handling->m_suspension_bias_front = fSuspensionBiasFront * 2; + g_local_player->m_vehicle->m_handling_data->m_suspension_bias_front = fSuspensionBiasFront * 2; ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_traction.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_traction.cpp index 8450375d..d8b278e5 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_traction.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_traction.cpp @@ -7,30 +7,30 @@ namespace big if (ImGui::BeginTabItem("Traction")) { ImGui::Text("Minimum Traction"); - ImGui::SliderFloat("##traction curve min", &g_local_player->m_vehicle->m_handling->m_traction_curve_min, 0.f, 7.f); + ImGui::SliderFloat("##traction curve min", &g_local_player->m_vehicle->m_handling_data->m_traction_curve_min, 0.f, 7.f); ImGui::Text("Peak Traction before grip is lost"); - ImGui::SliderFloat("##traction curve max", &g_local_player->m_vehicle->m_handling->m_traction_curve_max, 0.f, 7.f); + ImGui::SliderFloat("##traction curve max", &g_local_player->m_vehicle->m_handling_data->m_traction_curve_max, 0.f, 7.f); ImGui::Text("Traction Curve (point of grip loss)"); - ImGui::SliderAngle("##traction curve lateral", &g_local_player->m_vehicle->m_handling->m_traction_curve_lateral); + ImGui::SliderAngle("##traction curve lateral", &g_local_player->m_vehicle->m_handling_data->m_traction_curve_lateral); ImGui::Text("Traction Height Loss (distance ground and tires)"); - ImGui::SliderFloat("##traction spring delta max", &g_local_player->m_vehicle->m_handling->m_traction_spring_delta_max, 0.f, 2.f); + ImGui::SliderFloat("##traction spring delta max", &g_local_player->m_vehicle->m_handling_data->m_traction_spring_delta_max, 0.f, 2.f); ImGui::Text("Burnout Multiplier"); - ImGui::SliderFloat("##low speed traction loss mult", &g_local_player->m_vehicle->m_handling->m_low_speed_traction_loss_mult, 0.f, 10.f); + ImGui::SliderFloat("##low speed traction loss mult", &g_local_player->m_vehicle->m_handling_data->m_low_speed_traction_loss_mult, 0.f, 10.f); //ImGui::Text("Camber Stiffness (grip when drifting)"); - //ImGui::SliderFloat("##camber stiffness", &g_local_player->m_vehicle->m_handling->m_camber_stiffness, -1.f, 1.f); + //ImGui::SliderFloat("##camber stiffness", &g_local_player->m_vehicle->m_handling_data->m_camber_stiffness, -1.f, 1.f); ImGui::Text("Traction Bias (1.0 = front, 0.0 = rear, 0.5 = balanced)"); - float fTractionBiasFront = g_local_player->m_vehicle->m_handling->m_traction_bias_front / 2; + float fTractionBiasFront = g_local_player->m_vehicle->m_handling_data->m_traction_bias_front / 2; if (ImGui::SliderFloat("##traction bias front", &fTractionBiasFront, 0.01f, .99f)) - g_local_player->m_vehicle->m_handling->m_traction_bias_front = fTractionBiasFront * 2; + g_local_player->m_vehicle->m_handling_data->m_traction_bias_front = fTractionBiasFront * 2; ImGui::Text("Off-Road Traction Loss (1.0 = normal, lower = better)"); - ImGui::SliderFloat("##traction loss mult", &g_local_player->m_vehicle->m_handling->m_traction_loss_mult, 0.f, 5.f); + ImGui::SliderFloat("##traction loss mult", &g_local_player->m_vehicle->m_handling_data->m_traction_loss_mult, 0.f, 5.f); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/current_profile/current_profile_transmission.cpp b/BigBaseV2/src/gui/handling/current_profile/current_profile_transmission.cpp index de6b785b..1dbf81a1 100644 --- a/BigBaseV2/src/gui/handling/current_profile/current_profile_transmission.cpp +++ b/BigBaseV2/src/gui/handling/current_profile/current_profile_transmission.cpp @@ -7,17 +7,17 @@ namespace big if (ImGui::BeginTabItem("Transmission")) { ImGui::Text("Drive Bias (1.0 = front, 0.0 = rear, 0.5 = balanced 4WD)"); - float fDriveBiasFront = g_local_player->m_vehicle->m_handling->m_drive_bias_front / 2; + float fDriveBiasFront = g_local_player->m_vehicle->m_handling_data->m_drive_bias_front / 2; if (ImGui::SliderFloat("##drive_bias_front", &fDriveBiasFront, 0.f, 1.0f)) - g_local_player->m_vehicle->m_handling->m_drive_bias_front = fDriveBiasFront * 2; + g_local_player->m_vehicle->m_handling_data->m_drive_bias_front = fDriveBiasFront * 2; ImGui::Text("Drive Bias (1.0 = rear, 0.0 = front, 0.5 = balanced 4WD)"); - float fDriveBiasRear = g_local_player->m_vehicle->m_handling->m_drive_bias_rear / 2; + float fDriveBiasRear = g_local_player->m_vehicle->m_handling_data->m_drive_bias_rear / 2; if (ImGui::SliderFloat("##drive_bias_rear", &fDriveBiasRear, 0.f, 1.0f)) - g_local_player->m_vehicle->m_handling->m_drive_bias_rear = fDriveBiasRear * 2; + g_local_player->m_vehicle->m_handling_data->m_drive_bias_rear = fDriveBiasRear * 2; ImGui::Text("Transmission Output (force)"); - ImGui::SliderFloat("##initial drive force", &g_local_player->m_vehicle->m_handling->m_initial_drive_force, 0.01f, 2.f); + ImGui::SliderFloat("##initial drive force", &g_local_player->m_vehicle->m_handling_data->m_initial_drive_force, 0.01f, 2.f); ImGui::EndTabItem(); } diff --git a/BigBaseV2/src/gui/handling/handling_current_profile.cpp b/BigBaseV2/src/gui/handling/handling_current_profile.cpp index ca95414e..bcd43441 100644 --- a/BigBaseV2/src/gui/handling/handling_current_profile.cpp +++ b/BigBaseV2/src/gui/handling/handling_current_profile.cpp @@ -12,7 +12,7 @@ namespace big return; } - if (g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling->m_model_hash).empty()) + if (g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling_data->m_model_hash).empty()) { if (components::button("Save Profile")) { diff --git a/BigBaseV2/src/gui/handling/modals/update_handling.cpp b/BigBaseV2/src/gui/handling/modals/update_handling.cpp index 433a9dfb..1be9b35c 100644 --- a/BigBaseV2/src/gui/handling/modals/update_handling.cpp +++ b/BigBaseV2/src/gui/handling/modals/update_handling.cpp @@ -13,7 +13,7 @@ namespace big ImGui::SetNextWindowSize({ 520, 325 }, ImGuiCond_FirstUseEver); if (ImGui::BeginPopupModal("Update Handling")) { - auto share_code = g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling->m_model_hash); + auto share_code = g_vehicle_service->get_active_profile(g_local_player->m_vehicle->m_handling_data->m_model_hash); if (share_code.empty()) { // should be impossible to trigger but still diff --git a/BigBaseV2/src/hooking.hpp b/BigBaseV2/src/hooking.hpp index 60712308..6f387d67 100644 --- a/BigBaseV2/src/hooking.hpp +++ b/BigBaseV2/src/hooking.hpp @@ -48,7 +48,7 @@ namespace big static bool increment_stat_event(CNetworkIncrementStatEvent* net_event_struct, CNetGamePlayer* sender); static bool scripted_game_event(CScriptedGameEvent* scripted_game_event, CNetGamePlayer* player); - static bool send_net_info_to_lobby(rage::netPlayerData* player, int64_t a2, int64_t a3, DWORD* a4); + static bool send_net_info_to_lobby(rage::rlGamerInfo *player, int64_t a2, int64_t a3, DWORD* a4); static bool receive_net_message(void* netConnectionManager, void* a2, rage::netConnection::InFrame* frame); static void get_network_event_data(int64_t unk, rage::CEventNetwork* net_event); diff --git a/BigBaseV2/src/hooks/player_management/assign_physical_index.cpp b/BigBaseV2/src/hooks/player_management/assign_physical_index.cpp index dadf24d9..a91c81bf 100644 --- a/BigBaseV2/src/hooks/player_management/assign_physical_index.cpp +++ b/BigBaseV2/src/hooks/player_management/assign_physical_index.cpp @@ -9,21 +9,21 @@ namespace big auto returnResult = g_hooking->m_assign_physical_index_hook.get_original()(netPlayerMgr, player, new_index); if (new_index == 0xFF) { g_player_service->player_leave(player); - if (const rage::netPlayerData* net_player_data = player->get_net_data(); net_player_data) + if (const auto* net_player_data = player->get_net_data(); net_player_data) { 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_rockstar_id2; + << " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id; if (g->notifications.player_leave.notify) - g_notification_service->push("Player Left", fmt::format("{} freeing slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_rockstar_id2)); + g_notification_service->push("Player Left", fmt::format("{} freeing slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id)); } return returnResult; } g_player_service->player_join(player); - if (const rage::netPlayerData* net_player_data = player->get_net_data(); net_player_data) + if (const auto* net_player_data = player->get_net_data(); net_player_data) { if (g->notifications.player_join.above_map) notify::player_joined(player); @@ -31,10 +31,10 @@ 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_rockstar_id2; + << " with Rockstar ID: " << net_player_data->m_gamer_handle_2.m_rockstar_id; if (g->notifications.player_join.notify) - g_notification_service->push("Player Joined", fmt::format("{} taking slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_rockstar_id2)); + g_notification_service->push("Player Joined", fmt::format("{} taking slot #{} with Rockstar ID: {}", net_player_data->m_name, player->m_player_id, net_player_data->m_gamer_handle_2.m_rockstar_id)); } return returnResult; } diff --git a/BigBaseV2/src/hooks/protections/receive_net_message.cpp b/BigBaseV2/src/hooks/protections/receive_net_message.cpp index 289c740c..64fa216e 100644 --- a/BigBaseV2/src/hooks/protections/receive_net_message.cpp +++ b/BigBaseV2/src/hooks/protections/receive_net_message.cpp @@ -1,6 +1,7 @@ #include "hooking.hpp" #include "services/players/player_service.hpp" #include +#include "gta_util.hpp" namespace big { @@ -24,29 +25,24 @@ namespace big bool hooks::receive_net_message(void* netConnectionManager, void* a2, rage::netConnection::InFrame* frame) { - if (frame->get_type() == 4) + if (frame->get_event_type() == rage::netConnection::InFrame::EventType::FrameReceived) { rage::datBitBuffer buffer((uint8_t*)frame->m_data, frame->m_length); buffer.m_flagBits = 1; rage::eNetMessage msgType; - const auto player = g_player_service->get_by_msg_id(frame->m_msg_id); + player_ptr player; + for (std::uint32_t i = 0; i < gta_util::get_network()->m_game_session_ptr->m_player_count; i++) + { + if (gta_util::get_network()->m_game_session_ptr->m_players[i]->m_player_data.m_peer_id_2 == frame->m_peer_id) + { + player = g_player_service->get_by_host_token(gta_util::get_network()->m_game_session_ptr->m_players[i]->m_player_data.m_host_token); + break; + } + } if (player && get_msg_type(msgType, buffer)) { switch (msgType) { - //Desync Kick - case rage::eNetMessage::CMsgNetComplaint: - { - uint64_t hostToken; - buffer.ReadQWord(&hostToken, 0x40); - buffer.Seek(0); - player_ptr sender = g_player_service->get_by_host_token(hostToken); - sender->get_net_game_player()->m_complaints = USHRT_MAX; //Sender - g_notification_service->push_warning("Blocked Kick", fmt::format("Desync kick from {}", sender->get_name())); - buffer.Seek(0); - return false; - } - case rage::eNetMessage::CMsgScriptMigrateHost: { if (std::chrono::system_clock::now() - player->m_last_transition_msg_sent < 200ms) @@ -64,7 +60,33 @@ namespace big } break; } - + case rage::eNetMessage::CMsgRemoveGamersFromSessionCmd: + { + player_ptr pl; + uint64_t session_id; + buffer.ReadQWord(&session_id, 64); + uint32_t count; + buffer.ReadDword(&count, 6); + pl = nullptr; + for (std::uint32_t i = 0; i < count; i++) + { + uint64_t peer_id; + buffer.ReadQWord((uint64_t*)&peer_id, 64); + 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_peer_id_2 == peer_id) + { + pl = g_player_service->get_by_host_token(gta_util::get_network()->m_game_session_ptr->m_peers[i]->m_peer_data.m_host_token); + break; + } + } + } + if (player && pl && player->id() != pl->id() && count == 1 && frame->m_msg_id == -1) + { + g_notification_service->push_error("Warning!", fmt::format("{} breakup kicked {}!", player->get_name(), pl->get_name())); + } + break; + } } } } diff --git a/BigBaseV2/src/hooks/protections/received_clone_sync.cpp b/BigBaseV2/src/hooks/protections/received_clone_sync.cpp index ec7d5a9a..44d7b99a 100644 --- a/BigBaseV2/src/hooks/protections/received_clone_sync.cpp +++ b/BigBaseV2/src/hooks/protections/received_clone_sync.cpp @@ -2,7 +2,8 @@ #include "core/globals.hpp" #include "natives.hpp" #include "network/netObject.hpp" -#include "rage/fwEntity.hpp" +#include "base/CBaseModelInfo.hpp" +#include "vehicle/CVehicleModelInfo.hpp" #include "base/CObject.hpp" namespace big { diff --git a/BigBaseV2/src/hooks/spoofing/send_net_info_to_lobby.cpp b/BigBaseV2/src/hooks/spoofing/send_net_info_to_lobby.cpp index 548f3817..43373b58 100644 --- a/BigBaseV2/src/hooks/spoofing/send_net_info_to_lobby.cpp +++ b/BigBaseV2/src/hooks/spoofing/send_net_info_to_lobby.cpp @@ -2,9 +2,9 @@ namespace big { - bool hooks::send_net_info_to_lobby(rage::netPlayerData* player, int64_t a2, int64_t a3, DWORD* a4) + bool hooks::send_net_info_to_lobby(rage::rlGamerInfo* player, int64_t a2, int64_t a3, DWORD* a4) { - const bool is_local_player = g_local_player->m_player_info->m_net_player_data.m_rockstar_id == player->m_rockstar_id; + const bool is_local_player = g_local_player->m_player_info->m_net_player_data.m_gamer_handle_2.m_rockstar_id == player->m_gamer_handle_2.m_rockstar_id; // check so we're 100% sure we modify data only for ourselves if (is_local_player) @@ -22,8 +22,8 @@ namespace big if (g->spoofing.spoof_rockstar_id) { - player->m_rockstar_id = g->spoofing.rockstar_id; - player->m_rockstar_id2 = g->spoofing.rockstar_id; + player->m_gamer_handle.m_rockstar_id = g->spoofing.rockstar_id; + player->m_gamer_handle_2.m_rockstar_id = g->spoofing.rockstar_id; } if (g->notifications.send_net_info_to_lobby.log) diff --git a/BigBaseV2/src/main.cpp b/BigBaseV2/src/main.cpp index 8936138c..0349b35d 100644 --- a/BigBaseV2/src/main.cpp +++ b/BigBaseV2/src/main.cpp @@ -31,6 +31,7 @@ BOOL APIENTRY DllMain(HMODULE hmod, DWORD reason, PVOID) DisableThreadLibraryCalls(hmod); g_hmodule = hmod; + g_is_steam = GetModuleHandle(L"steam_api64.dll") != NULL; g_main_thread = CreateThread(nullptr, 0, [](PVOID) -> DWORD { while (!FindWindow(L"grcWindow", L"Grand Theft Auto V")) diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index e11a8c53..660c55f0 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -324,6 +324,18 @@ namespace big m_get_label_text = ptr.sub(19).as(); }); + // Network + main_batch.add("N", "48 8B 0D ? ? ? ? 48 8B D7 E8 ? ? ? ? 84 C0 75 17 48 8B 0D ? ? ? ? 48 8B D7", [this](memory::handle ptr) + { + m_network = ptr.add(3).rip().as(); + }); + + // Reset Network Complaints + main_batch.add("RENC", "E8 ? ? ? ? 8B 8B ? ? ? ? 03 CF", [this](memory::handle ptr) + { + m_reset_network_complaints = ptr.add(1).rip().as(); + }); + auto mem_region = memory::module(nullptr); main_batch.run(mem_region); diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index 00fe8774..63183648 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -6,6 +6,7 @@ #include "gta/replay.hpp" #include "network/CNetworkPlayerMgr.hpp" #include "socialclub/FriendRegistry.hpp" +#include "network/Network.hpp" namespace big { @@ -97,6 +98,10 @@ namespace big PVOID m_receive_net_message{}; PVOID m_get_network_event_data{}; PVOID m_assign_physical_index{}; + + Network** m_network; + + functions::reset_network_complaints m_reset_network_complaints{}; }; inline pointers* g_pointers{}; diff --git a/BigBaseV2/src/services/context_menu/context_menu_service.cpp b/BigBaseV2/src/services/context_menu/context_menu_service.cpp index 47ea68b2..734e534b 100644 --- a/BigBaseV2/src/services/context_menu/context_menu_service.cpp +++ b/BigBaseV2/src/services/context_menu/context_menu_service.cpp @@ -106,7 +106,7 @@ namespace big } } - double context_menu_service::distance_to_middle_of_screen(const rage::vector2& screen_pos) + double context_menu_service::distance_to_middle_of_screen(const rage::fvector2& screen_pos) { double cumulative_distance{}; @@ -214,7 +214,7 @@ namespace big double distance = 1; bool got_an_entity = false; - rage::vector2 screen_pos{}; + rage::fvector2 screen_pos{}; for (std::uint32_t i = 0; i < offset; i++) { if (!all_entities[i].m_entity_ptr) diff --git a/BigBaseV2/src/services/context_menu/context_menu_service.hpp b/BigBaseV2/src/services/context_menu/context_menu_service.hpp index 3f63ae58..0fc0bd83 100644 --- a/BigBaseV2/src/services/context_menu/context_menu_service.hpp +++ b/BigBaseV2/src/services/context_menu/context_menu_service.hpp @@ -30,7 +30,7 @@ namespace big { private: void fill_model_bounding_box_screen_space(); - static double distance_to_middle_of_screen(const rage::vector2& screen_pos); + static double distance_to_middle_of_screen(const rage::fvector2& screen_pos); public: context_menu_service(); diff --git a/BigBaseV2/src/services/friends/friends_service.cpp b/BigBaseV2/src/services/friends/friends_service.cpp index bf1309ba..38a95e22 100644 --- a/BigBaseV2/src/services/friends/friends_service.cpp +++ b/BigBaseV2/src/services/friends/friends_service.cpp @@ -18,7 +18,7 @@ namespace big if (net_player == nullptr) return false; - const auto rockstar_id = net_player->get_net_data()->m_rockstar_id2; + const auto rockstar_id = net_player->get_net_data()->m_gamer_handle_2.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->m_friends_list->m_data[i].m_rockstar_id) return true; diff --git a/BigBaseV2/src/services/players/player.cpp b/BigBaseV2/src/services/players/player.cpp index 74bec8b6..94d183b4 100644 --- a/BigBaseV2/src/services/players/player.cpp +++ b/BigBaseV2/src/services/players/player.cpp @@ -1,6 +1,7 @@ #include "player.hpp" #include "network/CNetGamePlayer.hpp" #include "services/friends/friends_service.hpp" +#include "gta_util.hpp" namespace big { @@ -10,7 +11,7 @@ namespace big m_is_friend = friends_service::is_friend(net_game_player); } - CAutomobile* player::get_current_vehicle() const + CVehicle* player::get_current_vehicle() const { if (const auto ped = this->get_ped(); ped != nullptr) if (const auto vehicle = ped->m_vehicle; vehicle != nullptr) @@ -23,7 +24,7 @@ namespace big return m_net_game_player == nullptr ? "" : m_net_game_player->get_name(); } - rage::netPlayerData* player::get_net_data() const + rage::rlGamerInfo* player::get_net_data() const { return m_net_game_player == nullptr ? nullptr : m_net_game_player->get_net_data(); } @@ -48,6 +49,35 @@ namespace big return nullptr; } + rage::snPlayer* player::get_session_player() + { + for (std::uint32_t i = 0; i < gta_util::get_network()->m_game_session_ptr->m_player_count; i++) + { + if (gta_util::get_network()->m_game_session_ptr->m_players[i]->m_player_data.m_host_token == get_net_data()->m_host_token) + { + return gta_util::get_network()->m_game_session_ptr->m_players[i]; + } + } + + if (gta_util::get_network()->m_game_session_ptr->m_local_player.m_player_data.m_host_token == get_net_data()->m_host_token) + return >a_util::get_network()->m_game_session_ptr->m_local_player; + + return nullptr; + } + + rage::snPeer* player::get_session_peer() + { + 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) + { + return gta_util::get_network()->m_game_session_ptr->m_peers[i]; + } + } + + return nullptr; + } + uint8_t player::id() const { return m_net_game_player == nullptr ? -1 : m_net_game_player->m_player_id; diff --git a/BigBaseV2/src/services/players/player.hpp b/BigBaseV2/src/services/players/player.hpp index d8f8c229..bdff23cf 100644 --- a/BigBaseV2/src/services/players/player.hpp +++ b/BigBaseV2/src/services/players/player.hpp @@ -1,5 +1,7 @@ #pragma once #include "player_service.hpp" +#include "vehicle/CVehicle.hpp" +#include "network/snSession.hpp" namespace big { @@ -23,12 +25,14 @@ namespace big float screen_position_x = -1.f; float screen_position_y = -1.f; - [[nodiscard]] CAutomobile* get_current_vehicle() const; + [[nodiscard]] CVehicle* get_current_vehicle() const; [[nodiscard]] const char* get_name() const; - [[nodiscard]] rage::netPlayerData* get_net_data() const; + [[nodiscard]] rage::rlGamerInfo* get_net_data() const; [[nodiscard]] CNetGamePlayer* get_net_game_player() const; [[nodiscard]] CPed* get_ped() const; [[nodiscard]] CPlayerInfo* get_player_info() const; + [[nodiscard]] class rage::snPlayer* get_session_player(); + [[nodiscard]] class rage::snPeer* get_session_peer(); [[nodiscard]] uint8_t id() const; diff --git a/BigBaseV2/src/services/vehicle/vehicle_service.cpp b/BigBaseV2/src/services/vehicle/vehicle_service.cpp index 14ae5b4b..cdef338e 100644 --- a/BigBaseV2/src/services/vehicle/vehicle_service.cpp +++ b/BigBaseV2/src/services/vehicle/vehicle_service.cpp @@ -23,12 +23,12 @@ namespace big { if (g_local_player == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT || g_local_player->m_vehicle == nullptr) return -1; - if (m_handling_backup.find(g_local_player->m_vehicle->m_handling->m_model_hash) != m_handling_backup.end()) + if (m_handling_backup.find(g_local_player->m_vehicle->m_handling_data->m_model_hash) != m_handling_backup.end()) return 0; - CHandlingData handling = *g_local_player->m_vehicle->m_handling; + CHandlingData handling = *g_local_player->m_vehicle->m_handling_data; - m_handling_backup.emplace(g_local_player->m_vehicle->m_handling->m_model_hash, handling); + m_handling_backup.emplace(g_local_player->m_vehicle->m_handling_data->m_model_hash, handling); return 1; } @@ -63,7 +63,7 @@ namespace big { auto& data = json["data"]; - HandlingProfile profile = HandlingProfile(data, g_local_player->m_vehicle->m_handling); + HandlingProfile profile = HandlingProfile(data, g_local_player->m_vehicle->m_handling_data); if (auto it = m_handling_profiles.find(data["share_code"]); it != m_handling_profiles.end()) it->second = profile; @@ -155,7 +155,7 @@ namespace big if (!safe_to_modify()) return false; - if (!force_update && up_to_date == g_local_player->m_vehicle->m_handling->m_model_hash) + if (!force_update && up_to_date == g_local_player->m_vehicle->m_handling_data->m_model_hash) return true; busy = true; @@ -163,7 +163,7 @@ namespace big g_thread_pool->push([&]() { nlohmann::json json; - if (!api::vehicle::handling::get_saved_handling(g_local_player->m_vehicle->m_handling->m_model_hash, json) || json == nullptr) + if (!api::vehicle::handling::get_saved_handling(g_local_player->m_vehicle->m_handling_data->m_model_hash, json) || json == nullptr) { busy = false; @@ -175,7 +175,7 @@ namespace big { LOG(INFO) << "Registered profile '" << el["name"].get().c_str() << "' with share code " << el["share_code"].get().c_str(); - HandlingProfile profile = HandlingProfile(el, g_local_player->m_vehicle->m_handling); + HandlingProfile profile = HandlingProfile(el, g_local_player->m_vehicle->m_handling_data); if (auto it = this->m_handling_profiles.find(el["share_code"]); it != this->m_handling_profiles.end()) it->second = profile; @@ -184,7 +184,7 @@ namespace big } busy = false; - up_to_date = g_local_player->m_vehicle->m_handling->m_model_hash; + up_to_date = g_local_player->m_vehicle->m_handling_data->m_model_hash; }); return false; @@ -201,7 +201,7 @@ namespace big this->m_publish_status = PublishStatus::SAVING; - CHandlingData handling_data = *g_local_player->m_vehicle->m_handling; + CHandlingData handling_data = *g_local_player->m_vehicle->m_handling_data; uint32_t hash = handling_data.m_model_hash; nlohmann::json data; @@ -231,11 +231,11 @@ namespace big bool vehicle_service::restore_vehicle() { - if (auto it = m_handling_backup.find(g_local_player->m_vehicle->m_handling->m_model_hash); it != m_handling_backup.end()) + if (auto it = m_handling_backup.find(g_local_player->m_vehicle->m_handling_data->m_model_hash); it != m_handling_backup.end()) { if (safe_to_modify()) - *g_local_player->m_vehicle->m_handling = it->second; - this->m_active_profiles.erase(g_local_player->m_vehicle->m_handling->m_model_hash); + *g_local_player->m_vehicle->m_handling_data = it->second; + this->m_active_profiles.erase(g_local_player->m_vehicle->m_handling_data->m_model_hash); return true; } @@ -255,7 +255,7 @@ namespace big { if (!safe_to_modify()) return; - *g_local_player->m_vehicle->m_handling = profile.data; + *g_local_player->m_vehicle->m_handling_data = profile.data; this->set_active_profile(profile.handling_hash, profile.share_code); } @@ -271,14 +271,14 @@ namespace big if (!safe_to_modify()) return false; - if (!force_update && up_to_date == g_local_player->m_vehicle->m_handling->m_model_hash) + if (!force_update && up_to_date == g_local_player->m_vehicle->m_handling_data->m_model_hash) return true; busy = true; g_thread_pool->push([&] { nlohmann::json json; - if (!api::vehicle::handling::get_my_handling(g_local_player->m_vehicle->m_handling->m_model_hash, json) || json == nullptr) + if (!api::vehicle::handling::get_my_handling(g_local_player->m_vehicle->m_handling_data->m_model_hash, json) || json == nullptr) { busy = false; @@ -290,7 +290,7 @@ namespace big { LOG(INFO) << "Registered profile '" << el["name"].get().c_str() << "' with share code " << el["share_code"].get().c_str(); - HandlingProfile profile = HandlingProfile(el, g_local_player->m_vehicle->m_handling); + HandlingProfile profile = HandlingProfile(el, g_local_player->m_vehicle->m_handling_data); if (auto it = this->m_handling_profiles.find(el["share_code"]); it != this->m_handling_profiles.end()) it->second = profile; @@ -299,7 +299,7 @@ namespace big } busy = false; - up_to_date = g_local_player->m_vehicle->m_handling->m_model_hash; + up_to_date = g_local_player->m_vehicle->m_handling_data->m_model_hash; }); return false; diff --git a/BigBaseV2/src/views/players/view_player.cpp b/BigBaseV2/src/views/players/view_player.cpp index 2afe6482..49a9ad31 100644 --- a/BigBaseV2/src/views/players/view_player.cpp +++ b/BigBaseV2/src/views/players/view_player.cpp @@ -113,7 +113,7 @@ namespace big mode_str = ""; - if (CAutomobile* vehicle = g_player_service->get_selected()->get_current_vehicle(); vehicle != nullptr) + if (auto vehicle = g_player_service->get_selected()->get_current_vehicle(); vehicle != nullptr) { veh_damage_bits = vehicle->m_damage_bits; } @@ -150,9 +150,9 @@ namespace big ImGui::Separator(); - if (rage::netPlayerData* net_player_data = g_player_service->get_selected()->get_net_data(); net_player_data != nullptr) + if (auto net_player_data = g_player_service->get_selected()->get_net_data(); net_player_data != nullptr) { - ImGui::Text("Rockstar ID: %d", net_player_data->m_rockstar_id); + ImGui::Text("Rockstar ID: %d", net_player_data->m_gamer_handle_2.m_rockstar_id); ImGui::Text( "IP Address: %d.%d.%d.%d:%d", net_player_data->m_external_ip.m_field1, diff --git a/vendor/GTAV-Classes b/vendor/GTAV-Classes index b28a988a..e0b6b57b 160000 --- a/vendor/GTAV-Classes +++ b/vendor/GTAV-Classes @@ -1 +1 @@ -Subproject commit b28a988a660bcdbf93df67befa9646b300b00279 +Subproject commit e0b6b57b25819ef7edc2dd27765cbc80191a4d77