mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-01-19 08:52:34 +01:00
Added ISmmAPI::GetVSPVersion() to get highest supported IServerPluginCallbacks interface version
--HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40379
This commit is contained in:
parent
6278cc9f7b
commit
bf38135d88
@ -629,3 +629,8 @@ const char *CSmmAPI::GetUserMessage(int index, int *size)
|
||||
|
||||
return msg->name;
|
||||
}
|
||||
|
||||
int CSmmAPI::GetVSPVersion()
|
||||
{
|
||||
return g_VspVersion;
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ namespace SourceMM
|
||||
int GetUserMessageCount();
|
||||
int FindUserMessage(const char *name, int *size=NULL);
|
||||
const char *GetUserMessage(int index, int *size=NULL);
|
||||
int GetVSPVersion();
|
||||
public:
|
||||
bool CacheCmds();
|
||||
bool CmdCacheSuccessful();
|
||||
|
@ -266,7 +266,7 @@ public: // Added in 1.4 (1:5)
|
||||
/**
|
||||
* @brief Tells SourceMM to add VSP hooking capability to plugins.
|
||||
*
|
||||
* Since this potentially uses more resources than it would otherwise, plugins have to
|
||||
* Since this potentially uses more resources than it would otherwise, plugins have to
|
||||
* explicitly enable the feature. Whether requested or not, if it is enabled, all plugins
|
||||
* will get a pointer to the VSP listener through IMetamodListener.
|
||||
*/
|
||||
@ -303,6 +303,15 @@ public: // Added in 1.4 (1:5)
|
||||
* @return Message name, or NULL on failure.
|
||||
*/
|
||||
virtual const char *GetUserMessage(int index, int *size=NULL) =0;
|
||||
public: // Added in 1.4.1 (1:6)
|
||||
/**
|
||||
* @brief Returns the highest interface version of IServerPluginCallbacks that the engine supports.
|
||||
* This is useful for games that run on older versions of the Source engine, such as The Ship.
|
||||
*
|
||||
* @return Highest interface version of IServerPluginCallbacks.
|
||||
* Returns 0 if SourceMM's VSP listener isn't currently enabled.
|
||||
*/
|
||||
virtual int GetVSPVersion() =0;
|
||||
};
|
||||
|
||||
|
||||
@ -314,7 +323,8 @@ public: // Added in 1.4 (1:5)
|
||||
* 1.2 Added API more helper functions and new SourceHook version.
|
||||
* 1.2.2 Added API for printing to client console (with string formatting).
|
||||
* 1.3 Added new interface search API.
|
||||
* 1.4 Added VSP listener and user message API.
|
||||
* 1.4 Added VSP listener and user message API.
|
||||
* 1.4.1 Added API for getting highest supported version of IServerPluginCallbacks.
|
||||
*/
|
||||
|
||||
#endif //_INCLUDE_ISMM_API_H
|
||||
|
@ -1,3 +1,6 @@
|
||||
2007/??/?? 1.4.1:
|
||||
- Added API for getting highest supported IServerPluginCallbacks interface version.
|
||||
|
||||
2007/04/05 1.4.0:
|
||||
- Added API functions for retrieving User Message info without potentially crashing.
|
||||
- Added API functions for letting SourceMM plugins use Valve Server Plugin callbacks.
|
||||
|
@ -58,8 +58,8 @@ bool bGameInit = false;
|
||||
SourceHook::List<GameDllInfo *> gamedll_list;
|
||||
SourceHook::CallClass<IServerGameDLL> *g_GameDllPatch;
|
||||
int g_GameDllVersion = 0;
|
||||
const char VSPIFACE_001[] = "ISERVERPLUGINCALLBACKS001";
|
||||
const char VSPIFACE_002[] = "ISERVERPLUGINCALLBACKS002";
|
||||
int g_VspVersion = 0;
|
||||
const char VSPIFACE[] = "ISERVERPLUGINCALLBACKS";
|
||||
const char GAMEINFO_PATH[] = "|gameinfo_path|";
|
||||
|
||||
void ClearGamedllList();
|
||||
@ -227,17 +227,18 @@ SMM_API void *CreateInterface(const char *iface, int *ret)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* We check these separately because we can't reply
|
||||
* unless our interface version really matches.
|
||||
*/
|
||||
if ((strcmp(iface, VSPIFACE_002) == 0)
|
||||
|| strcmp(iface, VSPIFACE_001) == 0)
|
||||
if (strncmp(iface, VSPIFACE, 22) == 0)
|
||||
{
|
||||
if (ret)
|
||||
g_VspVersion = atoi(&(iface[22]));
|
||||
|
||||
if (g_VspVersion <= MAX_VSP_VERSION)
|
||||
{
|
||||
*ret = IFACE_OK;
|
||||
if (ret)
|
||||
{
|
||||
*ret = IFACE_OK;
|
||||
}
|
||||
return &g_VspListener;
|
||||
}
|
||||
return &g_VspListener;
|
||||
}
|
||||
|
||||
if (!gParsedGameInfo)
|
||||
|
@ -35,12 +35,15 @@
|
||||
#define SOURCEMM_VERSION SVN_FILE_VERSION_STRING
|
||||
#define SOURCEMM_DATE __DATE__
|
||||
#define SM_VERS_API_MAJOR 1 //increase this on a breaking change
|
||||
#define SM_VERS_API_MINOR 5 //increase this on a non-breaking API change
|
||||
#define SM_VERS_API_MINOR 6 //increase this on a non-breaking API change
|
||||
|
||||
//We need a good CServerGameDLL version to work properly. We support these inclusively.
|
||||
/* We need a good CServerGameDLL version to work properly. We support these inclusively. */
|
||||
#define MIN_GAMEDLL_VERSION 3
|
||||
#define MAX_GAMEDLL_VERSION 8
|
||||
|
||||
/* Maximum version of IServerPluginCallbacks that SourceMM supports */
|
||||
#define MAX_VSP_VERSION 2
|
||||
|
||||
/**
|
||||
* @brief Entry point for HL2 Engine
|
||||
*/
|
||||
@ -114,6 +117,9 @@ extern PluginId g_PLID;
|
||||
/** @brief ServerGameDLL version that is currently loaded */
|
||||
extern int g_GameDllVersion;
|
||||
|
||||
/** @brief Highest IServerPluginCallbacks version that is supported by engine */
|
||||
extern int g_VspVersion;
|
||||
|
||||
extern bool bGameInit;
|
||||
|
||||
/** @brief Global CallClass for IServerGameDLL */
|
||||
|
Loading…
x
Reference in New Issue
Block a user