This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/BigBaseV2/src/hooking.hpp
gir489 01d48cd314 Removed StackWalker and replaced it with g3log exception handling.
Updated natives for 1.50.
Added settings JSON implementation.
Refactored spawn vehicle bypass to not crash. (removed VMT hook)
2020-02-22 18:45:59 -05:00

55 lines
1.3 KiB
C++

#pragma once
#include "common.hpp"
#include "detour_hook.hpp"
#include "gta/fwddec.hpp"
#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);
};
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;
};
inline hooking *g_hooking{};
}