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
|
|
@ -19,23 +19,28 @@ void OpenGL_Hook::hook_ogl()
|
|||
{
|
||||
if (!_hooked)
|
||||
{
|
||||
PRINT_DEBUG("Hooked OpenGL\n");
|
||||
_hooked = true;
|
||||
Hook_Manager::Inst().FoundHook(this);
|
||||
|
||||
GLenum err = glewInit();
|
||||
if (GLEW_OK != err)
|
||||
|
||||
if (err == GLEW_OK)
|
||||
{
|
||||
PRINT_DEBUG("Hooked OpenGL\n");
|
||||
UnhookAll();
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)wglSwapBuffers, &OpenGL_Hook::MywglSwapBuffers)
|
||||
);
|
||||
EndHook();
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_DEBUG("Failed to hook OpenGL\n");
|
||||
/* Problem: glewInit failed, something is seriously wrong. */
|
||||
PRINT_DEBUG("Error: %s\n", glewGetErrorString(err));
|
||||
_hooked = false;
|
||||
}
|
||||
|
||||
UnhookAll();
|
||||
BeginHook();
|
||||
HookFuncs(
|
||||
std::make_pair<void**, void*>(&(PVOID&)wglSwapBuffers, &OpenGL_Hook::MywglSwapBuffers)
|
||||
);
|
||||
EndHook();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue