feat(Hooks): Added error screen hook
This commit is contained in:
parent
ac65297fb6
commit
ef818f03da
@ -9,6 +9,8 @@ namespace big::functions
|
||||
using get_native_handler_t = rage::scrNativeHandler(*)(rage::scrNativeRegistrationTable*, rage::scrNativeHash);
|
||||
using fix_vectors_t = void(*)(rage::scrNativeCallContext*);
|
||||
|
||||
using error_screen = void(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background);
|
||||
|
||||
using gta_thread_tick = __int64(GtaThread* a1, unsigned int a2);
|
||||
using gta_thread_kill = __int64(GtaThread* a1);
|
||||
|
||||
|
@ -42,7 +42,9 @@ namespace big
|
||||
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_increment_stat_hook("Increment Stat Event", g_pointers->m_increment_stat_event, &hooks::increment_stat_event)
|
||||
m_increment_stat_hook("Increment Stat Event", g_pointers->m_increment_stat_event, &hooks::increment_stat_event),
|
||||
|
||||
m_error_screen_hook("Error Screen", g_pointers->m_error_screen, &hooks::disable_error_screen)
|
||||
{
|
||||
m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present);
|
||||
m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers);
|
||||
@ -72,6 +74,8 @@ namespace big
|
||||
|
||||
m_increment_stat_hook.enable();
|
||||
|
||||
m_error_screen_hook.enable();
|
||||
|
||||
m_enabled = true;
|
||||
}
|
||||
|
||||
@ -79,6 +83,8 @@ namespace big
|
||||
{
|
||||
m_enabled = false;
|
||||
|
||||
m_error_screen_hook.disable();
|
||||
|
||||
m_increment_stat_hook.disable();
|
||||
|
||||
m_gta_thread_tick_hook.disable();
|
||||
|
@ -22,6 +22,8 @@ namespace big
|
||||
static LRESULT wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
||||
static BOOL set_cursor_pos(int x, int y);
|
||||
|
||||
static void disable_error_screen(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background);
|
||||
|
||||
static rage::eThreadState gta_thread_tick(GtaThread* a1, unsigned int a2);
|
||||
static rage::eThreadState gta_thread_kill(GtaThread* thread);
|
||||
|
||||
@ -55,6 +57,8 @@ namespace big
|
||||
detour_hook m_run_script_threads_hook;
|
||||
detour_hook m_convert_thread_to_fiber_hook;
|
||||
|
||||
detour_hook m_error_screen_hook;
|
||||
|
||||
detour_hook m_gta_thread_tick_hook;
|
||||
detour_hook m_gta_thread_kill_hook;
|
||||
|
||||
|
23
BigBaseV2/src/hooks/disable_error_screen.cpp
Normal file
23
BigBaseV2/src/hooks/disable_error_screen.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
#include "gta/joaat.hpp"
|
||||
#include "hooking.hpp"
|
||||
#include "natives.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void hooks::disable_error_screen(
|
||||
char* entryHeader,
|
||||
char* entryLine1,
|
||||
int instructionalKey,
|
||||
char* entryLine2,
|
||||
BOOL p4,
|
||||
Any p5,
|
||||
Any* p6,
|
||||
Any* p7,
|
||||
BOOL background
|
||||
)
|
||||
{
|
||||
if (SCRIPT::GET_HASH_OF_THIS_SCRIPT_NAME() != RAGE_JOAAT("shop_controller"))
|
||||
return g_hooking->m_error_screen_hook.get_original<decltype(&hooks::disable_error_screen)>()(entryHeader, entryLine1, instructionalKey, entryLine2, p4, p5, p6, p7, background);
|
||||
return;
|
||||
}
|
||||
}
|
@ -127,6 +127,11 @@ namespace big
|
||||
{
|
||||
m_increment_stat_event = ptr.as<decltype(m_increment_stat_event)>();
|
||||
});
|
||||
|
||||
main_batch.add("Error Screen", "48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 41 56 41 57 48 83 EC 60 4C 8B F2 48 8B 94 24 ? ? ? ? 33 DB", [this](memory::handle ptr)
|
||||
{
|
||||
m_error_screen = ptr.as<decltype(m_error_screen)>();
|
||||
});
|
||||
|
||||
main_batch.run(memory::module(nullptr));
|
||||
|
||||
|
@ -41,6 +41,8 @@ namespace big
|
||||
unsigned char m_event_restore[event_count];
|
||||
char* m_event_register;
|
||||
|
||||
functions::error_screen* m_error_screen{};
|
||||
|
||||
functions::gta_thread_tick* m_gta_thread_tick{};
|
||||
functions::gta_thread_kill* m_gta_thread_kill{};
|
||||
|
||||
|
Reference in New Issue
Block a user