diff --git a/configs/plugin_settings.cfg b/configs/plugin_settings.cfg
deleted file mode 100644
index edfbbac1..00000000
--- a/configs/plugin_settings.cfg
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Each sub-section of "Plugins" should have a title which specifies a plugin filename.
- * Filenames have a wildcard of *. Appending .smx is not required.
- * If the filename has no explicit path, it will be patched to any sub-path in the plugins folder.
- *
- * Available properties for plugins are:
- * "pause" - Whether or not the plugin should load paused - "yes" or "no" (default)
- * "lifetime" - Lifetime of the plugin. Options:
- * "mapsync" - Plugins should be reloaded on mapchange if changed (default)
- * "global" - Plugin will never be unloaded or updated
- * "blockload" - Plugin will always be blocked from loading. Implicit (automatic) loads
- * produce no error, but explicit (manual) loads will show an error message.
- * (Options are one of "yes" or "no")
- *
- * You can also have an "Options" section declaring options to pass onto the JIT:
- * "profile" - Bit flags for profiling level. Add flags together to reach a value.
- * WARNING: Profiler is _ALPHA_ software! Use it at your own risk for
- * development cycles only (not production setups).
- * See the wiki article "SourceMod Profiler" for more information.
- * 1 - Profile natives
- * 2 - Profile callbacks
- * 4 - Profile internal plugin function calls
- */
-
-"Plugins"
-{
- "*"
- {
- "pause" "no"
- "lifetime" "mapsync"
-
- "Options"
- {
- }
- }
-}
diff --git a/core/AMBuilder b/core/AMBuilder
index 59a6dedd..42b8b1c1 100644
--- a/core/AMBuilder
+++ b/core/AMBuilder
@@ -78,7 +78,6 @@ for i in SM.sdkInfo:
'TimerSys.cpp',
'CoreConfig.cpp',
'Logger.cpp',
- 'PluginInfoDatabase.cpp',
'smn_halflife.cpp',
'PluginSys.cpp',
'smn_console.cpp',
diff --git a/core/PluginInfoDatabase.cpp b/core/PluginInfoDatabase.cpp
deleted file mode 100644
index c5feeded..00000000
--- a/core/PluginInfoDatabase.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-/**
- * vim: set ts=4 :
- * =============================================================================
- * SourceMod
- * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
- * =============================================================================
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, version 3.0, as published by the
- * Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- *
- * As a special exception, AlliedModders LLC gives you permission to link the
- * code of this program (as well as its derivative works) to "Half-Life 2," the
- * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
- * by the Valve Corporation. You must obey the GNU General Public License in
- * all respects for all other code used. Additionally, AlliedModders LLC grants
- * this exception to all derivative works. AlliedModders LLC defines further
- * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
- * or .
- *
- * Version: $Id$
- */
-
-#include
-#include
-#include "PluginInfoDatabase.h"
-#include "PluginSys.h"
-
-void PluginSettings::Init()
-{
- name = -1;
- pause_val = false;
- type_val = PluginType_MapUpdated;
- optarray = -1;
- opts_num = 0;
- opts_size = 0;
- blockload_val = false;
-}
-
-/**
- * :TODO: write the logger, make these errors log instead of being static
- * NOTE: once we do that, we will have to change some code to ignore sections
- */
-
-CPluginInfoDatabase::CPluginInfoDatabase()
-{
- m_strtab = NULL;
- m_infodb_count = 0;
- m_infodb_size = 0;
- m_infodb = -1;
-}
-
-CPluginInfoDatabase::~CPluginInfoDatabase()
-{
- delete m_strtab;
-}
-
-void CPluginInfoDatabase::ReadSMC_ParseStart()
-{
- /* Create or reset our string table */
- if (m_strtab)
- {
- m_strtab->Reset();
- } else {
- m_strtab = new BaseStringTable(1024);
- }
-
- /* Set our internal states to the beginning */
- in_plugins = false;
- cur_plugin = -1;
- in_options = false;
- m_infodb_size = 0;
- m_infodb_count = 0;
- m_infodb = -1;
-}
-
-SMCResult CPluginInfoDatabase::MakeError(const char *fmt, ...)
-{
- char buffer[512];
- va_list ap;
-
- va_start(ap, fmt);
- vsnprintf(buffer, sizeof(buffer), fmt, ap);
- va_end(ap);
-
- m_errmsg = m_strtab->AddString(buffer);
-
- return SMCResult_HaltFail;
-}
-
-unsigned int CPluginInfoDatabase::GetSettingsNum()
-{
- return m_infodb_count;
-}
-
-PluginSettings *CPluginInfoDatabase::GetSettingsIfMatch(unsigned int index, const char *filename)
-{
- BaseMemTable *memtab = m_strtab->GetMemTable();
- int *table = (int *)memtab->GetAddress(m_infodb);
-
- if (!table || index >= m_infodb_count)
- {
- return NULL;
- }
-
- PluginSettings *plugin = (PluginSettings *)memtab->GetAddress(table[index]);
-
- const char *name = m_strtab->GetString(plugin->name);
-
- if (!name)
- {
- return NULL;
- }
-
- if (!g_PluginSys.TestAliasMatch(name, filename))
- {
- return NULL;
- }
-
- return plugin;
-}
-
-void CPluginInfoDatabase::GetOptionsForPlugin(PluginSettings *settings, unsigned int opt_num, const char **key, const char **val)
-{
- PluginOpts *table = (PluginOpts *)m_strtab->GetMemTable()->GetAddress(settings->optarray);
- if (!table)
- {
- *key = NULL;
- *val = NULL;
- return;
- }
-
- if (opt_num >= settings->opts_num)
- {
- *key = NULL;
- *val = NULL;
- return;
- }
-
- *key = m_strtab->GetString(table[opt_num].key);
- *val = m_strtab->GetString(table[opt_num].val);
-}
-
-SMCResult CPluginInfoDatabase::ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
-{
- if (cur_plugin != -1)
- {
- PluginSettings *plugin = (PluginSettings *)m_strtab->GetMemTable()->GetAddress(cur_plugin);
- if (!in_options)
- {
- if (strcmp(key, "pause") == 0)
- {
- if (strcasecmp(value, "yes") == 0)
- {
- plugin->pause_val = true;
- }
- else
- {
- plugin->pause_val = false;
- }
- }
- else if (strcmp(key, "lifetime") == 0)
- {
- if (strcasecmp(value, "private") == 0)
- {
- plugin->type_val = PluginType_Private;
- }
- else if (strcasecmp(value, "mapsync") == 0)
- {
- plugin->type_val = PluginType_MapUpdated;
- }
- else if (strcasecmp(value, "maponly") == 0)
- {
- plugin->type_val = PluginType_MapOnly;
- }
- else if (strcasecmp(value, "global") == 0)
- {
- plugin->type_val = PluginType_Global;
- }
- else
- {
- return MakeError("Unknown value for key \"lifetime\": \"%s\"", value);
- }
- }
- else if (strcmp(key, "blockload") == 0)
- {
- plugin->blockload_val = true;
- }
- else
- {
- return MakeError("Unknown property key: \"%s\"", key);
- }
- }
- else
- {
- /* Cache every option, valid or not */
- int keyidx = m_strtab->AddString(key);
- int validx = m_strtab->AddString(value);
- PluginOpts *table;
- BaseMemTable *memtab = m_strtab->GetMemTable();
- plugin = (PluginSettings *)memtab->GetAddress(cur_plugin);
- if (plugin->opts_num + 1 > plugin->opts_size)
- {
- unsigned int oldsize = plugin->opts_size;
- if (oldsize == 0)
- {
- //right now we don't have many
- plugin->opts_size = 2;
- }
- else
- {
- plugin->opts_size *= 2;
- }
- int newidx = memtab->CreateMem(plugin->opts_size * sizeof(PluginOpts), (void **)&table);
- /* in case it resized */
- plugin = (PluginSettings *)memtab->GetAddress(cur_plugin);
- if (plugin->optarray != -1)
- {
- void *oldtable = memtab->GetAddress(plugin->optarray);
- memcpy(table, oldtable, oldsize * sizeof(PluginOpts));
- }
- plugin->optarray = newidx;
- }
- else
- {
- table = (PluginOpts *)memtab->GetAddress(plugin->optarray);
- }
- PluginOpts *opt = &table[plugin->opts_num++];
- opt->key = keyidx;
- opt->val = validx;
- }
- }
- else if (in_plugins)
- {
- return MakeError("Unknown property key: \"%s\"", key);
- }
- else
- {
- /* Ignore anything we don't know about! */
- }
-
- return SMCResult_Continue;
-}
-
-SMCResult CPluginInfoDatabase::ReadSMC_LeavingSection(const SMCStates *states)
-{
- if (in_plugins)
- {
- if (cur_plugin != -1)
- {
- if (in_options)
- {
- in_options = false;
- }
- else
- {
- /* If the plugin is ending, add it to the table */
- BaseMemTable *memtab = m_strtab->GetMemTable();
- int *table;
- if (m_infodb_count + 1 > m_infodb_size)
- {
- unsigned int oldsize = m_infodb_size;
- if (!m_infodb_size)
- {
- m_infodb_size = 8;
- }
- else
- {
- m_infodb_size *= 2;
- }
- int newidx = memtab->CreateMem(m_infodb_size * sizeof(int), (void **)&table);
- if (m_infodb != -1)
- {
- void *oldtable = (int *)memtab->GetAddress(m_infodb);
- memcpy(table, oldtable, oldsize * sizeof(int));
- }
- m_infodb = newidx;
- }
- else
- {
- table = (int *)memtab->GetAddress(m_infodb);
- }
- /* Assign to table and scrap the current plugin */
- table[m_infodb_count++] = cur_plugin;
- cur_plugin = -1;
- }
- }
- else
- {
- in_plugins = false;
- }
- }
-
- return SMCResult_Continue;
-}
-
-SMCResult CPluginInfoDatabase::ReadSMC_NewSection(const SMCStates *states, const char *name)
-{
- if (!in_plugins)
- {
- /* If we're not in the main Plugins section, and we don't get it for the name, error out */
- if (strcmp(name, "Plugins") != 0)
- {
- return MakeError("Unknown root section: \"%s\"", name);
- }
- else
- {
- /* Otherwise set our states */
- in_plugins = true;
- cur_plugin = -1;
- in_options = false;
- }
- }
- else
- {
- if (cur_plugin == -1)
- {
- /* If we get a plugin node and we don't have a current plugin, create a new one */
- PluginSettings *plugin;
- int i_name = m_strtab->AddString(name);
- cur_plugin = m_strtab->GetMemTable()->CreateMem(sizeof(PluginSettings), (void **)&plugin);
- plugin->Init();
- plugin->name = i_name;
- in_options = false;
- }
- else
- {
- if (!in_options && strcmp(name, "Options") == 0)
- {
- in_options = true;
- }
- else
- {
- return MakeError("Unknown plugin sub-section: \"%s\"", name);
- }
- }
- }
-
- return SMCResult_Continue;
-}
-
diff --git a/core/PluginInfoDatabase.h b/core/PluginInfoDatabase.h
deleted file mode 100644
index 8d84be48..00000000
--- a/core/PluginInfoDatabase.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * vim: set ts=4 :
- * =============================================================================
- * SourceMod
- * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
- * =============================================================================
- *
- * This program is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, version 3.0, as published by the
- * Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see .
- *
- * As a special exception, AlliedModders LLC gives you permission to link the
- * code of this program (as well as its derivative works) to "Half-Life 2," the
- * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
- * by the Valve Corporation. You must obey the GNU General Public License in
- * all respects for all other code used. Additionally, AlliedModders LLC grants
- * this exception to all derivative works. AlliedModders LLC defines further
- * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
- * or .
- *
- * Version: $Id$
- */
-
-#ifndef _INCLUDE_SOURCEMOD_CORE_SYSTEM_PLUGININFODATABASE_H_
-#define _INCLUDE_SOURCEMOD_CORE_SYSTEM_PLUGININFODATABASE_H_
-
-/**
- * This file parses plugin_settings.cfg and stores the information in cached memory.
- * It provides simplistic abstraction to retrieving the info.
- * :TODO: currently untested
- */
-
-#include "sm_memtable.h"
-#include "ITextParsers.h"
-#include "IPluginSys.h"
-#include "sm_globals.h"
-
-struct PluginOpts
-{
- int key;
- int val;
-};
-
-struct PluginSettings
-{
- void Init();
- int name;
- bool pause_val;
- PluginType type_val;
- int optarray;
- size_t opts_num;
- size_t opts_size;
- bool blockload_val;
-};
-
-class CPluginInfoDatabase : public ITextListener_SMC
-{
-public:
- CPluginInfoDatabase();
- ~CPluginInfoDatabase();
-public: //ITextListener_SMC
- void ReadSMC_ParseStart();
- SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
- SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
- SMCResult ReadSMC_LeavingSection(const SMCStates *states);
-public:
- /**
- * Returns the number of plugin settings available.
- */
- unsigned int GetSettingsNum();
-
- /**
- * Given an index, returns the plugin settings block if the filename matches.
- * Otherwise, returns NULL.
- */
- PluginSettings *GetSettingsIfMatch(unsigned int index, const char *filename);
-
- /**
- * Given a plugin settings struct and an index,
- * returns the given JIT key/value option pair at that index.
- * If the input is invalid, key and val will be set to NULL.
- */
- void GetOptionsForPlugin(PluginSettings *settings, unsigned int opt_num, const char **key, const char **val);
-private:
- SMCResult MakeError(const char *fmt, ...);
-private:
- BaseStringTable *m_strtab;
- int m_errmsg;
- bool in_plugins;
- bool in_options;
- int m_infodb;
- size_t m_infodb_count;
- size_t m_infodb_size;
- int cur_plugin;
-};
-
-
-#endif //_INCLUDE_SOURCEMOD_CORE_SYSTEM_PLUGININFODATABASE_H_
diff --git a/core/PluginSys.cpp b/core/PluginSys.cpp
index dfe8b2b9..a2e8144c 100644
--- a/core/PluginSys.cpp
+++ b/core/PluginSys.cpp
@@ -823,19 +823,7 @@ void CPluginManager::Shutdown()
void CPluginManager::LoadAll_FirstPass(const char *config, const char *basedir)
{
/* First read in the database of plugin settings */
- SMCError err;
- SMCStates states;
m_AllPluginsLoaded = false;
- if ((err=textparsers->ParseFile_SMC(config, &m_PluginInfo, &states)) != SMCError_Okay)
- {
- g_Logger.LogError("[SM] Encountered fatal error parsing file \"%s\"", config);
- const char *err_msg = textparsers->GetSMCErrorString(err);
- if (err_msg)
- {
- g_Logger.LogError("[SM] Parse error encountered: \"%s\"", err_msg);
- }
- }
-
LoadPluginsFromDir(basedir, NULL);
}
@@ -909,21 +897,6 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
}
int err;
- bool no_load = false;
- PluginSettings *pset;
- unsigned int setcount = m_PluginInfo.GetSettingsNum();
- for (unsigned int i=0; iblockload_val)
- {
- no_load = true;
- break;
- }
- }
/**
* Does this plugin already exist?
@@ -934,8 +907,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
/* Check to see if we should try reloading it */
if (pPlugin->GetStatus() == Plugin_BadLoad
|| pPlugin->GetStatus() == Plugin_Error
- || pPlugin->GetStatus() == Plugin_Failed
- || no_load)
+ || pPlugin->GetStatus() == Plugin_Failed)
{
UnloadPlugin(pPlugin);
}
@@ -949,11 +921,6 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
}
}
- if (no_load)
- {
- return LoadRes_NeverLoad;
- }
-
pPlugin = CPlugin::CreatePlugin(path, error, maxlength);
assert(pPlugin != NULL);
@@ -967,37 +934,6 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
co = g_pSourcePawn2->StartCompilation();
}
- for (unsigned int i=0; im_type = pset->type_val;
- if (co)
- {
- for (unsigned int j=0; jopts_num; j++)
- {
- const char *key, *val;
- m_PluginInfo.GetOptionsForPlugin(pset, j, &key, &val);
- if (!key || !val)
- {
- continue;
- }
- if ((err = co->SetOption(key, val)) == SP_ERROR_NONE)
- {
- if (error)
- {
- UTIL_Format(error, maxlength, "Unable to set JIT option (key \"%s\") (value \"%s\")", key, val);
- }
- co->Abort();
- co = NULL;
- break;
- }
- }
- }
- }
-
/* Do the actual compiling */
if (co != NULL)
{
diff --git a/core/PluginSys.h b/core/PluginSys.h
index 1a910c6c..5b21b985 100644
--- a/core/PluginSys.h
+++ b/core/PluginSys.h
@@ -43,7 +43,6 @@
#include
#include
#include "sm_globals.h"
-#include "PluginInfoDatabase.h"
#include "sm_trie.h"
#include "sourcemod.h"
#include
@@ -469,7 +468,6 @@ private:
List m_listeners;
List m_plugins;
CStack m_iters;
- CPluginInfoDatabase m_PluginInfo;
Trie *m_LoadLookup;
bool m_AllPluginsLoaded;
IdentityToken_t *m_MyIdent;