diff --git a/BigBaseV2/src/hooking.cpp b/BigBaseV2/src/hooking.cpp index 822025f8..a9b6c14a 100644 --- a/BigBaseV2/src/hooking.cpp +++ b/BigBaseV2/src/hooking.cpp @@ -8,6 +8,7 @@ #include "hooking.hpp" #include "memory/module.hpp" #include "natives.hpp" +#include "native_hooks/native_hooks.hpp" #include "pointers.hpp" #include "renderer.hpp" #include "script_mgr.hpp" diff --git a/BigBaseV2/src/hooking.hpp b/BigBaseV2/src/hooking.hpp index 479c9f55..dbde84e5 100644 --- a/BigBaseV2/src/hooking.hpp +++ b/BigBaseV2/src/hooking.hpp @@ -63,6 +63,8 @@ namespace big void enable(); void disable(); + std::list m_native_hooks; + std::unordered_map m_natives; private: bool m_enabled{}; minhook_keepalive m_minhook_keepalive; diff --git a/BigBaseV2/src/native_hooks/native_hooks.hpp b/BigBaseV2/src/native_hooks/native_hooks.hpp new file mode 100644 index 00000000..baa48f96 --- /dev/null +++ b/BigBaseV2/src/native_hooks/native_hooks.hpp @@ -0,0 +1,16 @@ +#pragma once +#include "natives.hpp" + +namespace big::native_hook +{ + inline void NETWORK_CAN_BAIL(rage::scrNativeCallContext* src); + inline void STAT_SET_INT(rage::scrNativeCallContext* src); + inline void TRIGGER_SCRIPT_EVENT(rage::scrNativeCallContext* src); + + static std::unordered_map natives_replace = + { + { 0x580CE4438479CC61, &NETWORK_CAN_BAIL }, + { 0xB3271D7AB655B441, &STAT_SET_INT }, + { 0x5AE99C571D5BBE5D, &TRIGGER_SCRIPT_EVENT } + }; +} \ No newline at end of file diff --git a/BigBaseV2/src/native_hooks/network_can_bail.cpp b/BigBaseV2/src/native_hooks/network_can_bail.cpp new file mode 100644 index 00000000..8e406355 --- /dev/null +++ b/BigBaseV2/src/native_hooks/network_can_bail.cpp @@ -0,0 +1,11 @@ +#include "native_hooks.hpp" + +namespace big::native_hook +{ + void NETWORK_CAN_BAIL(rage::scrNativeCallContext* src) + { + LOG(INFO) << "NATIVE_HOOK => NETWORK_CAN_BAIL : TRIGGERED"; + + src->set_return_value(false); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/native_hooks/stat_set_int.cpp b/BigBaseV2/src/native_hooks/stat_set_int.cpp new file mode 100644 index 00000000..14af0663 --- /dev/null +++ b/BigBaseV2/src/native_hooks/stat_set_int.cpp @@ -0,0 +1,28 @@ +#include "native_hooks.hpp" +#include "gta/joaat.hpp" + +namespace big::native_hook +{ + void STAT_SET_INT(rage::scrNativeCallContext* src) + { + Hash stat_hash = src->get_arg(0); + int value = src->get_arg(1); + BOOL save = src->get_arg(2); + + switch (stat_hash) + { + case RAGE_JOAAT("MPPLY_GAME_EXPLOITS"): + case RAGE_JOAAT("MPPLY_VC_HATE"): + case RAGE_JOAAT("MPPLY_EXPLOITS"): + case RAGE_JOAAT("MPPLY_TC_ANNOYINGME"): + case RAGE_JOAAT("MPPLY_TC_HATE"): + src->set_return_value(true); + + break; + default: + src->set_return_value(STATS::STAT_SET_INT(stat_hash, value, save)); + + break; + } + } +} \ No newline at end of file diff --git a/BigBaseV2/src/native_hooks/trigger_script_event.cpp b/BigBaseV2/src/native_hooks/trigger_script_event.cpp new file mode 100644 index 00000000..c3a215e3 --- /dev/null +++ b/BigBaseV2/src/native_hooks/trigger_script_event.cpp @@ -0,0 +1,24 @@ +#include "native_hooks.hpp" +#include "pointers.hpp" + +namespace big::native_hook +{ + void TRIGGER_SCRIPT_EVENT(rage::scrNativeCallContext* src) + { + int event_group = src->get_arg(0); + Any* event_data = src->get_arg(1); + int event_size = src->get_arg(3); + int player_bits = src->get_arg(4); + + if (event_group) + { + Hash event_hash = event_data[0]; + + LOG(INFO) << "Event hash: " << event_hash; + for (size_t i = 1; i < std::min(event_size, 200); i++) + LOG(INFO) << "Arg[#" << i << "] : " << event_data[i]; + } + + SCRIPT::TRIGGER_SCRIPT_EVENT(event_group, event_data, event_size, player_bits); + } +} \ No newline at end of file diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index fc8afda7..f7ba4459 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -3,6 +3,7 @@ #include "gta/fwddec.hpp" #include "gta/enums.hpp" #include "gta/replay.hpp" +#include "gta/script_program.hpp" #include "function_types.hpp" namespace big diff --git a/BigBaseV2/src/util/toxic.hpp b/BigBaseV2/src/util/toxic.hpp index 0df5a236..da456314 100644 --- a/BigBaseV2/src/util/toxic.hpp +++ b/BigBaseV2/src/util/toxic.hpp @@ -35,8 +35,8 @@ namespace big::toxic inline void bounty_player(Player target, Player origin, int amount) { const size_t arg_count = 22; - int64_t args[22] = { - 2388821078, // 0 + int args[22] = { + (int)eRemoteEvent::Bounty, // 0 origin, // 1 Player in script self target, // 2 Player in script self 0, // 3 unk