mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
IDetour: code refactor
Utilize the new IDetour::DetourSetup() code, IDetour::Attach and IDetour::Detach have been removed in favor of this (significantly reduces chance of user error). Since the template check happens in the idetour header, it is much more aggressive on type mismatches, such as a difference in parameter types, between the function and detour, will now raise a compile time error. As a result, some type mismatches have been fixed in this commit as well.
This commit is contained in:
parent
e0a60a14e5
commit
e541814482
@ -66,11 +66,7 @@ void* CAppSystemGroup::FindSystem(const char* pSystemName)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void VAppSystemGroup::Attach(void) const
|
||||
void VAppSystemGroup::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&CAppSystemGroup_Destroy, &CAppSystemGroup::StaticDestroy);
|
||||
DetourSetup(&CAppSystemGroup_Destroy, &CAppSystemGroup::StaticDestroy, bAttach);
|
||||
}
|
||||
void VAppSystemGroup::Detach(void) const
|
||||
{
|
||||
DetourDetach(&CAppSystemGroup_Destroy, &CAppSystemGroup::StaticDestroy);
|
||||
}
|
@ -20,12 +20,7 @@ void* BinkOpen(HANDLE hBinkFile, UINT32 nFlags)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void BinkCore::Attach() const
|
||||
void BinkCore::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_BinkOpen, &BinkOpen);
|
||||
DetourSetup(&v_BinkOpen, &BinkOpen, bAttach);
|
||||
}
|
||||
|
||||
void BinkCore::Detach() const
|
||||
{
|
||||
DetourDetach(&v_BinkOpen, &BinkOpen);
|
||||
}
|
@ -29,8 +29,7 @@ class BinkCore : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -52,18 +52,10 @@ void MilesBankPatch(Miles::Bank* bank, char* streamPatch, char* localizedStreamP
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void MilesCore::Attach() const
|
||||
void MilesCore::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_AIL_LogFunc, &AIL_LogFunc);
|
||||
DetourAttach(&v_Miles_Initialize, &Miles_Initialize);
|
||||
DetourAttach(&v_MilesQueueEventRun, &MilesQueueEventRun);
|
||||
DetourAttach(&v_MilesBankPatch, &MilesBankPatch);
|
||||
DetourSetup(&v_AIL_LogFunc, &AIL_LogFunc, bAttach);
|
||||
DetourSetup(&v_Miles_Initialize, &Miles_Initialize, bAttach);
|
||||
DetourSetup(&v_MilesQueueEventRun, &MilesQueueEventRun, bAttach);
|
||||
DetourSetup(&v_MilesBankPatch, &MilesBankPatch, bAttach);
|
||||
}
|
||||
|
||||
void MilesCore::Detach() const
|
||||
{
|
||||
DetourDetach(&v_AIL_LogFunc, &AIL_LogFunc);
|
||||
DetourDetach(&v_Miles_Initialize, &Miles_Initialize);
|
||||
DetourDetach(&v_MilesQueueEventRun, &MilesQueueEventRun);
|
||||
DetourDetach(&v_MilesBankPatch, &MilesBankPatch);
|
||||
}
|
@ -43,7 +43,6 @@ class MilesCore : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -17,7 +17,6 @@ class VRadShal : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -1520,12 +1520,7 @@ void Cmd_Exec_f(const CCommand& args)
|
||||
}
|
||||
|
||||
|
||||
void VCallback::Attach() const
|
||||
void VCallback::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&_Cmd_Exec_f, &Cmd_Exec_f);
|
||||
}
|
||||
|
||||
void VCallback::Detach() const
|
||||
{
|
||||
DetourDetach(&_Cmd_Exec_f, &Cmd_Exec_f);
|
||||
DetourSetup(&_Cmd_Exec_f, &Cmd_Exec_f, bAttach);
|
||||
}
|
||||
|
@ -104,7 +104,6 @@ class VCallback : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -36,7 +36,6 @@ class VCompletion : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -160,26 +160,28 @@ bool ShouldReplayMessage(const CNetMessage* msg)
|
||||
}
|
||||
}
|
||||
|
||||
void V_NetMessages::Attach() const
|
||||
void V_NetMessages::Detour(const bool bAttach) const
|
||||
{
|
||||
auto hk_SVCPrint_Process = &SVC_Print::ProcessImpl;
|
||||
auto hk_SVCUserMessage_Process = &SVC_UserMessage::ProcessImpl;
|
||||
if (bAttach)
|
||||
{
|
||||
auto hk_SVCPrint_Process = &SVC_Print::ProcessImpl;
|
||||
auto hk_SVCUserMessage_Process = &SVC_UserMessage::ProcessImpl;
|
||||
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_Print_VFTable, (LPVOID&)hk_SVCPrint_Process, NetMessageVtbl::Process, (LPVOID*)&SVC_Print_Process);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_UserMessage_VFTable, (LPVOID&)hk_SVCUserMessage_Process, NetMessageVtbl::Process, (LPVOID*)&SVC_UserMessage_Process);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID*)&Base_CmdKeyValues::ReadFromBufferImpl, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&Base_CmdKeyValues_ReadFromBuffer);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID*)&Base_CmdKeyValues::WriteToBufferImpl, NetMessageVtbl::WriteToBuffer, (LPVOID*)&Base_CmdKeyValues_WriteToBuffer);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID*)&CLC_SetPlaylistVarOverride::ReadFromBufferImpl, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&CLC_SetPlaylistVarOverride_ReadFromBuffer);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID*)&CLC_SetPlaylistVarOverride::WriteToBufferImpl, NetMessageVtbl::WriteToBuffer, (LPVOID*)&CLC_SetPlaylistVarOverride_WriteToBuffer);
|
||||
}
|
||||
|
||||
void V_NetMessages::Detach() const
|
||||
{
|
||||
void* hkRestore = nullptr;
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_Print_VFTable, (LPVOID)SVC_Print_Process, NetMessageVtbl::Process, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_UserMessage_VFTable, (LPVOID)SVC_UserMessage_Process, NetMessageVtbl::Process, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID)Base_CmdKeyValues_ReadFromBuffer, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID)Base_CmdKeyValues_WriteToBuffer, NetMessageVtbl::WriteToBuffer, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID)CLC_SetPlaylistVarOverride_ReadFromBuffer, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID)CLC_SetPlaylistVarOverride_WriteToBuffer, NetMessageVtbl::WriteToBuffer, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_Print_VFTable, (LPVOID&)hk_SVCPrint_Process, NetMessageVtbl::Process, (LPVOID*)&SVC_Print_Process);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_UserMessage_VFTable, (LPVOID&)hk_SVCUserMessage_Process, NetMessageVtbl::Process, (LPVOID*)&SVC_UserMessage_Process);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID*)&Base_CmdKeyValues::ReadFromBufferImpl, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&Base_CmdKeyValues_ReadFromBuffer);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID*)&Base_CmdKeyValues::WriteToBufferImpl, NetMessageVtbl::WriteToBuffer, (LPVOID*)&Base_CmdKeyValues_WriteToBuffer);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID*)&CLC_SetPlaylistVarOverride::ReadFromBufferImpl, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&CLC_SetPlaylistVarOverride_ReadFromBuffer);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID*)&CLC_SetPlaylistVarOverride::WriteToBufferImpl, NetMessageVtbl::WriteToBuffer, (LPVOID*)&CLC_SetPlaylistVarOverride_WriteToBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
void* hkRestore = nullptr;
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_Print_VFTable, (LPVOID)SVC_Print_Process, NetMessageVtbl::Process, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pSVC_UserMessage_VFTable, (LPVOID)SVC_UserMessage_Process, NetMessageVtbl::Process, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID)Base_CmdKeyValues_ReadFromBuffer, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pBase_CmdKeyValues_VFTable, (LPVOID)Base_CmdKeyValues_WriteToBuffer, NetMessageVtbl::WriteToBuffer, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID)CLC_SetPlaylistVarOverride_ReadFromBuffer, NetMessageVtbl::ReadFromBuffer, (LPVOID*)&hkRestore);
|
||||
CMemory::HookVirtualMethod((uintptr_t)g_pCLC_SetPlaylistVarOverride_VFTable, (LPVOID)CLC_SetPlaylistVarOverride_WriteToBuffer, NetMessageVtbl::WriteToBuffer, (LPVOID*)&hkRestore);
|
||||
}
|
||||
}
|
||||
|
@ -522,8 +522,7 @@ class V_NetMessages : public IDetour
|
||||
g_pCLC_SetPlaylistVarOverride_VFTable = g_GameDll.GetVirtualMethodTable(".?AVCLC_SetPlaylistVarOverride@@");
|
||||
g_pBase_CmdKeyValues_VFTable = g_GameDll.GetVirtualMethodTable(".?AVBase_CmdKeyValues@@");
|
||||
}
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -161,7 +161,6 @@ class VOpcodes : public IDetour
|
||||
//#endif //48 83 EC 28 33 C9 FF 15 ? ? ? ? 48 8D 0D ? ? ? ?
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -198,9 +198,9 @@ void Systems_Init()
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
|
||||
// Hook functions
|
||||
for (const IDetour* Detour : g_DetourVec)
|
||||
for (const IDetour* pd : g_DetourVec)
|
||||
{
|
||||
Detour->Attach();
|
||||
pd->Detour(true);
|
||||
}
|
||||
|
||||
// Patch instructions
|
||||
@ -266,9 +266,9 @@ void Systems_Shutdown()
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
|
||||
// Unhook functions
|
||||
for (const IDetour* Detour : g_DetourVec)
|
||||
for (const IDetour* pd : g_DetourVec)
|
||||
{
|
||||
Detour->Detach();
|
||||
pd->Detour(false);
|
||||
}
|
||||
|
||||
// Commit the transaction
|
||||
@ -408,11 +408,11 @@ void DetourInit() // Run the sigscan
|
||||
// No debug logging in non dev builds.
|
||||
const bool bDevMode = !IsCert() && !IsRetail();
|
||||
|
||||
for (const IDetour* Detour : g_DetourVec)
|
||||
for (const IDetour* pd : g_DetourVec)
|
||||
{
|
||||
Detour->GetCon(); // Constants.
|
||||
Detour->GetFun(); // Functions.
|
||||
Detour->GetVar(); // Variables.
|
||||
pd->GetCon(); // Constants.
|
||||
pd->GetFun(); // Functions.
|
||||
pd->GetVar(); // Variables.
|
||||
|
||||
if (bDevMode && bLogAdr)
|
||||
{
|
||||
@ -421,7 +421,7 @@ void DetourInit() // Run the sigscan
|
||||
bInitDivider = true;
|
||||
spdlog::debug("+---------------------------------------------------------------------+\n");
|
||||
}
|
||||
Detour->GetAdr();
|
||||
pd->GetAdr();
|
||||
spdlog::debug("+---------------------------------------------------------------------+\n");
|
||||
}
|
||||
}
|
||||
@ -438,9 +438,9 @@ void DetourInit() // Run the sigscan
|
||||
void DetourAddress() // Test the sigscan results
|
||||
{
|
||||
spdlog::debug("+---------------------------------------------------------------------+\n");
|
||||
for (const IDetour* Detour : g_DetourVec)
|
||||
for (const IDetour* pd : g_DetourVec)
|
||||
{
|
||||
Detour->GetAdr();
|
||||
pd->GetAdr();
|
||||
spdlog::debug("+---------------------------------------------------------------------+\n");
|
||||
}
|
||||
}
|
||||
|
@ -309,28 +309,15 @@ bool CMDLCache::IsKnownBadModel(MDLHandle_t handle)
|
||||
return !p.second;
|
||||
}
|
||||
|
||||
void VMDLCache::Attach() const
|
||||
void VMDLCache::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_CMDLCache__FindMDL, &CMDLCache::FindMDL);
|
||||
DetourSetup(&v_CMDLCache__FindMDL, &CMDLCache::FindMDL, bAttach);
|
||||
#ifdef GAMEDLL_S3 // !!! DECLARED INLINE WITH FINDMDL IN < S3 !!!
|
||||
DetourAttach((LPVOID*)&v_CMDLCache__FindCachedMDL, &CMDLCache::FindCachedMDL);
|
||||
DetourAttach((LPVOID*)&v_CMDLCache__FindUncachedMDL, &CMDLCache::FindUncachedMDL);
|
||||
DetourSetup(&v_CMDLCache__FindCachedMDL, &CMDLCache::FindCachedMDL, bAttach);
|
||||
DetourSetup(&v_CMDLCache__FindUncachedMDL, &CMDLCache::FindUncachedMDL, bAttach);
|
||||
#endif // GAMEDLL_S3
|
||||
#ifdef GAMEDLL_S3 // !TODO:
|
||||
DetourAttach((LPVOID*)&v_CMDLCache__GetHardwareData, &CMDLCache::GetHardwareData);
|
||||
DetourAttach((LPVOID*)&v_CMDLCache__GetStudioHDR, &CMDLCache::GetStudioHDR);
|
||||
#endif
|
||||
}
|
||||
|
||||
void VMDLCache::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_CMDLCache__FindMDL, &CMDLCache::FindMDL);
|
||||
#ifdef GAMEDLL_S3 // !!! DECLARED INLINE WITH FINDMDL IN < S3 !!!
|
||||
DetourDetach((LPVOID*)&v_CMDLCache__FindCachedMDL, &CMDLCache::FindCachedMDL);
|
||||
DetourDetach((LPVOID*)&v_CMDLCache__FindUncachedMDL, &CMDLCache::FindUncachedMDL);
|
||||
#endif // GAMEDLL_S3
|
||||
#ifdef GAMEDLL_S3 // !TODO:
|
||||
DetourDetach((LPVOID*)&v_CMDLCache__GetHardwareData, &CMDLCache::GetHardwareData);
|
||||
DetourDetach((LPVOID*)&v_CMDLCache__GetStudioHDR, &CMDLCache::GetStudioHDR);
|
||||
DetourSetup(&v_CMDLCache__GetHardwareData, &CMDLCache::GetHardwareData, bAttach);
|
||||
DetourSetup(&v_CMDLCache__GetStudioHDR, &CMDLCache::GetStudioHDR, bAttach);
|
||||
#endif
|
||||
}
|
@ -109,13 +109,13 @@ private:
|
||||
};
|
||||
|
||||
inline CMemory p_CMDLCache__FindMDL;
|
||||
inline studiohdr_t*(*v_CMDLCache__FindMDL)(CMDLCache* pCache, void* a2, void* a3);
|
||||
inline studiohdr_t*(*v_CMDLCache__FindMDL)(CMDLCache* pCache, MDLHandle_t handle, void* a3);
|
||||
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2)
|
||||
inline CMemory p_CMDLCache__FindCachedMDL;
|
||||
inline void(*v_CMDLCache__FindCachedMDL)(CMDLCache* pCache, void* a2, void* a3);
|
||||
inline void(*v_CMDLCache__FindCachedMDL)(CMDLCache* pCache, studiodata_t* pStudioData, void* a3);
|
||||
|
||||
inline CMemory p_CMDLCache__FindUncachedMDL;
|
||||
inline studiohdr_t*(*v_CMDLCache__FindUncachedMDL)(CMDLCache* pCache, MDLHandle_t handle, void* a3, void* a4);
|
||||
inline studiohdr_t*(*v_CMDLCache__FindUncachedMDL)(CMDLCache* pCache, MDLHandle_t handle, studiodata_t* pStudioData, void* a4);
|
||||
#endif
|
||||
inline CMemory p_CMDLCache__GetStudioHDR;
|
||||
inline studiohdr_t*(*v_CMDLCache__GetStudioHDR)(CMDLCache* pCache, MDLHandle_t handle);
|
||||
@ -165,13 +165,13 @@ class VMDLCache : public IDetour
|
||||
#endif
|
||||
#else
|
||||
p_CMDLCache__FindMDL = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 20 48 8B F1 0F B7 EA");
|
||||
v_CMDLCache__FindMDL = p_CMDLCache__FindMDL.RCast<studiohdr_t* (*)(CMDLCache*, void*, void*)>(); /*48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B F1 0F B7 EA*/
|
||||
v_CMDLCache__FindMDL = p_CMDLCache__FindMDL.RCast<studiohdr_t* (*)(CMDLCache*, MDLHandle_t, void*)>(); /*48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B F1 0F B7 EA*/
|
||||
|
||||
p_CMDLCache__FindCachedMDL = g_GameDll.FindPatternSIMD("4D 85 C0 74 7A 48 89 6C 24 ??");
|
||||
v_CMDLCache__FindCachedMDL = p_CMDLCache__FindCachedMDL.RCast<void(*)(CMDLCache*, void*, void*)>(); /*4D 85 C0 74 7A 48 89 6C 24 ?*/
|
||||
v_CMDLCache__FindCachedMDL = p_CMDLCache__FindCachedMDL.RCast<void(*)(CMDLCache*, studiodata_t*, void*)>(); /*4D 85 C0 74 7A 48 89 6C 24 ?*/
|
||||
|
||||
p_CMDLCache__FindUncachedMDL = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 48 83 EC 20 48 8B E9 0F B7 FA");
|
||||
v_CMDLCache__FindUncachedMDL = p_CMDLCache__FindUncachedMDL.RCast<studiohdr_t* (*)(CMDLCache*, MDLHandle_t, void*, void*)>(); /*48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 56 48 83 EC 20 48 8B E9 0F B7 FA*/
|
||||
v_CMDLCache__FindUncachedMDL = p_CMDLCache__FindUncachedMDL.RCast<studiohdr_t* (*)(CMDLCache*, MDLHandle_t, studiodata_t*, void*)>(); /*48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 41 56 48 83 EC 20 48 8B E9 0F B7 FA*/
|
||||
|
||||
p_CMDLCache__GetStudioHDR = g_GameDll.FindPatternSIMD("40 53 48 83 EC 20 48 8D 0D ?? ?? ?? ?? 0F B7 DA FF 15 ?? ?? ?? ?? 48 8B 05 ?? ?? ?? ?? 48 8D 14 5B 48 8D 0D ?? ?? ?? ?? 48 8B 5C D0 ?? FF 15 ?? ?? ?? ?? 48 8B 03 48 8B 48 08");
|
||||
v_CMDLCache__GetStudioHDR = p_CMDLCache__GetStudioHDR.RCast<studiohdr_t* (*)(CMDLCache*, MDLHandle_t)>(); /*40 53 48 83 EC 20 48 8D 0D ? ? ? ? 0F B7 DA FF 15 ? ? ? ? 48 8B 05 ? ? ? ? 48 8D 14 5B 48 8D 0D ? ? ? ? 48 8B 5C D0 ? FF 15 ? ? ? ? 48 8B 03 48 8B 48 08*/
|
||||
@ -192,8 +192,7 @@ class VMDLCache : public IDetour
|
||||
g_pMDLLock = p_CMDLCache__GetHardwareData.Offset(0x35).FindPatternSelf("48 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<PSRWLOCK>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -61,7 +61,6 @@ class VEbisuSDK : public IDetour
|
||||
g_EbisuSDKInit = p_EbisuSDK_Tier0_Init.Offset(0x0).FindPatternSelf("80 3D", CMemory::Direction::DOWN, 150).ResolveRelativeAddressSelf(0x2, 0x7).RCast<bool*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,16 +38,9 @@ ClientClass* CHLClient::GetAllClasses()
|
||||
#endif // !DEDICATED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VDll_Engine_Int::Attach() const
|
||||
void VDll_Engine_Int::Detour(const bool bAttach) const
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
DetourAttach((LPVOID*)&CHLClient_FrameStageNotify, &CHLClient::FrameStageNotify);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
void VDll_Engine_Int::Detach() const
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
DetourDetach((LPVOID*)&CHLClient_FrameStageNotify, &CHLClient::FrameStageNotify);
|
||||
DetourSetup(&CHLClient_FrameStageNotify, &CHLClient::FrameStageNotify, bAttach);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
@ -120,7 +120,6 @@ class VDll_Engine_Int : public IDetour
|
||||
.FindPatternSelf("4C 8B", CMemory::Direction::DOWN, 512, 2).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CHLClient**>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -19,13 +19,9 @@ class V_CL_Ents_Parse : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const
|
||||
virtual void Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_CL_CopyExistingEntity, &CL_CopyExistingEntity);
|
||||
}
|
||||
virtual void Detach(void) const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_CL_CopyExistingEntity, &CL_CopyExistingEntity);
|
||||
DetourSetup(&v_CL_CopyExistingEntity, &CL_CopyExistingEntity, bAttach);
|
||||
}
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -141,12 +141,7 @@ void CL_MoveEx()
|
||||
}
|
||||
}
|
||||
|
||||
void VCL_Main::Attach() const
|
||||
void VCL_Main::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&CL_Move, &CL_MoveEx);
|
||||
}
|
||||
|
||||
void VCL_Main::Detach() const
|
||||
{
|
||||
DetourDetach(&CL_Move, &CL_MoveEx);
|
||||
DetourSetup(&CL_Move, &CL_MoveEx, bAttach);
|
||||
}
|
||||
|
@ -57,7 +57,6 @@ class VCL_Main : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -146,8 +146,7 @@ class VSplitScreen : public IDetour
|
||||
g_pSplitScreenMgr = g_GameDll.FindPatternSIMD(pszPattern).FindPatternSelf(pszInstruction).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CSplitScreen*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { };
|
||||
virtual void Detach(void) const { };
|
||||
virtual void Detour(const bool bAttach) const { };
|
||||
};
|
||||
|
||||
#endif // CL_SPLITSCREEN_H
|
||||
|
@ -292,7 +292,7 @@ void CClient::VActivatePlayer(CClient* pClient)
|
||||
// bForceReliable -
|
||||
// bVoice -
|
||||
//---------------------------------------------------------------------------------
|
||||
bool CClient::SendNetMsgEx(CNetMessage* pMsg, char bLocal, bool bForceReliable, bool bVoice)
|
||||
bool CClient::SendNetMsgEx(CNetMessage* pMsg, bool bLocal, bool bForceReliable, bool bVoice)
|
||||
{
|
||||
if (!ShouldReplayMessage(pMsg))
|
||||
{
|
||||
@ -323,7 +323,7 @@ void* CClient::VSendSnapshot(CClient* pClient, CClientFrame* pFrame, int nTick,
|
||||
// bForceReliable -
|
||||
// bVoice -
|
||||
//---------------------------------------------------------------------------------
|
||||
bool CClient::VSendNetMsgEx(CClient* pClient, CNetMessage* pMsg, char bLocal, bool bForceReliable, bool bVoice)
|
||||
bool CClient::VSendNetMsgEx(CClient* pClient, CNetMessage* pMsg, bool bLocal, bool bForceReliable, bool bVoice)
|
||||
{
|
||||
return pClient->SendNetMsgEx(pMsg, bLocal, bForceReliable, bVoice);
|
||||
}
|
||||
@ -477,29 +477,16 @@ bool CClient::VProcessSetConVar(CClient* pClient, NET_SetConVar* pMsg)
|
||||
return true;
|
||||
}
|
||||
|
||||
void VClient::Attach(void) const
|
||||
void VClient::Detour(const bool bAttach) const
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
DetourAttach((LPVOID*)&v_CClient_Clear, &CClient::VClear);
|
||||
DetourAttach((LPVOID*)&v_CClient_Connect, &CClient::VConnect);
|
||||
DetourAttach((LPVOID*)&v_CClient_ActivatePlayer, &CClient::VActivatePlayer);
|
||||
DetourAttach((LPVOID*)&v_CClient_SendNetMsgEx, &CClient::VSendNetMsgEx);
|
||||
//DetourAttach((LPVOID*)&p_CClient_SendSnapshot, &CClient::VSendSnapshot);
|
||||
DetourSetup(&v_CClient_Clear, &CClient::VClear, bAttach);
|
||||
DetourSetup(&v_CClient_Connect, &CClient::VConnect, bAttach);
|
||||
DetourSetup(&v_CClient_ActivatePlayer, &CClient::VActivatePlayer, bAttach);
|
||||
DetourSetup(&v_CClient_SendNetMsgEx, &CClient::VSendNetMsgEx, bAttach);
|
||||
//DetourSetup(&p_CClient_SendSnapshot, &CClient::VSendSnapshot, bAttach);
|
||||
|
||||
DetourAttach((LPVOID*)&v_CClient_ProcessStringCmd, &CClient::VProcessStringCmd);
|
||||
DetourAttach((LPVOID*)&v_CClient_ProcessSetConVar, &CClient::VProcessSetConVar);
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
void VClient::Detach(void) const
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
DetourDetach((LPVOID*)&v_CClient_Clear, &CClient::VClear);
|
||||
DetourDetach((LPVOID*)&v_CClient_Connect, &CClient::VConnect);
|
||||
DetourDetach((LPVOID*)&v_CClient_ActivatePlayer, &CClient::VActivatePlayer);
|
||||
DetourDetach((LPVOID*)&v_CClient_SendNetMsgEx, &CClient::VSendNetMsgEx);
|
||||
//DetourDetach((LPVOID*)&p_CClient_SendSnapshot, &CClient::VSendSnapshot);
|
||||
|
||||
DetourDetach((LPVOID*)&v_CClient_ProcessStringCmd, &CClient::VProcessStringCmd);
|
||||
DetourDetach((LPVOID*)&v_CClient_ProcessSetConVar, &CClient::VProcessSetConVar);
|
||||
DetourSetup(&v_CClient_ProcessStringCmd, &CClient::VProcessStringCmd, bAttach);
|
||||
DetourSetup(&v_CClient_ProcessSetConVar, &CClient::VProcessSetConVar, bAttach);
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
inline bool IsFakeClient(void) const { return m_bFakePlayer; }
|
||||
inline bool IsHumanPlayer(void) const { if (!IsConnected() || IsFakeClient()) { return false; } return true; }
|
||||
|
||||
bool SendNetMsgEx(CNetMessage* pMsg, char bLocal, bool bForceReliable, bool bVoice);
|
||||
bool SendNetMsgEx(CNetMessage* pMsg, bool bLocal, bool bForceReliable, bool bVoice);
|
||||
|
||||
bool Authenticate(const char* const playerName, char* const reasonBuf, const size_t reasonBufLen);
|
||||
bool Connect(const char* szName, CNetChan* pNetChan, bool bFakePlayer,
|
||||
@ -108,7 +108,7 @@ public: // Hook statics:
|
||||
|
||||
static void VActivatePlayer(CClient* pClient);
|
||||
static void* VSendSnapshot(CClient* pClient, CClientFrame* pFrame, int nTick, int nTickAck);
|
||||
static bool VSendNetMsgEx(CClient* pClient, CNetMessage* pMsg, char bLocal, bool bForceReliable, bool bVoice);
|
||||
static bool VSendNetMsgEx(CClient* pClient, CNetMessage* pMsg, bool bLocal, bool bForceReliable, bool bVoice);
|
||||
|
||||
static bool VProcessStringCmd(CClient* pClient, NET_StringCmd* pMsg);
|
||||
static bool VProcessSetConVar(CClient* pClient, NET_SetConVar* pMsg);
|
||||
@ -288,7 +288,6 @@ class VClient : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -173,7 +173,7 @@ bool CClientState::_ProcessStringCmd(CClientState* thisptr, NET_StringCmd* msg)
|
||||
CClientState* const thisptr_ADJ = thisptr->GetShiftedBasePointer();
|
||||
|
||||
if (thisptr_ADJ->m_bRestrictServerCommands
|
||||
#ifndef CLIENT_DLLInternalProcessStringCmd
|
||||
#ifndef CLIENT_DLL
|
||||
&& !g_pServer->IsActive()
|
||||
#endif // !CLIENT_DLL
|
||||
)
|
||||
@ -285,20 +285,12 @@ void CClientState::VConnect(CClientState* thisptr, connectparams_t* connectParam
|
||||
CClientState__Connect(thisptr, connectParams);
|
||||
}
|
||||
|
||||
void VClientState::Attach() const
|
||||
void VClientState::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&CClientState__ConnectionClosing, &CClientState::VConnectionClosing);
|
||||
DetourAttach(&CClientState__ProcessStringCmd, &CClientState::_ProcessStringCmd);
|
||||
DetourAttach(&CClientState__ProcessServerTick, &CClientState::VProcessServerTick);
|
||||
DetourAttach(&CClientState__Connect, &CClientState::VConnect);
|
||||
}
|
||||
|
||||
void VClientState::Detach() const
|
||||
{
|
||||
DetourDetach(&CClientState__ConnectionClosing, &CClientState::VConnectionClosing);
|
||||
DetourDetach(&CClientState__ProcessStringCmd, &CClientState::_ProcessStringCmd);
|
||||
DetourDetach(&CClientState__ProcessServerTick, &CClientState::VProcessServerTick);
|
||||
DetourDetach(&CClientState__Connect, &CClientState::VConnect);
|
||||
DetourSetup(&CClientState__ConnectionClosing, &CClientState::VConnectionClosing, bAttach);
|
||||
DetourSetup(&CClientState__ProcessStringCmd, &CClientState::_ProcessStringCmd, bAttach);
|
||||
DetourSetup(&CClientState__ProcessServerTick, &CClientState::VProcessServerTick, bAttach);
|
||||
DetourSetup(&CClientState__Connect, &CClientState::VConnect, bAttach);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -281,7 +281,6 @@ class VClientState : public IDetour
|
||||
g_pClientState_Shifted = reinterpret_cast<CClientState**>(reinterpret_cast<int64_t*>(g_pClientState)+1); // Shift by 8 bytes.
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -53,8 +53,7 @@ class VClientDataBlockReceiver : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -96,12 +96,7 @@ void CEngineClient::_ClientCmd(CEngineClient* thisptr, const char* const szCmdSt
|
||||
}
|
||||
}
|
||||
|
||||
void HVEngineClient::Attach() const
|
||||
void HVEngineClient::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&CEngineClient__ClientCmd, &CEngineClient::_ClientCmd);
|
||||
}
|
||||
|
||||
void HVEngineClient::Detach() const
|
||||
{
|
||||
DetourDetach(&CEngineClient__ClientCmd, &CEngineClient::_ClientCmd);
|
||||
DetourSetup(&CEngineClient__ClientCmd, &CEngineClient::_ClientCmd, bAttach);
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ class HVEngineClient : public IDetour
|
||||
g_pEngineClientVFTable = g_GameDll.GetVirtualMethodTable(".?AVCEngineClient@@");
|
||||
g_pEngineClient = g_pEngineClientVFTable.RCast<CEngineClient*>();
|
||||
}
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -106,11 +106,7 @@ bool Cmd_ForwardToServer(const CCommand* args)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VCmd::Attach() const
|
||||
void VCmd::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_Cmd_ForwardToServer, &Cmd_ForwardToServer);
|
||||
}
|
||||
void VCmd::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_Cmd_ForwardToServer, &Cmd_ForwardToServer);
|
||||
DetourSetup(&v_Cmd_ForwardToServer, &Cmd_ForwardToServer, bAttach);
|
||||
}
|
||||
|
@ -84,8 +84,7 @@ class VCmd : public IDetour
|
||||
g_pExecutionMarkers = p_Cbuf_AddExecutionMarker.FindPattern("48 8B 0D").ResolveRelativeAddressSelf(3, 7).RCast<CUtlVector<int>*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
|
||||
#endif // CMD_H
|
||||
|
@ -480,14 +480,8 @@ void Mod_UnloadPakFile(void)
|
||||
g_vBadMDLHandles.clear();
|
||||
}
|
||||
|
||||
void VModel_BSP::Attach() const
|
||||
void VModel_BSP::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_Mod_LoadPakForMap, &Mod_LoadPakForMap);
|
||||
DetourAttach((LPVOID*)&v_Mod_ProcessPakQueue, &Mod_ProcessPakQueue);
|
||||
DetourSetup(&v_Mod_LoadPakForMap, &Mod_LoadPakForMap, bAttach);
|
||||
DetourSetup(&v_Mod_ProcessPakQueue, &Mod_ProcessPakQueue, bAttach);
|
||||
}
|
||||
|
||||
void VModel_BSP::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_Mod_LoadPakForMap, &Mod_LoadPakForMap);
|
||||
DetourDetach((LPVOID*)&v_Mod_ProcessPakQueue, &Mod_ProcessPakQueue);
|
||||
}
|
@ -89,7 +89,6 @@ class VModel_BSP : public IDetour
|
||||
qword_167ED7BC0 = p_Mod_ProcessPakQueue.Offset(0x200).FindPatternSelf("48 83 3D").ResolveRelativeAddressSelf(0x3, 0x8).RCast<int64_t*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -90,12 +90,7 @@ void COM_ExplainDisconnection(bool bPrint, const char* fmt, ...)
|
||||
v_COM_ExplainDisconnection(bPrint, szBuf);
|
||||
}
|
||||
|
||||
void VCommon::Attach() const
|
||||
void VCommon::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_COM_ExplainDisconnection, COM_ExplainDisconnection);
|
||||
DetourSetup(&v_COM_ExplainDisconnection, COM_ExplainDisconnection, bAttach);
|
||||
}
|
||||
|
||||
void VCommon::Detach() const
|
||||
{
|
||||
DetourDetach(&v_COM_ExplainDisconnection, COM_ExplainDisconnection);
|
||||
}
|
@ -33,7 +33,6 @@ class VCommon : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -300,12 +300,7 @@ void DrawAllOverlays(bool bRender)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VDebugOverlay::Attach() const
|
||||
void VDebugOverlay::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_DrawAllOverlays, &DrawAllOverlays);
|
||||
}
|
||||
|
||||
void VDebugOverlay::Detach() const
|
||||
{
|
||||
DetourDetach(&v_DrawAllOverlays, &DrawAllOverlays);
|
||||
DetourSetup(&v_DrawAllOverlays, &DrawAllOverlays, bAttach);
|
||||
}
|
||||
|
@ -228,7 +228,6 @@ class VDebugOverlay : public IDetour
|
||||
#endif
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -6,13 +6,3 @@
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "engine/enginetrace.h"
|
||||
|
||||
void CEngineTrace_Attach()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CEngineTrace_Detach()
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -22,10 +22,6 @@ class CEngineTraceClient : public CEngineTrace
|
||||
inline CEngineTraceClient* g_pEngineTraceClient = nullptr;
|
||||
#endif // DEDICATED
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void CEngineTrace_Attach();
|
||||
void CEngineTrace_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VEngineTrace : public IDetour
|
||||
{
|
||||
@ -47,7 +43,6 @@ class VEngineTrace : public IDetour
|
||||
g_pEngineTraceServer = reinterpret_cast<CEngineTraceServer*>(&g_pEngineTraceServerVFTable); // Must be done for virtual calls.
|
||||
#endif // CLIENT_DLL
|
||||
}
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -22,7 +22,6 @@ class VGL_MatSysIFace : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -24,8 +24,7 @@ class VGL_RMain : public IDetour
|
||||
virtual void GetFun(void) const { }
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -32,16 +32,9 @@ void* R_DrawWorldMeshesDepthAtTheEnd(void* ptr1, void* ptr2, void* ptr3, DrawWor
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void VGL_RSurf::Attach() const
|
||||
void VGL_RSurf::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&V_DrawWorldMeshes, &R_DrawWorldMeshes);
|
||||
DetourAttach(&V_DrawWorldMeshesDepthOnly, &R_DrawWorldMeshesDepthOnly);
|
||||
DetourAttach(&V_DrawWorldMeshesDepthAtTheEnd, &R_DrawWorldMeshesDepthAtTheEnd);
|
||||
DetourSetup(&V_DrawWorldMeshes, &R_DrawWorldMeshes, bAttach);
|
||||
DetourSetup(&V_DrawWorldMeshesDepthOnly, &R_DrawWorldMeshesDepthOnly, bAttach);
|
||||
DetourSetup(&V_DrawWorldMeshesDepthAtTheEnd, &R_DrawWorldMeshesDepthAtTheEnd, bAttach);
|
||||
}
|
||||
|
||||
void VGL_RSurf::Detach() const
|
||||
{
|
||||
DetourDetach(&V_DrawWorldMeshes, &R_DrawWorldMeshes);
|
||||
DetourDetach(&V_DrawWorldMeshesDepthOnly, &R_DrawWorldMeshesDepthOnly);
|
||||
DetourDetach(&V_DrawWorldMeshesDepthAtTheEnd, &R_DrawWorldMeshesDepthAtTheEnd);
|
||||
}
|
@ -35,7 +35,6 @@ class VGL_RSurf : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -39,7 +39,6 @@ class VGL_Screen : public IDetour
|
||||
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -56,7 +56,7 @@ void _Host_RunFrame(void* unused, float time)
|
||||
return v_Host_RunFrame(unused, time);
|
||||
}
|
||||
|
||||
void _Host_Error(char* error, ...)
|
||||
void _Host_Error(const char* error, ...)
|
||||
{
|
||||
char buf[1024];
|
||||
{/////////////////////////////
|
||||
@ -74,20 +74,11 @@ void _Host_Error(char* error, ...)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VHost::Attach() const
|
||||
void VHost::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_Host_RunFrame, &_Host_RunFrame);
|
||||
DetourSetup(&v_Host_RunFrame, &_Host_RunFrame, bAttach);
|
||||
|
||||
#ifndef DEDICATED // Dedicated already logs this!
|
||||
DetourAttach((LPVOID*)&v_Host_Error, &_Host_Error);
|
||||
DetourSetup(&v_Host_Error, &_Host_Error, bAttach);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
void VHost::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_Host_RunFrame, &_Host_RunFrame);
|
||||
|
||||
#ifndef DEDICATED // Dedicated already logs this!
|
||||
DetourDetach((LPVOID*)&v_Host_Error, &_Host_Error);
|
||||
#endif // !DEDICATED
|
||||
}
|
@ -106,7 +106,6 @@ class VHost : public IDetour
|
||||
host_frametime_stddeviation = p_Host_RunFrame.Offset(n_host_frametime_stddeviation_search_offset).FindPatternSelf("F3 0F 11").ResolveRelativeAddressSelf(0x4, 0x8).RCast<float*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -81,21 +81,12 @@ bool DFS_InitializeFeatureFlagDefinitions(const char* pszFeatureFlags)
|
||||
#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VHostCmd::Attach() const
|
||||
void VHostCmd::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_Host_Shutdown, &Host_Shutdown);
|
||||
DetourAttach(&v_Host_Status_PrintClient, &Host_Status_PrintClient);
|
||||
DetourSetup(&v_Host_Shutdown, &Host_Shutdown, bAttach);
|
||||
DetourSetup(&v_Host_Status_PrintClient, &Host_Status_PrintClient, bAttach);
|
||||
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2)
|
||||
DetourAttach(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions);
|
||||
#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
|
||||
}
|
||||
|
||||
void VHostCmd::Detach() const
|
||||
{
|
||||
DetourDetach(&v_Host_Shutdown, &Host_Shutdown);
|
||||
DetourDetach(&v_Host_Status_PrintClient, &Host_Status_PrintClient);
|
||||
#if !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) && !defined (GAMEDLL_S2)
|
||||
DetourDetach(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions);
|
||||
DetourSetup(&v_DFS_InitializeFeatureFlagDefinitions, &DFS_InitializeFeatureFlagDefinitions, bAttach);
|
||||
#endif // !(GAMEDLL_S0) || !(GAMEDLL_S1) || !(GAMEDLL_S2)
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,6 @@ class VHostCmd : public IDetour
|
||||
#endif
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -518,13 +518,9 @@ void CHostState::ResetLevelName(void)
|
||||
Q_snprintf(const_cast<char*>(m_levelName), sizeof(m_levelName), "%s", szNoMap);
|
||||
}
|
||||
|
||||
void VHostState::Attach(void) const
|
||||
void VHostState::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&CHostState_FrameUpdate, &CHostState::FrameUpdate);
|
||||
}
|
||||
void VHostState::Detach(void) const
|
||||
{
|
||||
DetourDetach(&CHostState_FrameUpdate, &CHostState::FrameUpdate);
|
||||
DetourSetup(&CHostState_FrameUpdate, &CHostState::FrameUpdate, bAttach);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -100,7 +100,6 @@ class VHostState : public IDetour
|
||||
g_pHostState = p_CHostState_FrameUpdate.FindPattern("48 8D ?? ?? ?? ?? 01", CMemory::Direction::DOWN, 100).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CHostState*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -26,12 +26,7 @@ bool UpdateCurrentVideoConfig(MaterialSystem_Config_t* pConfig)
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VMatSys_Interface::Attach() const
|
||||
void VMatSys_Interface::Detour(const bool bAttach) const
|
||||
{
|
||||
//DetourAttach(&v_UpdateCurrentVideoConfig, &UpdateCurrentVideoConfig);
|
||||
//DetourSetup(&v_UpdateCurrentVideoConfig, &UpdateCurrentVideoConfig, bAttach);
|
||||
}
|
||||
|
||||
void VMatSys_Interface::Detach() const
|
||||
{
|
||||
//DetourDetach(&v_UpdateCurrentVideoConfig, &UpdateCurrentVideoConfig);
|
||||
}
|
@ -42,8 +42,7 @@ class VMatSys_Interface : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -60,8 +60,7 @@ class VModelInfo : public IDetour
|
||||
#endif // DEDICATED
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -345,20 +345,11 @@ void AddGameLump()
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VModelLoader::Attach() const
|
||||
void VModelLoader::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&CModelLoader__LoadModel, &CModelLoader::LoadModel);
|
||||
DetourAttach((LPVOID*)&CModelLoader__Map_LoadModelGuts, &CModelLoader::Map_LoadModelGuts);
|
||||
DetourSetup(&CModelLoader__LoadModel, &CModelLoader::LoadModel, bAttach);
|
||||
DetourSetup(&CModelLoader__Map_LoadModelGuts, &CModelLoader::Map_LoadModelGuts, bAttach);
|
||||
|
||||
DetourAttach((LPVOID*)&CMapLoadHelper__CMapLoadHelper, &CMapLoadHelper::Constructor);
|
||||
DetourAttach((LPVOID*)&v_AddGameLump, &AddGameLump);
|
||||
}
|
||||
|
||||
void VModelLoader::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&CModelLoader__LoadModel, &CModelLoader::LoadModel);
|
||||
DetourDetach((LPVOID*)&CModelLoader__Map_LoadModelGuts, &CModelLoader::Map_LoadModelGuts);
|
||||
|
||||
DetourDetach((LPVOID*)&CMapLoadHelper__CMapLoadHelper, &CMapLoadHelper::Constructor);
|
||||
DetourDetach((LPVOID*)&v_AddGameLump, &AddGameLump);
|
||||
DetourSetup(&CMapLoadHelper__CMapLoadHelper, &CMapLoadHelper::Constructor, bAttach);
|
||||
DetourSetup(&v_AddGameLump, &AddGameLump, bAttach);
|
||||
}
|
||||
|
@ -179,7 +179,6 @@ class VModelLoader : public IDetour
|
||||
s_szMapPathName = p_CMapLoadHelper__CMapLoadHelper.FindPattern("4C 8D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<char*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -297,22 +297,13 @@ const char* NET_ErrorString(int iCode)
|
||||
|
||||
#ifndef NETCONSOLE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VNet::Attach() const
|
||||
void VNet::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_NET_Config, &NET_Config);
|
||||
DetourAttach((LPVOID*)&v_NET_ReceiveDatagram, &NET_ReceiveDatagram);
|
||||
DetourAttach((LPVOID*)&v_NET_SendDatagram, &NET_SendDatagram);
|
||||
DetourAttach((LPVOID*)&v_NET_Decompress, &NET_Decompress);
|
||||
DetourAttach((LPVOID*)&v_NET_PrintFunc, &NET_PrintFunc);
|
||||
}
|
||||
|
||||
void VNet::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_NET_Config, &NET_Config);
|
||||
DetourDetach((LPVOID*)&v_NET_ReceiveDatagram, &NET_ReceiveDatagram);
|
||||
DetourDetach((LPVOID*)&v_NET_SendDatagram, &NET_SendDatagram);
|
||||
DetourDetach((LPVOID*)&v_NET_Decompress, &NET_Decompress);
|
||||
DetourDetach((LPVOID*)&v_NET_PrintFunc, &NET_PrintFunc);
|
||||
DetourSetup(&v_NET_Config, &NET_Config, bAttach);
|
||||
DetourSetup(&v_NET_ReceiveDatagram, &NET_ReceiveDatagram, bAttach);
|
||||
DetourSetup(&v_NET_SendDatagram, &NET_SendDatagram, bAttach);
|
||||
DetourSetup(&v_NET_Decompress, &NET_Decompress, bAttach);
|
||||
DetourSetup(&v_NET_PrintFunc, &NET_PrintFunc, bAttach);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -35,10 +35,10 @@ inline CMemory p_NET_SendDatagram;
|
||||
inline int(*v_NET_SendDatagram)(SOCKET s, void* pPayload, int iLenght, netadr_t* pAdr, bool bEncrypted);
|
||||
|
||||
inline CMemory p_NET_Decompress;
|
||||
inline int(*v_NET_Decompress)(CLZSS* lzss, unsigned char* pInput, unsigned char* pOutput, unsigned int unBufSize);
|
||||
inline unsigned int(*v_NET_Decompress)(CLZSS* lzss, unsigned char* pInput, unsigned char* pOutput, unsigned int unBufSize);
|
||||
|
||||
inline CMemory p_NET_PrintFunc;
|
||||
inline void(*v_NET_PrintFunc)(const char* fmt);
|
||||
inline void(*v_NET_PrintFunc)(const char* fmt, ...);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
bool NET_ReceiveDatagram(int iSocket, netpacket_s* pInpacket, bool bRaw);
|
||||
@ -91,8 +91,8 @@ class VNet : public IDetour
|
||||
v_NET_SetKey = p_NET_SetKey.RCast<void (*)(netkey_t*, const char*)>(); /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 48 83 EC 20 48 8B F9 41 B8*/
|
||||
v_NET_ReceiveDatagram = p_NET_ReceiveDatagram.RCast<bool (*)(int, netpacket_s*, bool)>(); /*E8 ?? ?? ?? ?? 84 C0 75 35 48 8B D3*/
|
||||
v_NET_SendDatagram = p_NET_SendDatagram.RCast<int (*)(SOCKET, void*, int, netadr_t*, bool)>(); /*48 89 5C 24 08 48 89 6C 24 10 48 89 74 24 18 57 41 56 41 57 48 81 EC ?? 05 00 00*/
|
||||
v_NET_Decompress = p_NET_Decompress.RCast<int (*)(CLZSS*, unsigned char*, unsigned char*, unsigned int)>();
|
||||
v_NET_PrintFunc = p_NET_PrintFunc.RCast<void(*)(const char*)>(); /*48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 C3 48*/
|
||||
v_NET_Decompress = p_NET_Decompress.RCast<unsigned int (*)(CLZSS*, unsigned char*, unsigned char*, unsigned int)>();
|
||||
v_NET_PrintFunc = p_NET_PrintFunc.RCast<void(*)(const char*, ...)>(); /*48 89 54 24 10 4C 89 44 24 18 4C 89 4C 24 20 C3 48*/
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
@ -101,8 +101,7 @@ class VNet : public IDetour
|
||||
g_pNetTime = p_NET_Init.Offset(0xA).FindPatternSelf("F2 0F").ResolveRelativeAddressSelf(0x4, 0x8).RCast<double*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#endif // !NETCONSOLE
|
||||
|
@ -573,15 +573,9 @@ bool CNetChan::HasPendingReliableData(void)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VNetChan::Attach() const
|
||||
void VNetChan::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((PVOID*)&v_NetChan_Shutdown, &CNetChan::_Shutdown);
|
||||
DetourAttach((PVOID*)&v_NetChan_FlowNewPacket, &CNetChan::_FlowNewPacket);
|
||||
DetourAttach((PVOID*)&v_NetChan_ProcessMessages, &CNetChan::_ProcessMessages);
|
||||
}
|
||||
void VNetChan::Detach() const
|
||||
{
|
||||
DetourDetach((PVOID*)&v_NetChan_Shutdown, &CNetChan::_Shutdown);
|
||||
DetourDetach((PVOID*)&v_NetChan_FlowNewPacket, &CNetChan::_FlowNewPacket);
|
||||
DetourDetach((PVOID*)&v_NetChan_ProcessMessages, &CNetChan::_ProcessMessages);
|
||||
DetourSetup(&v_NetChan_Shutdown, &CNetChan::_Shutdown, bAttach);
|
||||
DetourSetup(&v_NetChan_FlowNewPacket, &CNetChan::_FlowNewPacket, bAttach);
|
||||
DetourSetup(&v_NetChan_ProcessMessages, &CNetChan::_ProcessMessages, bAttach);
|
||||
}
|
||||
|
@ -292,8 +292,7 @@ class VNetChan : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -112,16 +112,9 @@ void CNetworkStringTableContainer::WriteUpdateMessage(CNetworkStringTableContain
|
||||
v_CNetworkStringTableContainer__WriteUpdateMessage(thisp, pClient, nTickAck, pMsg);
|
||||
}
|
||||
|
||||
void VNetworkStringTableContainer::Attach() const
|
||||
void VNetworkStringTableContainer::Detour(const bool bAttach) const
|
||||
{
|
||||
#if !defined (CLIENT_DLL) && !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) // TODO: doesn't work properly for S0/S1 yet.
|
||||
DetourAttach(&v_CNetworkStringTableContainer__WriteUpdateMessage, &CNetworkStringTableContainer::WriteUpdateMessage);
|
||||
DetourSetup(&v_CNetworkStringTableContainer__WriteUpdateMessage, &CNetworkStringTableContainer::WriteUpdateMessage, bAttach);
|
||||
#endif // !CLIENT_DLL && !GAMEDLL_S0 && !GAMEDLL_S1
|
||||
}
|
||||
|
||||
void VNetworkStringTableContainer::Detach() const
|
||||
{
|
||||
#if !defined (CLIENT_DLL) && !defined (GAMEDLL_S0) && !defined (GAMEDLL_S1) // TODO: doesn't work properly for S0/S1 yet.
|
||||
DetourDetach(&v_CNetworkStringTableContainer__WriteUpdateMessage, &CNetworkStringTableContainer::WriteUpdateMessage);
|
||||
#endif // !CLIENT_DLL && !GAMEDLL_S0 && !GAMEDLL_S1
|
||||
}
|
@ -75,8 +75,7 @@ class VNetworkStringTableContainer : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -80,8 +80,7 @@ class VServerDataBlockSender : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -10,15 +10,9 @@ bool Persistence_SetXP(int a1, int* a2)
|
||||
}
|
||||
#endif
|
||||
|
||||
void VPersistence::Attach() const
|
||||
void VPersistence::Detour(const bool bAttach) const
|
||||
{
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
DetourAttach((LPVOID*)&v_Persistence_SetXP, &Persistence_SetXP);
|
||||
Setup(&v_Persistence_SetXP, &Persistence_SetXP, bAttach);
|
||||
#endif
|
||||
}
|
||||
void VPersistence::Detach() const
|
||||
{
|
||||
#if defined (GAMEDLL_S0) || defined (GAMEDLL_S1)
|
||||
DetourDetach((LPVOID*)&v_Persistence_SetXP, &Persistence_SetXP);
|
||||
#endif
|
||||
}
|
@ -24,8 +24,7 @@ class VPersistence : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -200,23 +200,15 @@ void CServer::RunFrame(CServer* pServer)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VServer::Attach() const
|
||||
void VServer::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_CServer_RunFrame, &CServer::RunFrame);
|
||||
DetourSetup(&v_CServer_RunFrame, &CServer::RunFrame, bAttach);
|
||||
#if defined(GAMEDLL_S3)
|
||||
DetourAttach((LPVOID*)&v_CServer_ConnectClient, &CServer::ConnectClient);
|
||||
DetourAttach((LPVOID*)&v_CServer_FrameJob, &CServer::FrameJob);
|
||||
DetourSetup(&v_CServer_ConnectClient, &CServer::ConnectClient, bAttach);
|
||||
DetourSetup(&v_CServer_FrameJob, &CServer::FrameJob, bAttach);
|
||||
#endif // !TODO: S1 and S2 CServer functions require work.
|
||||
}
|
||||
|
||||
void VServer::Detach() const
|
||||
{
|
||||
DetourDetach(&v_CServer_RunFrame, &CServer::RunFrame);
|
||||
#if defined(GAMEDLL_S3)
|
||||
DetourDetach((LPVOID*)&v_CServer_ConnectClient, &CServer::ConnectClient);
|
||||
DetourDetach((LPVOID*)&v_CServer_FrameJob, &CServer::FrameJob);
|
||||
#endif // !TODO: S1 and S2 CServer functions require work.
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
CServer* g_pServer = nullptr;
|
@ -166,7 +166,6 @@ class VServer : public IDetour
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -85,23 +85,13 @@ class HSV_Main : public IDetour
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
virtual void Attach(void) const
|
||||
virtual void Detour(const bool bAttach) const
|
||||
{
|
||||
//DetourAttach(&v_SV_InitGameDLL, SV_InitGameDLL);
|
||||
//DetourAttach(&v_SV_ShutdownGameDLL, SV_ShutdownGameDLL);
|
||||
//DetourAttach(&v_SV_ActivateServer, SV_ActivateServer);
|
||||
//DetourSetup(&v_SV_InitGameDLL, SV_InitGameDLL, bAttach);
|
||||
//DetourSetup(&v_SV_ShutdownGameDLL, SV_ShutdownGameDLL, bAttach);
|
||||
//DetourSetup(&v_SV_ActivateServer, SV_ActivateServer, bAttach);
|
||||
#ifndef CLIENT_DLL
|
||||
DetourAttach(&v_SV_BroadcastVoiceData, SV_BroadcastVoiceData);
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
|
||||
virtual void Detach(void) const
|
||||
{
|
||||
//DetourDetach(&v_SV_InitGameDLL, SV_InitGameDLL);
|
||||
//DetourDetach(&v_SV_ShutdownGameDLL, SV_ShutdownGameDLL);
|
||||
//DetourDetach(&v_SV_ActivateServer, SV_ActivateServer);
|
||||
#ifndef CLIENT_DLL
|
||||
DetourDetach(&v_SV_BroadcastVoiceData, SV_BroadcastVoiceData);
|
||||
DetourSetup(&v_SV_BroadcastVoiceData, SV_BroadcastVoiceData, bAttach);
|
||||
#endif // !CLIENT_DLL
|
||||
}
|
||||
};
|
||||
|
@ -15,14 +15,9 @@ bool CVEngineServer::PersistenceAvailable(void* entidx, int clientidx)
|
||||
return IVEngineServer__PersistenceAvailable(entidx, clientidx);
|
||||
}
|
||||
|
||||
void HVEngineServer::Attach() const
|
||||
void HVEngineServer::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&IVEngineServer__PersistenceAvailable, &CVEngineServer::PersistenceAvailable);
|
||||
}
|
||||
|
||||
void HVEngineServer::Detach() const
|
||||
{
|
||||
DetourDetach(&IVEngineServer__PersistenceAvailable, &CVEngineServer::PersistenceAvailable);
|
||||
DetourSetup(&IVEngineServer__PersistenceAvailable, &CVEngineServer::PersistenceAvailable, bAttach);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -65,7 +65,6 @@ class HVEngineServer : public IDetour
|
||||
m_bIsDedicated = pEngineServerVFTable.WalkVTableSelf(3).DerefSelf().ResolveRelativeAddress(0x3, 0x7).RCast<bool*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -22,16 +22,9 @@ void* __fastcall CStaticProp_Init(int64_t thisptr, int64_t a2, unsigned int idx,
|
||||
return v_CStaticProp_Init(thisptr, a2, idx, a4, lump, a6, a7);
|
||||
}
|
||||
|
||||
void VStaticPropMgr::Attach() const
|
||||
void VStaticPropMgr::Detour(const bool bAttach) const
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
DetourAttach((LPVOID*)&v_CStaticProp_Init, &CStaticProp_Init);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
void VStaticPropMgr::Detach() const
|
||||
{
|
||||
#ifndef DEDICATED
|
||||
DetourDetach((LPVOID*)&v_CStaticProp_Init, &CStaticProp_Init);
|
||||
DetourSetup(&v_CStaticProp_Init, &CStaticProp_Init, bAttach);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ class VStaticPropMgr : public IDetour
|
||||
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -177,24 +177,13 @@ int HSys_Error_Internal(char* fmt, va_list args)
|
||||
return Sys_Error_Internal(fmt, args);
|
||||
}
|
||||
|
||||
void VSys_Dll::Attach() const
|
||||
void VSys_Dll::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&CSourceAppSystemGroup__PreInit, &CSourceAppSystemGroup::StaticPreInit);
|
||||
DetourAttach((LPVOID*)&CSourceAppSystemGroup__Create, &CSourceAppSystemGroup::StaticCreate);
|
||||
DetourSetup(&CSourceAppSystemGroup__PreInit, &CSourceAppSystemGroup::StaticPreInit, bAttach);
|
||||
DetourSetup(&CSourceAppSystemGroup__Create, &CSourceAppSystemGroup::StaticCreate, bAttach);
|
||||
|
||||
DetourAttach((LPVOID*)&CModAppSystemGroup_Main, &CModAppSystemGroup::StaticMain);
|
||||
DetourAttach((LPVOID*)&CModAppSystemGroup_Create, &CModAppSystemGroup::StaticCreate);
|
||||
DetourSetup(&CModAppSystemGroup_Main, &CModAppSystemGroup::StaticMain, bAttach);
|
||||
DetourSetup(&CModAppSystemGroup_Create, &CModAppSystemGroup::StaticCreate, bAttach);
|
||||
|
||||
DetourAttach(&Sys_Error_Internal, &HSys_Error_Internal);
|
||||
}
|
||||
|
||||
void VSys_Dll::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&CSourceAppSystemGroup__PreInit, &CSourceAppSystemGroup::StaticPreInit);
|
||||
DetourDetach((LPVOID*)&CSourceAppSystemGroup__Create, &CSourceAppSystemGroup::StaticCreate);
|
||||
|
||||
DetourDetach((LPVOID*)&CModAppSystemGroup_Main, &CModAppSystemGroup::StaticMain);
|
||||
DetourDetach((LPVOID*)&CModAppSystemGroup_Create, &CModAppSystemGroup::StaticCreate);
|
||||
|
||||
DetourDetach(&Sys_Error_Internal, &HSys_Error_Internal);
|
||||
DetourSetup(&Sys_Error_Internal, &HSys_Error_Internal, bAttach);
|
||||
}
|
||||
|
@ -103,7 +103,6 @@ class VSys_Dll : public IDetour
|
||||
gfExtendedError = p_COM_ExplainDisconnection.Offset(0x0).FindPatternSelf("C6 05", CMemory::Direction::DOWN, 300).ResolveRelativeAddressSelf(0x2, 0x7).RCast<bool*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -232,20 +232,11 @@ bool CEngineAPI::MainLoop()
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VSys_Dll2::Attach() const
|
||||
void VSys_Dll2::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&CEngineAPI_Init, &CEngineAPI::VInit);
|
||||
DetourAttach(&CEngineAPI_ModInit, &CEngineAPI::VModInit);
|
||||
DetourAttach(&CEngineAPI_PumpMessages, &CEngineAPI::PumpMessages);
|
||||
DetourAttach(&CEngineAPI_MainLoop, &CEngineAPI::MainLoop);
|
||||
DetourAttach(&v_CEngineAPI_SetStartupInfo, &CEngineAPI::VSetStartupInfo);
|
||||
DetourSetup(&CEngineAPI_Init, &CEngineAPI::VInit, bAttach);
|
||||
DetourSetup(&CEngineAPI_ModInit, &CEngineAPI::VModInit, bAttach);
|
||||
DetourSetup(&CEngineAPI_PumpMessages, &CEngineAPI::PumpMessages, bAttach);
|
||||
DetourSetup(&CEngineAPI_MainLoop, &CEngineAPI::MainLoop, bAttach);
|
||||
DetourSetup(&v_CEngineAPI_SetStartupInfo, &CEngineAPI::VSetStartupInfo, bAttach);
|
||||
}
|
||||
|
||||
void VSys_Dll2::Detach() const
|
||||
{
|
||||
DetourDetach(&CEngineAPI_Init, &CEngineAPI::VInit);
|
||||
DetourDetach(&CEngineAPI_ModInit, &CEngineAPI::VModInit);
|
||||
DetourDetach(&CEngineAPI_PumpMessages, &CEngineAPI::PumpMessages);
|
||||
DetourDetach(&CEngineAPI_MainLoop, &CEngineAPI::MainLoop);
|
||||
DetourDetach(&v_CEngineAPI_SetStartupInfo, &CEngineAPI::VSetStartupInfo);
|
||||
}
|
@ -132,7 +132,6 @@ class VSys_Dll2 : public IDetour
|
||||
g_szMTVFItemName = p_ResetMTVFTaskItem.FindPattern("C6 05", CMemory::Direction::DOWN, 250).ResolveRelativeAddressSelf(0x2, 0x7).RCast<char*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -31,12 +31,7 @@ bool CEngine::_Frame(CEngine* thisp)
|
||||
return v_CEngine_Frame(thisp);
|
||||
}
|
||||
|
||||
void VEngine::Attach() const
|
||||
void VEngine::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_CEngine_Frame, &CEngine::_Frame);
|
||||
DetourSetup(&v_CEngine_Frame, &CEngine::_Frame, bAttach);
|
||||
}
|
||||
|
||||
void VEngine::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_CEngine_Frame, &CEngine::_Frame);
|
||||
}
|
@ -64,7 +64,6 @@ class VEngine : public IDetour
|
||||
gsm_Quitting = g_GameDll.FindPatternSIMD("89 15 ?? ?? ?? ?? C3 CC CC CC CC CC CC CC CC CC 83 C1 F4").ResolveRelativeAddressSelf(0x2, 0x6).RCast<IEngine::QuitState_t*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -17,12 +17,7 @@ bool HCVideoMode_Common__CreateGameWindow(int* pnRect)
|
||||
return CVideoMode_Common__CreateGameWindow(pnRect);
|
||||
}
|
||||
|
||||
void HVideoMode_Common::Attach() const
|
||||
void HVideoMode_Common::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&CVideoMode_Common__CreateGameWindow, &HCVideoMode_Common__CreateGameWindow);
|
||||
}
|
||||
|
||||
void HVideoMode_Common::Detach() const
|
||||
{
|
||||
DetourDetach(&CVideoMode_Common__CreateGameWindow, &HCVideoMode_Common__CreateGameWindow);
|
||||
DetourSetup(&CVideoMode_Common__CreateGameWindow, &HCVideoMode_Common__CreateGameWindow, bAttach);
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ class HVideoMode_Common : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -118,14 +118,8 @@ void CGame::GetWindowRect(int* x, int* y, int* w, int* h)
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VGame::Attach() const
|
||||
void VGame::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_CGame__PlayStartupVideos, &CGame::PlayStartupVideos);
|
||||
DetourAttach(&v_CGame__WindowProc, &CGame::WindowProc);
|
||||
DetourSetup(&v_CGame__PlayStartupVideos, &CGame::PlayStartupVideos, bAttach);
|
||||
DetourSetup(&v_CGame__WindowProc, &CGame::WindowProc, bAttach);
|
||||
}
|
||||
|
||||
void VGame::Detach() const
|
||||
{
|
||||
DetourDetach(&v_CGame__PlayStartupVideos, &CGame::PlayStartupVideos);
|
||||
DetourDetach(&v_CGame__WindowProc, &CGame::WindowProc);
|
||||
}
|
@ -82,8 +82,7 @@ class VGame : public IDetour
|
||||
g_pGame = p_CGame__AttachToWindow.FindPattern("48 8B 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CGame*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
// ... -
|
||||
// Output : void _Error
|
||||
//-----------------------------------------------------------------------------
|
||||
void _Error(char* fmt, ...)
|
||||
void _Error(const char* fmt, ...)
|
||||
{
|
||||
char buf[4096];
|
||||
bool shouldNewline = true;
|
||||
@ -53,7 +53,7 @@ void _Error(char* fmt, ...)
|
||||
// *error - ... -
|
||||
// Output : void* _Warning
|
||||
//-----------------------------------------------------------------------------
|
||||
void _Warning(int level, char* fmt, ...)
|
||||
void _Warning(int level, const char* fmt, ...)
|
||||
{
|
||||
char buf[10000];
|
||||
bool shouldNewline = true;
|
||||
@ -114,20 +114,11 @@ int Sys_GetProcessUpTime(char* szBuffer)
|
||||
return v_Sys_GetProcessUpTime(szBuffer);
|
||||
}
|
||||
|
||||
void VSys_Utils::Attach() const
|
||||
void VSys_Utils::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_Error, &_Error);
|
||||
DetourAttach((LPVOID*)&v_Warning, &_Warning);
|
||||
DetourSetup(&v_Error, &_Error, bAttach);
|
||||
DetourSetup(&v_Warning, &_Warning, bAttach);
|
||||
#ifndef DEDICATED
|
||||
DetourAttach((LPVOID*)&v_Con_NPrintf, &_Con_NPrintf);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
||||
void VSys_Utils::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_Error, &_Error);
|
||||
DetourDetach((LPVOID*)&v_Warning, &_Warning);
|
||||
#ifndef DEDICATED
|
||||
DetourDetach((LPVOID*)&v_Con_NPrintf, &_Con_NPrintf);
|
||||
DetourSetup(&v_Con_NPrintf, &_Con_NPrintf, bAttach);
|
||||
#endif // !DEDICATED
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ class VSys_Utils : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -18,8 +18,7 @@ class VTraceInit : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -69,7 +69,7 @@ bool CBaseFileSystem::VCheckDisk(const char* pszFilePath)
|
||||
// *pszFilePath -
|
||||
// Output : handle to file on success, NULL on failure
|
||||
//---------------------------------------------------------------------------------
|
||||
FileHandle_t CBaseFileSystem::VReadFromVPK(CBaseFileSystem* pFileSystem, FileHandle_t pResults, char* pszFilePath)
|
||||
FileHandle_t CBaseFileSystem::VReadFromVPK(CBaseFileSystem* pFileSystem, FileHandle_t pResults, const char* pszFilePath)
|
||||
{
|
||||
if (VCheckDisk(pszFilePath))
|
||||
{
|
||||
@ -87,7 +87,7 @@ FileHandle_t CBaseFileSystem::VReadFromVPK(CBaseFileSystem* pFileSystem, FileHan
|
||||
// *pCache -
|
||||
// Output : true if file exists, false otherwise
|
||||
//---------------------------------------------------------------------------------
|
||||
bool CBaseFileSystem::VReadFromCache(CBaseFileSystem* pFileSystem, char* pszFilePath, FileSystemCache* pCache)
|
||||
bool CBaseFileSystem::VReadFromCache(CBaseFileSystem* pFileSystem, const char* pszFilePath, FileSystemCache* pCache)
|
||||
{
|
||||
if (VCheckDisk(pszFilePath))
|
||||
{
|
||||
@ -201,23 +201,14 @@ CUtlString CBaseFileSystem::ReadString(FileHandle_t pFile)
|
||||
return result;
|
||||
}
|
||||
|
||||
void VBaseFileSystem::Attach() const
|
||||
void VBaseFileSystem::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_CBaseFileSystem_Warning, &CBaseFileSystem::Warning);
|
||||
DetourAttach((LPVOID*)&v_CBaseFileSystem_LoadFromVPK, &CBaseFileSystem::VReadFromVPK);
|
||||
DetourAttach((LPVOID*)&v_CBaseFileSystem_LoadFromCache, &CBaseFileSystem::VReadFromCache);
|
||||
DetourAttach((LPVOID*)&v_CBaseFileSystem_AddMapPackFile, &CBaseFileSystem::VAddMapPackFile);
|
||||
DetourAttach((LPVOID*)&v_CBaseFileSystem_MountVPKFile, &CBaseFileSystem::VMountVPKFile);
|
||||
DetourAttach((LPVOID*)&v_CBaseFileSystem_UnmountVPKFile, &CBaseFileSystem::VUnmountVPKFile);
|
||||
DetourSetup(&v_CBaseFileSystem_Warning, &CBaseFileSystem::Warning, bAttach);
|
||||
DetourSetup(&v_CBaseFileSystem_LoadFromVPK, &CBaseFileSystem::VReadFromVPK, bAttach);
|
||||
DetourSetup(&v_CBaseFileSystem_LoadFromCache, &CBaseFileSystem::VReadFromCache, bAttach);
|
||||
DetourSetup(&v_CBaseFileSystem_AddMapPackFile, &CBaseFileSystem::VAddMapPackFile, bAttach);
|
||||
DetourSetup(&v_CBaseFileSystem_MountVPKFile, &CBaseFileSystem::VMountVPKFile, bAttach);
|
||||
DetourSetup(&v_CBaseFileSystem_UnmountVPKFile, &CBaseFileSystem::VUnmountVPKFile, bAttach);
|
||||
}
|
||||
|
||||
void VBaseFileSystem::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_CBaseFileSystem_Warning, &CBaseFileSystem::Warning);
|
||||
DetourDetach((LPVOID*)&v_CBaseFileSystem_LoadFromVPK, &CBaseFileSystem::VReadFromVPK);
|
||||
DetourDetach((LPVOID*)&v_CBaseFileSystem_LoadFromCache, &CBaseFileSystem::VReadFromCache);
|
||||
DetourDetach((LPVOID*)&v_CBaseFileSystem_AddMapPackFile, &CBaseFileSystem::VAddMapPackFile);
|
||||
DetourDetach((LPVOID*)&v_CBaseFileSystem_MountVPKFile, &CBaseFileSystem::VMountVPKFile);
|
||||
DetourDetach((LPVOID*)&v_CBaseFileSystem_UnmountVPKFile, &CBaseFileSystem::VUnmountVPKFile);
|
||||
}
|
||||
CBaseFileSystem* g_pFileSystem = nullptr;
|
@ -9,8 +9,8 @@ public:
|
||||
//--------------------------------------------------------
|
||||
static void Warning(CBaseFileSystem* pFileSystem, FileWarningLevel_t level, const char* fmt, ...);
|
||||
static bool VCheckDisk(const char* pszFilePath);
|
||||
static FileHandle_t VReadFromVPK(CBaseFileSystem* pFileSystem, FileHandle_t pResults, char* pszFilePath);
|
||||
static bool VReadFromCache(CBaseFileSystem* pFileSystem, char* pszFilePath, FileSystemCache* pCache);
|
||||
static FileHandle_t VReadFromVPK(CBaseFileSystem* pFileSystem, FileHandle_t pResults, const char* pszFilePath);
|
||||
static bool VReadFromCache(CBaseFileSystem* pFileSystem, const char* pszFilePath, FileSystemCache* pCache);
|
||||
static void VAddMapPackFile(CBaseFileSystem* pFileSystem, const char* pPath, const char* pPathID, SearchPathAdd_t addType);
|
||||
static VPKData_t* VMountVPKFile(CBaseFileSystem* pFileSystem, const char* pszVpkPath);
|
||||
static const char* VUnmountVPKFile(CBaseFileSystem* pFileSystem, const char* pszVpkPath);
|
||||
@ -104,7 +104,6 @@ class VBaseFileSystem : public IDetour
|
||||
.FindPattern("48 89", CMemory::Direction::DOWN, 512, 2).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CBaseFileSystem*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -58,8 +58,7 @@ class VFileSystem_Stdio : public IDetour
|
||||
.FindPattern("48 89", CMemory::Direction::DOWN, 512, 1).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CFileSystem_Stdio*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -18,12 +18,7 @@ void CInput::SetCustomWeaponActivity(CInput* pInput, int weaponActivity)
|
||||
v_CInput__SetCustomWeaponActivity(pInput, weaponActivity);
|
||||
}
|
||||
|
||||
void VInput::Attach(void) const
|
||||
void VInput::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_CInput__SetCustomWeaponActivity, CInput::SetCustomWeaponActivity);
|
||||
}
|
||||
|
||||
void VInput::Detach(void) const
|
||||
{
|
||||
DetourDetach(&v_CInput__SetCustomWeaponActivity, CInput::SetCustomWeaponActivity);
|
||||
DetourSetup(&v_CInput__SetCustomWeaponActivity, CInput::SetCustomWeaponActivity, bAttach);
|
||||
}
|
||||
|
@ -39,8 +39,7 @@ class VInput : public IDetour
|
||||
{
|
||||
g_pInput_VFTable = g_GameDll.GetVirtualMethodTable(".?AVCInput@@").RCast<IInput*>();
|
||||
}
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -44,8 +44,7 @@ class VMoveHelperClient : public IDetour
|
||||
s_MoveHelperClient = pFunc.FindPattern("4C 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CMoveHelperClient*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -53,7 +53,6 @@ class V_ViewRender : public IDetour
|
||||
{
|
||||
g_pViewRender_VFTable = g_GameDll.GetVirtualMethodTable(".?AVCViewRender@@");
|
||||
}
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -154,12 +154,7 @@ CAI_NodeLink* CAI_Network::CreateNodeLink(int srcID, int destID)
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void VAI_Network::Attach() const
|
||||
void VAI_Network::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach(&v_CAI_Network__DebugConnectMsg, &CAI_Network::DebugConnectMsg);
|
||||
}
|
||||
|
||||
void VAI_Network::Detach() const
|
||||
{
|
||||
DetourDetach(&v_CAI_Network__DebugConnectMsg, &CAI_Network::DebugConnectMsg);
|
||||
DetourSetup(&v_CAI_Network__DebugConnectMsg, &CAI_Network::DebugConnectMsg, bAttach);
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ class VAI_Network : public IDetour
|
||||
g_pAINetwork = g_GameDll.FindPatternSIMD("48 89 5C 24 ?? 4C 63 91 ?? ?? ?? ??").FindPatternSelf("48 8B").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CAI_Network**>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -546,14 +546,8 @@ void CAI_NetworkBuilder::Build(CAI_NetworkBuilder* pBuilder, CAI_Network* pAINet
|
||||
CAI_NetworkBuilder::SaveNetworkGraph(pAINetwork);
|
||||
}
|
||||
|
||||
void VAI_NetworkManager::Attach() const
|
||||
void VAI_NetworkManager::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&CAI_NetworkManager__LoadNetworkGraph, &CAI_NetworkManager::LoadNetworkGraph);
|
||||
DetourAttach((LPVOID*)&CAI_NetworkBuilder__Build, &CAI_NetworkBuilder::Build);
|
||||
}
|
||||
|
||||
void VAI_NetworkManager::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&CAI_NetworkManager__LoadNetworkGraph, &CAI_NetworkManager::LoadNetworkGraph);
|
||||
DetourDetach((LPVOID*)&CAI_NetworkBuilder__Build, &CAI_NetworkBuilder::Build);
|
||||
DetourSetup(&CAI_NetworkManager__LoadNetworkGraph, &CAI_NetworkManager::LoadNetworkGraph, bAttach);
|
||||
DetourSetup(&CAI_NetworkBuilder__Build, &CAI_NetworkBuilder::Build, bAttach);
|
||||
}
|
||||
|
@ -173,7 +173,6 @@ class VAI_NetworkManager : public IDetour
|
||||
.FindPatternSelf("48 8B 05", CMemory::Direction::DOWN).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CUtlVector<CAI_TraverseNode>*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -133,14 +133,8 @@ void Detour_HotSwap()
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void VRecast::Attach() const
|
||||
void VRecast::Detour(const bool bAttach) const
|
||||
{
|
||||
DetourAttach((LPVOID*)&v_dtNavMesh__isPolyReachable, &IsGoalPolyReachable);
|
||||
DetourAttach((LPVOID*)&v_Detour_LevelInit, &Detour_LevelInit);
|
||||
DetourSetup(&v_dtNavMesh__isPolyReachable, &IsGoalPolyReachable, bAttach);
|
||||
DetourSetup(&v_Detour_LevelInit, &Detour_LevelInit, bAttach);
|
||||
}
|
||||
|
||||
void VRecast::Detach() const
|
||||
{
|
||||
DetourDetach((LPVOID*)&v_dtNavMesh__isPolyReachable, &IsGoalPolyReachable);
|
||||
DetourDetach((LPVOID*)&v_Detour_LevelInit, &Detour_LevelInit);
|
||||
}
|
@ -81,10 +81,3 @@ CStudioHdr* CBaseAnimating::GetModelPtr(void)
|
||||
}
|
||||
return (m_pStudioHdr && m_pStudioHdr->IsValid()) ? m_pStudioHdr : nullptr;
|
||||
}
|
||||
|
||||
void BaseAnimating_Attach()
|
||||
{
|
||||
}
|
||||
void BaseAnimating_Detach()
|
||||
{
|
||||
}
|
@ -138,9 +138,6 @@ protected:
|
||||
inline CMemory p_CBaseAnimating__LockStudioHdr;
|
||||
inline CBaseAnimating*(*v_CBaseAnimating__LockStudioHdr)(CBaseAnimating* thisp);
|
||||
|
||||
void BaseAnimating_Attach();
|
||||
void BaseAnimating_Detach();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class VBaseAnimating : public IDetour
|
||||
{
|
||||
@ -155,8 +152,7 @@ class VBaseAnimating : public IDetour
|
||||
}
|
||||
virtual void GetVar(void) const { }
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -297,8 +297,7 @@ class VBaseEntity : public IDetour
|
||||
g_pEntityList = p_CBaseEntity__GetBaseEntity.FindPattern("48 8D 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CEntInfo**>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const { }
|
||||
virtual void Detach(void) const { }
|
||||
virtual void Detour(const bool bAttach) const { }
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -19,7 +19,7 @@ inline CMemory p_dtNavMesh__addTile;
|
||||
inline dtStatus(*v_dtNavMesh__addTile)(dtNavMesh* thisptr, unsigned char* data, dtMeshHeader* header, int dataSize, int flags, dtTileRef lastRef);
|
||||
|
||||
inline CMemory p_dtNavMesh__isPolyReachable;
|
||||
inline bool(*v_dtNavMesh__isPolyReachable)(dtNavMesh* thisptr, dtPolyRef poly_1, dtPolyRef poly_2, int hull_type);
|
||||
inline uint8_t(*v_dtNavMesh__isPolyReachable)(dtNavMesh* thisptr, dtPolyRef poly_1, dtPolyRef poly_2, int hull_type);
|
||||
|
||||
|
||||
constexpr const char* NAVMESH_PATH = "maps/navmesh/";
|
||||
@ -84,7 +84,7 @@ class VRecast : public IDetour
|
||||
v_Detour_FreeNavMesh = p_Detour_FreeNavMesh.RCast<void(*)(dtNavMesh*)>();
|
||||
v_dtNavMesh__Init = p_dtNavMesh__Init.RCast<dtStatus(*)(dtNavMesh*, unsigned char*, int)>(); /*4C 89 44 24 ?? 53 41 56 48 81 EC ?? ?? ?? ?? 0F 10 11*/
|
||||
v_dtNavMesh__addTile = p_dtNavMesh__addTile.RCast<dtStatus(*)(dtNavMesh*, unsigned char*, dtMeshHeader*, int, int, dtTileRef)>(); /*44 89 4C 24 ?? 41 55*/
|
||||
v_dtNavMesh__isPolyReachable = p_dtNavMesh__isPolyReachable.RCast<bool(*)(dtNavMesh*, dtPolyRef, dtPolyRef, int)>(); /*48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 49 63 F1*/
|
||||
v_dtNavMesh__isPolyReachable = p_dtNavMesh__isPolyReachable.RCast<uint8_t(*)(dtNavMesh*, dtPolyRef, dtPolyRef, int)>(); /*48 89 6C 24 ?? 48 89 74 24 ?? 48 89 7C 24 ?? 41 56 49 63 F1*/
|
||||
}
|
||||
virtual void GetVar(void) const
|
||||
{
|
||||
@ -94,7 +94,6 @@ class VRecast : public IDetour
|
||||
.FindPatternSelf("48 89 0D").ResolveRelativeAddressSelf(0x3, 0x7).RCast<dtNavMeshQuery*>();
|
||||
}
|
||||
virtual void GetCon(void) const { }
|
||||
virtual void Attach(void) const;
|
||||
virtual void Detach(void) const;
|
||||
virtual void Detour(const bool bAttach) const;
|
||||
};
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user