mirror of
https://github.com/rehlds/metamod-r.git
synced 2025-01-13 23:28:23 +03:00
Add option dynalign_list <yes/no> (for compatibility HLSW on Tab 'Metamod Plugins')
This commit is contained in:
parent
e32e4f6d6e
commit
e1e1b8aaaa
@ -65,3 +65,9 @@ debuglevel 0
|
||||
// clientmeta yes
|
||||
// clientmeta no
|
||||
clientmeta no
|
||||
|
||||
|
||||
// dynalign_list <yes/no>
|
||||
// Setting to disable or enable plugins list dynamic alignment into output
|
||||
// NOTE: This option affect's on incorrect parse from HLSW on Tab 'Metamod Plugins'
|
||||
dynalign_list yes
|
||||
|
@ -205,6 +205,11 @@ void cmd_meta_pluginlist()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_config->m_dynalign_list) {
|
||||
g_plugins->show_static();
|
||||
return;
|
||||
}
|
||||
|
||||
g_plugins->show();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
MConfig::MConfig() : m_debuglevel(0), m_gamedll(nullptr), m_exec_cfg(nullptr), m_list(nullptr), m_filename(nullptr), m_clientmeta(FALSE)
|
||||
MConfig::MConfig() : m_debuglevel(0), m_gamedll(nullptr), m_exec_cfg(nullptr), m_list(nullptr), m_filename(nullptr), m_clientmeta(FALSE), m_dynalign_list(FALSE)
|
||||
{
|
||||
set_directory();
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
char* m_gamedll; // string if specified in config.ini
|
||||
char* m_exec_cfg; // ie exec.cfg
|
||||
BOOL m_clientmeta;
|
||||
BOOL m_dynalign_list;
|
||||
|
||||
private:
|
||||
option_t* m_list;
|
||||
|
@ -6,10 +6,11 @@ MConfig g_static_config;
|
||||
MConfig *g_config = &g_static_config;
|
||||
option_t g_global_options[] =
|
||||
{
|
||||
{ "debuglevel", CF_INT, &g_config->m_debuglevel, "0" },
|
||||
{ "gamedll", CF_PATH, &g_config->m_gamedll, nullptr },
|
||||
{ "exec_cfg", CF_STR, &g_config->m_exec_cfg, nullptr },
|
||||
{ "clientmeta", CF_BOOL, &g_config->m_clientmeta, "no" },
|
||||
{ "debuglevel", CF_INT, &g_config->m_debuglevel, "0" },
|
||||
{ "gamedll", CF_PATH, &g_config->m_gamedll, nullptr },
|
||||
{ "exec_cfg", CF_STR, &g_config->m_exec_cfg, nullptr },
|
||||
{ "clientmeta", CF_BOOL, &g_config->m_clientmeta, "no" },
|
||||
{ "dynalign_list", CF_BOOL, &g_config->m_dynalign_list, "yes" },
|
||||
|
||||
// list terminator
|
||||
{ nullptr, CF_NONE, nullptr, nullptr }
|
||||
@ -130,6 +131,12 @@ void metamod_startup()
|
||||
g_config->set("clientmeta", cp);
|
||||
}
|
||||
|
||||
cp = LOCALINFO("mm_dynalign_list");
|
||||
if (cp && *cp != '\0') {
|
||||
META_LOG("Dynamic alignment list specified via localinfo: %s", cp);
|
||||
g_config->set("dynalign_list", cp);
|
||||
}
|
||||
|
||||
// Check for an initial debug level, since cfg files don't get exec'd
|
||||
// until later.
|
||||
if (g_config->m_debuglevel)
|
||||
|
@ -603,7 +603,7 @@ void MPluginList::show(int source_index)
|
||||
size_t nWidthDesc, nWidthFile, nWidthVers;
|
||||
getWidthFields(source_index, nWidthDesc, nWidthFile, nWidthVers);
|
||||
|
||||
char *desc = new char[nWidthDesc + 1]; // + 1 for term null
|
||||
char *desc = new char[nWidthDesc + 1]; // +1 for term null
|
||||
char *file = new char[nWidthFile + 1];
|
||||
char *vers = new char[nWidthVers + 1];
|
||||
|
||||
@ -645,6 +645,48 @@ void MPluginList::show(int source_index)
|
||||
delete [] vers;
|
||||
}
|
||||
|
||||
void MPluginList::show_static(int source_index)
|
||||
{
|
||||
if (source_index <= 0)
|
||||
META_CONS("Currently loaded plugins:");
|
||||
else
|
||||
META_CONS("Child plugins:");
|
||||
|
||||
int nPlugins = 0, nRunPlugins = 0;
|
||||
char desc[15 + 1], file[16 + 1], vers[7 + 1]; // +1 for term null
|
||||
META_CONS(" %*s %-*s %-4s %-4s %-*s v%-*s %-*s %-5s %-5s", WIDTH_MAX_PLUGINS, "", sizeof(desc) - 1, "description", "stat", "pend",
|
||||
sizeof(file) - 1, "file", sizeof(vers) - 1, "ers", 2 + WIDTH_MAX_PLUGINS, "src", "load ", "unlod");
|
||||
|
||||
for (auto p : m_plugins) {
|
||||
if (p->m_status < PL_VALID)
|
||||
continue;
|
||||
|
||||
if (source_index > 0 && p->m_source_plugin_index != source_index)
|
||||
continue;
|
||||
|
||||
Q_strlcpy(desc, p->m_desc);
|
||||
Q_strlcpy(file, p->m_file);
|
||||
|
||||
if (p->info() && p->info()->version) {
|
||||
Q_strlcpy(vers, p->info()->version);
|
||||
}
|
||||
else {
|
||||
Q_strlcpy(vers, " -");
|
||||
}
|
||||
|
||||
META_CONS(" [%*d] %-*s %-4s %-4s %-*s v%-*s %-*s %-5s %-5s", WIDTH_MAX_PLUGINS, p->m_index,
|
||||
sizeof(desc) - 1, desc, p->str_status(ST_SHOW), p->str_action(SA_SHOW), sizeof(file) - 1, file, sizeof(vers) - 1, vers,
|
||||
2 + WIDTH_MAX_PLUGINS, p->str_source(SO_SHOW), p->str_loadable(SL_SHOW), p->str_unloadable(SL_SHOW));
|
||||
|
||||
if (p->m_status == PL_RUNNING)
|
||||
nPlugins++;
|
||||
|
||||
nRunPlugins++;
|
||||
}
|
||||
|
||||
META_CONS("%d plugins, %d running", nRunPlugins, nPlugins);
|
||||
}
|
||||
|
||||
// List plugins and information to Player/client entity. Differs from the
|
||||
// "meta list" console command in that:
|
||||
// - Shows only "running" plugins, skipping any failed or paused plugins.
|
||||
|
@ -36,7 +36,8 @@ public:
|
||||
bool refresh(PLUG_LOADTIME now); // update from re-read inifile
|
||||
void unpause_all(); // unpause any paused plugins
|
||||
void retry_all(PLUG_LOADTIME now); // retry any pending plugin actions
|
||||
void show(int source_index = 0); // list plugins to console
|
||||
void show(int source_index = 0); // list plugins to console use dynamic aligment
|
||||
void show_static(int source_index = 0); // list plugins to console use static aligment
|
||||
void show_client(edict_t* pEntity); // list plugins to player client
|
||||
void clear_source_plugin_index(int source_index);
|
||||
void getWidthFields(int source_index, size_t &widthDescBest, size_t &widthFileBest, size_t &widthVersBest);
|
||||
|
Loading…
x
Reference in New Issue
Block a user