feat(Hooking): Added GTA Thread start hook
This commit is contained in:
parent
49cdac1d3b
commit
eba692ff37
@ -8,7 +8,6 @@
|
||||
#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"
|
||||
@ -47,7 +46,9 @@ namespace big
|
||||
m_scripted_game_event_hook("SGEH", g_pointers->m_scripted_game_event, &hooks::scripted_game_event),
|
||||
|
||||
// Send NET Info to Lobby
|
||||
m_send_net_info_to_lobby("SNITL", g_pointers->m_send_net_info_to_lobby, &hooks::send_net_info_to_lobby)
|
||||
m_send_net_info_to_lobby("SNITL", g_pointers->m_send_net_info_to_lobby, &hooks::send_net_info_to_lobby),
|
||||
|
||||
m_gta_thread_start_hook("GTS", g_pointers->m_gta_thread_start, &hooks::gta_thread_start)
|
||||
{
|
||||
m_swapchain_hook.hook(hooks::swapchain_present_index, &hooks::swapchain_present);
|
||||
m_swapchain_hook.hook(hooks::swapchain_resizebuffers_index, &hooks::swapchain_resizebuffers);
|
||||
@ -72,6 +73,7 @@ namespace big
|
||||
m_run_script_threads_hook.enable();
|
||||
m_convert_thread_to_fiber_hook.enable();
|
||||
|
||||
m_gta_thread_start_hook.enable();
|
||||
m_gta_thread_kill_hook.enable();
|
||||
m_gta_thread_tick_hook.enable();
|
||||
|
||||
@ -104,6 +106,7 @@ namespace big
|
||||
|
||||
m_gta_thread_tick_hook.disable();
|
||||
m_gta_thread_kill_hook.disable();
|
||||
m_gta_thread_start_hook.disable();
|
||||
|
||||
m_convert_thread_to_fiber_hook.disable();
|
||||
m_run_script_threads_hook.disable();
|
||||
|
@ -36,6 +36,7 @@ namespace big
|
||||
Any p9
|
||||
);
|
||||
|
||||
static GtaThread* gta_thread_start(unsigned int** a1, unsigned int a2);
|
||||
static rage::eThreadState gta_thread_tick(GtaThread* a1, unsigned int a2);
|
||||
static rage::eThreadState gta_thread_kill(GtaThread* thread);
|
||||
|
||||
@ -73,14 +74,12 @@ namespace big
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
std::list<script_hook*> m_native_hooks;
|
||||
std::unordered_map<rage::scrNativeHash, rage::scrNativeHandler> m_natives;
|
||||
private:
|
||||
bool m_enabled{};
|
||||
minhook_keepalive m_minhook_keepalive;
|
||||
|
||||
vmt_hook m_swapchain_hook;
|
||||
WNDPROC m_og_wndproc;
|
||||
WNDPROC m_og_wndproc = nullptr;
|
||||
detour_hook m_set_cursor_pos_hook;
|
||||
|
||||
detour_hook m_run_script_threads_hook;
|
||||
@ -88,6 +87,7 @@ namespace big
|
||||
|
||||
detour_hook m_error_screen_hook;
|
||||
|
||||
detour_hook m_gta_thread_start_hook;
|
||||
detour_hook m_gta_thread_tick_hook;
|
||||
detour_hook m_gta_thread_kill_hook;
|
||||
|
||||
|
15
BigBaseV2/src/hooks/gta_thread_start.cpp
Normal file
15
BigBaseV2/src/hooks/gta_thread_start.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
#include "hooking.hpp"
|
||||
#include "native_hooks/native_hooks.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
GtaThread* hooks::gta_thread_start(unsigned int** a1, unsigned int a2)
|
||||
{
|
||||
GtaThread* new_thread = g_hooking->m_gta_thread_start_hook.get_original<decltype(&hooks::gta_thread_start)>()(a1, a2);
|
||||
|
||||
if (new_thread != nullptr)
|
||||
g_native_hooks->check_for_thread(new_thread);
|
||||
|
||||
return new_thread;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user