2021-05-18 23:03:42 +02:00
|
|
|
#pragma once
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "detour_hook.hpp"
|
|
|
|
#include "gta/fwddec.hpp"
|
2021-05-19 00:41:55 +02:00
|
|
|
#include "gta/script_thread.hpp"
|
2021-05-18 23:03:42 +02:00
|
|
|
#include "script_hook.hpp"
|
|
|
|
#include "vmt_hook.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
struct hooks
|
|
|
|
{
|
|
|
|
static bool run_script_threads(std::uint32_t ops_to_execute);
|
|
|
|
static void *convert_thread_to_fiber(void *param);
|
|
|
|
|
|
|
|
static constexpr auto swapchain_num_funcs = 19;
|
|
|
|
static constexpr auto swapchain_present_index = 8;
|
|
|
|
static constexpr auto swapchain_resizebuffers_index = 13;
|
|
|
|
static HRESULT swapchain_present(IDXGISwapChain *this_, UINT sync_interval, UINT flags);
|
|
|
|
static HRESULT swapchain_resizebuffers(IDXGISwapChain *this_, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT new_format, UINT swapchain_flags);
|
|
|
|
|
|
|
|
static LRESULT wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
|
|
|
|
static BOOL set_cursor_pos(int x, int y);
|
2021-05-19 00:41:55 +02:00
|
|
|
|
2021-05-20 15:49:36 +02:00
|
|
|
static void disable_error_screen(char* entryHeader, char* entryLine1, int instructionalKey, char* entryLine2, BOOL p4, Any p5, Any* p6, Any* p7, BOOL background);
|
|
|
|
|
2021-05-19 00:41:55 +02:00
|
|
|
static rage::eThreadState gta_thread_tick(GtaThread* a1, unsigned int a2);
|
|
|
|
static rage::eThreadState gta_thread_kill(GtaThread* thread);
|
2021-05-19 16:19:38 +02:00
|
|
|
|
2021-05-25 14:44:35 +02:00
|
|
|
static bool increment_stat_event(uint64_t net_event_struct, CNetGamePlayer* sender, int64_t a3);
|
|
|
|
|
2021-05-25 12:58:33 +02:00
|
|
|
static bool received_event(
|
|
|
|
rage::netEventMgr* event_manager,
|
|
|
|
CNetGamePlayer* source_player,
|
|
|
|
CNetGamePlayer* target_player,
|
|
|
|
uint16_t event_id,
|
|
|
|
int event_index,
|
|
|
|
int event_handled_bitset,
|
|
|
|
int64_t bit_buffer_size,
|
|
|
|
int64_t bit_buffer
|
|
|
|
);
|
2021-05-18 23:03:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct minhook_keepalive
|
|
|
|
{
|
|
|
|
minhook_keepalive();
|
|
|
|
~minhook_keepalive();
|
|
|
|
};
|
|
|
|
|
|
|
|
class hooking
|
|
|
|
{
|
|
|
|
friend hooks;
|
|
|
|
public:
|
|
|
|
explicit hooking();
|
|
|
|
~hooking();
|
|
|
|
|
|
|
|
void enable();
|
|
|
|
void disable();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool m_enabled{};
|
|
|
|
minhook_keepalive m_minhook_keepalive;
|
|
|
|
|
|
|
|
vmt_hook m_swapchain_hook;
|
|
|
|
WNDPROC m_og_wndproc;
|
|
|
|
detour_hook m_set_cursor_pos_hook;
|
|
|
|
|
|
|
|
detour_hook m_run_script_threads_hook;
|
|
|
|
detour_hook m_convert_thread_to_fiber_hook;
|
2021-05-19 00:41:55 +02:00
|
|
|
|
2021-05-20 15:49:36 +02:00
|
|
|
detour_hook m_error_screen_hook;
|
|
|
|
|
2021-05-19 00:41:55 +02:00
|
|
|
detour_hook m_gta_thread_tick_hook;
|
|
|
|
detour_hook m_gta_thread_kill_hook;
|
2021-05-19 16:19:38 +02:00
|
|
|
|
2021-05-25 14:44:35 +02:00
|
|
|
detour_hook m_increment_stat_hook;
|
|
|
|
|
2021-05-25 12:58:33 +02:00
|
|
|
detour_hook m_received_event_hook;
|
2021-05-18 23:03:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inline hooking *g_hooking{};
|
|
|
|
}
|