Move scared guts of core into logic (bug 5680, r=fyren).

--HG--
rename : core/ExtensionSys.cpp => core/logic/ExtensionSys.cpp
rename : core/ExtensionSys.h => core/logic/ExtensionSys.h
rename : core/HandleSys.cpp => core/logic/HandleSys.cpp
rename : core/HandleSys.h => core/logic/HandleSys.h
rename : core/NativeInvoker.cpp => core/logic/NativeInvoker.cpp
rename : core/NativeInvoker.h => core/logic/NativeInvoker.h
rename : core/NativeOwner.cpp => core/logic/NativeOwner.cpp
rename : core/NativeOwner.h => core/logic/NativeOwner.h
rename : core/PluginSys.cpp => core/logic/PluginSys.cpp
rename : core/PluginSys.h => core/logic/PluginSys.h
rename : core/ShareSys.cpp => core/logic/ShareSys.cpp
rename : core/ShareSys.h => core/logic/ShareSys.h
rename : core/smn_fakenatives.cpp => core/logic/smn_fakenatives.cpp
rename : core/logic/AutoHandleRooter.h => public/AutoHandleRooter.h
This commit is contained in:
David Anderson 2013-03-29 11:37:29 -07:00
parent 502c6f0dae
commit 045ee262a8
71 changed files with 3973 additions and 1131 deletions

View File

@ -31,7 +31,7 @@
#include "ADTFactory.h"
#include "sm_globals.h"
#include "ShareSys.h"
#include "logic_bridge.h"
ADTFactory g_AdtFactory;
@ -47,7 +47,7 @@ unsigned int ADTFactory::GetInterfaceVersion()
void ADTFactory::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
IBasicTrie *ADTFactory::CreateBasicTrie()

View File

@ -50,7 +50,6 @@ for i in SM.sdkInfo:
files = [
'AdminCache.cpp',
'ExtensionSys.cpp',
'MenuStyle_Valve.cpp',
'logic_bridge.cpp',
'smn_entities.cpp',
@ -63,19 +62,16 @@ for i in SM.sdkInfo:
'sm_trie.cpp',
'CDataPack.cpp',
'frame_hooks.cpp',
'NativeInvoker.cpp',
'smn_fakenatives.cpp',
'smn_nextmap.cpp',
'sourcemm_api.cpp',
'ChatTriggers.cpp',
'NativeOwner.cpp',
'smn_player.cpp',
'sourcemod.cpp',
'concmd_cleaner.cpp',
'HalfLife2.cpp',
'NextMap.cpp',
'ConCmdManager.cpp',
'HandleSys.cpp',
'ConVarManager.cpp',
'LibrarySys.cpp',
'PlayerManager.cpp',
@ -83,7 +79,6 @@ for i in SM.sdkInfo:
'CoreConfig.cpp',
'Logger.cpp',
'smn_halflife.cpp',
'PluginSys.cpp',
'smn_console.cpp',
'UserMessages.cpp',
'Database.cpp',
@ -92,7 +87,6 @@ for i in SM.sdkInfo:
'smn_hudtext.cpp',
'smn_usermsgs.cpp',
'MenuStyle_Base.cpp',
'ShareSys.cpp',
'smn_database.cpp',
'smn_keyvalues.cpp',
'smn_vector.cpp',

View File

@ -33,7 +33,6 @@
#include <assert.h>
#include <ITextParsers.h>
#include "AdminCache.h"
#include "ShareSys.h"
#include "ForwardSys.h"
#include "PlayerManager.h"
#include "ConCmdManager.h"
@ -42,6 +41,7 @@
#include "sm_stringutil.h"
#include "sourcemm_api.h"
#include "sm_srvcmds.h"
#include "logic_bridge.h"
#define LEVEL_STATE_NONE 0
#define LEVEL_STATE_LEVELS 1
@ -294,7 +294,7 @@ void AdminCache::OnSourceModStartup(bool late)
void AdminCache::OnSourceModAllInitialized()
{
m_pCacheFwd = g_Forwards.CreateForward("OnRebuildAdminCache", ET_Ignore, 1, NULL, Param_Cell);
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void AdminCache::OnSourceModLevelChange(const char *mapName)

View File

@ -73,13 +73,14 @@ ConCmdManager::~ConCmdManager()
void ConCmdManager::OnSourceModAllInitialized()
{
g_PluginSys.AddPluginsListener(this);
scripts->AddPluginsListener(this);
g_RootMenu.AddRootConsoleCommand("cmds", "List console commands", this);
SH_ADD_HOOK(IServerGameClients, SetCommandClient, serverClients, SH_MEMBER(this, &ConCmdManager::SetCommandClient), false);
}
void ConCmdManager::OnSourceModShutdown()
{
scripts->RemovePluginsListener(this);
/* All commands should already be removed by the time we're done */
SH_REMOVE_HOOK(IServerGameClients, SetCommandClient, serverClients, SH_MEMBER(this, &ConCmdManager::SetCommandClient), false);
g_RootMenu.RemoveRootConsoleCommand("cmds", this);
@ -109,7 +110,7 @@ void ConCmdManager::RemoveConCmds(List<CmdHook *> &cmdlist)
{
CmdHook *pHook = (*iter);
IPluginContext *pContext = pHook->pf->GetParentContext();
IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
CmdList *pList = NULL;
//gaben
@ -623,7 +624,7 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
/* Now add to the plugin */
CmdList *pList;
IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
if (!pPlugin->GetProperty("CommandList", (void **)&pList))
{
pList = new CmdList();
@ -663,7 +664,7 @@ bool ConCmdManager::AddServerCommand(IPluginFunction *pFunction,
/* Add to the plugin */
CmdList *pList;
IPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
if (!pPlugin->GetProperty("CommandList", (void **)&pList))
{
pList = new CmdList();
@ -915,7 +916,7 @@ void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
{
const char *text = command.Arg(2);
CPlugin *pPlugin = g_PluginSys.FindPluginByConsoleArg(text);
IPlugin *pPlugin = scripts->FindPluginByConsoleArg(text);
if (!pPlugin)
{

View File

@ -29,13 +29,12 @@
#include "ConVarManager.h"
#include "HalfLife2.h"
#include "PluginSys.h"
#include "ForwardSys.h"
#include "HandleSys.h"
#include "sm_srvcmds.h"
#include "sm_stringutil.h"
#include <sh_vector.h>
#include <sm_trie_tpl.h>
#include "logic_bridge.h"
ConVarManager g_ConVarManager;
@ -106,7 +105,7 @@ void ConVarManager::OnSourceModStartup(bool late)
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY | HANDLE_RESTRICT_OWNER;
/* Create the 'ConVar' handle type */
m_ConVarType = g_HandleSys.CreateType("ConVar", this, 0, NULL, &sec, g_pCoreIdent, NULL);
m_ConVarType = handlesys->CreateType("ConVar", this, 0, NULL, &sec, g_pCoreIdent, NULL);
}
void ConVarManager::OnSourceModAllInitialized()
@ -128,7 +127,7 @@ void ConVarManager::OnSourceModAllInitialized()
SH_ADD_HOOK(ICvar, CallGlobalChangeCallback, icvar, SH_STATIC(OnConVarChanged), false);
#endif
g_PluginSys.AddPluginsListener(this);
scripts->AddPluginsListener(this);
/* Add the 'convars' option to the 'sm' console command */
g_RootMenu.AddRootConsoleCommand("cvars", "View convars created by a plugin", this);
@ -146,7 +145,7 @@ void ConVarManager::OnSourceModShutdown()
iter = m_ConVars.erase(iter);
g_HandleSys.FreeHandle(pInfo->handle, &sec);
handlesys->FreeHandle(pInfo->handle, &sec);
if (pInfo->pChangeForward != NULL)
{
g_Forwards.ReleaseForward(pInfo->pChangeForward);
@ -200,10 +199,10 @@ void ConVarManager::OnSourceModShutdown()
/* Remove the 'convars' option from the 'sm' console command */
g_RootMenu.RemoveRootConsoleCommand("cvars", this);
g_PluginSys.RemovePluginsListener(this);
scripts->RemovePluginsListener(this);
/* Remove the 'ConVar' handle type */
g_HandleSys.RemoveType(m_ConVarType, g_pCoreIdent);
handlesys->RemoveType(m_ConVarType, g_pCoreIdent);
}
/**
@ -269,7 +268,7 @@ void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
convar_cache.remove(name);
/* Now make sure no plugins are referring to this pointer */
IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator();
IPluginIterator *pl_iter = scripts->GetPluginIterator();
while (pl_iter->MorePlugins())
{
IPlugin *pl = pl_iter->GetPlugin();
@ -285,7 +284,7 @@ void ConVarManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
}
/* Free resources */
g_HandleSys.FreeHandle(pInfo->handle, &sec);
handlesys->FreeHandle(pInfo->handle, &sec);
delete pInfo;
}
@ -337,7 +336,7 @@ void ConVarManager::OnRootConsoleCommand(const char *cmdname, const CCommand &co
}
/* Get plugin object */
CPlugin *plugin = g_PluginSys.FindPluginByConsoleArg(arg);
IPlugin *plugin = scripts->FindPluginByConsoleArg(arg);
if (!plugin)
{
@ -418,7 +417,7 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
pInfo->pVar = pConVar;
/* If we don't, then create a new handle from the convar */
hndl = g_HandleSys.CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete pInfo;
@ -449,7 +448,7 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
pInfo->pChangeForward = NULL;
/* Create a handle from the new convar */
hndl = g_HandleSys.CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete pInfo;
@ -500,7 +499,7 @@ Handle_t ConVarManager::FindConVar(const char *name)
pInfo->pVar = pConVar;
/* If we don't have a handle, then create a new one */
hndl = g_HandleSys.CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_ConVarType, pInfo, NULL, g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete pInfo;
@ -639,7 +638,7 @@ void ConVarManager::AddConVarToPluginList(IPluginContext *pContext, const ConVar
bool inserted = false;
const char *orig = pConVar->GetName();
IPlugin *plugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
IPlugin *plugin = scripts->FindPluginByContext(pContext->GetContext());
/* Check plugin for an existing convar list */
if (!plugin->GetProperty("ConVarList", (void **)&pConVarList))
@ -772,7 +771,7 @@ HandleError ConVarManager::ReadConVarHandle(Handle_t hndl, ConVar **pVar)
ConVarInfo *pInfo;
HandleError error;
if ((error = g_HandleSys.ReadHandle(hndl, m_ConVarType, NULL, (void **)&pInfo)) != HandleError_None)
if ((error = handlesys->ReadHandle(hndl, m_ConVarType, NULL, (void **)&pInfo)) != HandleError_None)
{
return error;
}

View File

@ -49,7 +49,7 @@
#include "ConCmdManager.h"
#include "HalfLife2.h"
#include "ConCommandBaseIterator.h"
#include "ShareSys.h"
#include "logic_bridge.h"
#if defined PLATFORM_POSIX
# include <dlfcn.h>
@ -576,7 +576,7 @@ void ConsoleDetours::OnSourceModAllInitialized()
{
m_pForward = g_Forwards.CreateForwardEx("OnAnyCommand", ET_Hook, 3, NULL, Param_Cell,
Param_String, Param_Cell);
g_ShareSys.AddCapabilityProvider(NULL, this, FEATURECAP_COMMANDLISTENER);
sharesys->AddCapabilityProvider(NULL, this, FEATURECAP_COMMANDLISTENER);
}
void ConsoleDetours::OnSourceModShutdown()

View File

@ -38,9 +38,9 @@
#include "sm_stringutil.h"
#include "LibrarySys.h"
#include "Logger.h"
#include "PluginSys.h"
#include "ForwardSys.h"
#include "frame_hooks.h"
#include "logic_bridge.h"
#ifdef PLATFORM_WINDOWS
ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
@ -321,7 +321,7 @@ inline bool IsPathSepChar(char c)
#endif
}
bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
bool SM_ExecuteConfig(IPlugin *pl, AutoConfig *cfg, bool can_create)
{
bool will_create = false;
@ -500,10 +500,10 @@ void SM_DoSingleExecFwds(IPluginContext *ctx)
void SM_ConfigsExecuted_Plugin(unsigned int serial)
{
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
IPluginIterator *iter = scripts->GetPluginIterator();
while (iter->MorePlugins())
{
CPlugin *plugin = (CPlugin *)(iter->GetPlugin());
IPlugin *plugin = iter->GetPlugin();
if (plugin->GetSerial() == serial)
{
SM_DoSingleExecFwds(plugin->GetBaseContext());
@ -516,7 +516,7 @@ void SM_ConfigsExecuted_Plugin(unsigned int serial)
void SM_ExecuteForPlugin(IPluginContext *ctx)
{
CPlugin *plugin = (CPlugin *)g_PluginSys.GetPluginByCtx(ctx->GetContext());
SMPlugin *plugin = scripts->FindPluginByContext(ctx->GetContext());
unsigned int num = plugin->GetConfigCount();
if (!num)
@ -545,19 +545,18 @@ void SM_ExecuteAllConfigs()
engine->ServerCommand("exec sourcemod/sourcemod.cfg\n");
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
while (iter->MorePlugins())
CVector<SMPlugin *> plugins;
scripts->ListPlugins(&plugins);
for (size_t i = 0; i < plugins.size(); i++)
{
CPlugin *plugin = (CPlugin *)(iter->GetPlugin());
SMPlugin *plugin = plugins[i];
unsigned int num = plugin->GetConfigCount();
bool can_create = true;
for (unsigned int i=0; i<num; i++)
{
can_create = SM_ExecuteConfig(plugin, plugin->GetConfig(i), can_create);
}
iter->NextPlugin();
}
iter->Release();
g_bGotServerStart = true;
CheckAndFinalizeConfigs();

View File

@ -30,14 +30,12 @@
*/
#include "Database.h"
#include "HandleSys.h"
#include "ShareSys.h"
#include "sourcemod.h"
#include "sm_stringutil.h"
#include "Logger.h"
#include "ExtensionSys.h"
#include <stdlib.h>
#include <IThreader.h>
#include "logic_bridge.h"
#define DBPARSE_LEVEL_NONE 0
#define DBPARSE_LEVEL_MAIN 1
@ -55,14 +53,14 @@ void DBManager::OnSourceModAllInitialized()
{
HandleAccess sec;
g_HandleSys.InitAccessDefaults(NULL, &sec);
handlesys->InitAccessDefaults(NULL, &sec);
sec.access[HandleAccess_Delete] |= HANDLE_RESTRICT_IDENTITY;
sec.access[HandleAccess_Clone] |= HANDLE_RESTRICT_IDENTITY;
m_DriverType = g_HandleSys.CreateType("IDriver", this, 0, NULL, &sec, g_pCoreIdent, NULL);
m_DatabaseType = g_HandleSys.CreateType("IDatabase", this, 0, NULL, NULL, g_pCoreIdent, NULL);
m_DriverType = handlesys->CreateType("IDriver", this, 0, NULL, &sec, g_pCoreIdent, NULL);
m_DatabaseType = handlesys->CreateType("IDatabase", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
g_SourceMod.BuildPath(Path_SM, m_Filename, sizeof(m_Filename), "configs/databases.cfg");
@ -70,7 +68,7 @@ void DBManager::OnSourceModAllInitialized()
m_pThinkLock = g_pThreader->MakeMutex();
m_pQueueLock = g_pThreader->MakeMutex();
g_PluginSys.AddPluginsListener(this);
scripts->AddPluginsListener(this);
}
void DBManager::OnSourceModLevelChange(const char *mapName)
@ -98,12 +96,12 @@ void DBManager::OnSourceModLevelChange(const char *mapName)
void DBManager::OnSourceModShutdown()
{
KillWorkerThread();
g_PluginSys.RemovePluginsListener(this);
scripts->RemovePluginsListener(this);
m_pConfigLock->DestroyThis();
m_pThinkLock->DestroyThis();
m_pQueueLock->DestroyThis();
g_HandleSys.RemoveType(m_DatabaseType, g_pCoreIdent);
g_HandleSys.RemoveType(m_DriverType, g_pCoreIdent);
handlesys->RemoveType(m_DatabaseType, g_pCoreIdent);
handlesys->RemoveType(m_DriverType, g_pCoreIdent);
ClearConfigs();
}
@ -125,7 +123,7 @@ void DBManager::OnHandleDestroy(HandleType_t type, void *object)
return;
}
if (g_HandleSys.TypeCheck(type, m_DatabaseType))
if (handlesys->TypeCheck(type, m_DatabaseType))
{
IDatabase *pdb = (IDatabase *)object;
pdb->Close();
@ -402,7 +400,7 @@ Handle_t DBManager::CreateHandle(DBHandleType dtype, void *ptr, IdentityToken_t
return BAD_HANDLE;
}
return g_HandleSys.CreateHandle(type, ptr, pToken, g_pCoreIdent, NULL);
return handlesys->CreateHandle(type, ptr, pToken, g_pCoreIdent, NULL);
}
HandleError DBManager::ReadHandle(Handle_t hndl, DBHandleType dtype, void **ptr)
@ -420,13 +418,13 @@ HandleError DBManager::ReadHandle(Handle_t hndl, DBHandleType dtype, void **ptr)
HandleSecurity sec(NULL, g_pCoreIdent);
return g_HandleSys.ReadHandle(hndl, type, &sec, ptr);
return handlesys->ReadHandle(hndl, type, &sec, ptr);
}
HandleError DBManager::ReleaseHandle(Handle_t hndl, DBHandleType type, IdentityToken_t *token)
{
HandleSecurity sec(token, g_pCoreIdent);
return g_HandleSys.FreeHandle(hndl, &sec);
return handlesys->FreeHandle(hndl, &sec);
}
unsigned int DBManager::GetDriverCount()
@ -485,7 +483,7 @@ IDBDriver *DBManager::FindOrLoadDriver(const char *name)
char filename[PLATFORM_MAX_PATH];
UTIL_Format(filename, sizeof(filename), "dbi.%s.ext", name);
IExtension *pExt = g_Extensions.LoadAutoExtension(filename);
IExtension *pExt = extsys->LoadAutoExtension(filename);
if (!pExt || !pExt->IsLoaded() || m_drivers.size() <= last_size)
{
return NULL;
@ -729,6 +727,6 @@ const char *DBManager::GetDefaultDriverName()
void DBManager::AddDependency(IExtension *myself, IDBDriver *driver)
{
g_Extensions.AddRawDependency(myself, driver->GetIdentity(), driver);
extsys->AddRawDependency(myself, driver->GetIdentity(), driver);
}

View File

@ -40,8 +40,8 @@
#include <ITextParsers.h>
#include "sm_memtable.h"
#include <IThreader.h>
#include <IPluginSys.h>
#include "sm_simple_prioqueue.h"
#include "PluginSys.h"
using namespace SourceHook;

View File

@ -31,9 +31,8 @@
#include "EventManager.h"
#include "ForwardSys.h"
#include "HandleSys.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "logic_bridge.h"
EventManager g_EventManager;
@ -90,7 +89,7 @@ void EventManager::OnSourceModAllInitialized()
sec.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY | HANDLE_RESTRICT_OWNER;
/* Create the 'GameEvent' handle type */
m_EventType = g_HandleSys.CreateType("GameEvent", this, 0, NULL, &sec, g_pCoreIdent, NULL);
m_EventType = handlesys->CreateType("GameEvent", this, 0, NULL, &sec, g_pCoreIdent, NULL);
}
void EventManager::OnSourceModShutdown()
@ -100,7 +99,7 @@ void EventManager::OnSourceModShutdown()
SH_REMOVE_HOOK(IGameEventManager2, FireEvent, gameevents, SH_MEMBER(this, &EventManager::OnFireEvent_Post), true);
/* Remove the 'GameEvent' handle type */
g_HandleSys.RemoveType(m_EventType, g_pCoreIdent);
handlesys->RemoveType(m_EventType, g_pCoreIdent);
/* Remove ourselves as listener for events */
gameevents->RemoveListener(this);
@ -187,7 +186,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
if (!sm_trie_retrieve(m_EventHooks, name, (void **)&pHook))
{
EventHookList *pHookList;
IPlugin *plugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
/* Check plugin for an existing EventHook list */
if (!plugin->GetProperty("EventHooks", (void **)&pHookList))
@ -300,7 +299,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
/* If reference count is now 0, free hook structure */
EventHookList *pHookList;
IPlugin *plugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
/* Get plugin's event hook list */
if (!plugin->GetProperty("EventHooks", (void**)&pHookList))
@ -411,7 +410,7 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
{
EventInfo info(pEvent, NULL);
HandleSecurity sec(NULL, g_pCoreIdent);
Handle_t hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
info.bDontBroadcast = bDontBroadcast;
@ -424,7 +423,7 @@ bool EventManager::OnFireEvent(IGameEvent *pEvent, bool bDontBroadcast)
broadcast = info.bDontBroadcast;
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
}
if (pHook->postCopy)
@ -476,7 +475,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
info.bDontBroadcast = bDontBroadcast;
info.pEvent = m_EventCopies.front();
info.pOwner = NULL;
hndl = g_HandleSys.CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(m_EventType, &info, NULL, g_pCoreIdent, NULL);
pForward->PushCell(hndl);
} else {
@ -491,7 +490,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
{
/* Free handle */
HandleSecurity sec(NULL, g_pCoreIdent);
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
/* Free event structure */
gameevents->FreeEvent(info.pEvent);

View File

@ -33,8 +33,6 @@
#include <stdarg.h>
#include <string.h>
#include "ForwardSys.h"
#include "PluginSys.h"
#include "ShareSys.h"
#include "logic_bridge.h"
CForwardManager g_Forwards;
@ -63,8 +61,8 @@ CForwardManager::~CForwardManager()
void CForwardManager::OnSourceModAllInitialized()
{
g_PluginSys.AddPluginsListener(this);
g_ShareSys.AddInterface(NULL, this);
scripts->AddPluginsListener(this);
sharesys->AddInterface(NULL, this);
}
IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned int num_params, const ParamType *types, ...)
@ -79,7 +77,7 @@ IForward *CForwardManager::CreateForward(const char *name, ExecType et, unsigned
if (fwd)
{
g_PluginSys.AddFunctionsToForward(name, fwd);
scripts->AddFunctionsToForward(name, fwd);
m_managed.push_back(fwd);
}

View File

@ -157,7 +157,7 @@ void CHalfLife2::OnSourceModAllInitialized()
m_HinTextMsg = g_UserMsgs.GetMessageIndex("HintText");
m_SayTextMsg = g_UserMsgs.GetMessageIndex("SayText");
m_VGUIMenu = g_UserMsgs.GetMessageIndex("VGUIMenu");
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void CHalfLife2::OnSourceModAllInitialized_Post()

View File

@ -544,13 +544,20 @@ void Logger::DisableLogging()
}
void Logger::LogFatal(const char *msg, ...)
{
va_list ap;
va_start(ap, msg);
LogFatalEx(msg, ap);
va_end(ap);
}
void Logger::LogFatalEx(const char *msg, va_list ap)
{
/* :TODO: make this print all pretty-like
* In fact, the pretty log printing function should be abstracted.
* It's already implemented twice which is bad.
*/
va_list ap;
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "sourcemod_fatal.log");
@ -559,9 +566,7 @@ void Logger::LogFatal(const char *msg, ...)
if (fp)
{
m_Active = true;
va_start(ap, msg);
LogToOpenFileEx(fp, msg, ap);
va_end(ap);
m_Active = false;
fclose(fp);
}

View File

@ -78,6 +78,7 @@ public:
void LogError(const char *msg, ...);
void LogErrorEx(const char *msg, va_list ap);
void LogFatal(const char *msg, ...);
void LogFatalEx(const char *msg, va_list ap);
void LogToOpenFile(FILE *fp, const char *msg, ...);
void LogToOpenFileEx(FILE *fp, const char *msg, va_list ap);
/* This version does not print to console, and is thus thread-safe */

View File

@ -38,8 +38,6 @@
#include "sourcemm_api.h"
#include "PlayerManager.h"
#include "MenuStyle_Valve.h"
#include "ShareSys.h"
#include "HandleSys.h"
#include "sourcemm_api.h"
#include "logic_bridge.h"
@ -56,24 +54,24 @@ MenuManager::MenuManager()
void MenuManager::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
HandleAccess access;
g_HandleSys.InitAccessDefaults(NULL, &access);
handlesys->InitAccessDefaults(NULL, &access);
/* Deny cloning to menus */
access.access[HandleAccess_Clone] = HANDLE_RESTRICT_OWNER|HANDLE_RESTRICT_IDENTITY;
m_MenuType = g_HandleSys.CreateType("IBaseMenu", this, 0, NULL, &access, g_pCoreIdent, NULL);
m_MenuType = handlesys->CreateType("IBaseMenu", this, 0, NULL, &access, g_pCoreIdent, NULL);
/* Also deny deletion to styles */
access.access[HandleAccess_Delete] = HANDLE_RESTRICT_OWNER|HANDLE_RESTRICT_IDENTITY;
m_StyleType = g_HandleSys.CreateType("IMenuStyle", this, 0, NULL, &access, g_pCoreIdent, NULL);
m_StyleType = handlesys->CreateType("IMenuStyle", this, 0, NULL, &access, g_pCoreIdent, NULL);
}
void MenuManager::OnSourceModAllShutdown()
{
g_HandleSys.RemoveType(m_MenuType, g_pCoreIdent);
g_HandleSys.RemoveType(m_StyleType, g_pCoreIdent);
handlesys->RemoveType(m_MenuType, g_pCoreIdent);
handlesys->RemoveType(m_StyleType, g_pCoreIdent);
}
void MenuManager::OnHandleDestroy(HandleType_t type, void *object)
@ -112,7 +110,7 @@ Handle_t MenuManager::CreateMenuHandle(IBaseMenu *menu, IdentityToken_t *pOwner)
return BAD_HANDLE;
}
return g_HandleSys.CreateHandle(m_MenuType, menu, pOwner, g_pCoreIdent, NULL);
return handlesys->CreateHandle(m_MenuType, menu, pOwner, g_pCoreIdent, NULL);
}
Handle_t MenuManager::CreateStyleHandle(IMenuStyle *style)
@ -122,7 +120,7 @@ Handle_t MenuManager::CreateStyleHandle(IMenuStyle *style)
return BAD_HANDLE;
}
return g_HandleSys.CreateHandle(m_StyleType, style, g_pCoreIdent, g_pCoreIdent, NULL);
return handlesys->CreateHandle(m_StyleType, style, g_pCoreIdent, g_pCoreIdent, NULL);
}
HandleError MenuManager::ReadMenuHandle(Handle_t handle, IBaseMenu **menu)
@ -132,7 +130,7 @@ HandleError MenuManager::ReadMenuHandle(Handle_t handle, IBaseMenu **menu)
sec.pIdentity = g_pCoreIdent;
sec.pOwner = NULL;
return g_HandleSys.ReadHandle(handle, m_MenuType, &sec, (void **)menu);
return handlesys->ReadHandle(handle, m_MenuType, &sec, (void **)menu);
}
HandleError MenuManager::ReadStyleHandle(Handle_t handle, IMenuStyle **style)
@ -142,7 +140,7 @@ HandleError MenuManager::ReadStyleHandle(Handle_t handle, IMenuStyle **style)
sec.pIdentity = g_pCoreIdent;
sec.pOwner = g_pCoreIdent;
return g_HandleSys.ReadHandle(handle, m_StyleType, &sec, (void **)style);
return handlesys->ReadHandle(handle, m_StyleType, &sec, (void **)style);
}
bool MenuManager::SetDefaultStyle(IMenuStyle *style)

View File

@ -34,11 +34,12 @@
#include "MenuStyle_Base.h"
#include "PlayerManager.h"
#include "MenuManager.h"
#include "HandleSys.h"
#include "CellRecipientFilter.h"
#if defined MENU_DEBUG
#include "Logger.h"
#endif
#include "logic_bridge.h"
#include "AutoHandleRooter.h"
BaseMenuStyle::BaseMenuStyle() : m_WatchList(256), m_hHandle(BAD_HANDLE)
{
@ -818,7 +819,7 @@ void CBaseMenu::InternalDelete()
m_hHandle = BAD_HANDLE;
m_bDeleting = true;
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
}
m_pHandler->OnMenuDestroy(this);

View File

@ -31,7 +31,6 @@
#include "PlayerManager.h"
#include "ForwardSys.h"
#include "ShareSys.h"
#include "AdminCache.h"
#include "ConCmdManager.h"
#include "MenuStyle_Valve.h"
@ -45,7 +44,6 @@
#include <inetchannel.h>
#include <iclient.h>
#include <IGameConfigs.h>
#include "ExtensionSys.h"
#include <sourcemod_version.h>
#include "ConsoleDetours.h"
#include "logic_bridge.h"
@ -141,7 +139,7 @@ void PlayerManager::OnSourceModAllInitialized()
SH_ADD_HOOK(IServerGameClients, ClientSettingsChanged, serverClients, SH_MEMBER(this, &PlayerManager::OnClientSettingsChanged), true);
SH_ADD_HOOK(IServerGameDLL, ServerActivate, gamedll, SH_MEMBER(this, &PlayerManager::OnServerActivate), true);
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
ParamType p1[] = {Param_Cell, Param_String, Param_Cell};
ParamType p2[] = {Param_Cell};
@ -278,11 +276,11 @@ void PlayerManager::OnServerActivate(edict_t *pEdictList, int edictCount, int cl
g_NumPlayersToAuth = &m_AuthQueue[0];
}
g_PluginSys.SyncMaxClients(m_maxClients);
scripts->SyncMaxClients(m_maxClients);
g_OnMapStarted = true;
g_Extensions.CallOnCoreMapStart(pEdictList, edictCount, m_maxClients);
extsys->CallOnCoreMapStart(pEdictList, edictCount, m_maxClients);
m_onActivate->Execute(NULL);
m_onActivate2->Execute(NULL);
@ -779,6 +777,173 @@ void ClientConsolePrint(edict_t *e, const char *fmt, ...)
engine->ClientPrintf(e, buffer);
}
void ListExtensionsToClient(CPlayer *player, const CCommand &args)
{
char buffer[256];
unsigned int id = 0;
unsigned int start = 0;
CVector<IExtension *> extensions;
extsys->ListExtensions(&extensions);
if (!extensions.size())
{
ClientConsolePrint(player->GetEdict(), "[SM] No extensions found.");
return;
}
if (args.ArgC() > 2)
{
start = atoi(args.Arg(2));
}
SourceHook::CVector<IExtension *>::iterator iter;
for (iter = extensions.begin();
iter != extensions.end();
iter++)
{
IExtension *ext = (*iter);
char error[255];
if (!ext->IsRunning(error, sizeof(error)))
{
continue;
}
id++;
if (id < start)
{
continue;
}
if (id - start > 10)
{
break;
}
IExtensionInterface *api = ext->GetAPI();
const char *name = api->GetExtensionName();
const char *version = api->GetExtensionVerString();
const char *author = api->GetExtensionAuthor();
const char *description = api->GetExtensionDescription();
size_t len = UTIL_Format(buffer, sizeof(buffer), " \"%s\"", name);
if (version != NULL && version[0])
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", version);
}
if (author != NULL && author[0])
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", author);
}
if (description != NULL && description[0])
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, ": %s", description);
}
ClientConsolePrint(player->GetEdict(), "%s", buffer);
}
for (; iter != extensions.end(); iter++)
{
char error[255];
if ((*iter)->IsRunning(error, sizeof(error)))
{
break;
}
}
if (iter != extensions.end())
{
ClientConsolePrint(player->GetEdict(), "To see more, type \"sm exts %d\"", id);
}
}
void ListPluginsToClient(CPlayer *player, const CCommand &args)
{
char buffer[256];
unsigned int id = 0;
edict_t *e = player->GetEdict();
unsigned int start = 0;
CVector<SMPlugin *> plugins;
scripts->ListPlugins(&plugins);
if (!plugins.size())
{
ClientConsolePrint(e, "[SM] No plugins found.");
return;
}
if (args.ArgC() > 2)
{
start = atoi(args.Arg(2));
}
SourceHook::List<SMPlugin *> m_FailList;
CVector<SMPlugin *>::iterator iter = plugins.begin();
for (; iter != plugins.end(); iter++)
{
SMPlugin *pl = *iter;
if (pl->GetStatus() != Plugin_Running)
{
continue;
}
/* Count valid plugins */
id++;
if (id < start)
{
continue;
}
if (id - start > 10)
{
break;
}
size_t len;
const sm_plugininfo_t *info = pl->GetPublicInfo();
len = UTIL_Format(buffer, sizeof(buffer), " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
if (IS_STR_FILLED(info->version))
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", info->version);
}
if (IS_STR_FILLED(info->author))
{
UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", info->author);
}
else
{
UTIL_Format(&buffer[len], sizeof(buffer)-len, " %s", pl->GetFilename());
}
ClientConsolePrint(e, "%s", buffer);
}
/* See if we can get more plugins */
for (; iter != plugins.end(); iter++)
{
if ((*iter)->GetStatus() == Plugin_Running)
{
break;
}
}
/* Do we actually have more plugins? */
if (iter != plugins.end())
{
ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id);
}
}
#if SOURCE_ENGINE >= SE_ORANGEBOX
void PlayerManager::OnClientCommand(edict_t *pEntity, const CCommand &args)
{
@ -800,12 +965,12 @@ void PlayerManager::OnClientCommand(edict_t *pEntity)
{
if (args.ArgC() > 1 && strcmp(args.Arg(1), "plugins") == 0)
{
g_PluginSys.ListPluginsToClient(pPlayer, args);
ListPluginsToClient(pPlayer, args);
RETURN_META(MRES_SUPERCEDE);
}
else if (args.ArgC() > 1 && strcmp(args.Arg(1), "exts") == 0)
{
g_Extensions.ListExtensionsToClient(pPlayer, args);
ListExtensionsToClient(pPlayer, args);
RETURN_META(MRES_SUPERCEDE);
}
else if (args.ArgC() > 1 && strcmp(args.Arg(1), "credits") == 0)

View File

@ -35,6 +35,7 @@
#include "sourcemm_api.h"
#include "frame_hooks.h"
#include "ConVarManager.h"
#include "logic_bridge.h"
#define TIMER_MIN_ACCURACY 0.1
@ -180,7 +181,7 @@ TimerSystem::~TimerSystem()
void TimerSystem::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
m_pOnGameFrame = g_Forwards.CreateForward("OnGameFrame", ET_Ignore, 0, NULL);
m_pOnMapTimeLeftChanged = g_Forwards.CreateForward("OnMapTimeLeftChanged", ET_Ignore, 0, NULL);
}

View File

@ -32,11 +32,11 @@
#ifndef _INCLUDE_SOURCEMOD_CTIMERSYS_H_
#define _INCLUDE_SOURCEMOD_CTIMERSYS_H_
#include "ShareSys.h"
#include <ITimerSystem.h>
#include <sh_stack.h>
#include <sh_list.h>
#include "sourcemm_api.h"
#include "sm_globals.h"
using namespace SourceHook;
using namespace SourceMod;

View File

@ -31,6 +31,7 @@
#include "UserMessages.h"
#include "sm_stringutil.h"
#include "logic_bridge.h"
#if SOURCE_ENGINE == SE_DOTA
#include <dota_usermessage_helpers.h>
@ -91,7 +92,7 @@ void UserMessages::OnSourceModStartup(bool late)
void UserMessages::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void UserMessages::OnSourceModAllShutdown()

View File

@ -32,12 +32,14 @@
#ifndef _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_
#define _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_
#include "ShareSys.h"
#include <IUserMessages.h>
#include "sourcemm_api.h"
#include "sm_trie.h"
#include "sm_stringutil.h"
#include "CellRecipientFilter.h"
#include "sm_globals.h"
#include <sh_list.h>
#include <sh_stack.h>
using namespace SourceHook;
using namespace SourceMod;

View File

@ -38,6 +38,7 @@
#include "CoreConfig.h"
#include <sm_queue.h>
#include <IThreader.h>
#include "sourcemod.h"
static IMutex *frame_mutex;
static Queue<FrameAction> *frame_queue;

View File

@ -47,9 +47,16 @@ files = [
'smn_handles.cpp',
'smn_datapacks.cpp',
'smn_gameconfigs.cpp',
'smn_fakenatives.cpp',
'GameConfigs.cpp',
'sm_crc32.cpp',
'smn_profiler.cpp',
'ShareSys.cpp',
'PluginSys.cpp',
'HandleSys.cpp',
'NativeOwner.cpp',
'NativeInvoker.cpp',
'ExtensionSys.cpp',
'DebugReporter.cpp'
]
if AMBuild.target['platform'] == 'windows':

View File

@ -31,13 +31,10 @@
#include <stdlib.h>
#include "ExtensionSys.h"
#include "LibrarySys.h"
#include "ShareSys.h"
#include "Logger.h"
#include "sourcemm_api.h"
#include "sm_srvcmds.h"
#include "sm_stringutil.h"
#include "PlayerManager.h"
#include <ILibrarySys.h>
#include <ISourceMod.h>
#include "common_logic.h"
#include "PluginSys.h"
CExtensionManager g_Extensions;
IdentityType_t g_ExtType;
@ -51,7 +48,7 @@ void CExtension::Initialize(const char *filename, const char *path)
m_File.assign(filename);
m_Path.assign(path);
char real_name[PLATFORM_MAX_PATH];
g_LibSys.GetFileFromPath(real_name, sizeof(real_name), m_Path.c_str());
libsys->GetFileFromPath(real_name, sizeof(real_name), m_Path.c_str());
m_RealFile.assign(real_name);
}
@ -107,29 +104,29 @@ CLocalExtension::CLocalExtension(const char *filename)
}
/* Zeroth, see if there is an engine specific build in the new place. */
g_SourceMod.BuildPath(Path_SM,
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s." GAMEFIX "." PLATFORM_LIB_EXT,
filename);
if (g_LibSys.IsPathFile(path))
if (libsys->IsPathFile(path))
{
goto found;
}
/* First see if there is an engine specific build! */
g_SourceMod.BuildPath(Path_SM,
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/auto." GAMEFIX "/%s." PLATFORM_LIB_EXT,
filename);
/* Try the "normal" version */
if (!g_LibSys.IsPathFile(path))
if (!libsys->IsPathFile(path))
{
normal:
g_SourceMod.BuildPath(Path_SM,
g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s." PLATFORM_LIB_EXT,
@ -159,7 +156,7 @@ bool CRemoteExtension::Load(char *error, size_t maxlength)
bool CLocalExtension::Load(char *error, size_t maxlength)
{
m_pLib = g_LibSys.OpenLibrary(m_Path.c_str(), error, maxlength);
m_pLib = libsys->OpenLibrary(m_Path.c_str(), error, maxlength);
if (m_pLib == NULL)
{
@ -191,24 +188,10 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
/* Load as MM:S */
if (m_pAPI->IsMetamodExtension())
{
bool already;
m_PlId = g_pMMPlugins->Load(m_Path.c_str(), g_PLID, already, error, maxlength);
bool ok;
m_PlId = smcore.LoadMMSPlugin(m_Path.c_str(), &ok, error, maxlength);
// Check the plugin didn't refuse load
Pl_Status status;
#ifndef METAMOD_PLAPI_VERSION
const char *file;
PluginId source;
#endif
if (!m_PlId || (
#ifndef METAMOD_PLAPI_VERSION
g_pMMPlugins->Query(m_PlId, file, status, source)
#else
g_pMMPlugins->Query(m_PlId, NULL, &status, NULL)
#endif
&& status < Pl_Paused))
if (!m_PlId || !ok)
{
m_pLib->CloseLibrary();
m_pLib = NULL;
@ -223,8 +206,7 @@ bool CLocalExtension::Load(char *error, size_t maxlength)
{
if (m_PlId)
{
char dummy[255];
g_pMMPlugins->Unload(m_PlId, true, dummy, sizeof(dummy));
smcore.UnloadMMSPlugin(m_PlId);
m_PlId = 0;
}
}
@ -245,8 +227,7 @@ void CLocalExtension::Unload()
{
if (m_pAPI != NULL && m_PlId)
{
char temp_buffer[255];
g_pMMPlugins->Unload(m_PlId, true, temp_buffer, sizeof(temp_buffer));
smcore.UnloadMMSPlugin(m_PlId);
m_PlId = 0;
}
@ -309,7 +290,7 @@ bool CExtension::PerformAPICheck(char *error, size_t maxlength)
bool CExtension::Load(char *error, size_t maxlength)
{
CreateIdentity();
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !g_SourceMod.IsMapLoading()))
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !smcore.IsMapLoading()))
{
DestroyIdentity();
return false;
@ -317,7 +298,7 @@ bool CExtension::Load(char *error, size_t maxlength)
else
{
/* Check if we're past load time */
if (!g_SourceMod.IsMapLoading())
if (!smcore.IsMapLoading())
{
m_pAPI->OnExtensionsAllLoaded();
}
@ -527,14 +508,13 @@ void CExtension::AddLibrary(const char *library)
void CExtensionManager::OnSourceModAllInitialized()
{
g_ExtType = g_ShareSys.CreateIdentType("EXTENSION");
g_PluginSys.AddPluginsListener(this);
g_RootMenu.AddRootConsoleCommand("exts", "Manage extensions", this);
pluginsys->AddPluginsListener(this);
g_ShareSys.AddInterface(NULL, this);
}
void CExtensionManager::OnSourceModShutdown()
{
g_RootMenu.RemoveRootConsoleCommand("exts", this);
pluginsys->RemovePluginsListener(this);
g_ShareSys.DestroyIdentType(g_ExtType);
}
@ -552,9 +532,9 @@ void CExtensionManager::TryAutoload()
{
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "extensions");
g_pSM->BuildPath(Path_SM, path, sizeof(path), "extensions");
IDirectory *pDir = g_LibSys.OpenDirectory(path);
IDirectory *pDir = libsys->OpenDirectory(path);
if (!pDir)
{
return;
@ -585,7 +565,7 @@ void CExtensionManager::TryAutoload()
}
char file[PLATFORM_MAX_PATH];
len = UTIL_Format(file, sizeof(file), "%s", lfile);
len = smcore.Format(file, sizeof(file), "%s", lfile);
strcpy(&file[len - 9], ".ext");
LoadAutoExtension(file);
@ -594,16 +574,16 @@ void CExtensionManager::TryAutoload()
}
}
IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOnMissing)
IExtension *CExtensionManager::LoadAutoExtension(const char *path)
{
/* Remove platform extension if it's there. Compat hack. */
const char *ext = g_LibSys.GetFileExtension(path);
const char *ext = libsys->GetFileExtension(path);
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
{
char path2[PLATFORM_MAX_PATH];
UTIL_Format(path2, sizeof(path2), "%s", path);
smcore.Format(path2, sizeof(path2), "%s", path);
path2[strlen(path) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
return LoadAutoExtension(path2, bErrorOnMissing);
return LoadAutoExtension(path);
}
IExtension *pAlready;
@ -622,11 +602,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path, bool bErrorOn
if (!p->Load(error, sizeof(error)) || !p->IsLoaded())
{
if (bErrorOnMissing || g_LibSys.IsPathFile(p->GetPath()))
{
g_Logger.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
}
smcore.LogError("[SM] Unable to load extension \"%s\": %s", path, error);
p->SetError(error);
}
@ -640,7 +616,7 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
/* Chomp off the path */
char lookup[PLATFORM_MAX_PATH];
g_LibSys.GetFileFromPath(lookup, sizeof(lookup), file);
libsys->GetFileFromPath(lookup, sizeof(lookup), file);
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
@ -689,11 +665,11 @@ IExtension *CExtensionManager::FindExtensionByName(const char *ext)
IExtension *CExtensionManager::LoadExtension(const char *file, char *error, size_t maxlength)
{
/* Remove platform extension if it's there. Compat hack. */
const char *ext = g_LibSys.GetFileExtension(file);
const char *ext = libsys->GetFileExtension(file);
if (strcmp(ext, PLATFORM_LIB_EXT) == 0)
{
char path2[PLATFORM_MAX_PATH];
UTIL_Format(path2, sizeof(path2), "%s", file);
smcore.Format(path2, sizeof(path2), "%s", file);
path2[strlen(file) - strlen(PLATFORM_LIB_EXT) - 1] = '\0';
return LoadExtension(path2, error, maxlength);
}
@ -755,11 +731,11 @@ void CExtensionManager::AddInterface(IExtension *pOwner, SMInterface *pInterface
pExt->AddInterface(pInterface);
}
void CExtensionManager::BindChildPlugin( IExtension *pParent, CPlugin *pPlugin )
void CExtensionManager::BindChildPlugin(IExtension *pParent, SMPlugin *pPlugin)
{
CExtension *pExt = (CExtension *)pParent;
pExt->AddPlugin(pPlugin);
pExt->AddPlugin(static_cast<CPlugin *>(pPlugin));
}
void CExtensionManager::OnPluginDestroyed(IPlugin *plugin)
@ -768,7 +744,7 @@ void CExtensionManager::OnPluginDestroyed(IPlugin *plugin)
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
{
(*iter)->DropRefsTo((CPlugin *)plugin);
(*iter)->DropRefsTo(static_cast<CPlugin *>(plugin));
}
}
@ -828,7 +804,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
while (p_iter != pExt->m_Dependents.end())
{
/* We have to manually unlink ourselves here, since we're no longer being managed */
g_PluginSys.UnloadPlugin((*p_iter));
scripts->UnloadPlugin((*p_iter));
p_iter = pExt->m_Dependents.erase(p_iter);
}
@ -837,7 +813,7 @@ bool CExtensionManager::UnloadExtension(IExtension *_pExt)
s_iter != pExt->m_Libraries.end();
s_iter++)
{
g_PluginSys.OnLibraryAction((*s_iter).c_str(), LibraryAction_Removed);
scripts->OnLibraryAction((*s_iter).c_str(), LibraryAction_Removed);
}
/* Notify and/or unload all dependencies */
@ -955,10 +931,10 @@ void CExtensionManager::AddDependency(IExtension *pSource, const char *file, boo
void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand &command)
{
int argcount = command.ArgC();
int argcount = smcore.Argc(command);
if (argcount >= 3)
{
const char *cmd = command.Arg(2);
const char *cmd = smcore.Arg(command, 2);
if (strcmp(cmd, "list") == 0)
{
List<CExtension *>::iterator iter;
@ -968,17 +944,17 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
case 1:
{
g_RootMenu.ConsolePrint("[SM] Displaying 1 extension:");
rootmenu->ConsolePrint("[SM] Displaying 1 extension:");
break;
}
case 0:
{
g_RootMenu.ConsolePrint("[SM] No extensions are loaded.");
rootmenu->ConsolePrint("[SM] No extensions are loaded.");
break;
}
default:
{
g_RootMenu.ConsolePrint("[SM] Displaying %d extensions:", m_Libs.size());
rootmenu->ConsolePrint("[SM] Displaying %d extensions:", m_Libs.size());
break;
}
}
@ -990,7 +966,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
char error[255];
if (!pExt->IsRunning(error, sizeof(error)))
{
g_RootMenu.ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), error);
rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), error);
}
else
{
@ -998,10 +974,10 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
const char *name = pAPI->GetExtensionName();
const char *version = pAPI->GetExtensionVerString();
const char *descr = pAPI->GetExtensionDescription();
g_RootMenu.ConsolePrint("[%02d] %s (%s): %s", num, name, version, descr);
rootmenu->ConsolePrint("[%02d] %s (%s): %s", num, name, version, descr);
}
} else {
g_RootMenu.ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str());
rootmenu->ConsolePrint("[%02d] <FAILED> file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str());
}
}
return;
@ -1010,29 +986,29 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts load <file>");
rootmenu->ConsolePrint("[SM] Usage: sm exts load <file>");
return;
}
const char *filename = command.Arg(3);
const char *filename = smcore.Arg(command, 3);
char path[PLATFORM_MAX_PATH];
char error[256];
UTIL_Format(path, sizeof(path), "%s%s%s", filename, !strstr(filename, ".ext") ? ".ext" : "",
smcore.Format(path, sizeof(path), "%s%s%s", filename, !strstr(filename, ".ext") ? ".ext" : "",
!strstr(filename, "." PLATFORM_LIB_EXT) ? "." PLATFORM_LIB_EXT : "");
if (FindExtensionByFile(path) != NULL)
{
g_RootMenu.ConsolePrint("[SM] Extension %s is already loaded.", path);
rootmenu->ConsolePrint("[SM] Extension %s is already loaded.", path);
return;
}
if (LoadExtension(path, error, sizeof(error)))
{
g_RootMenu.ConsolePrint("[SM] Loaded extension %s successfully.", path);
rootmenu->ConsolePrint("[SM] Loaded extension %s successfully.", path);
} else
{
g_RootMenu.ConsolePrint("[SM] Extension %s failed to load: %s", path, error);
rootmenu->ConsolePrint("[SM] Extension %s failed to load: %s", path, error);
}
return;
@ -1041,27 +1017,27 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
rootmenu->ConsolePrint("[SM] Usage: sm exts info <#>");
return;
}
const char *sId = command.Arg(3);
const char *sId = smcore.Arg(command, 3);
unsigned int id = atoi(sId);
if (id <= 0)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts info <#>");
rootmenu->ConsolePrint("[SM] Usage: sm exts info <#>");
return;
}
if (m_Libs.size() == 0)
{
g_RootMenu.ConsolePrint("[SM] No extensions are loaded.");
rootmenu->ConsolePrint("[SM] No extensions are loaded.");
return;
}
if (id > m_Libs.size())
{
g_RootMenu.ConsolePrint("[SM] No extension was found with id %d.", id);
rootmenu->ConsolePrint("[SM] No extension was found with id %d.", id);
return;
}
@ -1079,44 +1055,44 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
/* This should never happen */
if (!pExt)
{
g_RootMenu.ConsolePrint("[SM] No extension was found with id %d.", id);
rootmenu->ConsolePrint("[SM] No extension was found with id %d.", id);
return;
}
if (!pExt->IsLoaded())
{
g_RootMenu.ConsolePrint(" File: %s", pExt->GetFilename());
g_RootMenu.ConsolePrint(" Loaded: No (%s)", pExt->m_Error.c_str());
rootmenu->ConsolePrint(" File: %s", pExt->GetFilename());
rootmenu->ConsolePrint(" Loaded: No (%s)", pExt->m_Error.c_str());
}
else
{
char error[255];
if (!pExt->IsRunning(error, sizeof(error)))
{
g_RootMenu.ConsolePrint(" File: %s", pExt->GetFilename());
g_RootMenu.ConsolePrint(" Loaded: Yes");
g_RootMenu.ConsolePrint(" Running: No (%s)", error);
rootmenu->ConsolePrint(" File: %s", pExt->GetFilename());
rootmenu->ConsolePrint(" Loaded: Yes");
rootmenu->ConsolePrint(" Running: No (%s)", error);
}
else
{
IExtensionInterface *pAPI = pExt->GetAPI();
g_RootMenu.ConsolePrint(" File: %s", pExt->GetFilename());
g_RootMenu.ConsolePrint(" Loaded: Yes (version %s)", pAPI->GetExtensionVerString());
g_RootMenu.ConsolePrint(" Name: %s (%s)", pAPI->GetExtensionName(), pAPI->GetExtensionDescription());
g_RootMenu.ConsolePrint(" Author: %s (%s)", pAPI->GetExtensionAuthor(), pAPI->GetExtensionURL());
g_RootMenu.ConsolePrint(" Binary info: API version %d (compiled %s)", pAPI->GetExtensionVersion(), pAPI->GetExtensionDateString());
rootmenu->ConsolePrint(" File: %s", pExt->GetFilename());
rootmenu->ConsolePrint(" Loaded: Yes (version %s)", pAPI->GetExtensionVerString());
rootmenu->ConsolePrint(" Name: %s (%s)", pAPI->GetExtensionName(), pAPI->GetExtensionDescription());
rootmenu->ConsolePrint(" Author: %s (%s)", pAPI->GetExtensionAuthor(), pAPI->GetExtensionURL());
rootmenu->ConsolePrint(" Binary info: API version %d (compiled %s)", pAPI->GetExtensionVersion(), pAPI->GetExtensionDateString());
if (pExt->IsExternal())
{
g_RootMenu.ConsolePrint(" Method: Loaded by Metamod:Source, attached to SourceMod");
rootmenu->ConsolePrint(" Method: Loaded by Metamod:Source, attached to SourceMod");
}
else if (pAPI->IsMetamodExtension())
{
g_RootMenu.ConsolePrint(" Method: Loaded by SourceMod, attached to Metamod:Source");
rootmenu->ConsolePrint(" Method: Loaded by SourceMod, attached to Metamod:Source");
}
else
{
g_RootMenu.ConsolePrint(" Method: Loaded by SourceMod");
rootmenu->ConsolePrint(" Method: Loaded by SourceMod");
}
}
}
@ -1126,33 +1102,33 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts unload <#> [code]");
rootmenu->ConsolePrint("[SM] Usage: sm exts unload <#> [code]");
return;
}
const char *arg = command.Arg(3);
const char *arg = smcore.Arg(command, 3);
unsigned int num = atoi(arg);
CExtension *pExt = FindByOrder(num);
if (!pExt)
{
g_RootMenu.ConsolePrint("[SM] Extension number %d was not found.", num);
rootmenu->ConsolePrint("[SM] Extension number %d was not found.", num);
return;
}
if (argcount > 4 && pExt->unload_code)
{
const char *unload = command.Arg(4);
const char *unload = smcore.Arg(command, 4);
if (pExt->unload_code == (unsigned)atoi(unload))
{
char filename[PLATFORM_MAX_PATH];
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
UnloadExtension(pExt);
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
rootmenu->ConsolePrint("[SM] Extension %s is now unloaded.", filename);
}
else
{
g_RootMenu.ConsolePrint("[SM] Please try again, the correct unload code is \"%d\"", pExt->unload_code);
rootmenu->ConsolePrint("[SM] Please try again, the correct unload code is \"%d\"", pExt->unload_code);
}
return;
}
@ -1163,7 +1139,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
char filename[PLATFORM_MAX_PATH];
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
UnloadExtension(pExt);
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
rootmenu->ConsolePrint("[SM] Extension %s is now unloaded.", filename);
return;
}
else
@ -1171,7 +1147,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
List<CPlugin *> plugins;
if (pExt->m_ChildDeps.size())
{
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following extensions: ", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] Unloading %s will unload the following extensions: ", pExt->GetFilename());
List<CExtension *>::iterator iter;
CExtension *pOther;
/* Get list of all extensions */
@ -1196,7 +1172,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
/* Will our dependent care? */
if (!pExt->GetAPI()->QueryInterfaceDrop((*i_iter).iface))
{
g_RootMenu.ConsolePrint(" -> %s", pExt->GetFilename());
rootmenu->ConsolePrint(" -> %s", pExt->GetFilename());
/* Add to plugin unload list */
List<CPlugin *>::iterator p_iter;
for (p_iter=pOther->m_Dependents.begin();
@ -1214,7 +1190,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
}
if (pExt->m_Dependents.size())
{
g_RootMenu.ConsolePrint("[SM] Unloading %s will unload the following plugins: ", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] Unloading %s will unload the following plugins: ", pExt->GetFilename());
List<CPlugin *>::iterator iter;
CPlugin *pPlugin;
for (iter = pExt->m_Dependents.begin(); iter != pExt->m_Dependents.end(); iter++)
@ -1228,13 +1204,13 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
for (iter = plugins.begin(); iter != plugins.end(); iter++)
{
pPlugin = (*iter);
g_RootMenu.ConsolePrint(" -> %s", pPlugin->GetFilename());
rootmenu->ConsolePrint(" -> %s", pPlugin->GetFilename());
}
}
srand(static_cast<int>(time(NULL)));
pExt->unload_code = (rand() % 877) + 123; //123 to 999
g_RootMenu.ConsolePrint("[SM] To verify unloading %s, please use the following: ", pExt->GetFilename());
g_RootMenu.ConsolePrint("[SM] sm exts unload %d %d", num, pExt->unload_code);
rootmenu->ConsolePrint("[SM] To verify unloading %s, please use the following: ", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] sm exts unload %d %d", num, pExt->unload_code);
return;
}
@ -1243,17 +1219,17 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
{
if (argcount < 4)
{
g_RootMenu.ConsolePrint("[SM] Usage: sm exts reload <#>");
rootmenu->ConsolePrint("[SM] Usage: sm exts reload <#>");
return;
}
const char *arg = command.Arg(3);
const char *arg = smcore.Arg(command, 3);
unsigned int num = atoi(arg);
CExtension *pExt = FindByOrder(num);
if (!pExt)
{
g_RootMenu.ConsolePrint("[SM] Extension number %d was not found.", num);
rootmenu->ConsolePrint("[SM] Extension number %d was not found.", num);
return;
}
@ -1266,18 +1242,18 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
if (pExt->Reload(error, sizeof(error)))
{
g_RootMenu.ConsolePrint("[SM] Extension %s is now reloaded.", filename);
rootmenu->ConsolePrint("[SM] Extension %s is now reloaded.", filename);
}
else
{
g_RootMenu.ConsolePrint("[SM] Extension %s failed to reload: %s", filename, error);
rootmenu->ConsolePrint("[SM] Extension %s failed to reload: %s", filename, error);
}
return;
}
else
{
g_RootMenu.ConsolePrint("[SM] Extension %s is not loaded.", pExt->GetFilename());
rootmenu->ConsolePrint("[SM] Extension %s is not loaded.", pExt->GetFilename());
return;
}
@ -1285,100 +1261,12 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmdname, const CCommand
}
}
g_RootMenu.ConsolePrint("SourceMod Extensions Menu:");
g_RootMenu.DrawGenericOption("info", "Extra extension information");
g_RootMenu.DrawGenericOption("list", "List extensions");
g_RootMenu.DrawGenericOption("load", "Load an extension");
g_RootMenu.DrawGenericOption("reload", "Reload an extension");
g_RootMenu.DrawGenericOption("unload", "Unload an extension");
}
void CExtensionManager::ListExtensionsToClient(CPlayer *player, const CCommand &args)
{
char buffer[256];
int numExtensions = m_Libs.size();
edict_t *edict = player->GetEdict();
unsigned int id = 0;
unsigned int start = 0;
if (!numExtensions)
{
ClientConsolePrint(edict, "[SM] No extensions found.");
return;
}
if (args.ArgC() > 2)
{
start = atoi(args.Arg(2));
}
CExtension *ext;
SourceHook::List<CExtension *>::iterator iter;
for (iter = m_Libs.begin();
iter != m_Libs.end();
iter++)
{
ext = (*iter);
char error[255];
if (!ext->IsRunning(error, sizeof(error)))
{
continue;
}
id++;
if (id < start)
{
continue;
}
if (id - start > 10)
{
break;
}
IExtensionInterface *api = ext->GetAPI();
const char *name = api->GetExtensionName();
const char *version = api->GetExtensionVerString();
const char *author = api->GetExtensionAuthor();
const char *description = api->GetExtensionDescription();
size_t len = UTIL_Format(buffer, sizeof(buffer), " \"%s\"", name);
if (version != NULL && IS_STR_FILLED(version))
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", version);
}
if (author != NULL && IS_STR_FILLED(author))
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", author);
}
if (description != NULL && IS_STR_FILLED(description))
{
len += UTIL_Format(&buffer[len], sizeof(buffer)-len, ": %s", description);
}
ClientConsolePrint(edict, "%s", buffer);
}
while (iter != m_Libs.end())
{
char error[255];
if ((*iter)->IsRunning(error, sizeof(error)))
{
break;
}
}
if (iter != m_Libs.end())
{
ClientConsolePrint(edict, "To see more, type \"sm exts %d\"", id);
}
rootmenu->ConsolePrint("SourceMod Extensions Menu:");
rootmenu->DrawGenericOption("info", "Extra extension information");
rootmenu->DrawGenericOption("list", "List extensions");
rootmenu->DrawGenericOption("load", "Load an extension");
rootmenu->DrawGenericOption("reload", "Reload an extension");
rootmenu->DrawGenericOption("unload", "Unload an extension");
}
CExtension *CExtensionManager::GetExtensionFromIdent(IdentityToken_t *ptr)
@ -1403,7 +1291,7 @@ void CExtensionManager::AddLibrary(IExtension *pSource, const char *library)
{
CExtension *pExt = (CExtension *)pSource;
pExt->AddLibrary(library);
g_PluginSys.OnLibraryAction(library, LibraryAction_Added);
scripts->OnLibraryAction(library, LibraryAction_Added);
}
bool CExtensionManager::LibraryExists(const char *library)
@ -1473,6 +1361,14 @@ void CExtensionManager::CallOnCoreMapStart(edict_t *pEdictList, int edictCount,
}
}
void CExtensionManager::ListExtensions(CVector<IExtension *> *list)
{
for (List<CExtension *>::iterator iter = m_Libs.begin(); iter != m_Libs.end(); iter++)
{
list->push_back(*iter);
}
}
bool CLocalExtension::IsSameFile(const char *file)
{
/* Only care about the shortened name. */

View File

@ -37,13 +37,11 @@
#include <sh_list.h>
#include <sh_string.h>
#include <sm_trie_tpl.h>
#include "sm_globals.h"
#include "ShareSys.h"
#include <ISmmAPI.h>
#include "common_logic.h"
#include <IPluginSys.h>
#include <IRootConsoleMenu.h>
#include "PluginSys.h"
#include "NativeOwner.h"
#include "ShareSys.h"
class CPlayer;
@ -120,7 +118,7 @@ public:
bool IsExternal();
bool IsSameFile(const char *file);
private:
PluginId m_PlId;
int m_PlId;
ILibrary *m_pLib;
};
@ -138,10 +136,9 @@ public:
};
class CExtensionManager :
public IExtensionManager,
public IExtensionSys,
public SMGlobalClass,
public IPluginsListener,
public IRootConsoleCommand
public IPluginsListener
{
public:
CExtensionManager();
@ -166,10 +163,10 @@ public: //IPluginsListener
public: //IRootConsoleCommand
void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
public:
IExtension *LoadAutoExtension(const char *path, bool bErrorOnMissing=true);
IExtension *LoadAutoExtension(const char *path);
void BindDependency(IExtension *pOwner, IfaceInfo *pInfo);
void AddInterface(IExtension *pOwner, SMInterface *pInterface);
void BindChildPlugin(IExtension *pParent, CPlugin *pPlugin);
void BindChildPlugin(IExtension *pParent, SMPlugin *pPlugin);
void MarkAllLoaded();
void AddDependency(IExtension *pSource, const char *file, bool required, bool autoload);
void TryAutoload();
@ -177,8 +174,7 @@ public:
bool LibraryExists(const char *library);
void CallOnCoreMapStart(edict_t *pEdictList, int edictCount, int clientMax);
void AddRawDependency(IExtension *ext, IdentityToken_t *other, void *iface);
public:
void ListExtensionsToClient(CPlayer *player, const CCommand &args);
void ListExtensions(CVector<IExtension *> *list);
public:
CExtension *GetExtensionFromIdent(IdentityToken_t *ptr);
void Shutdown();

View File

@ -30,13 +30,11 @@
*/
#include "HandleSys.h"
#include "ShareSys.h"
#include "PluginSys.h"
#include "ExtensionSys.h"
#include "Logger.h"
#include <assert.h>
#include <string.h>
#include "sm_stringutil.h"
#include "common_logic.h"
#include "ShareSys.h"
#include "ExtensionSys.h"
HandleSystem g_HandleSys;
@ -60,7 +58,6 @@ HandleSystem::HandleSystem()
m_Types = new QHandleType[HANDLESYS_TYPEARRAY_SIZE];
memset(m_Types, 0, sizeof(QHandleType) * HANDLESYS_TYPEARRAY_SIZE);
m_TypeLookup = sm_trie_create();
m_strtab = new BaseStringTable(512);
m_TypeTail = 0;
@ -70,7 +67,6 @@ HandleSystem::~HandleSystem()
{
delete [] m_Handles;
delete [] m_Types;
sm_trie_destroy(m_TypeLookup);
delete m_strtab;
}
@ -145,7 +141,7 @@ HandleType_t HandleSystem::CreateType(const char *name,
if (name && name[0] != '\0')
{
if (sm_trie_retrieve(m_TypeLookup, name, NULL))
if (m_TypeLookup.retrieve(name))
{
if (err)
{
@ -213,7 +209,7 @@ HandleType_t HandleSystem::CreateType(const char *name,
if (name && name[0] != '\0')
{
pType->nameIdx = m_strtab->AddString(name);
sm_trie_insert(m_TypeLookup, name, (void *)pType);
m_TypeLookup.insert(name, pType);
} else {
pType->nameIdx = -1;
}
@ -245,14 +241,14 @@ HandleType_t HandleSystem::CreateType(const char *name,
bool HandleSystem::FindHandleType(const char *name, HandleType_t *type)
{
QHandleType *_type;
QHandleType **typepp = m_TypeLookup.retrieve(name);
if (!sm_trie_retrieve(m_TypeLookup, name, (void **)&_type))
if (!typepp)
{
return false;
}
unsigned int offset = _type - m_Types;
unsigned int offset = *typepp - m_Types;
if (type)
{
@ -945,7 +941,7 @@ bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
const char *typeName;
typeName = m_strtab->GetString(pType->nameIdx);
sm_trie_delete(m_TypeLookup, typeName);
m_TypeLookup.remove(typeName);
}
return true;
@ -980,12 +976,12 @@ bool HandleSystem::InitAccessDefaults(TypeAccess *pTypeAccess, HandleAccess *pHa
}
#define HANDLE_LOG_VERY_BAD(message, ...) \
g_Logger.LogFatal(message, ##__VA_ARGS__); \
g_Logger.LogError(message, ##__VA_ARGS__);
smcore.LogFatal(message, ##__VA_ARGS__); \
smcore.LogError(message, ##__VA_ARGS__);
bool HandleSystem::TryAndFreeSomeHandles()
{
IPluginIterator *pl_iter = g_PluginSys.GetPluginIterator();
IPluginIterator *pl_iter = scripts->GetPluginIterator();
IPlugin *highest_owner = NULL;
unsigned int highest_handle_count = 0;
@ -1034,7 +1030,7 @@ bool HandleSystem::TryAndFreeSomeHandles()
highest_owner->GetBaseContext()->ThrowNativeErrorEx(SP_ERROR_MEMACCESS, "Memory leak");
return g_PluginSys.UnloadPlugin(highest_owner);
return scripts->UnloadPlugin(highest_owner);
}
void HandleSystem::Dump(HANDLE_REPORTER rep)
@ -1059,20 +1055,20 @@ void HandleSystem::Dump(HANDLE_REPORTER rep)
{
owner = "CORE";
}
else if (pOwner == g_PluginSys.GetIdentity())
else if (pOwner == scripts->GetIdentity())
{
owner = "PLUGINSYS";
}
else
{
CExtension *ext = g_Extensions.GetExtensionFromIdent(pOwner);
IExtension *ext = g_Extensions.GetExtensionFromIdent(pOwner);
if (ext)
{
owner = ext->GetFilename();
}
else
{
CPlugin *pPlugin = g_PluginSys.GetPluginFromIdentity(pOwner);
SMPlugin *pPlugin = scripts->FindPluginByIdentity(pOwner);
if (pPlugin)
{
owner = pPlugin->GetFilename();
@ -1119,7 +1115,7 @@ void HandleSystem::Dump(HANDLE_REPORTER rep)
else
{
char buffer[32];
UTIL_Format(buffer, sizeof(buffer), "%d", size);
smcore.Format(buffer, sizeof(buffer), "%d", size);
rep("0x%08x\t%-20.20s\t%-20.20s\t%-10.10s", index, owner, type, buffer);
total_size += size;
}

View File

@ -34,10 +34,9 @@
#include <IHandleSys.h>
#include <stdio.h>
#include "sm_globals.h"
#include "sm_trie.h"
#include "sourcemod.h"
#include <sm_trie_tpl.h>
#include "sm_memtable.h"
#include "common_logic.h"
#define HANDLESYS_MAX_HANDLES (1<<14)
#define HANDLESYS_MAX_TYPES (1<<9)
@ -217,7 +216,7 @@ protected:
private:
QHandle *m_Handles;
QHandleType *m_Types;
Trie *m_TypeLookup;
KTrie<QHandleType *> m_TypeLookup;
unsigned int m_TypeTail;
unsigned int m_FreeTypes;
unsigned int m_HandleTail;

View File

@ -54,7 +54,7 @@ unsigned int NativeInterface::GetInterfaceVersion()
void NativeInterface::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, &g_NInvoke);
sharesys->AddInterface(NULL, &g_NInvoke);
}
IPluginRuntime *NativeInterface::CreateRuntime(const char *name, size_t bytes)

View File

@ -32,8 +32,12 @@
#ifndef _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
#define _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_
#include "sm_globals.h"
#include <sp_vm_api.h>
#include <INativeInvoker.h>
#include "common_logic.h"
using namespace SourceMod;
using namespace SourcePawn;
struct ParamInfo
{

View File

@ -1,3 +1,33 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourcePawn
* Copyright (C) 2004-2009 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 <http://www.gnu.org/licenses/>.
*
* 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 <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#include "NativeOwner.h"
#include "ShareSys.h"
#include "PluginSys.h"
@ -41,7 +71,7 @@ void CNativeOwner::AddNatives(const sp_nativeinfo_t *natives)
}
}
void CNativeOwner::PropogateMarkSerial(unsigned int serial)
void CNativeOwner::PropagateMarkSerial(unsigned int serial)
{
CNativeOwner *pOwner;
List<CPlugin *>::iterator iter;

View File

@ -3,25 +3,28 @@
#include <sp_vm_types.h>
#include <sh_list.h>
#include "common_logic.h"
class CPlugin;
struct NativeEntry;
class CPlugin;
using namespace SourceMod;
struct WeakNative
{
WeakNative(CPlugin *plugin, uint32_t index) :
WeakNative(IPlugin *plugin, uint32_t index) :
pl(plugin), idx(index), entry(NULL)
{
pl = plugin;
idx = index;
}
WeakNative(CPlugin *plugin, uint32_t index, NativeEntry *pEntry) :
WeakNative(IPlugin *plugin, uint32_t index, NativeEntry *pEntry) :
pl(plugin), idx(index), entry(pEntry)
{
pl = plugin;
idx = index;
}
CPlugin *pl;
IPlugin *pl;
uint32_t idx;
NativeEntry *entry;
};
@ -39,7 +42,7 @@ public:
public:
void SetMarkSerial(unsigned int serial);
unsigned int GetMarkSerial();
void PropogateMarkSerial(unsigned int serial);
void PropagateMarkSerial(unsigned int serial);
public:
void AddDependent(CPlugin *pPlugin);
void AddWeakRef(const WeakNative & ref);
@ -56,4 +59,6 @@ protected:
List<NativeEntry *> m_ReplacedNatives;
};
extern CNativeOwner g_CoreNatives;
#endif //_INCLUDE_SOURCEMOD_NATIVE_OWNER_H_

File diff suppressed because it is too large Load Diff

View File

@ -42,19 +42,9 @@
#include <sh_stack.h>
#include <sh_vector.h>
#include <sh_string.h>
#include "sm_globals.h"
#include "sm_trie.h"
#include "sourcemod.h"
#include "common_logic.h"
#include <sm_trie_tpl.h>
#include <IRootConsoleMenu.h>
#if SOURCE_ENGINE >= SE_ALIENSWARM
#include "convar_sm_swarm.h"
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
#include "convar_sm_l4d.h"
#elif SOURCE_ENGINE >= SE_ORANGEBOX
#include "convar_sm_ob.h"
#else
#include "convar_sm.h"
#endif
#include "ITranslator.h"
#include "IGameConfigs.h"
#include "NativeOwner.h"
@ -130,23 +120,8 @@ enum APLRes
APLRes_SilentFailure
};
enum LibraryAction
{
LibraryAction_Removed,
LibraryAction_Added
};
struct AutoConfig
{
String autocfg;
String folder;
bool create;
};
class CPlugin;
class CPlugin :
public IPlugin,
public SMPlugin,
public CNativeOwner
{
friend class CPluginManager;
@ -173,6 +148,9 @@ public:
bool GetProperty(const char *prop, void **ptr, bool remove=false);
void DropEverything();
SourcePawn::IPluginRuntime *GetRuntime();
CNativeOwner *ToNativeOwner() {
return this;
}
public:
/**
* Creates a plugin object with default values.
@ -276,7 +254,7 @@ private:
IPhraseCollection *m_pPhrases;
List<String> m_RequiredLibs;
List<String> m_Libraries;
Trie *m_pProps;
KTrie<void *> m_pProps;
bool m_FakeNativesMissing;
bool m_LibraryMissing;
CVector<AutoConfig *> m_configs;
@ -289,7 +267,7 @@ private:
};
class CPluginManager :
public IPluginManager,
public IScriptManager,
public SMGlobalClass,
public IHandleTypeDispatch,
public IRootConsoleCommand
@ -316,7 +294,7 @@ public:
List<CPlugin *>::iterator current;
};
friend class CPluginManager::CPluginIterator;
public: //IPluginManager
public: //IScriptManager
IPlugin *LoadPlugin(const char *path,
bool debug,
PluginType type,
@ -329,6 +307,25 @@ public: //IPluginManager
IPluginIterator *GetPluginIterator();
void AddPluginsListener(IPluginsListener *listener);
void RemovePluginsListener(IPluginsListener *listener);
void LoadAll(const char *config_path, const char *plugins_path);
void RefreshAll();
SMPlugin *FindPluginByOrder(unsigned num) {
return GetPluginByOrder(num);
}
SMPlugin *FindPluginByIdentity(IdentityToken_t *ident) {
return GetPluginFromIdentity(ident);
}
SMPlugin *FindPluginByContext(IPluginContext *ctx) {
return GetPluginByCtx(ctx->GetContext());
}
SMPlugin *FindPluginByContext(sp_context_t *ctx) {
return GetPluginByCtx(ctx);
}
SMPlugin *FindPluginByConsoleArg(const char *text);
SMPlugin *FindPluginByHandle(Handle_t hndl, HandleError *errp) {
return static_cast<SMPlugin *>(PluginFromHandle(hndl, errp));
}
void ListPlugins(CVector<SMPlugin *> *plugins);
public: //SMGlobalClass
void OnSourceModAllInitialized();
void OnSourceModShutdown();
@ -388,11 +385,6 @@ public:
*/
const char *GetStatusText(PluginStatus status);
/**
* Reload or update plugins on level shutdown.
*/
void ReloadOrUnloadPlugins();
/**
* Add public functions from all running or paused
* plugins to the specified forward if the names match.
@ -416,8 +408,6 @@ public:
void UnloadAll();
CPlugin *FindPluginByConsoleArg(const char *arg);
void SyncMaxClients(int max_clients);
void ListPluginsToClient(CPlayer *player, const CCommand &args);
@ -462,13 +452,14 @@ public:
{
return m_MyIdent;
}
IPluginManager *GetOldAPI();
private:
void TryRefreshDependencies(CPlugin *pOther);
private:
List<IPluginsListener *> m_listeners;
List<CPlugin *> m_plugins;
CStack<CPluginManager::CPluginIterator *> m_iters;
Trie *m_LoadLookup;
KTrie<CPlugin *> m_LoadLookup;
bool m_AllPluginsLoaded;
IdentityToken_t *m_MyIdent;

View File

@ -30,11 +30,11 @@
*/
#include "ShareSys.h"
#include "HandleSys.h"
#include "ExtensionSys.h"
#include "LibrarySys.h"
#include <ILibrarySys.h>
#include "common_logic.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "HandleSys.h"
ShareSystem g_ShareSys;
static unsigned int g_mark_serial = 0;
@ -61,36 +61,36 @@ void ShareSystem::Initialize()
{
TypeAccess sec;
g_HandleSys.InitAccessDefaults(&sec, NULL);
handlesys->InitAccessDefaults(&sec, NULL);
sec.ident = GetIdentRoot();
m_TypeRoot = g_HandleSys.CreateType("Identity", this, 0, &sec, NULL, NULL, NULL);
m_IfaceType = g_HandleSys.CreateType("Interface", this, 0, NULL, NULL, GetIdentRoot(), NULL);
m_TypeRoot = handlesys->CreateType("Identity", this, 0, &sec, NULL, NULL, NULL);
m_IfaceType = handlesys->CreateType("Interface", this, 0, NULL, NULL, GetIdentRoot(), NULL);
/* Initialize our static identity handle */
m_IdentRoot.ident = g_HandleSys.CreateHandle(m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
m_IdentRoot.ident = handlesys->CreateHandle(m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
/* Add the Handle System and others... they are too innocent and pure to do it themselves */
AddInterface(NULL, &g_HandleSys);
AddInterface(NULL, &g_LibSys);
AddInterface(NULL, handlesys);
AddInterface(NULL, libsys);
}
void ShareSystem::OnSourceModShutdown()
{
if (m_CoreType)
{
g_HandleSys.RemoveType(m_CoreType, GetIdentRoot());
handlesys->RemoveType(m_CoreType, GetIdentRoot());
}
g_HandleSys.RemoveType(m_IfaceType, GetIdentRoot());
g_HandleSys.RemoveType(m_TypeRoot, GetIdentRoot());
handlesys->RemoveType(m_IfaceType, GetIdentRoot());
handlesys->RemoveType(m_TypeRoot, GetIdentRoot());
}
IdentityType_t ShareSystem::FindIdentType(const char *name)
{
HandleType_t type;
if (g_HandleSys.FindHandleType(name, &type))
if (handlesys->FindHandleType(name, &type))
{
if (g_HandleSys.TypeCheck(type, m_TypeRoot))
{
@ -108,7 +108,7 @@ IdentityType_t ShareSystem::CreateIdentType(const char *name)
return 0;
}
return g_HandleSys.CreateType(name, this, m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
return handlesys->CreateType(name, this, m_TypeRoot, NULL, NULL, GetIdentRoot(), NULL);
}
void ShareSystem::OnHandleDestroy(HandleType_t type, void *object)
@ -217,13 +217,13 @@ void ShareSystem::DestroyIdentity(IdentityToken_t *identity)
sec.pOwner = GetIdentRoot();
sec.pIdentity = GetIdentRoot();
g_HandleSys.FreeHandle(identity->ident, &sec);
handlesys->FreeHandle(identity->ident, &sec);
delete identity;
}
void ShareSystem::DestroyIdentType(IdentityType_t type)
{
g_HandleSys.RemoveType(type, GetIdentRoot());
handlesys->RemoveType(type, GetIdentRoot());
}
void ShareSystem::RemoveInterfaces(IExtension *pExtension)
@ -268,7 +268,7 @@ void ShareSystem::OverrideNatives(IExtension *myself, const sp_nativeinfo_t *nat
continue;
}
if (pEntry->owner != g_pCoreNatives)
if (pEntry->owner != &g_CoreNatives)
{
continue;
}
@ -308,7 +308,7 @@ void ShareSystem::BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly)
/* Generate a new serial ID, mark our dependencies with it. */
g_mark_serial++;
pPlugin->PropogateMarkSerial(g_mark_serial);
pPlugin->PropagateMarkSerial(g_mark_serial);
native_count = pContext->GetNativesNum();
for (i = 0; i < native_count; i++)
@ -338,7 +338,7 @@ void ShareSystem::BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly)
continue;
}
if (bCoreOnly && pEntry->owner != g_pCoreNatives)
if (bCoreOnly && pEntry->owner != &g_CoreNatives)
{
continue;
}
@ -394,7 +394,7 @@ void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin,
native->pfn = pEntry->func;
/* We don't bother with dependency crap if the owner is Core. */
if (pEntry->owner != g_pCoreNatives)
if (pEntry->owner != &g_CoreNatives)
{
/* The native is optional, this is a special case */
if ((native->flags & SP_NTVFLAG_OPTIONAL) == SP_NTVFLAG_OPTIONAL)
@ -416,7 +416,7 @@ void ShareSystem::BindNativeToPlugin(CPlugin *pPlugin,
* If it has, it means this relationship has already occurred,
* and there is no reason to do it again.
*/
if (pEntry->owner != pPlugin
if (pEntry->owner != pPlugin->ToNativeOwner()
&& pEntry->owner->GetMarkSerial() != g_mark_serial)
{
/* This has not been marked as a dependency yet */
@ -516,7 +516,7 @@ NativeEntry *ShareSystem::AddFakeNative(IPluginFunction *pFunc, const char *name
pFake->call = pFunc;
pFake->ctx = pFunc->GetParentContext();
strncopy(pFake->name, name, sizeof(pFake->name));
smcore.strncopy(pFake->name, name, sizeof(pFake->name));
pEntry->fake = pFake;
pEntry->func = gate;

View File

@ -36,8 +36,7 @@
#include <IHandleSys.h>
#include <sh_list.h>
#include <sm_trie_tpl.h>
#include "sm_globals.h"
#include "sourcemod.h"
#include "common_logic.h"
using namespace SourceHook;
@ -62,8 +61,8 @@ struct IfaceInfo
};
class CNativeOwner;
class CPlugin;
struct NativeEntry;
class CPlugin;
struct ReplaceNative
{

View File

@ -43,18 +43,23 @@
#include "Translator.h"
#include "GameConfigs.h"
#include "DebugReporter.h"
#include "PluginSys.h"
#include "ShareSys.h"
#include "NativeOwner.h"
#include "HandleSys.h"
#include "ExtensionSys.h"
sm_core_t smcore;
IHandleSys *handlesys;
IHandleSys *handlesys = &g_HandleSys;
IdentityToken_t *g_pCoreIdent;
SMGlobalClass *SMGlobalClass::head = NULL;
ISourceMod *g_pSM;
ILibrarySys *libsys;
ITextParsers *textparser = &g_TextParser;
IVEngineServer *engine;
IShareSys *sharesys;
IShareSys *sharesys = &g_ShareSys;
IRootConsole *rootmenu;
IPluginManager *pluginsys;
IPluginManager *pluginsys = g_PluginSys.GetOldAPI();
IForwardManager *forwardsys;
ITimerSystem *timersys;
ServerGlobals serverGlobals;
@ -63,6 +68,8 @@ IAdminSystem *adminsys;
IGameHelpers *gamehelpers;
ISourcePawnEngine *g_pSourcePawn;
ISourcePawnEngine2 *g_pSourcePawn2;
CNativeOwner g_CoreNatives;
IScriptManager *scripts = &g_PluginSys;
static void AddCorePhraseFile(const char *filename)
{
@ -85,6 +92,16 @@ static void GenerateError(IPluginContext *ctx, cell_t idx, int err, const char *
va_end(ap);
}
static void AddNatives(sp_nativeinfo_t *natives)
{
g_CoreNatives.AddNatives(natives);
}
static void DumpHandles(void (*dumpfn)(const char *fmt, ...))
{
g_HandleSys.Dump(dumpfn);
}
static sm_logic_t logic =
{
NULL,
@ -100,7 +117,15 @@ static sm_logic_t logic =
GetCoreGameConfig,
OnLogPrint,
&g_DbgReporter,
GenerateError
GenerateError,
AddNatives,
DumpHandles,
&g_PluginSys,
&g_ShareSys,
&g_Extensions,
&g_HandleSys,
NULL,
-1.0f
};
static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
@ -111,14 +136,10 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
memcpy(_logic, &logic, sizeof(sm_logic_t));
memcpy(&serverGlobals, core->serverGlobals, sizeof(ServerGlobals));
handlesys = core->handlesys;
libsys = core->libsys;
engine = core->engine;
g_pCoreIdent = core->core_ident;
g_pSM = core->sm;
sharesys = core->sharesys;
rootmenu = core->rootmenu;
pluginsys = core->pluginsys;
forwardsys = core->forwardsys;
timersys = core->timersys;
playerhelpers = core->playerhelpers;
@ -126,6 +147,11 @@ static void logic_init(const sm_core_t* core, sm_logic_t* _logic)
gamehelpers = core->gamehelpers;
g_pSourcePawn = *core->spe1;
g_pSourcePawn2 = *core->spe2;
g_ShareSys.Initialize();
g_pCoreIdent = g_ShareSys.CreateCoreIdentity();
_logic->core_ident = g_pCoreIdent;
}
PLATFORM_EXTERN_C ITextParsers *get_textparsers()
@ -145,7 +171,7 @@ PLATFORM_EXTERN_C LogicInitFunction logic_load(uint32_t magic)
void CoreNativesToAdd::OnSourceModAllInitialized()
{
smcore.AddNatives(m_NativeList);
g_CoreNatives.AddNatives(m_NativeList);
}
/* Overload a few things to prevent libstdc++ linking */

View File

@ -52,6 +52,7 @@ extern ServerGlobals serverGlobals;
extern IPlayerManager *playerhelpers;
extern IAdminSystem *adminsys;
extern IGameHelpers *gamehelpers;
extern IScriptManager *scripts;
#endif /* _INCLUDE_SOURCEMOD_COMMON_LOGIC_H_ */

View File

@ -29,20 +29,27 @@
* Version: $Id$
*/
#include <sp_vm_api.h>
#include <IHandleSys.h>
#include <IShareSys.h>
#ifndef _INCLUDE_SOURCEMOD_INTERCOM_H_
#define _INCLUDE_SOURCEMOD_INTERCOM_H_
#include <sp_vm_api.h>
#include <IHandleSys.h>
#include <IShareSys.h>
#include <IPluginSys.h>
#include <sh_string.h>
#include <sp_vm_api.h>
#include <sh_vector.h>
#include <IExtensionSys.h>
using namespace SourceMod;
using namespace SourcePawn;
using namespace SourceHook;
/**
* Add 1 to the RHS of this expression to bump the intercom file
* This is to prevent mismatching core/logic binaries
*/
#define SM_LOGIC_MAGIC (0x0F47C0DE - 18)
#define SM_LOGIC_MAGIC (0x0F47C0DE - 19)
#if defined SM_LOGIC
class IVEngineServer
@ -75,6 +82,12 @@ namespace SourceMod
class IVEngineServer;
class ConVar;
class SMGlobalClass;
namespace SourceMod
{
class IChangeableForward;
}
struct ServerGlobals
{
@ -83,17 +96,79 @@ struct ServerGlobals
float *frametime;
};
struct AutoConfig
{
SourceHook::String autocfg;
SourceHook::String folder;
bool create;
};
enum LibraryAction
{
LibraryAction_Removed,
LibraryAction_Added
};
class CNativeOwner;
class SMPlugin : public IPlugin
{
public:
virtual size_t GetConfigCount() = 0;
virtual AutoConfig *GetConfig(size_t i) = 0;
virtual void AddLibrary(const char *name) = 0;
virtual void AddConfig(bool create, const char *cfg, const char *folder) = 0;
virtual void SetErrorState(PluginStatus status, const char *fmt, ...) = 0;
};
class IScriptManager
{
public:
virtual void LoadAll(const char *config_path, const char *plugins_path) = 0;
virtual void RefreshAll() = 0;
virtual void Shutdown() = 0;
virtual IdentityToken_t *GetIdentity() = 0;
virtual void SyncMaxClients(int maxClients) = 0;
virtual void AddPluginsListener(IPluginsListener *listener) = 0;
virtual void RemovePluginsListener(IPluginsListener *listener) = 0;
virtual IPluginIterator *GetPluginIterator() = 0;
virtual void OnLibraryAction(const char *name, LibraryAction action) = 0;
virtual bool LibraryExists(const char *name) = 0;
virtual SMPlugin *FindPluginByOrder(unsigned num) = 0;
virtual SMPlugin *FindPluginByIdentity(IdentityToken_t *ident) = 0;
virtual SMPlugin *FindPluginByContext(IPluginContext *ctx) = 0;
virtual SMPlugin *FindPluginByContext(sp_context_t *ctx) = 0;
virtual SMPlugin *FindPluginByConsoleArg(const char *text) = 0;
virtual SMPlugin *FindPluginByHandle(Handle_t hndl, HandleError *errp) = 0;
virtual bool UnloadPlugin(IPlugin *plugin) = 0;
virtual void ListPlugins(CVector<SMPlugin *> *plugins) = 0;
virtual void AddFunctionsToForward(const char *name, IChangeableForward *fwd) = 0;
};
class IExtensionSys : public IExtensionManager
{
public:
virtual IExtension *LoadAutoExtension(const char *name) = 0;
virtual void TryAutoload() = 0;
virtual void Shutdown() = 0;
virtual IExtension *FindExtensionByFile(const char *name) = 0;
virtual bool LibraryExists(const char *name) = 0;
virtual void CallOnCoreMapStart(edict_t *edictList, int edictCount, int maxClients) = 0;
virtual IExtension *GetExtensionFromIdent(IdentityToken_t *token) = 0;
virtual void BindChildPlugin(IExtension *ext, SMPlugin *plugin) = 0;
virtual void AddRawDependency(IExtension *myself, IdentityToken_t *token, void *iface) = 0;
virtual void ListExtensions(CVector<IExtension *> *list) = 0;
};
class CCommand;
struct sm_core_t
{
/* Objects */
IHandleSys *handlesys;
IdentityToken_t *core_ident;
ISourceMod *sm;
ILibrarySys *libsys;
IVEngineServer *engine;
IShareSys *sharesys;
IRootConsole *rootmenu;
IPluginManager *pluginsys;
IForwardManager *forwardsys;
ITimerSystem *timersys;
IPlayerManager *playerhelpers;
@ -102,11 +177,11 @@ struct sm_core_t
ISourcePawnEngine **spe1;
ISourcePawnEngine2 **spe2;
/* Functions */
void (*AddNatives)(sp_nativeinfo_t* nlist);
ConVar * (*FindConVar)(const char*);
unsigned int (*strncopy)(char*, const char*, size_t);
char * (*TrimWhitespace)(char *, size_t &);
void (*LogError)(const char*, ...);
void (*LogFatal)(const char*, ...);
void (*Log)(const char*, ...);
void (*LogToFile)(FILE *fp, const char*, ...);
void (*LogToGame)(const char *message);
@ -122,6 +197,15 @@ struct sm_core_t
const char * (*GetSourceEngineName)();
bool (*SymbolsAreHidden)();
const char * (*GetCoreConfigValue)(const char*);
bool (*IsMapLoading)();
bool (*IsMapRunning)();
int (*Argc)(const CCommand &args);
const char * (*Arg)(const CCommand &args, int arg);
int (*LoadMMSPlugin)(const char *file, bool *ok, char *error, size_t maxlength);
void (*UnloadMMSPlugin)(int id);
void (*DoGlobalPluginLoads)();
bool (*AreConfigsExecuted)();
void (*ExecuteConfigs)(IPluginContext *ctx);
/* Data */
ServerGlobals *serverGlobals;
void * serverFactory;
@ -145,6 +229,14 @@ struct sm_logic_t
bool (*OnLogPrint)(const char *msg); // true to supercede
IDebugListener *debugger;
void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
void (*AddNatives)(sp_nativeinfo_t *natives);
void (*DumpHandles)(void (*dumpfn)(const char *fmt, ...));
IScriptManager *scripts;
IShareSys *sharesys;
IExtensionSys *extsys;
IHandleSys *handlesys;
IdentityToken_t *core_ident;
float sentinel;
};
typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
@ -152,4 +244,3 @@ typedef LogicInitFunction (*LogicLoadFunction)(uint32_t magic);
typedef ITextParsers *(*GetITextParsers)();
#endif /* _INCLUDE_SOURCEMOD_INTERCOM_H_ */

View File

@ -113,10 +113,17 @@
<ItemGroup>
<ClCompile Include="..\common_logic.cpp" />
<ClCompile Include="..\DebugReporter.cpp" />
<ClCompile Include="..\ExtensionSys.cpp" />
<ClCompile Include="..\GameConfigs.cpp" />
<ClCompile Include="..\HandleSys.cpp" />
<ClCompile Include="..\MemoryUtils.cpp" />
<ClCompile Include="..\NativeInvoker.cpp" />
<ClCompile Include="..\NativeOwner.cpp" />
<ClCompile Include="..\PhraseCollection.cpp" />
<ClCompile Include="..\PluginSys.cpp" />
<ClCompile Include="..\Profiler.cpp" />
<ClCompile Include="..\ShareSys.cpp" />
<ClCompile Include="..\smn_fakenatives.cpp" />
<ClCompile Include="..\smn_filesystem.cpp" />
<ClCompile Include="..\sm_crc32.cpp" />
<ClCompile Include="..\smn_admin.cpp" />
@ -151,12 +158,17 @@
<ClInclude Include="..\AutoHandleRooter.h" />
<ClInclude Include="..\CellArray.h" />
<ClInclude Include="..\common_logic.h" />
<ClInclude Include="..\ExtensionSys.h" />
<ClInclude Include="..\GameConfigs.h" />
<ClInclude Include="..\intercom.h" />
<ClInclude Include="..\MemoryUtils.h" />
<ClInclude Include="..\MersenneTwister.h" />
<ClInclude Include="..\NativeInvoker.h" />
<ClInclude Include="..\NativeOwner.h" />
<ClInclude Include="..\PhraseCollection.h" />
<ClInclude Include="..\PluginSys.h" />
<ClInclude Include="..\Profiler.h" />
<ClInclude Include="..\ShareSys.h" />
<ClInclude Include="..\sm_crc32.h" />
<ClInclude Include="..\sm_memtable.h" />
<ClInclude Include="..\sm_symtable.h" />
@ -168,9 +180,6 @@
<ClInclude Include="..\thread\WinThreads.h" />
<ClInclude Include="..\Translator.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View File

@ -123,6 +123,27 @@
<ClCompile Include="..\smn_filesystem.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_fakenatives.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\ExtensionSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ShareSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\PluginSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NativeInvoker.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NativeOwner.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\HandleSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\CellArray.h">
@ -191,10 +212,20 @@
<ClInclude Include="..\..\..\public\sm_platform.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
<ClInclude Include="..\ExtensionSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NativeInvoker.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NativeOwner.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PluginSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ShareSys.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -31,11 +31,11 @@
#include <sh_list.h>
#include <sh_string.h>
#include "sm_trie.h"
#include "sm_globals.h"
#include <sm_trie_tpl.h>
#include <ISourceMod.h>
#include "common_logic.h"
#include "ShareSys.h"
#include "PluginSys.h"
#include "sourcemod.h"
#include "sm_stringutil.h"
using namespace SourceHook;
@ -139,11 +139,10 @@ static cell_t ThrowNativeError(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Not called from inside a native function");
}
g_SourceMod.SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
g_pSM->SetGlobalTarget(SOURCEMOD_SERVER_LANGUAGE);
char buffer[512];
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 2);
if (pContext->GetLastNativeError() != SP_ERROR_NONE)
{
@ -427,7 +426,7 @@ static cell_t FormatNativeString(IPluginContext *pContext, const cell_t *params)
size_t maxlen = (size_t)params[4];
/* Do the format */
size_t written = atcprintf(output_buffer, maxlen, format_buffer, s_curcaller, s_curparams, &var_param);
size_t written = smcore.atcprintf(output_buffer, maxlen, format_buffer, s_curcaller, s_curparams, &var_param);
cell_t *addr;
pContext->LocalToPhysAddr(params[5], &addr);

View File

@ -34,8 +34,8 @@
#include <IPlayerHelpers.h>
#include <sh_string.h>
#include <sh_list.h>
#include "AutoHandleRooter.h"
#include "CellArray.h"
#include "AutoHandleRooter.h"
using namespace SourceHook;
using namespace SourceMod;

View File

@ -33,14 +33,11 @@
#include "sourcemod.h"
#include "sourcemm_api.h"
#include "sm_globals.h"
#include "NativeOwner.h"
#include "sm_autonatives.h"
#include "logic/intercom.h"
#include "LibrarySys.h"
#include "HandleSys.h"
#include "sm_stringutil.h"
#include "Logger.h"
#include "ShareSys.h"
#include "sm_srvcmds.h"
#include "ForwardSys.h"
#include "TimerSys.h"
@ -49,6 +46,15 @@
#include "AdminCache.h"
#include "HalfLife2.h"
#include "CoreConfig.h"
#if SOURCE_ENGINE >= SE_ALIENSWARM
#include "convar_sm_swarm.h"
#elif SOURCE_ENGINE >= SE_LEFT4DEAD
#include "convar_sm_l4d.h"
#elif SOURCE_ENGINE >= SE_ORANGEBOX
#include "convar_sm_ob.h"
#else
#include "convar_sm.h"
#endif
#if defined _WIN32
#define MATCHMAKINGDS_SUFFIX ""
@ -72,13 +78,17 @@ IThreader *g_pThreader;
ITextParsers *textparsers;
sm_logic_t logicore;
ITranslator *translator;
IScriptManager *scripts;
IShareSys *sharesys;
IExtensionSys *extsys;
IHandleSys *handlesys;
class VEngineServer_Logic : public IVEngineServer_Logic
{
public:
virtual bool IsMapValid(const char *map)
{
return engine->IsMapValid(map);
return !!engine->IsMapValid(map);
}
virtual void ServerCommand(const char *cmd)
@ -89,11 +99,6 @@ public:
static VEngineServer_Logic logic_engine;
static void add_natives(sp_nativeinfo_t *natives)
{
g_pCoreNatives->AddNatives(natives);
}
static ConVar *find_convar(const char *name)
{
return icvar->FindVar(name);
@ -108,6 +113,15 @@ static void log_error(const char *fmt, ...)
va_end(ap);
}
static void log_fatal(const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
g_Logger.LogFatalEx(fmt, ap);
va_end(ap);
}
static void log_message(const char *fmt, ...)
{
va_list ap;
@ -208,19 +222,76 @@ static const char* get_core_config_value(const char* key)
return g_CoreConfig.GetCoreConfigValue(key);
}
static bool is_map_loading()
{
return g_SourceMod.IsMapLoading();
}
static bool is_map_running()
{
return g_SourceMod.IsMapRunning();
}
int read_cmd_argc(const CCommand &args)
{
return args.ArgC();
}
static const char *read_cmd_arg(const CCommand &args, int arg)
{
return args.Arg(arg);
}
static int load_mms_plugin(const char *file, bool *ok, char *error, size_t maxlength)
{
bool ignore_already;
PluginId id = g_pMMPlugins->Load(file, g_PLID, ignore_already, error, maxlength);
Pl_Status status;
#ifndef METAMOD_PLAPI_VERSION
const char *file;
PluginId source;
#endif
if (!id || (
#ifndef METAMOD_PLAPI_VERSION
g_pMMPlugins->Query(id, file, status, source)
#else
g_pMMPlugins->Query(id, NULL, &status, NULL)
#endif
&& status < Pl_Paused))
{
*ok = false;
}
else
{
*ok = true;
}
return id;
}
static void unload_mms_plugin(int id)
{
char ignore[255];
g_pMMPlugins->Unload(id, true, ignore, sizeof(ignore));
}
void do_global_plugin_loads()
{
g_SourceMod.DoGlobalPluginLoads();
}
static ServerGlobals serverGlobals;
static sm_core_t core_bridge =
{
/* Objects */
&g_HandleSys,
NULL,
&g_SourceMod,
&g_LibSys,
reinterpret_cast<IVEngineServer*>(&logic_engine),
&g_ShareSys,
&g_RootMenu,
&g_PluginSys,
&g_Forwards,
&g_Timers,
&g_Players,
@ -229,11 +300,11 @@ static sm_core_t core_bridge =
&g_pSourcePawn,
&g_pSourcePawn2,
/* Functions */
add_natives,
find_convar,
strncopy,
UTIL_TrimWhitespace,
log_error,
log_fatal,
log_message,
log_to_file,
log_to_game,
@ -248,6 +319,15 @@ static sm_core_t core_bridge =
get_source_engine_name,
symbols_are_hidden,
get_core_config_value,
is_map_loading,
is_map_running,
read_cmd_argc,
read_cmd_arg,
load_mms_plugin,
unload_mms_plugin,
do_global_plugin_loads,
SM_AreConfigsExecuted,
SM_ExecuteForPlugin,
&serverGlobals
};
@ -257,7 +337,6 @@ void InitLogicBridge()
serverGlobals.frametime = &gpGlobals->frametime;
serverGlobals.interval_per_tick = &gpGlobals->interval_per_tick;
core_bridge.core_ident = g_pCoreIdent;
core_bridge.engineFactory = (void *)g_SMAPI->GetEngineFactory(false);
core_bridge.serverFactory = (void *)g_SMAPI->GetServerFactory(false);
@ -286,6 +365,11 @@ void InitLogicBridge()
g_pThreader = logicore.threader;
g_pSourcePawn2->SetProfiler(logicore.profiler);
translator = logicore.translator;
scripts = logicore.scripts;
sharesys = logicore.sharesys;
extsys = logicore.extsys;
g_pCoreIdent = logicore.core_ident;
handlesys = logicore.handlesys;
}
bool StartLogicBridge(char *error, size_t maxlength)

View File

@ -42,6 +42,9 @@ struct sm_logic_t;
extern sm_logic_t logicore;
extern ITranslator *translator;
extern IGameConfig *g_pGameConf;
extern IScriptManager *scripts;
extern IShareSys *sharesys;
extern IExtensionSys *extsys;
extern IHandleSys *handlesys;
#endif /* _INCLUDE_SOURCEMOD_LOGIC_BRIDGE_H_ */

View File

@ -2098,11 +2098,9 @@
</ClCompile>
<ClCompile Include="..\Database.cpp" />
<ClCompile Include="..\EventManager.cpp" />
<ClCompile Include="..\ExtensionSys.cpp" />
<ClCompile Include="..\ForwardSys.cpp" />
<ClCompile Include="..\frame_hooks.cpp" />
<ClCompile Include="..\HalfLife2.cpp" />
<ClCompile Include="..\HandleSys.cpp" />
<ClCompile Include="..\LibrarySys.cpp" />
<ClCompile Include="..\Logger.cpp" />
<ClCompile Include="..\logic_bridge.cpp" />
@ -2111,12 +2109,8 @@
<ClCompile Include="..\MenuStyle_Radio.cpp" />
<ClCompile Include="..\MenuStyle_Valve.cpp" />
<ClCompile Include="..\MenuVoting.cpp" />
<ClCompile Include="..\NativeInvoker.cpp" />
<ClCompile Include="..\NativeOwner.cpp" />
<ClCompile Include="..\NextMap.cpp" />
<ClCompile Include="..\PlayerManager.cpp" />
<ClCompile Include="..\PluginSys.cpp" />
<ClCompile Include="..\ShareSys.cpp" />
<ClCompile Include="..\smn_protobuf.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CrazyDebug - Alien Swarm|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='CrazyDebug - Bloody Good Time|Win32'">true</ExcludedFromBuild>
@ -2170,7 +2164,6 @@
<ClCompile Include="..\smn_database.cpp" />
<ClCompile Include="..\smn_entities.cpp" />
<ClCompile Include="..\smn_events.cpp" />
<ClCompile Include="..\smn_fakenatives.cpp" />
<ClCompile Include="..\smn_halflife.cpp" />
<ClCompile Include="..\smn_hudtext.cpp" />
<ClCompile Include="..\smn_keyvalues.cpp" />
@ -2308,11 +2301,9 @@
<ClInclude Include="..\CoreConfig.h" />
<ClInclude Include="..\Database.h" />
<ClInclude Include="..\EventManager.h" />
<ClInclude Include="..\ExtensionSys.h" />
<ClInclude Include="..\ForwardSys.h" />
<ClInclude Include="..\frame_hooks.h" />
<ClInclude Include="..\HalfLife2.h" />
<ClInclude Include="..\HandleSys.h" />
<ClInclude Include="..\LibrarySys.h" />
<ClInclude Include="..\Logger.h" />
<ClInclude Include="..\logic_bridge.h" />
@ -2321,12 +2312,8 @@
<ClInclude Include="..\MenuStyle_Radio.h" />
<ClInclude Include="..\MenuStyle_Valve.h" />
<ClInclude Include="..\MenuVoting.h" />
<ClInclude Include="..\NativeInvoker.h" />
<ClInclude Include="..\NativeOwner.h" />
<ClInclude Include="..\NextMap.h" />
<ClInclude Include="..\PlayerManager.h" />
<ClInclude Include="..\PluginSys.h" />
<ClInclude Include="..\ShareSys.h" />
<ClInclude Include="..\sm_autonatives.h" />
<ClInclude Include="..\sm_fastlink.h" />
<ClInclude Include="..\sm_globals.h" />

View File

@ -69,9 +69,6 @@
<ClCompile Include="..\EventManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ExtensionSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ForwardSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -81,9 +78,6 @@
<ClCompile Include="..\HalfLife2.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\HandleSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\LibrarySys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -108,24 +102,12 @@
<ClCompile Include="..\MenuVoting.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NativeInvoker.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NativeOwner.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\NextMap.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\PlayerManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\PluginSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ShareSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\sm_autonatives.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -168,9 +150,6 @@
<ClCompile Include="..\smn_events.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_fakenatives.cpp">
<Filter>Natives</Filter>
</ClCompile>
<ClCompile Include="..\smn_halflife.cpp">
<Filter>Natives</Filter>
</ClCompile>
@ -251,9 +230,6 @@
<ClInclude Include="..\EventManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ExtensionSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ForwardSys.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -263,9 +239,6 @@
<ClInclude Include="..\HalfLife2.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\HandleSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\LibrarySys.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -290,24 +263,12 @@
<ClInclude Include="..\MenuVoting.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NativeInvoker.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NativeOwner.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\NextMap.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PlayerManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\PluginSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ShareSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\sm_autonatives.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -0,0 +1,95 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sourcemod_mm", "sourcemod_mm.vcxproj", "{E39527CD-7CAB-4420-97CC-DA1B93B260BC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CrazyDebug - Alien Swarm|Win32 = CrazyDebug - Alien Swarm|Win32
CrazyDebug - CS GO|Win32 = CrazyDebug - CS GO|Win32
CrazyDebug - Dark Messiah|Win32 = CrazyDebug - Dark Messiah|Win32
CrazyDebug - Episode 1|Win32 = CrazyDebug - Episode 1|Win32
CrazyDebug - Left 4 Dead 2|Win32 = CrazyDebug - Left 4 Dead 2|Win32
CrazyDebug - Left 4 Dead|Win32 = CrazyDebug - Left 4 Dead|Win32
CrazyDebug - Old Metamod|Win32 = CrazyDebug - Old Metamod|Win32
CrazyDebug - Orange Box Valve|Win32 = CrazyDebug - Orange Box Valve|Win32
CrazyDebug - Orange Box|Win32 = CrazyDebug - Orange Box|Win32
Debug - Alien Swarm|Win32 = Debug - Alien Swarm|Win32
Debug - CS GO|Win32 = Debug - CS GO|Win32
Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32
Debug - Episode 1|Win32 = Debug - Episode 1|Win32
Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32
Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32
Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32
Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32
Debug - Orange Box|Win32 = Debug - Orange Box|Win32
Release - Alien Swarm|Win32 = Release - Alien Swarm|Win32
Release - CS GO|Win32 = Release - CS GO|Win32
Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32
Release - Episode 1|Win32 = Release - Episode 1|Win32
Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32
Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32
Release - Old Metamod|Win32 = Release - Old Metamod|Win32
Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32
Release - Orange Box|Win32 = Release - Orange Box|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Alien Swarm|Win32.ActiveCfg = CrazyDebug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Alien Swarm|Win32.Build.0 = CrazyDebug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - CS GO|Win32.ActiveCfg = CrazyDebug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - CS GO|Win32.Build.0 = CrazyDebug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.ActiveCfg = CrazyDebug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Dark Messiah|Win32.Build.0 = CrazyDebug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.ActiveCfg = CrazyDebug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Episode 1|Win32.Build.0 = CrazyDebug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.ActiveCfg = CrazyDebug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead 2|Win32.Build.0 = CrazyDebug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.ActiveCfg = CrazyDebug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Left 4 Dead|Win32.Build.0 = CrazyDebug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.ActiveCfg = CrazyDebug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Old Metamod|Win32.Build.0 = CrazyDebug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.ActiveCfg = CrazyDebug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box Valve|Win32.Build.0 = CrazyDebug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.ActiveCfg = CrazyDebug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.CrazyDebug - Orange Box|Win32.Build.0 = CrazyDebug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Alien Swarm|Win32.ActiveCfg = Debug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Alien Swarm|Win32.Build.0 = Debug - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - CS GO|Win32.ActiveCfg = Debug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - CS GO|Win32.Build.0 = Debug - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.ActiveCfg = Debug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Episode 1|Win32.Build.0 = Debug - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.ActiveCfg = Debug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box Valve|Win32.Build.0 = Debug - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Alien Swarm|Win32.ActiveCfg = Release - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Alien Swarm|Win32.Build.0 = Release - Alien Swarm|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - CS GO|Win32.ActiveCfg = Release - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - CS GO|Win32.Build.0 = Release - CS GO|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.ActiveCfg = Release - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Episode 1|Win32.Build.0 = Release - Episode 1|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.ActiveCfg = Release - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box Valve|Win32.Build.0 = Release - Orange Box Valve|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32
{E39527CD-7CAB-4420-97CC-DA1B93B260BC}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

View File

@ -30,14 +30,9 @@
*/
#include "sm_autonatives.h"
#include "PluginSys.h"
#include "NativeOwner.h"
CNativeOwner g_CoreNatives;
CNativeOwner *g_pCoreNatives = &g_CoreNatives;
#include "logic_bridge.h"
void CoreNativesToAdd::OnSourceModAllInitialized()
{
g_CoreNatives.AddNatives(m_NativeList);
logicore.AddNatives(m_NativeList);
}

View File

@ -50,8 +50,4 @@ public:
sp_nativeinfo_t *m_NativeList;
};
class CNativeOwner;
extern CNativeOwner *g_pCoreNatives;
#endif //_INCLUDE_SOURCEMOD_CORE_AUTONATIVES_H_

View File

@ -32,10 +32,9 @@
#include "sm_srvcmds.h"
#include <sourcemod_version.h>
#include "sm_stringutil.h"
#include "HandleSys.h"
#include "CoreConfig.h"
#include "ConVarManager.h"
#include "ShareSys.h"
#include "logic_bridge.h"
RootConsoleMenu g_RootMenu;
@ -71,7 +70,7 @@ void RootConsoleMenu::OnSourceModStartup(bool late)
void RootConsoleMenu::OnSourceModAllInitialized()
{
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
}
void RootConsoleMenu::OnSourceModShutdown()
@ -406,14 +405,14 @@ CON_COMMAND(sm_dump_handles, "Dumps Handle usage to a file for finding Handle le
}
g_pHndlLog = fp;
g_HandleSys.Dump(write_handles_to_log);
logicore.DumpHandles(write_handles_to_log);
g_pHndlLog = NULL;
fclose(fp);
}
else
{
g_HandleSys.Dump(write_handles_to_game);
logicore.DumpHandles(write_handles_to_game);
}
}

View File

@ -34,7 +34,6 @@
#include "sourcemod.h"
#include <IRootConsoleMenu.h>
#include "PluginSys.h"
#include "sourcemm_api.h"
#include <sh_list.h>
#include <sh_string.h>

View File

@ -32,11 +32,12 @@
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
#include <ITextParsers.h>
#include "sm_stringutil.h"
#include "Logger.h"
#include "PluginSys.h"
#include "PlayerManager.h"
#include "logic_bridge.h"
#include "sourcemod.h"
#define LADJUST 0x00000004 /* left adjustment */
#define ZEROPAD 0x00000080 /* zero (as opposed to blank) pad */
@ -72,7 +73,7 @@ size_t Translate(char *buffer,
unsigned int langid;
*error = false;
Translation pTrans;
CPlugin *pl = (CPlugin *)g_PluginSys.FindPluginByContext(pCtx->GetContext());
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
unsigned int max_params = 0;
IPhraseCollection *pPhrases;

View File

@ -34,11 +34,12 @@
#ifndef USE_PROTOBUF_USERMESSAGES
#include "sourcemod.h"
#include "HandleSys.h"
#include <bitbuf.h>
#include <vector.h>
#include <HalfLife2.h>
#include "smn_usermsgs.h"
#include "sourcemod.h"
#include "logic_bridge.h"
static cell_t smn_BfWriteBool(IPluginContext *pCtx, const cell_t *params)
{
@ -50,7 +51,7 @@ static cell_t smn_BfWriteBool(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -71,7 +72,7 @@ static cell_t smn_BfWriteByte(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -92,7 +93,7 @@ static cell_t smn_BfWriteChar(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -113,7 +114,7 @@ static cell_t smn_BfWriteShort(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -134,7 +135,7 @@ static cell_t smn_BfWriteWord(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -155,7 +156,7 @@ static cell_t smn_BfWriteNum(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -176,7 +177,7 @@ static cell_t smn_BfWriteFloat(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -198,7 +199,7 @@ static cell_t smn_BfWriteString(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -226,7 +227,7 @@ static cell_t smn_BfWriteEntity(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -254,7 +255,7 @@ static cell_t smn_BfWriteAngle(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -275,7 +276,7 @@ static cell_t smn_BfWriteCoord(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -296,7 +297,7 @@ static cell_t smn_BfWriteVecCoord(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -320,7 +321,7 @@ static cell_t smn_BfWriteVecNormal(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -344,7 +345,7 @@ static cell_t smn_BfWriteAngles(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_WrBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -368,7 +369,7 @@ static cell_t smn_BfReadBool(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -387,7 +388,7 @@ static cell_t smn_BfReadByte(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -406,7 +407,7 @@ static cell_t smn_BfReadChar(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -425,7 +426,7 @@ static cell_t smn_BfReadShort(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -444,7 +445,7 @@ static cell_t smn_BfReadWord(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -463,7 +464,7 @@ static cell_t smn_BfReadNum(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -482,7 +483,7 @@ static cell_t smn_BfReadFloat(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -503,7 +504,7 @@ static cell_t smn_BfReadString(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -530,7 +531,7 @@ static cell_t smn_BfReadEntity(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -551,7 +552,7 @@ static cell_t smn_BfReadAngle(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -570,7 +571,7 @@ static cell_t smn_BfReadCoord(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -589,7 +590,7 @@ static cell_t smn_BfReadVecCoord(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -618,7 +619,7 @@ static cell_t smn_BfReadVecNormal(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -647,7 +648,7 @@ static cell_t smn_BfReadAngles(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);
@ -676,7 +677,7 @@ static cell_t smn_BfGetNumBytesLeft(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
if ((herr=handlesys->ReadHandle(hndl, g_RdBitBufType, &sec, (void **)&pBitBuf))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid bit buffer handle %x (error %d)", hndl, herr);

View File

@ -32,10 +32,8 @@
#include "sm_globals.h"
#include "HalfLife2.h"
#include "sourcemm_api.h"
#include "HandleSys.h"
#include "ConVarManager.h"
#include "ConCmdManager.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "PlayerManager.h"
#include "ChatTriggers.h"
@ -47,6 +45,7 @@
#include "Logger.h"
#include "ConsoleDetours.h"
#include "ConCommandBaseIterator.h"
#include "logic_bridge.h"
#if SOURCE_ENGINE == SE_CSGO || SOURCE_ENGINE == SE_DOTA
#include <netmessages.pb.h>
@ -88,13 +87,13 @@ public:
{
HandleAccess access;
g_HandleSys.InitAccessDefaults(NULL, &access);
handlesys->InitAccessDefaults(NULL, &access);
htConCmdIter = g_HandleSys.CreateType("ConCmdIter", this, 0, NULL, &access, g_pCoreIdent, NULL);
htConCmdIter = handlesys->CreateType("ConCmdIter", this, 0, NULL, &access, g_pCoreIdent, NULL);
access.access[HandleAccess_Clone] = HANDLE_RESTRICT_OWNER | HANDLE_RESTRICT_IDENTITY;
hCmdIterType = g_HandleSys.CreateType("CmdIter", this, 0, NULL, &access, g_pCoreIdent, NULL);
hCmdIterType = handlesys->CreateType("CmdIter", this, 0, NULL, &access, g_pCoreIdent, NULL);
}
virtual void OnHandleDestroy(HandleType_t type, void *object)
{
@ -726,7 +725,7 @@ static cell_t sm_RegConsoleCmd(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
}
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
const char *group = pPlugin->GetFilename();
if (!g_ConCmds.AddAdminCommand(pFunction, name, group, 0, help, params[4]))
{
@ -757,7 +756,7 @@ static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
if (group[0] == '\0')
{
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
group = pPlugin->GetFilename();
}
@ -1211,7 +1210,7 @@ static cell_t GetCommandIterator(IPluginContext *pContext, const cell_t *params)
GlobCmdIter *iter = new GlobCmdIter;
iter->started = false;
Handle_t hndl = g_HandleSys.CreateHandle(hCmdIterType, iter, pContext->GetIdentity(), g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(hCmdIterType, iter, pContext->GetIdentity(), g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
delete iter;
@ -1226,7 +1225,7 @@ static cell_t ReadCommandIterator(IPluginContext *pContext, const cell_t *params
HandleError err;
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
if ((err = g_HandleSys.ReadHandle(params[1], hCmdIterType, &sec, (void **)&iter))
if ((err = handlesys->ReadHandle(params[1], hCmdIterType, &sec, (void **)&iter))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid GlobCmdIter Handle %x", params[1]);
@ -1365,7 +1364,7 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
pContext->StringToLocalUTF8(params[5], params[6], (desc && desc[0]) ? desc : "", NULL);
}
if ((hndl = g_HandleSys.CreateHandle(htConCmdIter, pIter, pContext->GetIdentity(), g_pCoreIdent, NULL))
if ((hndl = handlesys->CreateHandle(htConCmdIter, pIter, pContext->GetIdentity(), g_pCoreIdent, NULL))
== BAD_HANDLE)
{
delete pIter;
@ -1384,7 +1383,7 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
const ConCommandBase *pConCmd;
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
if ((err = g_HandleSys.ReadHandle(params[1], htConCmdIter, &sec, (void **)&pIter)) != HandleError_None)
if ((err = handlesys->ReadHandle(params[1], htConCmdIter, &sec, (void **)&pIter)) != HandleError_None)
{
return pContext->ThrowNativeError("Invalid Handle %x (error %d)", params[1], err);
}

View File

@ -35,15 +35,13 @@
#include "sm_stringutil.h"
#include "sm_globals.h"
#include "sourcemod.h"
#include "PluginSys.h"
#include "HandleSys.h"
#include "LibrarySys.h"
#include "TimerSys.h"
#include "ForwardSys.h"
#include "Logger.h"
#include "ExtensionSys.h"
#include <sm_trie_tpl.h>
#include <sh_memory.h>
#include "logic_bridge.h"
#if defined PLATFORM_WINDOWS
#include <windows.h>
@ -65,10 +63,10 @@ public:
void OnSourceModAllInitialized()
{
HandleAccess hacc;
g_HandleSys.InitAccessDefaults(NULL, &hacc);
handlesys->InitAccessDefaults(NULL, &hacc);
hacc.access[HandleAccess_Clone] = HANDLE_RESTRICT_IDENTITY|HANDLE_RESTRICT_OWNER;
g_PlIter = g_HandleSys.CreateType("PluginIterator", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_PlIter = handlesys->CreateType("PluginIterator", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_OnLogAction = g_Forwards.CreateForward("OnLogAction",
ET_Hook,
@ -88,7 +86,7 @@ public:
void OnSourceModShutdown()
{
g_Forwards.ReleaseForward(g_OnLogAction);
g_HandleSys.RemoveType(g_PlIter, g_pCoreIdent);
handlesys->RemoveType(g_PlIter, g_pCoreIdent);
}
} g_CoreNativeHelpers;
@ -114,7 +112,7 @@ void LogAction(Handle_t hndl, int type, int client, int target, const char *mess
if (type == 2)
{
HandleError err;
IPlugin *pPlugin = g_PluginSys.PluginFromHandle(hndl, &err);
IPlugin *pPlugin = scripts->FindPluginByHandle(hndl, &err);
if (pPlugin)
{
logtag = pPlugin->GetFilename();
@ -197,9 +195,9 @@ static cell_t FormatTime(IPluginContext *pContext, const cell_t *params)
static cell_t GetPluginIterator(IPluginContext *pContext, const cell_t *params)
{
IPluginIterator *iter = g_PluginSys.GetPluginIterator();
IPluginIterator *iter = scripts->GetPluginIterator();
Handle_t hndl = g_HandleSys.CreateHandle(g_PlIter, iter, pContext->GetIdentity(), g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(g_PlIter, iter, pContext->GetIdentity(), g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
@ -219,7 +217,7 @@ static cell_t MorePlugins(IPluginContext *pContext, const cell_t *params)
sec.pIdentity = g_pCoreIdent;
sec.pOwner = pContext->GetIdentity();
if ((err=g_HandleSys.ReadHandle(hndl, g_PlIter, &sec, (void **)&pIter)) != HandleError_None)
if ((err=handlesys->ReadHandle(hndl, g_PlIter, &sec, (void **)&pIter)) != HandleError_None)
{
return pContext->ThrowNativeError("Could not read Handle %x (error %d)", hndl, err);
}
@ -237,12 +235,12 @@ static cell_t ReadPlugin(IPluginContext *pContext, const cell_t *params)
sec.pIdentity = g_pCoreIdent;
sec.pOwner = pContext->GetIdentity();
if ((err=g_HandleSys.ReadHandle(hndl, g_PlIter, &sec, (void **)&pIter)) != HandleError_None)
if ((err=handlesys->ReadHandle(hndl, g_PlIter, &sec, (void **)&pIter)) != HandleError_None)
{
return pContext->ThrowNativeError("Could not read Handle %x (error %d)", hndl, err);
}
CPlugin *pPlugin = (CPlugin *)pIter->GetPlugin();
IPlugin *pPlugin = pIter->GetPlugin();
if (!pPlugin)
{
return BAD_HANDLE;
@ -253,14 +251,14 @@ static cell_t ReadPlugin(IPluginContext *pContext, const cell_t *params)
return pPlugin->GetMyHandle();
}
CPlugin *GetPluginFromHandle(IPluginContext *pContext, Handle_t hndl)
IPlugin *GetPluginFromHandle(IPluginContext *pContext, Handle_t hndl)
{
if (hndl == BAD_HANDLE)
{
return g_PluginSys.GetPluginByCtx(pContext->GetContext());
return scripts->FindPluginByContext(pContext->GetContext());
} else {
HandleError err;
CPlugin *pPlugin = (CPlugin *)g_PluginSys.PluginFromHandle(hndl, &err);
IPlugin *pPlugin = scripts->FindPluginByHandle(hndl, &err);
if (!pPlugin)
{
pContext->ThrowNativeError("Could not read Handle %x (error %d)", hndl, err);
@ -271,7 +269,7 @@ CPlugin *GetPluginFromHandle(IPluginContext *pContext, Handle_t hndl)
static cell_t GetPluginStatus(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
IPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
if (!pPlugin)
{
return 0;
@ -282,7 +280,7 @@ static cell_t GetPluginStatus(IPluginContext *pContext, const cell_t *params)
static cell_t GetPluginFilename(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
IPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
if (!pPlugin)
{
return 0;
@ -295,7 +293,7 @@ static cell_t GetPluginFilename(IPluginContext *pContext, const cell_t *params)
static cell_t IsPluginDebugging(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
IPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
if (!pPlugin)
{
return 0;
@ -316,7 +314,7 @@ enum PluginInfo
static cell_t GetPluginInfo(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
IPlugin *pPlugin = GetPluginFromHandle(pContext, params[1]);
if (!pPlugin)
{
return 0;
@ -373,10 +371,10 @@ static cell_t GetPluginInfo(IPluginContext *pContext, const cell_t *params)
static cell_t SetFailState(IPluginContext *pContext, const cell_t *params)
{
char *str;
CPlugin *pPlugin;
SMPlugin *pPlugin;
pContext->LocalToString(params[1], &str);
pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
pPlugin = scripts->FindPluginByContext(pContext->GetContext());
if (params[0] == 1)
{
@ -425,7 +423,7 @@ static cell_t GetSysTickCount(IPluginContext *pContext, const cell_t *params)
static cell_t AutoExecConfig(IPluginContext *pContext, const cell_t *params)
{
CPlugin *plugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
SMPlugin *plugin = scripts->FindPluginByContext(pContext->GetContext());
char *cfg, *folder;
pContext->LocalToString(params[2], &cfg);
@ -476,12 +474,11 @@ static cell_t MarkNativeAsOptional(IPluginContext *pContext, const cell_t *param
static cell_t RegPluginLibrary(IPluginContext *pContext, const cell_t *params)
{
char *name;
CPlugin *pl = g_PluginSys.GetPluginByCtx(pContext->GetContext());
SMPlugin *pl = scripts->FindPluginByContext(pContext->GetContext());
pContext->LocalToString(params[1], &name);
pl->AddLibrary(name);
return 1;
}
@ -495,12 +492,12 @@ static cell_t LibraryExists(IPluginContext *pContext, const cell_t *params)
return 1;
}
if (g_PluginSys.LibraryExists(str))
if (scripts->LibraryExists(str))
{
return 1;
}
if (g_Extensions.LibraryExists(str))
if (extsys->LibraryExists(str))
{
return 1;
}
@ -519,7 +516,7 @@ static cell_t sm_LogAction(IPluginContext *pContext, const cell_t *params)
return 0;
}
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
LogAction(pPlugin->GetMyHandle(), 2, params[1], params[2], buffer);
@ -550,7 +547,7 @@ static cell_t LogToFile(IPluginContext *pContext, const cell_t *params)
return 0;
}
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
g_Logger.LogToOpenFile(fp, "[%s] %s", pPlugin->GetFilename(), buffer);
@ -595,7 +592,7 @@ static cell_t GetExtensionFileStatus(IPluginContext *pContext, const cell_t *par
char *str;
pContext->LocalToString(params[1], &str);
IExtension *pExtension = g_Extensions.FindExtensionByFile(str);
IExtension *pExtension = extsys->FindExtensionByFile(str);
if (!pExtension)
{
@ -619,7 +616,7 @@ static cell_t GetExtensionFileStatus(IPluginContext *pContext, const cell_t *par
static cell_t FindPluginByNumber(IPluginContext *pContext, const cell_t *params)
{
CPlugin *pPlugin = g_PluginSys.GetPluginByOrder(params[1]);
IPlugin *pPlugin = scripts->FindPluginByOrder(params[1]);
if (pPlugin == NULL)
{
@ -641,7 +638,7 @@ static cell_t GetFeatureStatus(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[2], &name);
return g_ShareSys.TestFeature(pContext->GetRuntime(),type, name);
return sharesys->TestFeature(pContext->GetRuntime(), type, name);
}
static cell_t RequireFeature(IPluginContext *pContext, const cell_t *params)
@ -651,12 +648,12 @@ static cell_t RequireFeature(IPluginContext *pContext, const cell_t *params)
pContext->LocalToString(params[2], &name);
if (g_ShareSys.TestFeature(pContext->GetRuntime(),type, name) != FeatureStatus_Available)
if (sharesys->TestFeature(pContext->GetRuntime(), type, name) != FeatureStatus_Available)
{
char buffer[255];
char *msg = buffer;
char default_message[255];
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
SMPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 3);
if (pContext->GetLastNativeError() != SP_ERROR_NONE || buffer[0] == '\0')

View File

@ -30,11 +30,11 @@
*/
#include "sm_globals.h"
#include "HandleSys.h"
#include "Database.h"
#include "ExtensionSys.h"
#include "PluginSys.h"
#include "sm_stringutil.h"
#include "logic_bridge.h"
#include "KeyValues.h"
#include "sourcemod.h"
HandleType_t hStmtType;
@ -55,22 +55,22 @@ public:
HandleAccess acc;
/* Disable cloning */
g_HandleSys.InitAccessDefaults(NULL, &acc);
handlesys->InitAccessDefaults(NULL, &acc);
acc.access[HandleAccess_Clone] = HANDLE_RESTRICT_OWNER|HANDLE_RESTRICT_IDENTITY;
TypeAccess tacc;
g_HandleSys.InitAccessDefaults(&tacc, NULL);
handlesys->InitAccessDefaults(&tacc, NULL);
tacc.ident = g_pCoreIdent;
hCombinedQueryType = g_HandleSys.CreateType("IQuery", this, 0, &tacc, &acc, g_pCoreIdent, NULL);
hStmtType = g_HandleSys.CreateType("IPreparedQuery", this, 0, &tacc, &acc, g_pCoreIdent, NULL);
hCombinedQueryType = handlesys->CreateType("IQuery", this, 0, &tacc, &acc, g_pCoreIdent, NULL);
hStmtType = handlesys->CreateType("IPreparedQuery", this, 0, &tacc, &acc, g_pCoreIdent, NULL);
}
virtual void OnSourceModShutdown()
{
g_HandleSys.RemoveType(hStmtType, g_pCoreIdent);
g_HandleSys.RemoveType(hCombinedQueryType, g_pCoreIdent);
handlesys->RemoveType(hStmtType, g_pCoreIdent);
handlesys->RemoveType(hCombinedQueryType, g_pCoreIdent);
}
virtual void OnHandleDestroy(HandleType_t type, void *object)
@ -97,9 +97,9 @@ inline HandleError ReadQueryHndl(Handle_t hndl, IPluginContext *pContext, IQuery
HandleError ret;
if ((ret = g_HandleSys.ReadHandle(hndl, hStmtType, &sec, (void **)query)) != HandleError_None)
if ((ret = handlesys->ReadHandle(hndl, hStmtType, &sec, (void **)query)) != HandleError_None)
{
ret = g_HandleSys.ReadHandle(hndl, hCombinedQueryType, &sec, (void **)&c);
ret = handlesys->ReadHandle(hndl, hCombinedQueryType, &sec, (void **)&c);
if (ret == HandleError_None)
{
*query = c->query;
@ -115,7 +115,7 @@ inline HandleError ReadQueryAndDbHndl(Handle_t hndl, IPluginContext *pContext, I
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
HandleError ret = g_HandleSys.ReadHandle(hndl, hCombinedQueryType, &sec, (void **)&c);
HandleError ret = handlesys->ReadHandle(hndl, hCombinedQueryType, &sec, (void **)&c);
if (ret == HandleError_None)
{
*query = c->query;
@ -130,7 +130,7 @@ inline HandleError ReadStmtHndl(Handle_t hndl, IPluginContext *pContext, IPrepar
sec.pOwner = pContext->GetIdentity();
sec.pIdentity = g_pCoreIdent;
return g_HandleSys.ReadHandle(hndl, hStmtType, &sec, (void **)query);
return handlesys->ReadHandle(hndl, hStmtType, &sec, (void **)query);
}
inline HandleError ReadDbOrStmtHndl(Handle_t hndl, IPluginContext *pContext, IDatabase **db, IPreparedQuery **query)
@ -149,7 +149,7 @@ class TQueryOp : public IDBThreadOperation
public:
TQueryOp(IDatabase *db, IPluginFunction *pf, const char *query, cell_t data) :
m_pDatabase(db), m_pFunction(pf), m_Query(query), m_Data(data),
me(g_PluginSys.GetPluginByCtx(pf->GetParentContext()->GetContext())),
me(scripts->FindPluginByContext(pf->GetParentContext()->GetContext())),
m_pQuery(NULL)
{
/* We always increase the reference count because this is potentially
@ -163,9 +163,9 @@ public:
*/
HandleSecurity sec(me->GetIdentity(), g_pCoreIdent);
HandleAccess access;
g_HandleSys.InitAccessDefaults(NULL, &access);
handlesys->InitAccessDefaults(NULL, &access);
access.access[HandleAccess_Delete] = HANDLE_RESTRICT_IDENTITY|HANDLE_RESTRICT_OWNER;
m_MyHandle = g_HandleSys.CreateHandleEx(g_DBMan.GetDatabaseType(),
m_MyHandle = handlesys->CreateHandleEx(g_DBMan.GetDatabaseType(),
db,
&sec,
&access,
@ -182,7 +182,7 @@ public:
if (m_MyHandle != BAD_HANDLE)
{
HandleSecurity sec(me->GetIdentity(), g_pCoreIdent);
g_HandleSys.FreeHandle(m_MyHandle, &sec);
handlesys->FreeHandle(m_MyHandle, &sec);
} else {
/* Otherwise, there is an open ref to the db */
m_pDatabase->Close();
@ -219,7 +219,7 @@ public:
/* Create a Handle for our query */
HandleSecurity sec(me->GetIdentity(), g_pCoreIdent);
HandleAccess access;
g_HandleSys.InitAccessDefaults(NULL, &access);
handlesys->InitAccessDefaults(NULL, &access);
access.access[HandleAccess_Delete] = HANDLE_RESTRICT_IDENTITY|HANDLE_RESTRICT_OWNER;
Handle_t qh = BAD_HANDLE;
@ -230,7 +230,7 @@ public:
c->query = m_pQuery;
c->db = m_pDatabase;
qh = g_HandleSys.CreateHandle(hCombinedQueryType, c, me->GetIdentity(), g_pCoreIdent, NULL);
qh = handlesys->CreateHandle(hCombinedQueryType, c, me->GetIdentity(), g_pCoreIdent, NULL);
if (qh != BAD_HANDLE)
{
m_pQuery = NULL;
@ -248,7 +248,7 @@ public:
if (qh != BAD_HANDLE)
{
g_HandleSys.FreeHandle(qh, &sec);
handlesys->FreeHandle(qh, &sec);
}
}
void Destroy()
@ -260,7 +260,7 @@ private:
IPluginFunction *m_pFunction;
String m_Query;
cell_t m_Data;
CPlugin *me;
IPlugin *me;
IQuery *m_pQuery;
char error[255];
Handle_t m_MyHandle;
@ -277,7 +277,7 @@ public:
m_Data = data;
error[0] = '\0';
strncopy(dbname, _dbname, sizeof(dbname));
me = g_PluginSys.GetPluginByCtx(m_pFunction->GetParentContext()->GetContext());
me = scripts->FindPluginByContext(m_pFunction->GetParentContext()->GetContext());
}
IdentityToken_t *GetOwner()
{
@ -336,7 +336,7 @@ public:
delete this;
}
private:
CPlugin *me;
IPlugin *me;
IPluginFunction *m_pFunction;
IDBDriver *m_pDriver;
IDatabase *m_pDatabase;
@ -369,10 +369,10 @@ static cell_t SQL_Connect(IPluginContext *pContext, const cell_t *params)
}
/* HACK! Add us to the dependency list */
CExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
IExtension *pExt = extsys->GetExtensionFromIdent(driver->GetIdentity());
if (pExt)
{
g_Extensions.BindChildPlugin(pExt, g_PluginSys.GetPluginByCtx(pContext->GetContext()));
extsys->BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
}
return hndl;
@ -427,15 +427,15 @@ static cell_t SQL_TConnect(IPluginContext *pContext, const cell_t *params)
}
/* HACK! Add us to the dependency list */
CExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
IExtension *pExt = extsys->GetExtensionFromIdent(driver->GetIdentity());
if (pExt)
{
g_Extensions.BindChildPlugin(pExt, g_PluginSys.GetPluginByCtx(pContext->GetContext()));
extsys->BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
}
/* Finally, add to the thread if we can */
TConnectOp *op = new TConnectOp(pf, driver, conf, params[3]);
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
if (pPlugin->GetProperty("DisallowDBThreads", NULL)
|| !g_DBMan.AddToThreadQueue(op, PrioQueue_High))
{
@ -498,10 +498,10 @@ static cell_t SQL_ConnectEx(IPluginContext *pContext, const cell_t *params)
}
/* HACK! Add us to the dependency list */
CExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
IExtension *pExt = extsys->GetExtensionFromIdent(driver->GetIdentity());
if (pExt)
{
g_Extensions.BindChildPlugin(pExt, g_PluginSys.GetPluginByCtx(pContext->GetContext()));
extsys->BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
}
return hndl;
@ -741,7 +741,7 @@ static cell_t SQL_Query(IPluginContext *pContext, const cell_t *params)
CombinedQuery *c = new CombinedQuery;
c->query = qr;
c->db = db;
Handle_t hndl = g_HandleSys.CreateHandle(hCombinedQueryType, c, pContext->GetIdentity(), g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(hCombinedQueryType, c, pContext->GetIdentity(), g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
qr->Destroy();
@ -786,7 +786,7 @@ static cell_t SQL_TQuery(IPluginContext *pContext, const cell_t *params)
level = PrioQueue_Low;
}
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
TQueryOp *op = new TQueryOp(db, pf, query, data);
if (pPlugin->GetProperty("DisallowDBThreads", NULL)
@ -856,7 +856,7 @@ static cell_t SQL_PrepareQuery(IPluginContext *pContext, const cell_t *params)
return BAD_HANDLE;
}
Handle_t hndl = g_HandleSys.CreateHandle(hStmtType, qr, pContext->GetIdentity(), g_pCoreIdent, NULL);
Handle_t hndl = handlesys->CreateHandle(hStmtType, qr, pContext->GetIdentity(), g_pCoreIdent, NULL);
if (hndl == BAD_HANDLE)
{
qr->Destroy();
@ -1398,10 +1398,10 @@ static cell_t SQL_ConnectCustom(IPluginContext *pContext, const cell_t *params)
}
/* HACK! Add us to the dependency list */
CExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
IExtension *pExt = extsys->GetExtensionFromIdent(driver->GetIdentity());
if (pExt)
{
g_Extensions.BindChildPlugin(pExt, g_PluginSys.GetPluginByCtx(pContext->GetContext()));
extsys->BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
}
return hndl;

View File

@ -31,8 +31,8 @@
#include "sm_globals.h"
#include "sourcemm_api.h"
#include "HandleSys.h"
#include "EventManager.h"
#include "logic_bridge.h"
static cell_t sm_HookEvent(IPluginContext *pContext, const cell_t *params)
{
@ -113,7 +113,7 @@ static cell_t sm_CreateEvent(IPluginContext *pContext, const cell_t *params)
if (pInfo)
{
return g_HandleSys.CreateHandle(g_EventManager.GetHandleType(), pInfo, pContext->GetIdentity(), g_pCoreIdent, NULL);
return handlesys->CreateHandle(g_EventManager.GetHandleType(), pInfo, pContext->GetIdentity(), g_pCoreIdent, NULL);
}
return BAD_HANDLE;
@ -125,7 +125,7 @@ static cell_t sm_FireEvent(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -141,7 +141,7 @@ static cell_t sm_FireEvent(IPluginContext *pContext, const cell_t *params)
/* Free handle on game event */
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
return 1;
}
@ -152,7 +152,7 @@ static cell_t sm_CancelCreatedEvent(IPluginContext *pContext, const cell_t *para
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -168,7 +168,7 @@ static cell_t sm_CancelCreatedEvent(IPluginContext *pContext, const cell_t *para
/* Free handle on game event */
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
return 1;
}
@ -179,7 +179,7 @@ static cell_t sm_GetEventName(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -196,7 +196,7 @@ static cell_t sm_GetEventBool(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -214,7 +214,7 @@ static cell_t sm_GetEventInt(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -232,7 +232,7 @@ static cell_t sm_GetEventFloat(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -252,7 +252,7 @@ static cell_t sm_GetEventString(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -272,7 +272,7 @@ static cell_t sm_SetEventBool(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -292,7 +292,7 @@ static cell_t sm_SetEventInt(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -312,7 +312,7 @@ static cell_t sm_SetEventFloat(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -333,7 +333,7 @@ static cell_t sm_SetEventString(IPluginContext *pContext, const cell_t *params)
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);
@ -354,7 +354,7 @@ static cell_t sm_SetEventBroadcast(IPluginContext *pContext, const cell_t *param
HandleError err;
EventInfo *pInfo;
if ((err=g_HandleSys.ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
if ((err=handlesys->ReadHandle(hndl, g_EventManager.GetHandleType(), NULL, (void **)&pInfo))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid game event handle %x (error %d)", hndl, err);

View File

@ -32,7 +32,6 @@
#include "sm_globals.h"
#include "sourcemod.h"
#include "sourcemm_api.h"
#include "HandleSys.h"
#include "PlayerManager.h"
#include "HalfLife2.h"

View File

@ -34,8 +34,8 @@
#include "UserMessages.h"
#include "TimerSys.h"
#include "PlayerManager.h"
#include "HandleSys.h"
#include "logic_bridge.h"
#include "sourcemod.h"
#if SOURCE_ENGINE == SE_DOTA
#include <game/shared/protobuf/usermessages.pb.h>
@ -101,7 +101,7 @@ public:
}
m_PlayerHuds = new player_chaninfo_t[256+1];
m_hHudSyncObj = g_HandleSys.CreateType("HudSyncObj", this, 0, NULL, NULL, g_pCoreIdent, NULL);
m_hHudSyncObj = handlesys->CreateType("HudSyncObj", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_Players.AddClientListener(this);
}
@ -114,7 +114,7 @@ public:
}
delete [] m_PlayerHuds;
g_HandleSys.RemoveType(m_hHudSyncObj, g_pCoreIdent);
handlesys->RemoveType(m_hHudSyncObj, g_pCoreIdent);
g_Players.RemoveClientListener(this);
}
@ -154,7 +154,7 @@ public:
sec = HandleSecurity(pIdent, g_pCoreIdent);
if ((hndl = g_HandleSys.CreateHandleEx(m_hHudSyncObj, obj, &sec, NULL, &err))
if ((hndl = handlesys->CreateHandleEx(m_hHudSyncObj, obj, &sec, NULL, &err))
== BAD_HANDLE)
{
delete obj;
@ -168,7 +168,7 @@ public:
hud_syncobj_t **pObj)
{
HandleSecurity sec(pOwner, g_pCoreIdent);
return g_HandleSys.ReadHandle(hndl, m_hHudSyncObj, &sec, (void **)pObj);
return handlesys->ReadHandle(hndl, m_hHudSyncObj, &sec, (void **)pObj);
}
unsigned int AutoSelectChannel(unsigned int client)

View File

@ -32,10 +32,10 @@
#include "sourcemod.h"
#include "sourcemm_api.h"
#include "sm_stringutil.h"
#include "HandleSys.h"
#include "HalfLife2.h"
#include <KeyValues.h>
#include "utlbuffer.h"
#include "logic_bridge.h"
HandleType_t g_KeyValueType;
@ -52,11 +52,11 @@ class KeyValueNatives :
public:
void OnSourceModAllInitialized()
{
g_KeyValueType = g_HandleSys.CreateType("KeyValues", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_KeyValueType = handlesys->CreateType("KeyValues", this, 0, NULL, NULL, g_pCoreIdent, NULL);
}
void OnSourceModShutdown()
{
g_HandleSys.RemoveType(g_KeyValueType, g_pCoreIdent);
handlesys->RemoveType(g_KeyValueType, g_pCoreIdent);
g_KeyValueType = 0;
}
void OnHandleDestroy(HandleType_t type, void *object)
@ -100,7 +100,7 @@ KeyValues *SourceModBase::ReadKeyValuesHandle(Handle_t hndl, HandleError *err, b
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
if (err)
@ -128,7 +128,7 @@ static cell_t smn_KvSetString(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -153,7 +153,7 @@ static cell_t smn_KvSetNum(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -177,7 +177,7 @@ static cell_t smn_KvSetUInt64(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -205,7 +205,7 @@ static cell_t smn_KvSetFloat(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -229,7 +229,7 @@ static cell_t smn_KvSetColor(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -254,7 +254,7 @@ static cell_t smn_KvSetVector(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -283,7 +283,7 @@ static cell_t smn_KvGetString(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -310,7 +310,7 @@ static cell_t smn_KvGetNum(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -335,7 +335,7 @@ static cell_t smn_KvGetFloat(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -360,7 +360,7 @@ static cell_t smn_KvGetColor(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -394,7 +394,7 @@ static cell_t smn_KvGetUInt64(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -423,7 +423,7 @@ static cell_t smn_KvGetVector(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -501,7 +501,7 @@ static cell_t smn_CreateKeyValues(IPluginContext *pCtx, const cell_t *params)
pStk->pBase = new KeyValues(name, is_empty ? NULL : firstkey, (is_empty||(firstvalue[0]=='\0')) ? NULL : firstvalue);
pStk->pCurRoot.push(pStk->pBase);
return g_HandleSys.CreateHandle(g_KeyValueType, pStk, pCtx->GetIdentity(), g_pCoreIdent, NULL);
return handlesys->CreateHandle(g_KeyValueType, pStk, pCtx->GetIdentity(), g_pCoreIdent, NULL);
}
static cell_t smn_KvJumpToKey(IPluginContext *pCtx, const cell_t *params)
@ -515,7 +515,7 @@ static cell_t smn_KvJumpToKey(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -544,7 +544,7 @@ static cell_t smn_KvJumpToKeySymbol(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -571,7 +571,7 @@ static cell_t smn_KvGotoFirstSubKey(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -605,7 +605,7 @@ static cell_t smn_KvGotoNextKey(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -638,7 +638,7 @@ static cell_t smn_KvGoBack(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -663,7 +663,7 @@ static cell_t smn_KvRewind(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -687,7 +687,7 @@ static cell_t smn_KvGetSectionName(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -715,7 +715,7 @@ static cell_t smn_KvSetSectionName(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -740,7 +740,7 @@ static cell_t smn_KvGetDataType(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -762,7 +762,7 @@ static cell_t smn_KeyValuesToFile(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -785,7 +785,7 @@ static cell_t smn_FileToKeyValues(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -807,7 +807,7 @@ static cell_t smn_KvSetEscapeSequences(IPluginContext *pCtx, const cell_t *param
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -828,7 +828,7 @@ static cell_t smn_KvNodesInStack(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -847,7 +847,7 @@ static cell_t smn_KvDeleteThis(IPluginContext *pContext, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -901,7 +901,7 @@ static cell_t smn_KvDeleteKey(IPluginContext *pContext, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -938,7 +938,7 @@ static cell_t smn_KvSavePosition(IPluginContext *pContext, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -966,12 +966,12 @@ static cell_t smn_CopySubkeys(IPluginContext *pContext, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl_copied, g_KeyValueType, &sec, (void **)&pStk_copied))
if ((herr=handlesys->ReadHandle(hndl_copied, g_KeyValueType, &sec, (void **)&pStk_copied))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid key value handle %x (error %d)", hndl_copied, herr);
}
if ((herr=g_HandleSys.ReadHandle(hndl_parent, g_KeyValueType, &sec, (void **)&pStk_parent))
if ((herr=handlesys->ReadHandle(hndl_parent, g_KeyValueType, &sec, (void **)&pStk_parent))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid key value handle %x (error %d)", hndl_parent, herr);
@ -994,7 +994,7 @@ static cell_t smn_GetNameSymbol(IPluginContext *pContext, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -1028,7 +1028,7 @@ static cell_t smn_FindKeyById(IPluginContext *pContext, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);
@ -1056,7 +1056,7 @@ static cell_t smn_KvGetSectionSymbol(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = NULL;
sec.pIdentity = g_pCoreIdent;
if ((herr=g_HandleSys.ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
if ((herr=handlesys->ReadHandle(hndl, g_KeyValueType, &sec, (void **)&pStk))
!= HandleError_None)
{
return pCtx->ThrowNativeError("Invalid key value handle %x (error %d)", hndl, herr);

View File

@ -34,8 +34,6 @@
#include "MenuManager.h"
#include "MenuStyle_Valve.h"
#include "MenuStyle_Radio.h"
#include "HandleSys.h"
#include "PluginSys.h"
#include "PlayerManager.h"
#include "sm_stringutil.h"
#include "sourcemm_api.h"
@ -44,6 +42,7 @@
#endif
#include "ChatTriggers.h"
#include "logic_bridge.h"
#include "sourcemod.h"
#if defined CreateMenu
#undef CreateMenu
@ -126,15 +125,16 @@ class MenuNativeHelpers :
public:
virtual void OnSourceModAllInitialized()
{
m_PanelType = g_HandleSys.CreateType("IMenuPanel", this, 0, NULL, NULL, g_pCoreIdent, NULL);
m_TempPanelType = g_HandleSys.CreateType("TempIMenuPanel", this, m_PanelType, NULL, NULL, g_pCoreIdent, NULL);
g_PluginSys.AddPluginsListener(this);
m_PanelType = handlesys->CreateType("IMenuPanel", this, 0, NULL, NULL, g_pCoreIdent, NULL);
m_TempPanelType = handlesys->CreateType("TempIMenuPanel", this, m_PanelType, NULL, NULL, g_pCoreIdent, NULL);
scripts->AddPluginsListener(this);
}
virtual void OnSourceModShutdown()
{
g_HandleSys.RemoveType(m_TempPanelType, g_pCoreIdent);
g_HandleSys.RemoveType(m_PanelType, g_pCoreIdent);
scripts->RemovePluginsListener(this);
handlesys->RemoveType(m_TempPanelType, g_pCoreIdent);
handlesys->RemoveType(m_PanelType, g_pCoreIdent);
while (!m_FreePanelHandlers.empty())
{
@ -208,7 +208,7 @@ public:
m_FreePanelHandlers.pop();
}
handler->m_pFunc = pFunction;
handler->m_pPlugin = g_PluginSys.GetPluginByCtx(pFunction->GetParentContext()->GetContext());
handler->m_pPlugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
return handler;
}
@ -311,14 +311,14 @@ void CMenuHandler::OnMenuDisplay(IBaseMenu *menu, int client, IMenuPanel *panel)
sec.pOwner = m_pBasic->GetParentContext()->GetIdentity();
HandleAccess access;
g_HandleSys.InitAccessDefaults(NULL, &access);
handlesys->InitAccessDefaults(NULL, &access);
access.access[HandleAccess_Delete] = HANDLE_RESTRICT_IDENTITY|HANDLE_RESTRICT_OWNER;
Handle_t hndl = g_HandleSys.CreateHandleEx(g_MenuHelpers.GetTempPanelType(), panel, &sec, &access, NULL);
Handle_t hndl = handlesys->CreateHandleEx(g_MenuHelpers.GetTempPanelType(), panel, &sec, &access, NULL);
DoAction(menu, MenuAction_Display, client, hndl);
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
}
}
@ -570,7 +570,7 @@ bool CMenuHandler::OnSetHandlerOption(const char *option, const void *data)
inline Handle_t MakePanelHandle(IMenuPanel *panel, IPluginContext *pContext)
{
return g_HandleSys.CreateHandle(g_MenuHelpers.GetPanelType(), panel, pContext->GetIdentity(), g_pCoreIdent, NULL);
return handlesys->CreateHandle(g_MenuHelpers.GetPanelType(), panel, pContext->GetIdentity(), g_pCoreIdent, NULL);
}
inline HandleError ReadPanelHandle(Handle_t hndl, IMenuPanel **panel)
@ -578,7 +578,7 @@ inline HandleError ReadPanelHandle(Handle_t hndl, IMenuPanel **panel)
HandleSecurity sec;
sec.pIdentity = g_pCoreIdent;
sec.pOwner = NULL;
return g_HandleSys.ReadHandle(hndl, g_MenuHelpers.GetPanelType(), &sec, (void **)panel);
return handlesys->ReadHandle(hndl, g_MenuHelpers.GetPanelType(), &sec, (void **)panel);
}
inline IMenuStyle *GetStyleFromCell(cell_t cell)

View File

@ -47,7 +47,7 @@
sec.pOwner = NULL; \
sec.pIdentity = g_pCoreIdent; \
\
if ((herr=g_HandleSys.ReadHandle(hndl, g_ProtobufType, &sec, (void **)&msg)) \
if ((herr=handlesys->ReadHandle(hndl, g_ProtobufType, &sec, (void **)&msg)) \
!= HandleError_None) \
{ \
return pCtx->ThrowNativeError("Invalid protobuf message handle %x (error %d)", hndl, herr); \
@ -872,7 +872,7 @@ static cell_t smn_PbReadMessage(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Invalid field \"%s\" for message \"%s\"", strField, msg->GetProtobufMessage()->GetTypeName().c_str());
}
Handle_t outHndl = g_HandleSys.CreateHandle(g_ProtobufType, new SMProtobufMessage(innerMsg), NULL, g_pCoreIdent, NULL);
Handle_t outHndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(innerMsg), NULL, g_pCoreIdent, NULL);
msg->AddChildHandle(outHndl);
return outHndl;
@ -889,7 +889,7 @@ static cell_t smn_PbReadRepeatedMessage(IPluginContext *pCtx, const cell_t *para
return pCtx->ThrowNativeError("Invalid field \"%s\"[%d] for message \"%s\"", strField, params[3], msg->GetProtobufMessage()->GetTypeName().c_str());
}
Handle_t outHndl = g_HandleSys.CreateHandle(g_ProtobufType, new SMProtobufMessage(const_cast<protobuf::Message *>(innerMsg)), NULL, g_pCoreIdent, NULL);
Handle_t outHndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(const_cast<protobuf::Message *>(innerMsg)), NULL, g_pCoreIdent, NULL);
msg->AddChildHandle(outHndl);
return outHndl;
@ -906,7 +906,7 @@ static cell_t smn_PbAddMessage(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Invalid field \"%s\" for message \"%s\"", strField, msg->GetProtobufMessage()->GetTypeName().c_str());
}
Handle_t outHndl = g_HandleSys.CreateHandle(g_ProtobufType, new SMProtobufMessage(innerMsg), NULL, g_pCoreIdent, NULL);
Handle_t outHndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(innerMsg), NULL, g_pCoreIdent, NULL);
msg->AddChildHandle(outHndl);
return outHndl;

View File

@ -29,10 +29,9 @@
* Version: $Id$
*/
#include "HandleSys.h"
#include "PluginSys.h"
#include "PlayerManager.h"
#include "smn_usermsgs.h"
#include "logic_bridge.h"
#ifdef USE_PROTOBUF_USERMESSAGES
#include "UserMessagePBHelpers.h"
#endif
@ -89,19 +88,19 @@ void UsrMessageNatives::OnSourceModAllInitialized()
{
HandleAccess sec;
g_HandleSys.InitAccessDefaults(NULL, &sec);
handlesys->InitAccessDefaults(NULL, &sec);
sec.access[HandleAccess_Delete] = HANDLE_RESTRICT_IDENTITY;
#ifdef USE_PROTOBUF_USERMESSAGES
g_ProtobufType = g_HandleSys.CreateType("ProtobufUM", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_ProtobufType = handlesys->CreateType("ProtobufUM", this, 0, NULL, NULL, g_pCoreIdent, NULL);
#else
g_WrBitBufType = g_HandleSys.CreateType("BitBufWriter", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_RdBitBufType = g_HandleSys.CreateType("BitBufReader", this, 0, NULL, &sec, g_pCoreIdent, NULL);
g_WrBitBufType = handlesys->CreateType("BitBufWriter", this, 0, NULL, NULL, g_pCoreIdent, NULL);
g_RdBitBufType = handlesys->CreateType("BitBufReader", this, 0, NULL, &sec, g_pCoreIdent, NULL);
g_ReadBufHandle = g_HandleSys.CreateHandle(g_RdBitBufType, &g_ReadBitBuf, NULL, g_pCoreIdent, NULL);
g_ReadBufHandle = handlesys->CreateHandle(g_RdBitBufType, &g_ReadBitBuf, NULL, g_pCoreIdent, NULL);
#endif
g_PluginSys.AddPluginsListener(this);
scripts->AddPluginsListener(this);
}
void UsrMessageNatives::OnSourceModShutdown()
@ -110,14 +109,14 @@ void UsrMessageNatives::OnSourceModShutdown()
sec.pIdentity = g_pCoreIdent;
#ifdef USE_PROTOBUF_USERMESSAGES
g_HandleSys.RemoveType(g_ProtobufType, g_pCoreIdent);
handlesys->RemoveType(g_ProtobufType, g_pCoreIdent);
g_ProtobufType = 0;
#else
g_HandleSys.FreeHandle(g_ReadBufHandle, &sec);
handlesys->FreeHandle(g_ReadBufHandle, &sec);
g_HandleSys.RemoveType(g_WrBitBufType, g_pCoreIdent);
g_HandleSys.RemoveType(g_RdBitBufType, g_pCoreIdent);
handlesys->RemoveType(g_WrBitBufType, g_pCoreIdent);
handlesys->RemoveType(g_RdBitBufType, g_pCoreIdent);
g_WrBitBufType = 0;
g_RdBitBufType = 0;
@ -169,7 +168,7 @@ MsgListenerWrapper *UsrMessageNatives::CreateListener(IPluginContext *pCtx)
{
MsgWrapperList *pList;
MsgListenerWrapper *pListener;
IPlugin *pl = g_PluginSys.FindPluginByContext(pCtx->GetContext());
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
if (m_FreeListeners.empty())
{
@ -195,7 +194,7 @@ bool UsrMessageNatives::FindListener(int msgid, IPluginContext *pCtx, IPluginFun
MsgWrapperList *pList;
MsgWrapperIter _iter;
MsgListenerWrapper *pListener;
IPlugin *pl = g_PluginSys.FindPluginByContext(pCtx->GetContext());
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
if (!pl->GetProperty("MsgListeners", reinterpret_cast<void **>(&pList)))
{
@ -221,7 +220,7 @@ bool UsrMessageNatives::DeleteListener(IPluginContext *pCtx, MsgWrapperIter iter
{
MsgWrapperList *pList;
MsgListenerWrapper *pListener;
IPlugin *pl = g_PluginSys.FindPluginByContext(pCtx->GetContext());
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
if (!pl->GetProperty("MsgListeners", reinterpret_cast<void **>(&pList)))
{
@ -311,7 +310,7 @@ void MsgListenerWrapper::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilte
size_t size = _FillInPlayers(g_MsgPlayers, pFilter);
#ifdef USE_PROTOBUF_USERMESSAGES
hndl = g_HandleSys.CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), NULL, g_pCoreIdent, NULL);
#else
g_ReadBitBuf.StartReading(bf->GetBasePointer(), bf->GetNumBytesWritten());
hndl = g_ReadBufHandle;
@ -328,7 +327,7 @@ void MsgListenerWrapper::OnUserMessage(int msg_id, bf_write *bf, IRecipientFilte
#ifdef USE_PROTOBUF_USERMESSAGES
HandleSecurity sec;
sec.pIdentity = g_pCoreIdent;
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
#endif
}
@ -343,7 +342,7 @@ ResultType MsgListenerWrapper::InterceptUserMessage(int msg_id, bf_write *bf, IR
size_t size = _FillInPlayers(g_MsgPlayers, pFilter);
#ifdef USE_PROTOBUF_USERMESSAGES
hndl = g_HandleSys.CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), NULL, g_pCoreIdent, NULL);
hndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), NULL, g_pCoreIdent, NULL);
#else
g_ReadBitBuf.StartReading(bf->GetBasePointer(), bf->GetNumBytesWritten());
hndl = g_ReadBufHandle;
@ -360,7 +359,7 @@ ResultType MsgListenerWrapper::InterceptUserMessage(int msg_id, bf_write *bf, IR
#ifdef USE_PROTOBUF_USERMESSAGES
HandleSecurity sec;
sec.pIdentity = g_pCoreIdent;
g_HandleSys.FreeHandle(hndl, &sec);
handlesys->FreeHandle(hndl, &sec);
#endif
return static_cast<ResultType>(res);
@ -455,7 +454,7 @@ static cell_t smn_StartMessage(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Unable to execute a new message while in hook");
}
g_CurMsgHandle = g_HandleSys.CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), pCtx->GetIdentity(), g_pCoreIdent, NULL);
g_CurMsgHandle = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), pCtx->GetIdentity(), g_pCoreIdent, NULL);
#else
bf_write *pBitBuf = g_UserMsgs.StartBitBufMessage(msgid, cl_array, numClients, params[4]);
if (!pBitBuf)
@ -463,7 +462,7 @@ static cell_t smn_StartMessage(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Unable to execute a new message while in hook");
}
g_CurMsgHandle = g_HandleSys.CreateHandle(g_WrBitBufType, pBitBuf, pCtx->GetIdentity(), g_pCoreIdent, NULL);
g_CurMsgHandle = handlesys->CreateHandle(g_WrBitBufType, pBitBuf, pCtx->GetIdentity(), g_pCoreIdent, NULL);
#endif
g_IsMsgInExec = true;
@ -514,7 +513,7 @@ static cell_t smn_StartMessageEx(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Unable to execute a new message while in hook");
}
g_CurMsgHandle = g_HandleSys.CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), pCtx->GetIdentity(), g_pCoreIdent, NULL);
g_CurMsgHandle = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(msg), pCtx->GetIdentity(), g_pCoreIdent, NULL);
#else
bf_write *pBitBuf = g_UserMsgs.StartBitBufMessage(msgid, cl_array, numClients, params[4]);
if (!pBitBuf)
@ -522,7 +521,7 @@ static cell_t smn_StartMessageEx(IPluginContext *pCtx, const cell_t *params)
return pCtx->ThrowNativeError("Unable to execute a new message while in hook");
}
g_CurMsgHandle = g_HandleSys.CreateHandle(g_WrBitBufType, pBitBuf, pCtx->GetIdentity(), g_pCoreIdent, NULL);
g_CurMsgHandle = handlesys->CreateHandle(g_WrBitBufType, pBitBuf, pCtx->GetIdentity(), g_pCoreIdent, NULL);
#endif
g_IsMsgInExec = true;
@ -542,7 +541,7 @@ static cell_t smn_EndMessage(IPluginContext *pCtx, const cell_t *params)
sec.pOwner = pCtx->GetIdentity();
sec.pIdentity = g_pCoreIdent;
g_HandleSys.FreeHandle(g_CurMsgHandle, &sec);
handlesys->FreeHandle(g_CurMsgHandle, &sec);
g_IsMsgInExec = false;

View File

@ -33,9 +33,9 @@
#include "sourcemm_api.h"
#include <sourcemod_version.h>
#include "Logger.h"
#include "ExtensionSys.h"
#include "concmd_cleaner.h"
#include "compat_wrappers.h"
#include "logic_bridge.h"
SourceMod_Core g_SourceMod_Core;
IVEngineServer *engine = NULL;
@ -231,7 +231,7 @@ void *SourceMod_Core::OnMetamodQuery(const char *iface, int *ret)
if (strcmp(iface, SOURCEMOD_INTERFACE_EXTENSIONS) == 0)
{
ptr = (IExtensionManager *)&g_Extensions;
ptr = extsys;
}
if (ret != NULL)

View File

@ -34,11 +34,8 @@
#include "sourcemm_api.h"
#include "LibrarySys.h"
#include <sh_string.h>
#include "PluginSys.h"
#include "ShareSys.h"
#include "CoreConfig.h"
#include "Logger.h"
#include "ExtensionSys.h"
#include "AdminCache.h"
#include "sm_stringutil.h"
#include "PlayerManager.h"
@ -263,11 +260,6 @@ void SourceModBase::StartSourceMod(bool late)
enginePatch = SH_GET_CALLCLASS(engine);
gamedllPatch = SH_GET_CALLCLASS(gamedll);
g_ShareSys.Initialize();
/* Make the global core identity */
g_pCoreIdent = g_ShareSys.CreateCoreIdentity();
InitLogicBridge();
/* Notify! */
@ -296,7 +288,7 @@ void SourceModBase::StartSourceMod(bool late)
}
/* Add us now... */
g_ShareSys.AddInterface(NULL, this);
sharesys->AddInterface(NULL, this);
/* We're loaded! */
g_Loaded = true;
@ -311,7 +303,7 @@ void SourceModBase::StartSourceMod(bool late)
const char *disabled = GetCoreConfigValue("DisableAutoUpdate");
if (disabled == NULL || strcasecmp(disabled, "yes") != 0)
{
g_Extensions.LoadAutoExtension("updater.ext." PLATFORM_LIB_EXT);
extsys->LoadAutoExtension("updater.ext." PLATFORM_LIB_EXT);
}
}
@ -383,7 +375,7 @@ void SourceModBase::LevelShutdown()
if (m_ExecPluginReload)
{
g_PluginSys.ReloadOrUnloadPlugins();
scripts->RefreshAll();
m_ExecPluginReload = false;
}
}
@ -406,7 +398,7 @@ void SourceModBase::DoGlobalPluginLoads()
"plugins");
/* Load any auto extensions */
g_Extensions.TryAutoload();
extsys->TryAutoload();
/* Fire the extensions ready message */
g_SMAPI->MetaFactory(SOURCEMOD_NOTICE_EXTENSIONS, NULL, NULL);
@ -417,23 +409,10 @@ void SourceModBase::DoGlobalPluginLoads()
{
char path[PLATFORM_MAX_PATH];
UTIL_Format(path, sizeof(path), "%s.ext." PLATFORM_LIB_EXT, game_ext);
g_Extensions.LoadAutoExtension(path);
extsys->LoadAutoExtension(path);
}
/* Run the first pass */
g_PluginSys.LoadAll_FirstPass(config_path, plugins_path);
/* Mark any extensions as loaded */
g_Extensions.MarkAllLoaded();
/* No modules yet, it's safe to call this from here */
g_PluginSys.LoadAll_SecondPass();
/* Re-mark any extensions as loaded */
g_Extensions.MarkAllLoaded();
/* Call OnAllPluginsLoaded */
g_PluginSys.AllPluginsLoaded();
scripts->LoadAll(config_path, plugins_path);
}
size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, const char *format, ...)
@ -484,10 +463,10 @@ void SourceModBase::CloseSourceMod()
LevelShutdown();
/* Unload plugins */
g_PluginSys.Shutdown();
scripts->Shutdown();
/* Unload extensions */
g_Extensions.Shutdown();
extsys->Shutdown();
SH_REMOVE_HOOK(IServerGameDLL, LevelInit, gamedll, SH_MEMBER(this, &SourceModBase::LevelInit), false);

View File

@ -32,7 +32,6 @@
#ifndef _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
#define _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_
#include "common_logic.h"
#include <IHandleSys.h>
class AutoHandleRooter

View File

@ -132,8 +132,10 @@ namespace SourceMod
*
* Note: This is bumped when IShareSys is changed, because IShareSys
* itself is not versioned.
*
* V6 - added TestFeature() to IShareSys.
*/
#define SMINTERFACE_EXTENSIONAPI_VERSION 5
#define SMINTERFACE_EXTENSIONAPI_VERSION 6
/**
* @brief The interface an extension must expose.

View File

@ -52,7 +52,7 @@
#include <sp_vm_types.h>
#define SMINTERFACE_HANDLESYSTEM_NAME "IHandleSys"
#define SMINTERFACE_HANDLESYSTEM_VERSION 4
#define SMINTERFACE_HANDLESYSTEM_VERSION 5
/** Specifies no Identity */
#define DEFAULT_IDENTITY NULL
@ -364,6 +364,15 @@ namespace SourceMod
* @return A new Handle_t, or 0 on failure.
*/
virtual Handle_t FastCloneHandle(Handle_t hndl) =0;
/**
* @brief Type checks two handles.
*
* @param given Type to test.
* @param actual Type to check for.
* @return True if "given" is a subtype of "actual", false otherwise.
*/
virtual bool TypeCheck(HandleType_t given, HandleType_t actual) = 0;
};
}

View File

@ -43,7 +43,7 @@
namespace SourceMod
{
#define SMINTERFACE_LIBRARYSYS_NAME "ILibrarySys"
#define SMINTERFACE_LIBRARYSYS_VERSION 4
#define SMINTERFACE_LIBRARYSYS_VERSION 5
enum FileTimeType
{
@ -223,6 +223,16 @@ namespace SourceMod
* @return True on success, false on failure.
*/
virtual bool FileTime(const char *path, FileTimeType type, time_t *pTime) =0;
/**
* @brief Retrieve the file component of the given path.
*
* @param buffer Output buffer.
* @param maxlength Length of the output buffer.
* @param path Path to search for a filename.
* @return Number of bytes written to buffer, not including the null terminator.
*/
virtual size_t GetFileFromPath(char *buffer, size_t maxlength, const char *path) =0;
};
}

View File

@ -38,7 +38,7 @@
*/
#include <sp_vm_types.h>
#include <sp_vm_api.h>
namespace SourceMod
{
@ -278,6 +278,19 @@ namespace SourceMod
virtual void DropCapabilityProvider(IExtension *myself,
IFeatureProvider *provider,
const char *name) =0;
/**
* Tests for a feature.
*
* @param rt Plugin to test.
* @param type Feature type.
* @param name Feature name.
* @return Feature status.
*/
virtual FeatureStatus TestFeature(SourcePawn::IPluginRuntime *rt,
FeatureType type,
const char *name) =0;
};
}