2017-03-09 18:59:38 +00:00
|
|
|
|
|
|
|
#include "mod_rehlds_api.h"
|
|
|
|
|
|
|
|
IRehldsApi* RehldsApi;
|
|
|
|
const RehldsFuncs_t* RehldsFuncs;
|
|
|
|
IRehldsServerData* RehldsData;
|
|
|
|
IRehldsHookchains* RehldsHookchains;
|
|
|
|
IRehldsServerStatic* RehldsSvs;
|
|
|
|
|
|
|
|
bool RehldsApi_Init()
|
|
|
|
{
|
2017-03-19 13:12:07 +00:00
|
|
|
if (!IS_DEDICATED_SERVER())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-09 18:59:38 +00:00
|
|
|
#if defined(PLATFORM_WINDOWS)
|
2018-08-25 07:20:06 +00:00
|
|
|
const auto library = "swds";
|
2017-03-09 18:59:38 +00:00
|
|
|
#elif defined(PLATFORM_POSIX)
|
2018-08-25 07:20:06 +00:00
|
|
|
const auto library = "engine_i486";
|
2017-03-09 18:59:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!GET_IFACE<IRehldsApi>(library, RehldsApi, VREHLDS_HLDS_API_VERSION) || !RehldsApi)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-08-25 07:20:06 +00:00
|
|
|
const auto majorVersion = RehldsApi->GetMajorVersion();
|
|
|
|
const auto minorVersion = RehldsApi->GetMinorVersion();
|
2017-03-09 18:59:38 +00:00
|
|
|
|
|
|
|
if (majorVersion != REHLDS_API_VERSION_MAJOR || minorVersion < REHLDS_API_VERSION_MINOR)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
RehldsFuncs = RehldsApi->GetFuncs();
|
|
|
|
RehldsData = RehldsApi->GetServerData();
|
|
|
|
RehldsHookchains = RehldsApi->GetHookchains();
|
|
|
|
RehldsSvs = RehldsApi->GetServerStatic();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|