From 95b0419ed4eaabcd83c71e3c148de80ffbc1691d Mon Sep 17 00:00:00 2001 From: Yimura Date: Wed, 19 May 2021 00:07:13 +0200 Subject: [PATCH] feat(Pointers): Added Event Register --- BigBaseV2/src/gta_util.hpp | 15 +++++++++++++++ BigBaseV2/src/gui.cpp | 2 ++ BigBaseV2/src/pointers.cpp | 29 +++++++++++++++++++++++++++++ BigBaseV2/src/pointers.hpp | 5 +++++ 4 files changed, 51 insertions(+) diff --git a/BigBaseV2/src/gta_util.hpp b/BigBaseV2/src/gta_util.hpp index 0d00d408..c38f84c5 100644 --- a/BigBaseV2/src/gta_util.hpp +++ b/BigBaseV2/src/gta_util.hpp @@ -9,6 +9,21 @@ namespace big::gta_util { + inline void defuse_event(RockstarEvent e, bool toggle) + { + if (g_pointers->m_event_ptr[e] == nullptr) return; + + char* p = (char*)g_pointers->m_event_ptr[e]; + if (toggle) + { + if (g_pointers->m_event_restore[e] == 0) + g_pointers->m_event_restore[e] = p[0]; + *p = (unsigned char)0xC3; + } + else if (g_pointers->m_event_restore[e] != 0) + *p = g_pointers->m_event_restore[e]; + } + inline CPed *get_local_ped() { if (auto ped_factory = *g_pointers->m_ped_factory) diff --git a/BigBaseV2/src/gui.cpp b/BigBaseV2/src/gui.cpp index 5b77cd37..c250ffe4 100644 --- a/BigBaseV2/src/gui.cpp +++ b/BigBaseV2/src/gui.cpp @@ -112,6 +112,8 @@ namespace big void gui::script_init() { + gta_util::defuse_event(RockstarEvent::REPORT_CASH_SPAWN_EVENT, true); + gta_util::defuse_event(RockstarEvent::REPORT_MYSELF_EVENT, true); } void gui::script_on_tick() diff --git a/BigBaseV2/src/pointers.cpp b/BigBaseV2/src/pointers.cpp index c36cc256..a8b55964 100644 --- a/BigBaseV2/src/pointers.cpp +++ b/BigBaseV2/src/pointers.cpp @@ -76,6 +76,35 @@ namespace big { m_native_return = ptr.add(0).as(); }); + + main_batch.add("Event Register", "48 83 EC 28 E8 ? ? ? ? 48 8B 0D ? ? ? ? 4C 8D 0D ? ? ? ? 4C 8D 05 ? ? ? ? BA 03", [this](memory::handle ptr) + { + m_event_register = ptr.as(); + + if (m_event_register) + { + const char* pattern = "\x4C\x8D\x05"; + for (int i = 0, x = 0, found = 0, matches = 0; found < event_count; i++) + { + if (m_event_register[i] == pattern[x]) + { + if (++matches == 3) + { + m_event_ptr.push_back((void*)(reinterpret_cast(m_event_register + i - x) + *reinterpret_cast(m_event_register + i + 1) + 7)); + + found++; + x = matches = 0; + } + + x++; + + continue; + } + + x = matches = 0; + } + } + }); main_batch.run(memory::module(nullptr)); diff --git a/BigBaseV2/src/pointers.hpp b/BigBaseV2/src/pointers.hpp index 94408935..b2b4b126 100644 --- a/BigBaseV2/src/pointers.hpp +++ b/BigBaseV2/src/pointers.hpp @@ -35,6 +35,11 @@ namespace big PVOID m_model_spawn_bypass; PVOID m_native_return; + + static const int event_count = 87; + std::vector m_event_ptr; + unsigned char m_event_restore[event_count]; + char* m_event_register; }; inline pointers *g_pointers{};