refactor: hooking restructure (#311)
This commit is contained in:
parent
6624060398
commit
034affd0a3
@ -189,59 +189,6 @@ namespace big
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT hooks::swapchain_present(IDXGISwapChain *this_, UINT sync_interval, UINT flags)
|
|
||||||
{
|
|
||||||
TRY_CLAUSE
|
|
||||||
{
|
|
||||||
if (g_running)
|
|
||||||
{
|
|
||||||
g_renderer->on_present();
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_hooking->m_swapchain_hook.get_original<decltype(&swapchain_present)>(swapchain_present_index)(this_, sync_interval, flags);
|
|
||||||
} EXCEPT_CLAUSE
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
HRESULT hooks::swapchain_resizebuffers(IDXGISwapChain * this_, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT new_format, UINT swapchain_flags)
|
|
||||||
{
|
|
||||||
TRY_CLAUSE
|
|
||||||
{
|
|
||||||
if (g_running)
|
|
||||||
{
|
|
||||||
g_renderer->pre_reset();
|
|
||||||
|
|
||||||
auto result = g_hooking->m_swapchain_hook.get_original<decltype(&swapchain_resizebuffers)>(swapchain_resizebuffers_index)
|
|
||||||
(this_, buffer_count, width, height, new_format, swapchain_flags);
|
|
||||||
|
|
||||||
if (SUCCEEDED(result))
|
|
||||||
{
|
|
||||||
g_renderer->post_reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_hooking->m_swapchain_hook.get_original<decltype(&swapchain_resizebuffers)>(swapchain_resizebuffers_index)
|
|
||||||
(this_, buffer_count, width, height, new_format, swapchain_flags);
|
|
||||||
} EXCEPT_CLAUSE
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
LRESULT hooks::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
|
||||||
{
|
|
||||||
TRY_CLAUSE
|
|
||||||
{
|
|
||||||
if (g_running)
|
|
||||||
{
|
|
||||||
g_renderer->wndproc(hwnd, msg, wparam, lparam);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CallWindowProcW(g_hooking->m_og_wndproc, hwnd, msg, wparam, lparam);
|
|
||||||
} EXCEPT_CLAUSE
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL hooks::set_cursor_pos(int x, int y)
|
BOOL hooks::set_cursor_pos(int x, int y)
|
||||||
{
|
{
|
||||||
TRY_CLAUSE
|
TRY_CLAUSE
|
||||||
|
21
BigBaseV2/src/hooks/gui/swap_chain_present.cpp
Normal file
21
BigBaseV2/src/hooks/gui/swap_chain_present.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "hooking.hpp"
|
||||||
|
#include "renderer.hpp"
|
||||||
|
#include "script.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
HRESULT hooks::swapchain_present(IDXGISwapChain* this_, UINT sync_interval, UINT flags)
|
||||||
|
{
|
||||||
|
TRY_CLAUSE
|
||||||
|
{
|
||||||
|
if (g_running)
|
||||||
|
{
|
||||||
|
g_renderer->on_present();
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_hooking->m_swapchain_hook.get_original<decltype(&swapchain_present)>(swapchain_present_index)(this_, sync_interval, flags);
|
||||||
|
} EXCEPT_CLAUSE
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
32
BigBaseV2/src/hooks/gui/swap_chain_resizebuffers.cpp
Normal file
32
BigBaseV2/src/hooks/gui/swap_chain_resizebuffers.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#include "hooking.hpp"
|
||||||
|
#include "renderer.hpp"
|
||||||
|
#include "script.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
HRESULT hooks::swapchain_resizebuffers(IDXGISwapChain* this_, UINT buffer_count, UINT width, UINT height, DXGI_FORMAT new_format, UINT swapchain_flags)
|
||||||
|
{
|
||||||
|
TRY_CLAUSE
|
||||||
|
{
|
||||||
|
if (g_running)
|
||||||
|
{
|
||||||
|
g_renderer->pre_reset();
|
||||||
|
|
||||||
|
const auto result = g_hooking->m_swapchain_hook.get_original<decltype(&swapchain_resizebuffers)>(swapchain_resizebuffers_index)
|
||||||
|
(this_, buffer_count, width, height, new_format, swapchain_flags);
|
||||||
|
|
||||||
|
if (SUCCEEDED(result))
|
||||||
|
{
|
||||||
|
g_renderer->post_reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_hooking->m_swapchain_hook.get_original<decltype(&swapchain_resizebuffers)>(swapchain_resizebuffers_index)
|
||||||
|
(this_, buffer_count, width, height, new_format, swapchain_flags);
|
||||||
|
} EXCEPT_CLAUSE
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
21
BigBaseV2/src/hooks/gui/wndproc.cpp
Normal file
21
BigBaseV2/src/hooks/gui/wndproc.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "hooking.hpp"
|
||||||
|
#include "renderer.hpp"
|
||||||
|
#include "script.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
LRESULT hooks::wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
TRY_CLAUSE
|
||||||
|
{
|
||||||
|
if (g_running)
|
||||||
|
{
|
||||||
|
g_renderer->wndproc(hwnd, msg, wparam, lparam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CallWindowProcW(g_hooking->m_og_wndproc, hwnd, msg, wparam, lparam);
|
||||||
|
} EXCEPT_CLAUSE
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user