Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/gta/enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2023,4 +2023,20 @@ enum class GameMode : int32_t
Golf = 0xB,
Tennis = 0xC,
ShootingRange = 0xD
};
};

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,
};
6 changes: 2 additions & 4 deletions src/hooking/hooking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ namespace big
detour_hook_helper::add<hooks::run_script_threads>("Script hook", (void*)g_pointers->m_run_script_threads);
detour_hook_helper::add<hooks::create_native>("Create Native", (void*)g_pointers->m_create_native);

if(!g_is_enhanced)
{
detour_hook_helper::add<hooks::network_can_access_multiplayer>("Network Can Access Multiplayer", (void*)g_pointers->m_network_can_access_multiplayer);
}
detour_hook_helper::add<hooks::network_can_access_multiplayer>("Network Can Access Multiplayer", (void*)g_pointers->m_network_can_access_multiplayer);
detour_hook_helper::add<hooks::has_privilege>("Has Privilege", (void*)g_pointers->m_has_privilege);

detour_hook_helper::add<hooks::create_stat>("Create Stat", (void*)g_pointers->m_create_stat);
detour_hook_helper::add<hooks::mp_stats_save>("MP Stats Save", (void*)g_pointers->m_mp_stats_save);
Expand Down
1 change: 1 addition & 0 deletions src/hooking/hooking.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
28 changes: 28 additions & 0 deletions src/hooks/misc/has_privilege.cpp
Original file line number Diff line number Diff line change
@@ -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<hooks::has_privilege>()(p1, privilege);
}
}
3 changes: 0 additions & 3 deletions src/native_hooks/native_hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
11 changes: 11 additions & 0 deletions src/pointers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PVOID>();
});

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<PVOID>();
});
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<PVOID>();
});

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<PVOID>();
Expand Down Expand Up @@ -179,6 +183,13 @@ namespace big
m_construct_basket = ptr.sub(10).as<PVOID>();
});

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<PVOID>();
});
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<PVOID>();
});

main_batch.run(memory::module(nullptr));

#ifdef ENABLE_GUI
Expand Down
3 changes: 2 additions & 1 deletion src/pointers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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{};
Expand Down