From 7cc4820b04e8c6c87bd1b5b1ab252a8069027137 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 24 Dec 2007 03:50:50 +0000 Subject: [PATCH] updated changelog, added new formatting for meta list --HG-- branch : sourcemm-1.4.3 extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/sourcemm-1.4.3%40602 --- sourcemm/CPlugin.cpp | 31 +++++++++++++++ sourcemm/CPlugin.h | 2 + sourcemm/changelog.txt | 7 ++++ sourcemm/concommands.cpp | 82 +++++++++++++++++++++------------------ sourcemm/svn_version.h | 8 ++-- sourcemm/vsp_listener.cpp | 7 ++++ 6 files changed, 95 insertions(+), 42 deletions(-) diff --git a/sourcemm/CPlugin.cpp b/sourcemm/CPlugin.cpp index aecd031..2996f2b 100644 --- a/sourcemm/CPlugin.cpp +++ b/sourcemm/CPlugin.cpp @@ -665,3 +665,34 @@ void CPluginManager::UnregAllConCmds(CPlugin *pl) pl->m_Cmds.clear(); } + +const char *CPluginManager::GetStatusText(CPlugin *pl) +{ + switch (pl->m_Status) + { + case Pl_NotFound: + return "NOFILE"; + case Pl_Error: + return "ERROR"; + case Pl_Refused: + return "FAILED"; + case Pl_Paused: + return "PAUSED"; + case Pl_Running: + { + if (pl->m_API && pl->m_API->QueryRunning(NULL, 0)) + { + return "STOPPED"; + } else { + return "RUNNING"; + } + } + default: + return "-"; + } +} + +unsigned int CPluginManager::GetPluginCount() +{ + return (unsigned int)m_Plugins.size(); +} diff --git a/sourcemm/CPlugin.h b/sourcemm/CPlugin.h index 86058be..2f9e3c2 100644 --- a/sourcemm/CPlugin.h +++ b/sourcemm/CPlugin.h @@ -132,6 +132,8 @@ namespace SourceMM SourceHook::List::iterator _end(); void SetVSPAsLoaded(); + unsigned int GetPluginCount(); + const char *CPluginManager::GetStatusText(CPlugin *pl); private: //These are identical internal functions for the wrappers above. CPlugin *_Load(const char *file, PluginId source, char *error, size_t maxlen); diff --git a/sourcemm/changelog.txt b/sourcemm/changelog.txt index 40867d6..812fbef 100644 --- a/sourcemm/changelog.txt +++ b/sourcemm/changelog.txt @@ -1,3 +1,10 @@ +2007/12/24 1.4.3: + - Metamod:Source can now be loaded via a .vdf instead of gameinfo.txt. + - Added new plugin loading mechanism via .vdf files in the metamod folder. + - Changed "meta list" output to look similar to Metamod:Source 1.6. + - Plugins which need a VSP pointer can now receive it on late load. + - Fixed a rare memory corruption bug in the CVector class. + 2007/06/26 1.4.2: - Fixed a bug where unloading all plugins could crash if one plugin had child plugins. diff --git a/sourcemm/concommands.cpp b/sourcemm/concommands.cpp index f19597a..21590be 100644 --- a/sourcemm/concommands.cpp +++ b/sourcemm/concommands.cpp @@ -154,11 +154,11 @@ CON_COMMAND(meta, "Metamod:Source Menu") CONMSG("Metamod:Source version %s\n", SOURCEMM_VERSION); if (g_VspListener.IsRootLoadMethod()) { - CONMSG("Load Method: Valve Server Plugin\n"); + CONMSG("Loaded As: Valve Server Plugin\n"); } else { - CONMSG("Load Method: GameDLL (gameinfo.txt)\n"); + CONMSG("Loaded As: GameDLL (gameinfo.txt)\n"); } CONMSG("Compiled on: %s\n", SOURCEMM_DATE); CONMSG("Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION); @@ -208,58 +208,64 @@ CON_COMMAND(meta, "Metamod:Source Menu") return; } else if (strcmp(command, "list") == 0) { - SourceMM::CPluginManager::CPlugin *pl; + size_t len; PluginIter i; - const char *status=""; - const char *version=NULL; - const char *name=NULL; - const char *author=NULL; + char buffer[255]; + ISmmPlugin *plapi; + const char *plname; + SourceMM::CPluginManager::CPlugin *pl; + unsigned int plnum = g_PluginMngr.GetPluginCount(); + +#define IS_STR_FILLED(var) (var != NULL && var[0] != '\0') + + if (!plnum) + { + CONMSG("No plugins loaded.\n"); + return; + } + else + { + CONMSG("Listing %d plugin%s:\n", plnum, (plnum > 1) ? "s" : ""); + } - CONMSG("-Id- %-20.19s %-10.9s %-20.19s %-8.7s\n", "Name", "Version", "Author", "Status"); for (i=g_PluginMngr._begin(); i!=g_PluginMngr._end(); i++) { pl = (*i); if (!pl) + { break; - if (pl->m_Status == Pl_Paused) - { - status = "PAUSE"; - } else if (pl->m_Status == Pl_Running) { - 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) { - status = "ERROR"; - } else if (pl->m_Status == Pl_NotFound) { - status = "NOFILE"; } - if (pl->m_API) + len = 0; + + if (pl->m_Status != Pl_Running) { - version = pl->m_API->GetVersion(); - author = pl->m_API->GetAuthor(); - name = pl->m_API->GetName(); - } else { - version = "-"; - author = "-"; - name = "-"; + len += UTIL_Format(buffer, sizeof(buffer), " [%02d] <%s>", pl->m_Id, g_PluginMngr.GetStatusText(pl)); + } + else + { + len += UTIL_Format(buffer, sizeof(buffer), " [%02d]", pl->m_Id); } - if (!version) - version = "-"; - if (!author) - author = "-"; - if (!name) - name = pl->m_File.c_str(); + if ((plapi = pl->m_API)) + { + plname = IS_STR_FILLED(plapi->GetName()) ? plapi->GetName() : pl->m_File.c_str(); + len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " %s", plname); + if (IS_STR_FILLED(plapi->GetVersion())) + { + len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", plapi->GetVersion()); + } + if (IS_STR_FILLED(plapi->GetAuthor())) + { + UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", plapi->GetAuthor()); + } + } - CONMSG("[%02d] %-20.19s %-10.9s %-20.19s %-8.7s\n", pl->m_Id, name, version, author, status); + CONMSG("%s\n", buffer); } - //CONMSG("\n"); +#undef IS_STR_FILLED return; } else if (strcmp(command, "cmds") == 0) { diff --git a/sourcemm/svn_version.h b/sourcemm/svn_version.h index 59689e1..6dfe460 100644 --- a/sourcemm/svn_version.h +++ b/sourcemm/svn_version.h @@ -5,9 +5,9 @@ #define SVN_PRODUCT_VERSION "1.4.3" -#define SVN_REVISION 600 -#define SVN_REVISION_STRING "600" -#define SVN_FILE_VERSION 1,4,3,600 -#define SVN_FILE_VERSION_STRING "1.4.3.600" +#define SVN_REVISION 602 +#define SVN_REVISION_STRING "602" +#define SVN_FILE_VERSION 1,4,3,602 +#define SVN_FILE_VERSION_STRING "1.4.3.602" #endif //_INCLUDE_SVN_VERSION_H_ diff --git a/sourcemm/vsp_listener.cpp b/sourcemm/vsp_listener.cpp index 0a4889c..87cbc91 100644 --- a/sourcemm/vsp_listener.cpp +++ b/sourcemm/vsp_listener.cpp @@ -173,6 +173,13 @@ bool VSPListener::Load(CreateInterfaceFn interfaceFactory, CreateInterfaceFn gam SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads, false); SH_ADD_HOOK_STATICFUNC(ConCommand, Dispatch, g_plugin_unload, InterceptPluginUnloads_Post, true); } + + /* Ho ho ho... if we get here, set a new cvar version. */ + extern ConVar metamod_version; + char buffer[255]; + + UTIL_Format(buffer, sizeof(buffer), "%sV", metamod_version.GetString()); + metamod_version.SetValue(buffer); } m_Loaded = true;