Null hlclient pointer on dedicated server properly

We have a pointer to a pointer, as we obtain the address in which the pointer to the hlclient structure is set.
This commit is contained in:
Kawe Mazidjatari 2022-11-24 13:39:57 +01:00
parent 27d00215ac
commit 009fd49e7f
2 changed files with 6 additions and 8 deletions

View File

@ -60,8 +60,8 @@ inline CMemory p_CHLClient_GetAllClasses;
inline auto CHLClient_GetAllClasses = p_CHLClient_GetAllClasses.RCast<ClientClass*(*)()>();
#endif // !DEDICATED
inline CHLClient* gHLClient = nullptr;
inline CHLClient* g_pHLClient = nullptr;
inline CHLClient** gHLClient = nullptr;
inline CHLClient** g_pHLClient = nullptr;
#ifndef DEDICATED
inline IClientEntityList* g_pClientEntityList = nullptr;
#endif // !DEDICATED
@ -118,11 +118,11 @@ class VDll_Engine_Int : public IDetour
{
gHLClient = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>
("\x48\x8D\x05\x00\x00\x00\x00\xC3\xCC\xCC\xCC\xCC\xCC\xCC\xCC\xCC\x48\x89\x5C\x24\x00\x57\x48\x83\xEC\x30\x48\x8B\xF9"),
"xxx????xxxxxxxxxxxxx?xxxxxxxx").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CHLClient*>();
"xxx????xxxxxxxxxxxxx?xxxxxxxx").ResolveRelativeAddressSelf(0x3, 0x7).RCast<CHLClient**>();
g_pHLClient = g_GameDll.FindPatternSIMD(reinterpret_cast<rsig_t>
("\x41\x55\x48\x83\xEC\x00\x4C\x63\x91\x00\x00\x00\x00"),
"xxxxx?xxx????").FindPatternSelf("4C 8B", CMemory::Direction::DOWN, 512, 2).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CHLClient*>();
"xxxxx?xxx????").FindPatternSelf("4C 8B", CMemory::Direction::DOWN, 512, 2).ResolveRelativeAddressSelf(0x3, 0x7).RCast<CHLClient**>();
}
virtual void GetCon(void) const { }
virtual void Attach(void) const { }

View File

@ -90,10 +90,8 @@ bool CModAppSystemGroup::Create(CModAppSystemGroup* pModAppSystemGroup)
}
if (pModAppSystemGroup->IsServerOnly())
{
memset(gHLClient, '\0', sizeof(void*));
gHLClient = nullptr;
memset(g_pHLClient, '\0', sizeof(void*));
g_pHLClient = nullptr;
*g_pHLClient = nullptr;
*gHLClient = nullptr;
}
g_FrameTasks.push_back(std::move(g_TaskScheduler));