feat(IncrementStatEvent): Added REPORT blocking

This commit is contained in:
Yimura 2021-05-19 16:19:38 +02:00
parent 9e1465548b
commit f070caf23d
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
6 changed files with 52 additions and 1 deletions

View File

@ -11,4 +11,6 @@ namespace big::functions
using gta_thread_tick = __int64(GtaThread* a1, unsigned int a2);
using gta_thread_kill = __int64(GtaThread* a1);
using increment_stat_event = bool(uint64_t net_event_struct, int64_t sender, int64_t a3);
}

View File

@ -40,7 +40,9 @@ namespace big
m_convert_thread_to_fiber_hook("ConvertThreadToFiber", memory::module("kernel32.dll").get_export("ConvertThreadToFiber").as<void*>(), &hooks::convert_thread_to_fiber),
m_gta_thread_tick_hook("GTA Thread Tick", g_pointers->m_gta_thread_tick, &hooks::gta_thread_tick),
m_gta_thread_kill_hook("GTA Thread Kill", g_pointers->m_gta_thread_kill, &hooks::gta_thread_kill)
m_gta_thread_kill_hook("GTA Thread Kill", g_pointers->m_gta_thread_kill, &hooks::gta_thread_kill),
m_increment_stat_hook("Increment Stat Event", g_pointers->m_increment_stat_event, &hooks::increment_stat_event)
{
m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present);
m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers);
@ -68,6 +70,8 @@ namespace big
m_gta_thread_kill_hook.enable();
m_gta_thread_tick_hook.enable();
m_increment_stat_hook.enable();
m_enabled = true;
}
@ -75,6 +79,8 @@ namespace big
{
m_enabled = false;
m_increment_stat_hook.disable();
m_gta_thread_tick_hook.disable();
m_gta_thread_kill_hook.disable();

View File

@ -24,6 +24,8 @@ namespace big
static rage::eThreadState gta_thread_tick(GtaThread* a1, unsigned int a2);
static rage::eThreadState gta_thread_kill(GtaThread* thread);
static bool increment_stat_event(uint64_t net_event_struct, CNetGamePlayer* sender, int64_t a3);
};
struct minhook_keepalive
@ -55,6 +57,8 @@ namespace big
detour_hook m_gta_thread_tick_hook;
detour_hook m_gta_thread_kill_hook;
detour_hook m_increment_stat_hook;
};
inline hooking *g_hooking{};

View File

@ -0,0 +1,32 @@
#include "gta/joaat.hpp"
#include "hooking.hpp"
#include "natives.hpp"
#include "util/notify.hpp"
namespace big
{
bool hooks::increment_stat_event(uint64_t net_event_struct, CNetGamePlayer* sender, int64_t a3)
{
Hash hash = *reinterpret_cast<DWORD*>(net_event_struct + 0x30);
Player sender_id = sender->player_id;
switch (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"):
char report[64];
strcpy(report, "~g~BLOCKED REPORT~s~\nFrom: <C>");
strcat(report, PLAYER::GET_PLAYER_NAME(sender_id));
strcat(report, "</C>");
notify::above_map(report);
return true;
}
return g_hooking->m_increment_stat_hook.get_original<decltype(&hooks::increment_stat_event) > ()(net_event_struct, sender, a3);
}
}

View File

@ -122,6 +122,11 @@ namespace big
{
m_gta_thread_kill = ptr.as<decltype(m_gta_thread_kill)>();
});
main_batch.add("Increment Stat Event", "", [this](memory::handle ptr)
{
m_increment_stat_event = ptr.as<decltype(m_increment_stat_event)>();
});
main_batch.run(memory::module(nullptr));

View File

@ -43,6 +43,8 @@ namespace big
functions::gta_thread_tick* m_gta_thread_tick{};
functions::gta_thread_kill* m_gta_thread_kill{};
functions::increment_stat_event* m_increment_stat_event{};
};
inline pointers *g_pointers{};