mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-05 11:44:53 +01:00
Added error checks for renderer hooks
Added errors checks but there are no error correction, If it fails your won't have any overlay at all.
This commit is contained in:
parent
3a0d9c55c1
commit
7137fae413
4 changed files with 85 additions and 57 deletions
|
|
@ -20,7 +20,6 @@ void DX9_Hook::hook_dx9(UINT SDKVersion)
|
|||
{
|
||||
if (!_hooked)
|
||||
{
|
||||
PRINT_DEBUG("Hooked DirectX 9\n");
|
||||
_hooked = true;
|
||||
Hook_Manager::Inst().FoundHook(this);
|
||||
|
||||
|
|
@ -36,20 +35,29 @@ void DX9_Hook::hook_dx9(UINT SDKVersion)
|
|||
|
||||
pD3D->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, ¶ms, NULL, &pDeviceEx);
|
||||
|
||||
loadFunctions(pDeviceEx);
|
||||
if (pDeviceEx != nullptr)
|
||||
{
|
||||
PRINT_DEBUG("Hooked DirectX 9\n");
|
||||
loadFunctions(pDeviceEx);
|
||||
|
||||
//UnhookAll();
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)Reset, &DX9_Hook::MyReset),
|
||||
std::make_pair<void**, void*>(&(PVOID&)Present, &DX9_Hook::MyPresent),
|
||||
std::make_pair<void**, void*>(&(PVOID&)PresentEx, &DX9_Hook::MyPresentEx)
|
||||
//std::make_pair<void**, void*>(&(PVOID&)EndScene, &DX9_Hook::MyEndScene)
|
||||
);
|
||||
EndHook();
|
||||
UnhookAll();
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)Reset, &DX9_Hook::MyReset),
|
||||
std::make_pair<void**, void*>(&(PVOID&)Present, &DX9_Hook::MyPresent),
|
||||
std::make_pair<void**, void*>(&(PVOID&)PresentEx, &DX9_Hook::MyPresentEx)
|
||||
//std::make_pair<void**, void*>(&(PVOID&)EndScene, &DX9_Hook::MyEndScene)
|
||||
);
|
||||
EndHook();
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_DEBUG("Failed to DirectX 9\n");
|
||||
_hooked = false;
|
||||
}
|
||||
|
||||
pDeviceEx->Release();
|
||||
pD3D->Release();
|
||||
if(pDeviceEx)pDeviceEx->Release();
|
||||
if(pD3D)pD3D->Release();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue