mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Added DirectX hooks
Warning: DX9 doesn't support resizing (TODO), DX12 has not beed tested and is not finished. No OpenGL support for now.
This commit is contained in:
parent
bb9c516775
commit
2ba8cae64e
13 changed files with 1656 additions and 0 deletions
40
overlay_experimental/Base_Hook.cpp
Normal file
40
overlay_experimental/Base_Hook.cpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#include "Base_Hook.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include "Hook_Manager.h"
|
||||
|
||||
#include "../detours/detours.h"
|
||||
|
||||
Base_Hook::~Base_Hook()
|
||||
{
|
||||
UnhookAll();
|
||||
}
|
||||
|
||||
void Base_Hook::BeginHook()
|
||||
{
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
}
|
||||
|
||||
void Base_Hook::EndHook()
|
||||
{
|
||||
DetourTransactionCommit();
|
||||
}
|
||||
|
||||
void Base_Hook::UnhookAll()
|
||||
{
|
||||
if (_hooked_funcs.size())
|
||||
{
|
||||
BeginHook();
|
||||
std::for_each(_hooked_funcs.begin(), _hooked_funcs.end(), [](std::pair<void**, void*>& hook) {
|
||||
DetourDetach(hook.first, hook.second);
|
||||
});
|
||||
EndHook();
|
||||
_hooked_funcs.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void Base_Hook::HookFuncs(std::pair<void**, void*> hook)
|
||||
{
|
||||
DetourAttach(hook.first, hook.second);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue