diff --git a/sourcemm/CSmmAPI.cpp b/sourcemm/CSmmAPI.cpp index 152877e..78bcb07 100644 --- a/sourcemm/CSmmAPI.cpp +++ b/sourcemm/CSmmAPI.cpp @@ -11,6 +11,7 @@ #include "CSmmAPI.h" #include "sourcemm.h" #include "concommands.h" +#include "CPlugin.h" /** * @brief Implementation of main API interface @@ -226,3 +227,17 @@ bool CSmmAPI::CacheSuccessful() { return m_Cache; } + +void CSmmAPI::GetApiVersions(int &major, int &minor, int &plvers, int &plmin) +{ + major = SM_VERS_API_MAJOR; + minor = SM_VERS_API_MINOR; + plvers = PLAPI_VERSION; + plmin = PLAPI_MIN_VERSION; +} + +void CSmmAPI::GetShVersions(int &shvers, int &shimpl) +{ + shvers = SH_IFACE_VERSION; + shimpl = SH_IMPL_VERSION; +} diff --git a/sourcemm/CSmmAPI.h b/sourcemm/CSmmAPI.h index d828a51..9ebe0a5 100644 --- a/sourcemm/CSmmAPI.h +++ b/sourcemm/CSmmAPI.h @@ -44,6 +44,12 @@ namespace SourceMM void ConPrint(const char *fmt); void ConPrintf(const char *fmt, ...); bool CacheSuccessful(); + bool RemotePrintingAvailable() + { + return CacheSuccessful(); + } + virtual void GetApiVersions(int &major, int &minor, int &plvers, int &plmin); + virtual void GetShVersions(int &shvers, int &shimpl); public: bool CacheCmds(); private: diff --git a/sourcemm/ISmmAPI.h b/sourcemm/ISmmAPI.h index 2656886..ad18218 100644 --- a/sourcemm/ISmmAPI.h +++ b/sourcemm/ISmmAPI.h @@ -45,16 +45,29 @@ public: virtual CGlobalVars *pGlobals() =0; virtual void SetLastMetaReturn(META_RES res) =0; virtual META_RES GetLastMetaReturn() =0; -public: - //Added in 1.00-RC2 to solve concommand problems +public: //Added in 1.00-RC2 (0:0) + //solves concommand problems by keeping track for loading/unloading virtual IConCommandBaseAccessor *GetCvarBaseAccessor() =0; virtual bool RegisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0; virtual void UnregisterConCmdBase(ISmmPlugin *plugin, ConCommandBase *pCommand) =0; -public: - //Added in 1.00-RC2. attempt fix at valve not exporting rcon printing + //attempt fix at valve not exporting rcon printing //these do not add newlines virtual void ConPrint(const char *fmt) =0; virtual void ConPrintf(const char *fmt, ...) =0; +public: //Added in 1.10 (1:0) + //added by request. Checks if ConPrint/ConPrintf will mirror to rcon. + virtual bool RemotePrintingAvailable() =0; + //Returns the Metamod Version numbers as major version and minor (API) version. + //changes to minor version are guaranteed to be backwards compatible. + //changes to major version are not. + //Also returns current plugin version and minimum plugin version + virtual void GetApiVersions(int &major, int &minor, int &plvers, int &plmin) =0; + //Returns sourcehook API version and implementation version + virtual void GetShVersions(int &shvers, int &shimpl) =0; }; +/** Version history + * 1.10 bumped API to 1:0. The breaking changes occured in sourcehook and the plugin API. + */ + #endif //_INCLUDE_ISMM_API_H diff --git a/sourcemm/concommands.cpp b/sourcemm/concommands.cpp index 1a088c8..a98008f 100644 --- a/sourcemm/concommands.cpp +++ b/sourcemm/concommands.cpp @@ -183,7 +183,10 @@ CON_COMMAND(meta, "Metamod:Source Menu") { status = "PAUSE"; } else if (pl->m_Status == Pl_Running) { - status = "RUN"; + if (pl->m_API && pl->m_API->QueryRunning(NULL, 0)) + status = "RUN"; + else + status = "STOPPED"; } else if (pl->m_Status == Pl_Refused) { status = "FAIL"; } else if (pl->m_Status == Pl_Error) { @@ -298,7 +301,16 @@ CON_COMMAND(meta, "Metamod:Source Menu") { CONMSG("Plugin %d is paused.\n", id); } else if (pl->m_Status == Pl_Running) { - CONMSG("Plugin %d is running.\n", id); + char run_msg[255]; + bool run = false; + if (pl->m_API && pl->m_API->QueryRunning(run_msg, sizeof(run_msg)-1)) + run = true; + if (run) + { + CONMSG("Plugin %d is running.\n", id); + } else { + CONMSG("Plugin %d is stopped: %s\n", id, run_msg); + } } CONMSG(" Name: \"%s\" by %s\n", pl->m_API->GetName(), pl->m_API->GetAuthor()); CONMSG(" Version: %s\n", pl->m_API->GetVersion()); diff --git a/sourcemm/sample_mm/SamplePlugin.cpp b/sourcemm/sample_mm/SamplePlugin.cpp index 11718e2..9b9c85e 100644 --- a/sourcemm/sample_mm/SamplePlugin.cpp +++ b/sourcemm/sample_mm/SamplePlugin.cpp @@ -98,7 +98,7 @@ bool FireEvent_Handler(IGameEvent *event, bool bDontBroadcast) RETURN_META_VALUE(MRES_IGNORED, true); } -bool SamplePlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen) +bool SamplePlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen, bool late) { PLUGIN_SAVEVARS(); diff --git a/sourcemm/sample_mm/SamplePlugin.h b/sourcemm/sample_mm/SamplePlugin.h index f50cfb2..ce53ac8 100644 --- a/sourcemm/sample_mm/SamplePlugin.h +++ b/sourcemm/sample_mm/SamplePlugin.h @@ -20,7 +20,7 @@ class SamplePlugin : public ISmmPlugin { public: - bool Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen); + bool Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen, bool late); bool Unload(char *error, size_t maxlen); void AllPluginsLoaded(); bool Pause(char *error, size_t maxlen) diff --git a/sourcemm/sourcemm.cpp b/sourcemm/sourcemm.cpp index 9853f16..571bd85 100644 --- a/sourcemm/sourcemm.cpp +++ b/sourcemm/sourcemm.cpp @@ -396,8 +396,6 @@ void DLLShutdown_handler() SH_RELEASE_CALLCLASS(dllExec); dllExec = NULL; - //right now this will crash when the function returns! - // :TODO: remove this warning once PM fixes it. g_SourceHook.CompleteShutdown(); if (g_GameDll.lib && g_GameDll.loaded) @@ -468,7 +466,7 @@ int LoadPluginsFromFile(const char *file) ext = ""; } //Format the new path - UTIL_PathFmt(full_path, sizeof(full_path)-1, "%s/%s", g_ModPath.c_str(), buffer, ext); + UTIL_PathFmt(full_path, sizeof(full_path)-1, "%s/%s%s", g_ModPath.c_str(), buffer, ext); id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error)-1); if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused) { diff --git a/sourcemm/sourcemm.h b/sourcemm/sourcemm.h index f6aa9e6..90f6b4b 100644 --- a/sourcemm/sourcemm.h +++ b/sourcemm/sourcemm.h @@ -26,9 +26,27 @@ #include "oslink.h" #include "util.h" +/** + * Versioning + * First grouping is major release version (1) + * Second grouping is minor release version. + * Third grouping is release change version. + * For an entire code rehaul, we would change major. + * For a simple bug-fix release, we would change the third grouping. + * For an API change, we would increase the second grouping by one. + * For a breaking API change, we would increase the second group up to the next bracket. + * (example: 1.45 -> 1.50. 1.12 -> 1.20. 1.19 -> 1.20) + * minor changes can also roll over, but a big change should ALWAYS roll over. + * Increasing one grouping should make the lesser ones reset back to zero. + */ #define SOURCEMM_VERSION "1.10" #define SOURCEMM_DATE __DATE__ +#define SM_MAJOR_VERSION 1 //never need to increase this +#define SM_VERS_API_MAJOR 1 //increase this on a breaking change +#define SM_VERS_API_MINOR 0 //increase this on a non-breaking API change +#define SM_VERS_RELEASE 0 //increase this on a bug-fix release. +//We need a good CServerGameDLL version to work properly. We support these inclusively. #define MIN_GAMEDLL_VERSION 3 #define MAX_GAMEDLL_VERSION 4 diff --git a/sourcemm/sourcemm.vcproj b/sourcemm/sourcemm.vcproj index 9e3272d..29b281b 100644 --- a/sourcemm/sourcemm.vcproj +++ b/sourcemm/sourcemm.vcproj @@ -209,9 +209,6 @@ - - @@ -224,6 +221,9 @@ + +