Added ISmmAPI::GetVSPVersion() to get highest supported IServerPluginCallbacks interface version
Added ISmmAPI::GetVSPVersion() to get highest supported IServerPluginCallbacks interface version
1.1 --- a/sourcemm/CSmmAPI.cpp Tue Apr 24 20:30:17 2007 +0000
1.2 +++ b/sourcemm/CSmmAPI.cpp Tue Apr 24 22:07:00 2007 +0000
1.3 @@ -629,3 +629,8 @@
1.4
1.5 return msg->name;
1.6 }
1.7 +
1.8 +int CSmmAPI::GetVSPVersion()
1.9 +{
1.10 + return g_VspVersion;
1.11 +}
2.1 --- a/sourcemm/CSmmAPI.h Tue Apr 24 20:30:17 2007 +0000
2.2 +++ b/sourcemm/CSmmAPI.h Tue Apr 24 22:07:00 2007 +0000
2.3 @@ -70,6 +70,7 @@
2.4 int GetUserMessageCount();
2.5 int FindUserMessage(const char *name, int *size=NULL);
2.6 const char *GetUserMessage(int index, int *size=NULL);
2.7 + int GetVSPVersion();
2.8 public:
2.9 bool CacheCmds();
2.10 bool CmdCacheSuccessful();
3.1 --- a/sourcemm/ISmmAPI.h Tue Apr 24 20:30:17 2007 +0000
3.2 +++ b/sourcemm/ISmmAPI.h Tue Apr 24 22:07:00 2007 +0000
3.3 @@ -266,7 +266,7 @@
3.4 /**
3.5 * @brief Tells SourceMM to add VSP hooking capability to plugins.
3.6 *
3.7 - * Since this potentially uses more resources than it would otherwise, plugins have to
3.8 + * Since this potentially uses more resources than it would otherwise, plugins have to
3.9 * explicitly enable the feature. Whether requested or not, if it is enabled, all plugins
3.10 * will get a pointer to the VSP listener through IMetamodListener.
3.11 */
3.12 @@ -303,6 +303,15 @@
3.13 * @return Message name, or NULL on failure.
3.14 */
3.15 virtual const char *GetUserMessage(int index, int *size=NULL) =0;
3.16 +public: // Added in 1.4.1 (1:6)
3.17 + /**
3.18 + * @brief Returns the highest interface version of IServerPluginCallbacks that the engine supports.
3.19 + * This is useful for games that run on older versions of the Source engine, such as The Ship.
3.20 + *
3.21 + * @return Highest interface version of IServerPluginCallbacks.
3.22 + * Returns 0 if SourceMM's VSP listener isn't currently enabled.
3.23 + */
3.24 + virtual int GetVSPVersion() =0;
3.25 };
3.26
3.27
3.28 @@ -314,7 +323,8 @@
3.29 * 1.2 Added API more helper functions and new SourceHook version.
3.30 * 1.2.2 Added API for printing to client console (with string formatting).
3.31 * 1.3 Added new interface search API.
3.32 - * 1.4 Added VSP listener and user message API.
3.33 + * 1.4 Added VSP listener and user message API.
3.34 + * 1.4.1 Added API for getting highest supported version of IServerPluginCallbacks.
3.35 */
3.36
3.37 #endif //_INCLUDE_ISMM_API_H
4.1 --- a/sourcemm/changelog.txt Tue Apr 24 20:30:17 2007 +0000
4.2 +++ b/sourcemm/changelog.txt Tue Apr 24 22:07:00 2007 +0000
4.3 @@ -1,3 +1,6 @@
4.4 +2007/??/?? 1.4.1:
4.5 + - Added API for getting highest supported IServerPluginCallbacks interface version.
4.6 +
4.7 2007/04/05 1.4.0:
4.8 - Added API functions for retrieving User Message info without potentially crashing.
4.9 - Added API functions for letting SourceMM plugins use Valve Server Plugin callbacks.
5.1 --- a/sourcemm/sourcemm.cpp Tue Apr 24 20:30:17 2007 +0000
5.2 +++ b/sourcemm/sourcemm.cpp Tue Apr 24 22:07:00 2007 +0000
5.3 @@ -58,8 +58,8 @@
5.4 SourceHook::List<GameDllInfo *> gamedll_list;
5.5 SourceHook::CallClass<IServerGameDLL> *g_GameDllPatch;
5.6 int g_GameDllVersion = 0;
5.7 -const char VSPIFACE_001[] = "ISERVERPLUGINCALLBACKS001";
5.8 -const char VSPIFACE_002[] = "ISERVERPLUGINCALLBACKS002";
5.9 +int g_VspVersion = 0;
5.10 +const char VSPIFACE[] = "ISERVERPLUGINCALLBACKS";
5.11 const char GAMEINFO_PATH[] = "|gameinfo_path|";
5.12
5.13 void ClearGamedllList();
5.14 @@ -227,17 +227,18 @@
5.15 return NULL;
5.16 }
5.17
5.18 - /* We check these separately because we can't reply
5.19 - * unless our interface version really matches.
5.20 - */
5.21 - if ((strcmp(iface, VSPIFACE_002) == 0)
5.22 - || strcmp(iface, VSPIFACE_001) == 0)
5.23 + if (strncmp(iface, VSPIFACE, 22) == 0)
5.24 {
5.25 - if (ret)
5.26 + g_VspVersion = atoi(&(iface[22]));
5.27 +
5.28 + if (g_VspVersion <= MAX_VSP_VERSION)
5.29 {
5.30 - *ret = IFACE_OK;
5.31 + if (ret)
5.32 + {
5.33 + *ret = IFACE_OK;
5.34 + }
5.35 + return &g_VspListener;
5.36 }
5.37 - return &g_VspListener;
5.38 }
5.39
5.40 if (!gParsedGameInfo)
6.1 --- a/sourcemm/sourcemm.h Tue Apr 24 20:30:17 2007 +0000
6.2 +++ b/sourcemm/sourcemm.h Tue Apr 24 22:07:00 2007 +0000
6.3 @@ -35,12 +35,15 @@
6.4 #define SOURCEMM_VERSION SVN_FILE_VERSION_STRING
6.5 #define SOURCEMM_DATE __DATE__
6.6 #define SM_VERS_API_MAJOR 1 //increase this on a breaking change
6.7 -#define SM_VERS_API_MINOR 5 //increase this on a non-breaking API change
6.8 +#define SM_VERS_API_MINOR 6 //increase this on a non-breaking API change
6.9
6.10 -//We need a good CServerGameDLL version to work properly. We support these inclusively.
6.11 +/* We need a good CServerGameDLL version to work properly. We support these inclusively. */
6.12 #define MIN_GAMEDLL_VERSION 3
6.13 #define MAX_GAMEDLL_VERSION 8
6.14
6.15 +/* Maximum version of IServerPluginCallbacks that SourceMM supports */
6.16 +#define MAX_VSP_VERSION 2
6.17 +
6.18 /**
6.19 * @brief Entry point for HL2 Engine
6.20 */
6.21 @@ -114,6 +117,9 @@
6.22 /** @brief ServerGameDLL version that is currently loaded */
6.23 extern int g_GameDllVersion;
6.24
6.25 +/** @brief Highest IServerPluginCallbacks version that is supported by engine */
6.26 +extern int g_VspVersion;
6.27 +
6.28 extern bool bGameInit;
6.29
6.30 /** @brief Global CallClass for IServerGameDLL */