Skip to content

Commit

Permalink
Hook V_CalcRefdef through symbol lookups
Browse files Browse the repository at this point in the history
Don't overwrite the engine function as that is required for the bxt-rs
function table hooks to work.

I don't know why this hook worked as is for HL1 but didn't for OP4, but
now it seems to work fine for both.
  • Loading branch information
YaLTeR committed Jul 26, 2023
1 parent 7fed61e commit ded1d76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 2 additions & 0 deletions BunnymodXT/modules/ClientDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ void ClientDLL::Hook(const std::wstring& moduleName, void* moduleHandle, void* m
MemUtils::AddSymbolLookupHook(moduleHandle, reinterpret_cast<void*>(ORIG_HUD_Key_Event), reinterpret_cast<void*>(HOOKED_HUD_Key_Event));
MemUtils::AddSymbolLookupHook(moduleHandle, reinterpret_cast<void*>(ORIG_HUD_UpdateClientData), reinterpret_cast<void*>(HOOKED_HUD_UpdateClientData));
MemUtils::AddSymbolLookupHook(moduleHandle, reinterpret_cast<void*>(ORIG_HUD_AddEntity), reinterpret_cast<void*>(HOOKED_HUD_AddEntity));
MemUtils::AddSymbolLookupHook(moduleHandle, reinterpret_cast<void*>(ORIG_V_CalcRefdef), reinterpret_cast<void*>(HOOKED_V_CalcRefdef));
MemUtils::AddSymbolLookupHook(moduleHandle, reinterpret_cast<void*>(ORIG_CL_IsThirdPerson), reinterpret_cast<void*>(HOOKED_CL_IsThirdPerson));
MemUtils::AddSymbolLookupHook(moduleHandle, reinterpret_cast<void*>(ORIG_HUD_Shutdown), reinterpret_cast<void*>(HOOKED_HUD_Shutdown));

Expand Down Expand Up @@ -260,6 +261,7 @@ void ClientDLL::Unhook()
MemUtils::RemoveSymbolLookupHook(m_Handle, reinterpret_cast<void*>(ORIG_HUD_Key_Event));
MemUtils::RemoveSymbolLookupHook(m_Handle, reinterpret_cast<void*>(ORIG_HUD_UpdateClientData));
MemUtils::RemoveSymbolLookupHook(m_Handle, reinterpret_cast<void*>(ORIG_HUD_AddEntity));
MemUtils::RemoveSymbolLookupHook(m_Handle, reinterpret_cast<void*>(ORIG_V_CalcRefdef));
MemUtils::RemoveSymbolLookupHook(m_Handle, reinterpret_cast<void*>(ORIG_CL_IsThirdPerson));
MemUtils::RemoveSymbolLookupHook(m_Handle, reinterpret_cast<void*>(ORIG_HUD_Shutdown));

Expand Down
5 changes: 0 additions & 5 deletions BunnymodXT/modules/HwDLL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,6 @@ extern "C" void __cdecl R_SetFrustum()
HwDLL::HOOKED_R_SetFrustum();
}

extern "C" void __cdecl ClientDLL_CalcRefdef(ref_params_s *pparams)
{
ClientDLL::HOOKED_V_CalcRefdef(pparams);
}

extern "C" void __cdecl SPR_Set(HSPRITE_HL hSprite, int r, int g, int b)
{
HwDLL::HOOKED_SPR_Set(hSprite, r, g, b);
Expand Down

0 comments on commit ded1d76

Please sign in to comment.