diff --git a/src/gta/enums.hpp b/src/gta/enums.hpp index 8ccc429..dabef4d 100644 --- a/src/gta/enums.hpp +++ b/src/gta/enums.hpp @@ -2023,4 +2023,20 @@ enum class GameMode : int32_t Golf = 0xB, Tennis = 0xC, ShootingRange = 0xD -}; \ No newline at end of file +}; + +enum class eRosPrivilege : uint32_t +{ + CREATE_TICKET = 1, + MULTIPLAYER = 3, + LEADERBOARD_WRITE = 4, + BANNED = 7, + PRIVATE_MSG = 9, + SOCIAL_CLUB = 10, + CHEATER = 20, + PLAYED_LAST_GEN = 24, + SPECIAL_EDITION_CONTENT = 25, + MP_TEXT_COMMUNICATION = 29, + MP_VOICE_COMMUNICATION = 30, + REPORTING = 31, +}; diff --git a/src/hooking/hooking.cpp b/src/hooking/hooking.cpp index 7a5524f..080304a 100644 --- a/src/hooking/hooking.cpp +++ b/src/hooking/hooking.cpp @@ -30,10 +30,8 @@ namespace big detour_hook_helper::add("Script hook", (void*)g_pointers->m_run_script_threads); detour_hook_helper::add("Create Native", (void*)g_pointers->m_create_native); - if(!g_is_enhanced) - { - detour_hook_helper::add("Network Can Access Multiplayer", (void*)g_pointers->m_network_can_access_multiplayer); - } + detour_hook_helper::add("Network Can Access Multiplayer", (void*)g_pointers->m_network_can_access_multiplayer); + detour_hook_helper::add("Has Privilege", (void*)g_pointers->m_has_privilege); detour_hook_helper::add("Create Stat", (void*)g_pointers->m_create_stat); detour_hook_helper::add("MP Stats Save", (void*)g_pointers->m_mp_stats_save); diff --git a/src/hooking/hooking.hpp b/src/hooking/hooking.hpp index 7085ea8..87e3397 100644 --- a/src/hooking/hooking.hpp +++ b/src/hooking/hooking.hpp @@ -13,6 +13,7 @@ namespace big { static bool run_script_threads(std::uint32_t ops_to_execute); + static bool has_privilege(void* p1, uint32_t privilege); static uint32_t network_can_access_multiplayer(uint32_t a1, uint64_t* a2); static void create_native(void* a1, rage::scrNativeHash native_hash, rage::scrNativeHandler native_func); diff --git a/src/hooks/misc/has_privilege.cpp b/src/hooks/misc/has_privilege.cpp new file mode 100644 index 0000000..08f928a --- /dev/null +++ b/src/hooks/misc/has_privilege.cpp @@ -0,0 +1,28 @@ +#include "hooking/hooking.hpp" +#include "gta/enums.hpp" + +namespace big +{ + bool hooks::has_privilege(void* p1, uint32_t privilege) + { + switch ((eRosPrivilege)privilege) + { + case eRosPrivilege::CREATE_TICKET: + case eRosPrivilege::MULTIPLAYER: + case eRosPrivilege::PRIVATE_MSG: + case eRosPrivilege::SOCIAL_CLUB: + case eRosPrivilege::MP_TEXT_COMMUNICATION: + case eRosPrivilege::MP_VOICE_COMMUNICATION: + case eRosPrivilege::REPORTING: + return true; + + case eRosPrivilege::BANNED: + case eRosPrivilege::CHEATER: + return false; + + default: break; + }; + + return g_hooking->get_original()(p1, privilege); + } +} diff --git a/src/native_hooks/native_hooks.cpp b/src/native_hooks/native_hooks.cpp index e6f8720..f29f72d 100644 --- a/src/native_hooks/native_hooks.cpp +++ b/src/native_hooks/native_hooks.cpp @@ -18,9 +18,6 @@ namespace big add_native_detour(0xE496A53BA5F50A56, all_scripts::RETURN_FALSE); // STAT_CLOUD_SLOT_LOAD_FAILED_CODE add_native_detour(0xECB41AC6AB754401, all_scripts::RETURN_FALSE); // STAT_LOAD_DIRTY_READ_DETECTED add_native_detour(0xC0E0D686DDFC6EAE, all_scripts::RETURN_TRUE); // STAT_GET_LOAD_SAFE_TO_PROGRESS_TO_MP_FROM_SP - add_native_detour(0xD9719341663C385F, all_scripts::RETURN_TRUE); // _NETWORK_HAS_ROS_PRIVILEGE_MP_TEXT_COMMUNICATION - add_native_detour(0x8956A309BE90057C, all_scripts::RETURN_TRUE); // _NETWORK_HAS_ROS_PRIVILEGE_MP_VOICE_COMMUNICATION - add_native_detour(0xE1E02509169C124E, all_scripts::RETURN_TRUE); // _NETWORK_HAVE_PLATFORM_COMMUNICATION_PRIVILEGES add_native_detour(0xF70EFA14FE091429, all_scripts::WITHDRAW_VC); add_native_detour(0xE260E0BB9CD995AC, all_scripts::DEPOSIT_VC); diff --git a/src/pointers.cpp b/src/pointers.cpp index 569b985..8922369 100644 --- a/src/pointers.cpp +++ b/src/pointers.cpp @@ -117,9 +117,13 @@ namespace big main_batch.add("ProfileStats Write Request", "10 ? 89 ? 31 D2 41 89 ? E8", -1, -1, eGameBranch::Enhanced, [this](memory::handle ptr) { m_profile_stats_save = ptr.add(10).rip().as(); }); + main_batch.add("Network Can Access Multiplayer", "74 E0 33 D2 8B CB", -1, -1, eGameBranch::Legacy, [this](memory::handle ptr) { m_network_can_access_multiplayer = ptr.add(7).rip().as(); }); + main_batch.add("Network Can Access Multiplayer", "B9 01 00 00 00 31 D2 E8 ? ? ? ? 48 8B 0D", -1, -1, eGameBranch::Enhanced, [this](memory::handle ptr) { + m_network_can_access_multiplayer = ptr.add(8).rip().add(1).rip().as(); + }); main_batch.add("Create Stat", "44 8A 45 70", -1, -1, eGameBranch::Legacy, [this](memory::handle ptr) { m_create_stat = ptr.add(12).rip().as(); @@ -179,6 +183,13 @@ namespace big m_construct_basket = ptr.sub(10).as(); }); + main_batch.add("Has Privilege", "76 ? BA 05 00 00 00 E8", -1, -1, eGameBranch::Legacy, [this](memory::handle ptr) { + m_has_privilege = ptr.add(8).rip().as(); + }); + main_batch.add("Has Privilege", "BA 1B 00 00 00 E8 ? ? ? ? EB", -1, -1, eGameBranch::Enhanced, [this](memory::handle ptr) { + m_has_privilege = ptr.add(6).rip().as(); + }); + main_batch.run(memory::module(nullptr)); #ifdef ENABLE_GUI diff --git a/src/pointers.hpp b/src/pointers.hpp index c13278b..954c1e7 100644 --- a/src/pointers.hpp +++ b/src/pointers.hpp @@ -41,7 +41,6 @@ namespace big PVOID m_profile_stats_save; PVOID m_network_can_access_multiplayer; - bool m_network_can_access_multiplayer_already_hooked = false; PVOID m_create_stat; PVOID m_stat_dtor; @@ -58,6 +57,8 @@ namespace big PVOID m_construct_basket; functions::spend_money m_spend_money; functions::earn_money m_earn_money; + + PVOID m_has_privilege; }; inline pointers* g_pointers{};