Remove the ability to compile against Metamod:Source versions lower than 1.8.
This commit is contained in:
parent
c54b54ded0
commit
df672dd8ce
@ -79,14 +79,8 @@ void GameHooks::OnVSPReceived()
|
|||||||
if (client_cvar_query_mode_ != ClientCvarQueryMode::Unavailable)
|
if (client_cvar_query_mode_ != ClientCvarQueryMode::Unavailable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// For later MM:S versions, use the updated API, since it's cleaner.
|
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL || vsp_version < 2)
|
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL || vsp_version < 2)
|
||||||
return;
|
return;
|
||||||
#else
|
|
||||||
if (g_HL2.IsOriginalEngine() || vsp_version < 2)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SOURCE_ENGINE != SE_DARKMESSIAH && SOURCE_ENGINE != SE_DOTA
|
#if SOURCE_ENGINE != SE_DARKMESSIAH && SOURCE_ENGINE != SE_DOTA
|
||||||
hooks_ += SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &GameHooks::OnQueryCvarValueFinished), false);
|
hooks_ += SH_ADD_HOOK(IServerPluginCallbacks, OnQueryCvarValueFinished, vsp_interface, SH_MEMBER(this, &GameHooks::OnQueryCvarValueFinished), false);
|
||||||
|
@ -114,24 +114,10 @@ CHalfLife2::~CHalfLife2()
|
|||||||
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
CSharedEdictChangeInfo *g_pSharedChangeInfo = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
|
||||||
bool is_original_engine = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void CHalfLife2::OnSourceModStartup(bool late)
|
void CHalfLife2::OnSourceModStartup(bool late)
|
||||||
{
|
{
|
||||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
|
if (g_SMAPI->GetSourceEngineBuild() != SOURCE_ENGINE_ORIGINAL && !g_pSharedChangeInfo)
|
||||||
/* The Ship currently is the only known game to use an older version of the engine */
|
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
|
||||||
#else
|
|
||||||
if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
is_original_engine = true;
|
|
||||||
}
|
|
||||||
else if (g_pSharedChangeInfo == NULL)
|
|
||||||
{
|
{
|
||||||
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
|
g_pSharedChangeInfo = engine->GetSharedEdictChangeInfo();
|
||||||
}
|
}
|
||||||
@ -238,7 +224,7 @@ void CHalfLife2::InitCommandLine()
|
|||||||
{
|
{
|
||||||
char error[256];
|
char error[256];
|
||||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
if (!is_original_engine)
|
if (g_SMAPI->GetSourceEngineBuild() != SOURCE_ENGINE_ORIGINAL)
|
||||||
{
|
{
|
||||||
ke::Ref<ke::SharedLib> lib = ke::SharedLib::Open(TIER0_NAME, error, sizeof(error));
|
ke::Ref<ke::SharedLib> lib = ke::SharedLib::Open(TIER0_NAME, error, sizeof(error));
|
||||||
if (!lib) {
|
if (!lib) {
|
||||||
@ -280,13 +266,6 @@ ICommandLine *CHalfLife2::GetValveCommandLine()
|
|||||||
return ((FakeGetCommandLine)((FakeGetCommandLine *)m_pGetCommandLine))();
|
return ((FakeGetCommandLine)((FakeGetCommandLine *)m_pGetCommandLine))();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
|
||||||
bool CHalfLife2::IsOriginalEngine()
|
|
||||||
{
|
|
||||||
return is_original_engine;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
#if SOURCE_ENGINE != SE_DARKMESSIAH
|
||||||
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
IChangeInfoAccessor *CBaseEdict::GetChangeAccessor()
|
||||||
{
|
{
|
||||||
@ -786,11 +765,7 @@ bool CHalfLife2::IsLANServer()
|
|||||||
|
|
||||||
bool CHalfLife2::KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID)
|
bool CHalfLife2::KVLoadFromFile(KeyValues *kv, IBaseFileSystem *filesystem, const char *resourceName, const char *pathID)
|
||||||
{
|
{
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
if (g_SMAPI->GetSourceEngineBuild() == SOURCE_ENGINE_ORIGINAL)
|
||||||
#else
|
|
||||||
if (strcasecmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Assert(filesystem);
|
Assert(filesystem);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -197,9 +197,6 @@ public:
|
|||||||
const char *CurrentCommandName();
|
const char *CurrentCommandName();
|
||||||
void AddDelayedKick(int client, int userid, const char *msg);
|
void AddDelayedKick(int client, int userid, const char *msg);
|
||||||
void ProcessDelayedKicks();
|
void ProcessDelayedKicks();
|
||||||
#if !defined METAMOD_PLAPI_VERSION || PLAPI_VERSION < 11
|
|
||||||
bool IsOriginalEngine();
|
|
||||||
#endif
|
|
||||||
private:
|
private:
|
||||||
void PushCommandStack(const ICommandArgs *cmd);
|
void PushCommandStack(const ICommandArgs *cmd);
|
||||||
void PopCommandStack();
|
void PopCommandStack();
|
||||||
|
@ -482,7 +482,6 @@ static cell_t smn_IsPlayerAlive(IPluginContext *pContext, const cell_t *params)
|
|||||||
|
|
||||||
static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
int version = g_SMAPI->GetSourceEngineBuild();
|
int version = g_SMAPI->GetSourceEngineBuild();
|
||||||
|
|
||||||
switch (version)
|
switch (version)
|
||||||
@ -527,16 +526,6 @@ static cell_t GuessSDKVersion(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 90;
|
return 90;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (g_HL2.IsOriginalEngine())
|
|
||||||
{
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return 20;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,10 @@ int vsp_version = 0;
|
|||||||
|
|
||||||
PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);
|
PLUGIN_EXPOSE(SourceMod, g_SourceMod_Core);
|
||||||
|
|
||||||
|
#if !defined(METAMOD_PLAPI_VERSION) && PLAPI_VERSION < 11
|
||||||
|
# error "SourceMod requires Metamod:Source 1.8 or higher."
|
||||||
|
#endif
|
||||||
|
|
||||||
ConVar sourcemod_version("sourcemod_version", SOURCEMOD_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, "SourceMod Version");
|
ConVar sourcemod_version("sourcemod_version", SOURCEMOD_VERSION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY, "SourceMod Version");
|
||||||
|
|
||||||
bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
|
bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
|
||||||
@ -100,9 +104,7 @@ bool SourceMod_Core::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen
|
|||||||
|
|
||||||
ismm->AddListener(this, this);
|
ismm->AddListener(this, this);
|
||||||
|
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
if ((vsp_interface = g_SMAPI->GetVSPInfo(&vsp_version)) == NULL)
|
if ((vsp_interface = g_SMAPI->GetVSPInfo(&vsp_version)) == NULL)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
g_SMAPI->EnableVSPListener();
|
g_SMAPI->EnableVSPListener();
|
||||||
}
|
}
|
||||||
@ -190,31 +192,15 @@ void SourceMod_Core::OnVSPListening(IServerPluginCallbacks *iface)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
if (vsp_version == 0)
|
if (vsp_version == 0)
|
||||||
{
|
{
|
||||||
g_SMAPI->GetVSPInfo(&vsp_version);
|
g_SMAPI->GetVSPInfo(&vsp_version);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (vsp_version == 0)
|
|
||||||
{
|
|
||||||
if (strcmp(g_SourceMod.GetGameFolderName(), "ship") == 0)
|
|
||||||
{
|
|
||||||
vsp_version = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
vsp_version = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Notify! */
|
/* Notify! */
|
||||||
sCoreProviderImpl.OnVSPReceived();
|
sCoreProviderImpl.OnVSPReceived();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
|
|
||||||
void SourceMod_Core::OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand)
|
void SourceMod_Core::OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand)
|
||||||
{
|
{
|
||||||
#if SOURCE_ENGINE < SE_ORANGEBOX
|
#if SOURCE_ENGINE < SE_ORANGEBOX
|
||||||
@ -222,15 +208,6 @@ void SourceMod_Core::OnUnlinkConCommandBase(PluginId id, ConCommandBase *pComman
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
void SourceMod_Core::OnPluginUnload(PluginId id)
|
|
||||||
{
|
|
||||||
Global_OnUnlinkConCommandBase(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret)
|
void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret)
|
||||||
{
|
{
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
|
@ -80,11 +80,7 @@ public:
|
|||||||
const char *GetLogTag();
|
const char *GetLogTag();
|
||||||
public:
|
public:
|
||||||
void OnVSPListening(IServerPluginCallbacks *iface);
|
void OnVSPListening(IServerPluginCallbacks *iface);
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
void OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand);
|
void OnUnlinkConCommandBase(PluginId id, ConCommandBase *pCommand);
|
||||||
#else
|
|
||||||
void OnPluginUnload(PluginId id);
|
|
||||||
#endif
|
|
||||||
void *OnMetamodQuery(const char *iface, int *ret);
|
void *OnMetamodQuery(const char *iface, int *ret);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -242,24 +242,11 @@ void GetIServer()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined METAMOD_PLAPI_VERSION || PLAPI_VERSION >= 11
|
|
||||||
/* Get the CreateFakeClient function pointer */
|
/* Get the CreateFakeClient function pointer */
|
||||||
if (!(vfunc=SH_GET_ORIG_VFNPTR_ENTRY(engine, &IVEngineServer::CreateFakeClient)))
|
if (!(vfunc=SH_GET_ORIG_VFNPTR_ENTRY(engine, &IVEngineServer::CreateFakeClient)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* Get the interface manually */
|
|
||||||
SourceHook::MemFuncInfo info = {true, -1, 0, 0};
|
|
||||||
SourceHook::GetFuncInfo(&IVEngineServer::CreateFakeClient, info);
|
|
||||||
|
|
||||||
vfunc = enginePatch->GetOrigFunc(info.vtbloffs, info.vtblindex);
|
|
||||||
if (!vfunc)
|
|
||||||
{
|
|
||||||
void **vtable = *reinterpret_cast<void ***>(enginePatch->GetThisPtr() + info.thisptroffs + info.vtbloffs);
|
|
||||||
vfunc = vtable[info.vtblindex];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Get signature string for IVEngineServer::CreateFakeClient() */
|
/* Get signature string for IVEngineServer::CreateFakeClient() */
|
||||||
sigstr = g_pGameConf->GetKeyValue(FAKECLIENT_KEY);
|
sigstr = g_pGameConf->GetKeyValue(FAKECLIENT_KEY);
|
||||||
|
Loading…
Reference in New Issue
Block a user