Fix retrieval of sv address not working under linux

This commit is contained in:
Arkshine 2015-10-11 13:19:06 +02:00
parent 2eeeb2997d
commit b3e5e10473

View File

@ -524,22 +524,28 @@ void InitGlobalVars()
uintptr_t base = *reinterpret_cast<uintptr_t*>(reinterpret_cast<byte*>(g_engfuncs.pfnGetCurrentPlayer) + typeDesc.fieldOffset); uintptr_t base = *reinterpret_cast<uintptr_t*>(reinterpret_cast<byte*>(g_engfuncs.pfnGetCurrentPlayer) + typeDesc.fieldOffset);
ServerStatic = reinterpret_cast<server_static_t*>(base - 4); ServerStatic = reinterpret_cast<server_static_t*>(base - 4);
} }
if (CommonConfig->GetAddress("sv", &address))
{
Server = *reinterpret_cast<server_t**>(address);
}
#else #else
if (CommonConfig->GetMemSig("svs", &address)) if (CommonConfig->GetMemSig("svs", &address))
{ {
ServerStatic = reinterpret_cast<server_static_t*>(address); ServerStatic = reinterpret_cast<server_static_t*>(address);
} }
#endif
if (CommonConfig->GetAddress("sv", &address)) if (CommonConfig->GetMemSig("sv", &address))
{ {
Server = *reinterpret_cast<server_t**>(address); Server = reinterpret_cast<server_t*>(address);
} }
#endif
if (!ServerStatic) if (!ServerStatic)
{ {
MF_Log("svs global variable is not available\n"); MF_Log("svs global variable is not available\n");
} }
if (!Server) if (!Server)
{ {
MF_Log("sv global variable is not available\n"); MF_Log("sv global variable is not available\n");