mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2024-11-29 11:24:19 +01:00
Finalized versioning and PI
Added QueryRunning() output to meta info/list. --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%40125
This commit is contained in:
parent
a4299bd097
commit
08b2d3d1c3
@ -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;
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -209,9 +209,6 @@
|
||||
<File
|
||||
RelativePath="..\sourcehook\sh_vector.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sourcehook\sourcehook.cpp">
|
||||
</File>
|
||||
<Filter
|
||||
Name="Headers"
|
||||
Filter="">
|
||||
@ -224,6 +221,9 @@
|
||||
<File
|
||||
RelativePath="..\sourcehook\sh_memory.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sourcehook\sourcehook.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\sourcehook\sourcehook.h">
|
||||
</File>
|
||||
|
Loading…
Reference in New Issue
Block a user