From 045ee262a81ac50bef4a25401d65146ae45e31d1 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 29 Mar 2013 11:37:29 -0700 Subject: [PATCH] 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 --- core/ADTFactory.cpp | 4 +- core/AMBuilder | 6 - core/AdminCache.cpp | 4 +- core/ConCmdManager.cpp | 11 +- core/ConVarManager.cpp | 29 +- core/ConsoleDetours.cpp | 4 +- core/CoreConfig.cpp | 19 +- core/Database.cpp | 32 +- core/Database.h | 2 +- core/EventManager.cpp | 19 +- core/ForwardSys.cpp | 8 +- core/HalfLife2.cpp | 76 +- core/Logger.cpp | 11 +- core/Logger.h | 1 + core/MenuManager.cpp | 22 +- core/MenuStyle_Base.cpp | 5 +- core/PlayerManager.cpp | 205 +- core/TimerSys.cpp | 3 +- core/TimerSys.h | 2 +- core/UserMessages.cpp | 3 +- core/UserMessages.h | 4 +- core/frame_hooks.cpp | 1 + core/logic/AMBuilder | 7 + core/{ => logic}/ExtensionSys.cpp | 310 +-- core/{ => logic}/ExtensionSys.h | 20 +- core/{ => logic}/HandleSys.cpp | 94 +- core/{ => logic}/HandleSys.h | 7 +- core/{ => logic}/NativeInvoker.cpp | 2 +- core/{ => logic}/NativeInvoker.h | 6 +- core/{ => logic}/NativeOwner.cpp | 32 +- core/{ => logic}/NativeOwner.h | 15 +- core/{ => logic}/PluginSys.cpp | 517 +++-- core/{ => logic}/PluginSys.h | 69 +- core/{ => logic}/ShareSys.cpp | 44 +- core/{ => logic}/ShareSys.h | 5 +- core/logic/common_logic.cpp | 44 +- core/logic/common_logic.h | 1 + core/logic/intercom.h | 113 +- core/logic/msvc10/logic.vcxproj | 15 +- core/logic/msvc10/logic.vcxproj.filters | 41 +- core/{ => logic}/smn_fakenatives.cpp | 15 +- core/logic/smn_players.cpp | 2 +- core/logic_bridge.cpp | 116 +- core/logic_bridge.h | 5 +- core/msvc10/sourcemod_mm.vcxproj | 13 - core/msvc10/sourcemod_mm.vcxproj.filters | 39 - core/msvc11/sourcemod_mm.sln | 95 + core/msvc11/sourcemod_mm.vcxproj | 2479 +++++++++++++++++++++ core/sm_autonatives.cpp | 9 +- core/sm_autonatives.h | 4 - core/sm_srvcmds.cpp | 9 +- core/sm_srvcmds.h | 1 - core/sm_stringutil.cpp | 5 +- core/smn_bitbuffer.cpp | 61 +- core/smn_console.cpp | 21 +- core/smn_core.cpp | 63 +- core/smn_database.cpp | 70 +- core/smn_events.cpp | 32 +- core/smn_halflife.cpp | 1 - core/smn_hudtext.cpp | 10 +- core/smn_keyvalues.cpp | 76 +- core/smn_menus.cpp | 26 +- core/smn_protobuf.cpp | 8 +- core/smn_usermsgs.cpp | 47 +- core/sourcemm_api.cpp | 4 +- core/sourcemod.cpp | 37 +- {core/logic => public}/AutoHandleRooter.h | 1 - public/IExtensionSys.h | 4 +- public/IHandleSys.h | 11 +- public/ILibrarySys.h | 12 +- public/IShareSys.h | 15 +- 71 files changed, 3973 insertions(+), 1131 deletions(-) rename core/{ => logic}/ExtensionSys.cpp (71%) rename core/{ => logic}/ExtensionSys.h (90%) rename core/{ => logic}/HandleSys.cpp (92%) rename core/{ => logic}/HandleSys.h (96%) rename core/{ => logic}/NativeInvoker.cpp (95%) rename core/{ => logic}/NativeInvoker.h (94%) rename core/{ => logic}/NativeOwner.cpp (62%) rename core/{ => logic}/NativeOwner.h (77%) rename core/{ => logic}/PluginSys.cpp (75%) rename core/{ => logic}/PluginSys.h (90%) rename core/{ => logic}/ShareSys.cpp (88%) rename core/{ => logic}/ShareSys.h (95%) rename core/{ => logic}/smn_fakenatives.cpp (93%) create mode 100644 core/msvc11/sourcemod_mm.sln create mode 100644 core/msvc11/sourcemod_mm.vcxproj rename {core/logic => public}/AutoHandleRooter.h (95%) diff --git a/core/ADTFactory.cpp b/core/ADTFactory.cpp index e8fc2031..0726504f 100644 --- a/core/ADTFactory.cpp +++ b/core/ADTFactory.cpp @@ -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() diff --git a/core/AMBuilder b/core/AMBuilder index bc318a0f..e5c3e491 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -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', diff --git a/core/AdminCache.cpp b/core/AdminCache.cpp index 4b21338a..688549bc 100644 --- a/core/AdminCache.cpp +++ b/core/AdminCache.cpp @@ -33,7 +33,6 @@ #include #include #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) diff --git a/core/ConCmdManager.cpp b/core/ConCmdManager.cpp index 25c75ab4..2cf494f8 100644 --- a/core/ConCmdManager.cpp +++ b/core/ConCmdManager.cpp @@ -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 &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) { diff --git a/core/ConVarManager.cpp b/core/ConVarManager.cpp index 07414884..a5a9c424 100644 --- a/core/ConVarManager.cpp +++ b/core/ConVarManager.cpp @@ -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 #include +#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; } diff --git a/core/ConsoleDetours.cpp b/core/ConsoleDetours.cpp index 81e11aee..4657384b 100644 --- a/core/ConsoleDetours.cpp +++ b/core/ConsoleDetours.cpp @@ -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 @@ -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() diff --git a/core/CoreConfig.cpp b/core/CoreConfig.cpp index 5d25aa32..e441b13d 100644 --- a/core/CoreConfig.cpp +++ b/core/CoreConfig.cpp @@ -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 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; iGetConfig(i), can_create); } - iter->NextPlugin(); } - iter->Release(); g_bGotServerStart = true; CheckAndFinalizeConfigs(); diff --git a/core/Database.cpp b/core/Database.cpp index 4aa38e51..fe267f1f 100644 --- a/core/Database.cpp +++ b/core/Database.cpp @@ -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 #include +#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); } diff --git a/core/Database.h b/core/Database.h index 4ac4826d..9e2b9cf7 100644 --- a/core/Database.h +++ b/core/Database.h @@ -40,8 +40,8 @@ #include #include "sm_memtable.h" #include +#include #include "sm_simple_prioqueue.h" -#include "PluginSys.h" using namespace SourceHook; diff --git a/core/EventManager.cpp b/core/EventManager.cpp index 3ebddf10..7625e005 100644 --- a/core/EventManager.cpp +++ b/core/EventManager.cpp @@ -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); diff --git a/core/ForwardSys.cpp b/core/ForwardSys.cpp index e85be0c1..40a5f642 100644 --- a/core/ForwardSys.cpp +++ b/core/ForwardSys.cpp @@ -33,8 +33,6 @@ #include #include #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); } diff --git a/core/HalfLife2.cpp b/core/HalfLife2.cpp index 69cf7aae..d61df914 100644 --- a/core/HalfLife2.cpp +++ b/core/HalfLife2.cpp @@ -51,12 +51,12 @@ typedef ICommandLine *(*FakeGetCommandLine)(); -#if defined _WIN32 -#define TIER0_NAME "tier0.dll" -#define VSTDLIB_NAME "vstdlib.dll" -#elif defined __APPLE__ -#define TIER0_NAME "libtier0.dylib" -#define VSTDLIB_NAME "libvstdlib.dylib" +#if defined _WIN32 +#define TIER0_NAME "tier0.dll" +#define VSTDLIB_NAME "vstdlib.dll" +#elif defined __APPLE__ +#define TIER0_NAME "libtier0.dylib" +#define VSTDLIB_NAME "libvstdlib.dylib" #elif defined __linux__ #if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS #define TIER0_NAME "libtier0_srv.so" @@ -67,7 +67,7 @@ typedef ICommandLine *(*FakeGetCommandLine)(); #else #define TIER0_NAME "tier0_i486.so" #define VSTDLIB_NAME "vstdlib_i486.so" -#endif +#endif #endif CHalfLife2 g_HL2; @@ -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() @@ -241,44 +241,44 @@ void CHalfLife2::InitCommandLine() if (!g_LibSys.IsPathFile(path)) { - g_Logger.LogError("Could not find path for: " TIER0_NAME); + g_Logger.LogError("Could not find path for: " TIER0_NAME); return; } ILibrary *lib = g_LibSys.OpenLibrary(path, error, sizeof(error)); m_pGetCommandLine = lib->GetSymbolAddress("CommandLine_Tier0"); - /* '_Tier0' dropped on Alien Swarm version */ - if (m_pGetCommandLine == NULL) - { - m_pGetCommandLine = lib->GetSymbolAddress("CommandLine"); + /* '_Tier0' dropped on Alien Swarm version */ + if (m_pGetCommandLine == NULL) + { + m_pGetCommandLine = lib->GetSymbolAddress("CommandLine"); } - if (m_pGetCommandLine == NULL) - { - /* We probably have a Ship engine. */ - lib->CloseLibrary(); - g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" VSTDLIB_NAME); - if (!g_LibSys.IsPathFile(path)) - { - g_Logger.LogError("Could not find path for: " VSTDLIB_NAME); - return; - } - - if ((lib = g_LibSys.OpenLibrary(path, error, sizeof(error))) == NULL) - { - g_Logger.LogError("Could not load %s: %s", path, error); - return; - } - - m_pGetCommandLine = lib->GetSymbolAddress("CommandLine"); - - if (m_pGetCommandLine == NULL) - { - g_Logger.LogError("Could not locate any command line functionality"); - } - - lib->CloseLibrary(); + if (m_pGetCommandLine == NULL) + { + /* We probably have a Ship engine. */ + lib->CloseLibrary(); + g_SourceMod.BuildPath(Path_Game, path, sizeof(path), "../bin/" VSTDLIB_NAME); + if (!g_LibSys.IsPathFile(path)) + { + g_Logger.LogError("Could not find path for: " VSTDLIB_NAME); + return; + } + + if ((lib = g_LibSys.OpenLibrary(path, error, sizeof(error))) == NULL) + { + g_Logger.LogError("Could not load %s: %s", path, error); + return; + } + + m_pGetCommandLine = lib->GetSymbolAddress("CommandLine"); + + if (m_pGetCommandLine == NULL) + { + g_Logger.LogError("Could not locate any command line functionality"); + } + + lib->CloseLibrary(); } } diff --git a/core/Logger.cpp b/core/Logger.cpp index 89f29f18..336379d2 100644 --- a/core/Logger.cpp +++ b/core/Logger.cpp @@ -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); } diff --git a/core/Logger.h b/core/Logger.h index 8982631c..d9f3d8ef 100644 --- a/core/Logger.h +++ b/core/Logger.h @@ -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 */ diff --git a/core/MenuManager.cpp b/core/MenuManager.cpp index ab92280e..fd34df77 100644 --- a/core/MenuManager.cpp +++ b/core/MenuManager.cpp @@ -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) diff --git a/core/MenuStyle_Base.cpp b/core/MenuStyle_Base.cpp index 7cc98492..748133a9 100644 --- a/core/MenuStyle_Base.cpp +++ b/core/MenuStyle_Base.cpp @@ -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); diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index d6a98db1..c91310dd 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -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 #include #include -#include "ExtensionSys.h" #include #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 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::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 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 m_FailList; + + CVector::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) @@ -1641,9 +1806,9 @@ void CPlayer::SetAuthString(const char *steamid) m_AuthID.assign(steamid); } -// Ensure a valid AuthString is set before calling. -void CPlayer::Authorize() -{ +// Ensure a valid AuthString is set before calling. +void CPlayer::Authorize() +{ m_IsAuthorized = true; } @@ -1690,9 +1855,9 @@ const char *CPlayer::GetIPAddress() const char *CPlayer::GetAuthString(bool validated) { - if (validated && !IsAuthStringValidated()) - { - return NULL; + if (validated && !IsAuthStringValidated()) + { + return NULL; } return m_AuthID.c_str(); @@ -1752,15 +1917,15 @@ bool CPlayer::IsAuthorized() return m_IsAuthorized; } -bool CPlayer::IsAuthStringValidated() +bool CPlayer::IsAuthStringValidated() { #if SOURCE_ENGINE >= SE_ORANGEBOX - if (g_Players.m_bAuthstringValidation && !g_HL2.IsLANServer()) - { - return engine->IsClientFullyAuthenticated(m_pEdict); - } -#endif - + if (g_Players.m_bAuthstringValidation && !g_HL2.IsLANServer()) + { + return engine->IsClientFullyAuthenticated(m_pEdict); + } +#endif + return true; } diff --git a/core/TimerSys.cpp b/core/TimerSys.cpp index 32726a01..77c1f28f 100644 --- a/core/TimerSys.cpp +++ b/core/TimerSys.cpp @@ -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); } diff --git a/core/TimerSys.h b/core/TimerSys.h index 6526a3c2..c5a9b758 100644 --- a/core/TimerSys.h +++ b/core/TimerSys.h @@ -32,11 +32,11 @@ #ifndef _INCLUDE_SOURCEMOD_CTIMERSYS_H_ #define _INCLUDE_SOURCEMOD_CTIMERSYS_H_ -#include "ShareSys.h" #include #include #include #include "sourcemm_api.h" +#include "sm_globals.h" using namespace SourceHook; using namespace SourceMod; diff --git a/core/UserMessages.cpp b/core/UserMessages.cpp index cede4e11..ef9339e5 100644 --- a/core/UserMessages.cpp +++ b/core/UserMessages.cpp @@ -31,6 +31,7 @@ #include "UserMessages.h" #include "sm_stringutil.h" +#include "logic_bridge.h" #if SOURCE_ENGINE == SE_DOTA #include @@ -91,7 +92,7 @@ void UserMessages::OnSourceModStartup(bool late) void UserMessages::OnSourceModAllInitialized() { - g_ShareSys.AddInterface(NULL, this); + sharesys->AddInterface(NULL, this); } void UserMessages::OnSourceModAllShutdown() diff --git a/core/UserMessages.h b/core/UserMessages.h index 71b003e9..b882bae3 100644 --- a/core/UserMessages.h +++ b/core/UserMessages.h @@ -32,12 +32,14 @@ #ifndef _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_ #define _INCLUDE_SOURCEMOD_CUSERMESSAGES_H_ -#include "ShareSys.h" #include #include "sourcemm_api.h" #include "sm_trie.h" #include "sm_stringutil.h" #include "CellRecipientFilter.h" +#include "sm_globals.h" +#include +#include using namespace SourceHook; using namespace SourceMod; diff --git a/core/frame_hooks.cpp b/core/frame_hooks.cpp index 2c8c03a0..d0524cba 100644 --- a/core/frame_hooks.cpp +++ b/core/frame_hooks.cpp @@ -38,6 +38,7 @@ #include "CoreConfig.h" #include #include +#include "sourcemod.h" static IMutex *frame_mutex; static Queue *frame_queue; diff --git a/core/logic/AMBuilder b/core/logic/AMBuilder index c8278db6..091427d9 100644 --- a/core/logic/AMBuilder +++ b/core/logic/AMBuilder @@ -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': diff --git a/core/ExtensionSys.cpp b/core/logic/ExtensionSys.cpp similarity index 71% rename from core/ExtensionSys.cpp rename to core/logic/ExtensionSys.cpp index c4b09daa..bb61d153 100644 --- a/core/ExtensionSys.cpp +++ b/core/logic/ExtensionSys.cpp @@ -31,13 +31,10 @@ #include #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 +#include +#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(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(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::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] file \"%s\": %s", num, pExt->GetFilename(), error); + rootmenu->ConsolePrint("[%02d] 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] file \"%s\": %s", num, pExt->GetFilename(), pExt->m_Error.c_str()); + rootmenu->ConsolePrint("[%02d] 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 "); + rootmenu->ConsolePrint("[SM] Usage: sm exts load "); 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 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::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::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::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(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::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 *list) +{ + for (List::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. */ diff --git a/core/ExtensionSys.h b/core/logic/ExtensionSys.h similarity index 90% rename from core/ExtensionSys.h rename to core/logic/ExtensionSys.h index 4c059fb1..1aabd1f7 100644 --- a/core/ExtensionSys.h +++ b/core/logic/ExtensionSys.h @@ -37,13 +37,11 @@ #include #include #include -#include "sm_globals.h" -#include "ShareSys.h" -#include +#include "common_logic.h" #include #include -#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 *list); public: CExtension *GetExtensionFromIdent(IdentityToken_t *ptr); void Shutdown(); diff --git a/core/HandleSys.cpp b/core/logic/HandleSys.cpp similarity index 92% rename from core/HandleSys.cpp rename to core/logic/HandleSys.cpp index f07b1412..60675483 100644 --- a/core/HandleSys.cpp +++ b/core/logic/HandleSys.cpp @@ -30,13 +30,11 @@ */ #include "HandleSys.h" -#include "ShareSys.h" -#include "PluginSys.h" -#include "ExtensionSys.h" -#include "Logger.h" #include #include -#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) { @@ -660,13 +656,13 @@ void HandleSystem::GetHandleUnchecked(Handle_t hndl, QHandle *& pHandle, unsigne HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index) { - if (pHandle->is_destroying) - { - /* Someone tried to free this recursively. - * We'll just ignore this safely. - */ - return HandleError_None; - } + if (pHandle->is_destroying) + { + /* Someone tried to free this recursively. + * We'll just ignore this safely. + */ + return HandleError_None; + } QHandleType *pType = &m_Types[pHandle->type]; @@ -691,9 +687,9 @@ HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index) /* Type should be the same but do this anyway... */ pType = &m_Types[pMaster->type]; pMaster->is_destroying = true; - if (pMaster->object) - { - pType->dispatch->OnHandleDestroy(pMaster->type, pMaster->object); + if (pMaster->object) + { + pType->dispatch->OnHandleDestroy(pMaster->type, pMaster->object); } ReleasePrimHandle(master); } @@ -708,9 +704,9 @@ HandleError HandleSystem::FreeHandle(QHandle *pHandle, unsigned int index) if (--pHandle->refcount == 0) { pHandle->is_destroying = true; - if (pHandle->object) - { - pType->dispatch->OnHandleDestroy(pHandle->type, pHandle->object); + if (pHandle->object) + { + pType->dispatch->OnHandleDestroy(pHandle->type, pHandle->object); } ReleasePrimHandle(index); } else { @@ -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(); @@ -1094,21 +1090,21 @@ void HandleSystem::Dump(HANDLE_REPORTER rep) type = m_strtab->GetString(pType->nameIdx); } - if ((parentIdx = m_Handles[i].clone) != 0) - { - if (m_Handles[parentIdx].refcount > 0) - { - size = 0; - bresult = true; - } - else - { - bresult = pType->dispatch->GetHandleApproxSize(m_Handles[parentIdx].type, m_Handles[parentIdx].object, &size); - } - } - else - { - bresult = pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size); + if ((parentIdx = m_Handles[i].clone) != 0) + { + if (m_Handles[parentIdx].refcount > 0) + { + size = 0; + bresult = true; + } + else + { + bresult = pType->dispatch->GetHandleApproxSize(m_Handles[parentIdx].type, m_Handles[parentIdx].object, &size); + } + } + else + { + bresult = pType->dispatch->GetHandleApproxSize(m_Handles[i].type, m_Handles[i].object, &size); } if (pType->dispatch->GetDispatchVersion() < HANDLESYS_MEMUSAGE_MIN_VERSION @@ -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; } diff --git a/core/HandleSys.h b/core/logic/HandleSys.h similarity index 96% rename from core/HandleSys.h rename to core/logic/HandleSys.h index 5a554aae..6d46bc9c 100644 --- a/core/HandleSys.h +++ b/core/logic/HandleSys.h @@ -34,10 +34,9 @@ #include #include -#include "sm_globals.h" -#include "sm_trie.h" -#include "sourcemod.h" +#include #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 m_TypeLookup; unsigned int m_TypeTail; unsigned int m_FreeTypes; unsigned int m_HandleTail; diff --git a/core/NativeInvoker.cpp b/core/logic/NativeInvoker.cpp similarity index 95% rename from core/NativeInvoker.cpp rename to core/logic/NativeInvoker.cpp index 3759684c..89805487 100644 --- a/core/NativeInvoker.cpp +++ b/core/logic/NativeInvoker.cpp @@ -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) diff --git a/core/NativeInvoker.h b/core/logic/NativeInvoker.h similarity index 94% rename from core/NativeInvoker.h rename to core/logic/NativeInvoker.h index 120b7019..243ec905 100644 --- a/core/NativeInvoker.h +++ b/core/logic/NativeInvoker.h @@ -32,8 +32,12 @@ #ifndef _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_ #define _INCLUDE_SOURCEMOD_NATIVE_INVOKER_H_ -#include "sm_globals.h" +#include #include +#include "common_logic.h" + +using namespace SourceMod; +using namespace SourcePawn; struct ParamInfo { diff --git a/core/NativeOwner.cpp b/core/logic/NativeOwner.cpp similarity index 62% rename from core/NativeOwner.cpp rename to core/logic/NativeOwner.cpp index a650438d..69cdf6f2 100644 --- a/core/NativeOwner.cpp +++ b/core/logic/NativeOwner.cpp @@ -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 . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ #include "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::iterator iter; diff --git a/core/NativeOwner.h b/core/logic/NativeOwner.h similarity index 77% rename from core/NativeOwner.h rename to core/logic/NativeOwner.h index 2ba3c6ae..d95bea94 100644 --- a/core/NativeOwner.h +++ b/core/logic/NativeOwner.h @@ -3,25 +3,28 @@ #include #include +#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 m_ReplacedNatives; }; +extern CNativeOwner g_CoreNatives; + #endif //_INCLUDE_SOURCEMOD_NATIVE_OWNER_H_ diff --git a/core/PluginSys.cpp b/core/logic/PluginSys.cpp similarity index 75% rename from core/PluginSys.cpp rename to core/logic/PluginSys.cpp index a2e8144c..47aa0e3e 100644 --- a/core/PluginSys.cpp +++ b/core/logic/PluginSys.cpp @@ -32,19 +32,15 @@ #include #include "PluginSys.h" #include "ShareSys.h" -#include "LibrarySys.h" -#include "HandleSys.h" -#include "ForwardSys.h" -#include "sourcemm_api.h" -#include "sourcemod.h" -#include "Logger.h" +#include +#include +#include +#include +#include #include "ExtensionSys.h" -#include "sm_srvcmds.h" -#include "sm_stringutil.h" -#include "ConCmdManager.h" -#include "PlayerManager.h" -#include "CoreConfig.h" -#include "logic_bridge.h" +#include "GameConfigs.h" +#include "common_logic.h" +#include "Translator.h" CPluginManager g_PluginSys; HandleType_t g_PluginType = 0; @@ -60,14 +56,13 @@ CPlugin::CPlugin(const char *file) m_serial = ++MySerial; m_pRuntime = NULL; m_errormsg[sizeof(m_errormsg) - 1] = '\0'; - UTIL_Format(m_filename, sizeof(m_filename), "%s", file); + smcore.Format(m_filename, sizeof(m_filename), "%s", file); m_handle = 0; m_ident = NULL; - m_pProps = sm_trie_create(); m_FakeNativesMissing = false; m_LibraryMissing = false; m_bGotAllLoaded = false; - m_pPhrases = translator->CreatePhraseCollection(); + m_pPhrases = g_Translator.CreatePhraseCollection(); m_MaxClientsVar = NULL; } @@ -79,7 +74,7 @@ CPlugin::~CPlugin() sec.pOwner = g_PluginSys.GetIdentity(); sec.pIdentity = sec.pOwner; - g_HandleSys.FreeHandle(m_handle, &sec); + handlesys->FreeHandle(m_handle, &sec); g_ShareSys.DestroyIdentity(m_ident); } @@ -89,10 +84,6 @@ CPlugin::~CPlugin() m_pRuntime = NULL; } - if (m_pProps) - { - sm_trie_destroy(m_pProps); - } for (size_t i=0; iCreateHandle(g_PluginType, this, g_PluginSys.GetIdentity(), g_PluginSys.GetIdentity(), NULL); m_pRuntime->GetDefaultContext()->SetKey(1, m_ident); m_pRuntime->GetDefaultContext()->SetKey(2, (IPlugin *)this); } @@ -122,7 +113,7 @@ unsigned int CPlugin::CalcMemUsage() sizeof(CPlugin) + sizeof(IdentityToken_t) + (m_configs.size() * (sizeof(AutoConfig *) + sizeof(AutoConfig))) - + sm_trie_mem_usage(m_pProps); + + m_pProps.mem_usage(); for (unsigned int i = 0; i < m_configs.size(); i++) { @@ -155,7 +146,7 @@ Handle_t CPlugin::GetMyHandle() CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength) { char fullpath[PLATFORM_MAX_PATH]; - g_SourceMod.BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", file); + g_pSM->BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", file); FILE *fp = fopen(fullpath, "rb"); CPlugin *pPlugin = new CPlugin(file); @@ -164,7 +155,7 @@ CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength) { if (error) { - UTIL_Format(error, maxlength, "Unable to open file"); + smcore.Format(error, maxlength, "Unable to open file"); } pPlugin->m_status = Plugin_BadLoad; return pPlugin; @@ -177,11 +168,14 @@ CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength) bool CPlugin::GetProperty(const char *prop, void **ptr, bool remove/* =false */) { - bool exists = sm_trie_retrieve(m_pProps, prop, ptr); + void **ptrpp = m_pProps.retrieve(prop); + bool exists = !!ptrpp; - if (exists && remove) + if (exists) { - sm_trie_delete(m_pProps, prop); + *ptr = *ptrpp; + if (remove) + m_pProps.remove(prop); } return exists; @@ -189,7 +183,7 @@ bool CPlugin::GetProperty(const char *prop, void **ptr, bool remove/* =false */) bool CPlugin::SetProperty(const char *prop, void *ptr) { - return sm_trie_insert(m_pProps, prop, ptr); + return m_pProps.insert(prop, ptr); } IPluginRuntime *CPlugin::GetRuntime() @@ -210,7 +204,7 @@ void CPlugin::SetErrorState(PluginStatus status, const char *error_fmt, ...) va_list ap; va_start(ap, error_fmt); - UTIL_FormatArgs(m_errormsg, sizeof(m_errormsg), error_fmt, ap); + smcore.FormatArgs(m_errormsg, sizeof(m_errormsg), error_fmt, ap); va_end(ap); if (m_pRuntime != NULL) @@ -277,7 +271,7 @@ bool CPlugin::UpdateInfo() { base->LocalToString(info->date, (char **)&pDate); base->LocalToString(info->time, (char **)&pTime); - UTIL_Format(m_DateTime, sizeof(m_DateTime), "%s %s", pDate, pTime); + smcore.Format(m_DateTime, sizeof(m_DateTime), "%s %s", pDate, pTime); } if (m_FileVersion > 5) { @@ -318,7 +312,7 @@ void CPlugin::Call_OnPluginStart() m_status = Plugin_Running; - SyncMaxClients(g_Players.MaxClients()); + SyncMaxClients(playerhelpers->GetMaxClients()); cell_t result; IPluginFunction *pFunction = m_pRuntime->GetFunctionByName("OnPluginStart"); @@ -372,7 +366,7 @@ void CPlugin::Call_OnAllPluginsLoaded() pFunction->Execute(&result); } - if (g_SourceMod.IsMapRunning()) + if (smcore.IsMapRunning()) { if ((pFunction = m_pRuntime->GetFunctionByName("OnMapStart")) != NULL) { @@ -380,9 +374,9 @@ void CPlugin::Call_OnAllPluginsLoaded() } } - if (SM_AreConfigsExecuted()) + if (smcore.AreConfigsExecuted()) { - SM_ExecuteForPlugin(GetBaseContext()); + smcore.ExecuteConfigs(GetBaseContext()); } } @@ -566,7 +560,7 @@ bool CPlugin::IsRunnable() time_t CPlugin::GetFileTimeStamp() { char path[PLATFORM_MAX_PATH]; - g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "plugins/%s", m_filename); + g_pSM->BuildPath(Path_SM, path, sizeof(path), "plugins/%s", m_filename); #ifdef PLATFORM_WINDOWS struct _stat s; if (_stat(path, &s) != 0) @@ -693,15 +687,14 @@ void CPlugin::AddConfig(bool autoCreate, const char *cfg, const char *folder) void CPlugin::DropEverything() { CPlugin *pOther; - List::iterator iter; List::iterator wk_iter; /* Tell everyone that depends on us that we're about to drop */ - for (iter = m_Dependents.begin(); + for (List::iterator iter = m_Dependents.begin(); iter != m_Dependents.end(); iter++) { - pOther = (*iter); + pOther = static_cast(*iter); pOther->DependencyDropped(this); } @@ -715,11 +708,11 @@ void CPlugin::DropEverything() /* Other plugins could be holding weak references that were * added by us. We need to clean all of those up now. */ - for (iter = g_PluginSys.m_plugins.begin(); + for (List::iterator iter = g_PluginSys.m_plugins.begin(); iter != g_PluginSys.m_plugins.end(); iter++) { - (*iter)->DropRefsTo(this); + (*iter)->ToNativeOwner()->DropRefsTo(this); } /* Proceed with the rest of the necessities. */ @@ -785,7 +778,6 @@ void CPluginManager::CPluginIterator::Reset() CPluginManager::CPluginManager() { - m_LoadLookup = sm_trie_create(); m_AllPluginsLoaded = false; m_MyIdent = NULL; m_LoadingLocked = false; @@ -795,13 +787,6 @@ CPluginManager::CPluginManager() CPluginManager::~CPluginManager() { - /* :NOTICE: - * Ignore the fact that there might be plugins in the cache. - * This usually means that Core is not being unloaded properly, and everything - * will crash anyway. YAY - */ - sm_trie_destroy(m_LoadLookup); - CStack::iterator iter; for (iter=m_iters.begin(); iter!=m_iters.end(); iter++) { @@ -820,6 +805,15 @@ void CPluginManager::Shutdown() } } +void CPluginManager::LoadAll(const char *config_path, const char *plugins_path) +{ + LoadAll_FirstPass(config_path, plugins_path); + g_Extensions.MarkAllLoaded(); + LoadAll_SecondPass(); + g_Extensions.MarkAllLoaded(); + AllPluginsLoaded(); +} + void CPluginManager::LoadAll_FirstPass(const char *config, const char *basedir) { /* First read in the database of plugin settings */ @@ -834,19 +828,19 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa /* Form the current path to start reading from */ if (localpath == NULL) { - g_LibSys.PathFormat(base_path, sizeof(base_path), "%s", basedir); + libsys->PathFormat(base_path, sizeof(base_path), "%s", basedir); } else { - g_LibSys.PathFormat(base_path, sizeof(base_path), "%s/%s", basedir, localpath); + libsys->PathFormat(base_path, sizeof(base_path), "%s/%s", basedir, localpath); } - IDirectory *dir = g_LibSys.OpenDirectory(base_path); + IDirectory *dir = libsys->OpenDirectory(base_path); if (!dir) { char error[256]; - g_LibSys.GetPlatformError(error, sizeof(error)); - g_Logger.LogError("[SM] Failure reading from plugins path: %s", localpath); - g_Logger.LogError("[SM] Platform returned error: %s", error); + libsys->GetPlatformError(error, sizeof(error)); + smcore.LogError("[SM] Failure reading from plugins path: %s", localpath); + smcore.LogError("[SM] Platform returned error: %s", error); return; } @@ -862,9 +856,9 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa if (localpath == NULL) { /* If no path yet, don't add a former slash */ - UTIL_Format(new_local, sizeof(new_local), "%s", dir->GetEntryName()); + smcore.Format(new_local, sizeof(new_local), "%s", dir->GetEntryName()); } else { - g_LibSys.PathFormat(new_local, sizeof(new_local), "%s/%s", localpath, dir->GetEntryName()); + libsys->PathFormat(new_local, sizeof(new_local), "%s/%s", localpath, dir->GetEntryName()); } LoadPluginsFromDir(basedir, new_local); } else if (dir->IsEntryFile()) { @@ -877,16 +871,16 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa char plugin[PLATFORM_MAX_PATH]; if (localpath == NULL) { - UTIL_Format(plugin, sizeof(plugin), "%s", name); + smcore.Format(plugin, sizeof(plugin), "%s", name); } else { - g_LibSys.PathFormat(plugin, sizeof(plugin), "%s/%s", localpath, name); + libsys->PathFormat(plugin, sizeof(plugin), "%s/%s", localpath, name); } LoadAutoPlugin(plugin); } } dir->NextEntry(); } - g_LibSys.CloseDirectory(dir); + libsys->CloseDirectory(dir); } LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength) @@ -901,9 +895,10 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de /** * Does this plugin already exist? */ - CPlugin *pPlugin; - if (sm_trie_retrieve(m_LoadLookup, path, (void **)&pPlugin)) + CPlugin **pluginpp = m_LoadLookup.retrieve(path); + if (pluginpp && *pluginpp) { + CPlugin *pPlugin = *pluginpp; /* Check to see if we should try reloading it */ if (pPlugin->GetStatus() == Plugin_BadLoad || pPlugin->GetStatus() == Plugin_Error @@ -921,7 +916,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de } } - pPlugin = CPlugin::CreatePlugin(path, error, maxlength); + CPlugin *pPlugin = CPlugin::CreatePlugin(path, error, maxlength); assert(pPlugin != NULL); @@ -938,14 +933,14 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de if (co != NULL) { char fullpath[PLATFORM_MAX_PATH]; - g_SourceMod.BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", pPlugin->m_filename); + g_pSM->BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", pPlugin->m_filename); pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err); if (pPlugin->m_pRuntime == NULL) { if (error) { - UTIL_Format(error, + smcore.Format(error, maxlength, "Unable to load plugin (error %d: %s)", err, @@ -963,7 +958,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de { if (error) { - UTIL_Format(error, maxlength, "%s", pPlugin->m_errormsg); + smcore.Format(error, maxlength, "%s", pPlugin->m_errormsg); } } } @@ -974,9 +969,9 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de unsigned char *pCodeHash = pPlugin->m_pRuntime->GetCodeHash(); char codeHashBuf[40]; - UTIL_Format(codeHashBuf, 40, "plugin_"); + smcore.Format(codeHashBuf, 40, "plugin_"); for (int i = 0; i < 16; i++) - UTIL_Format(codeHashBuf + 7 + (i * 2), 3, "%02x", pCodeHash[i]); + smcore.Format(codeHashBuf + 7 + (i * 2), 3, "%02x", pCodeHash[i]); const char *bulletinUrl = g_pGameConf->GetKeyValue(codeHashBuf); if (bulletinUrl != NULL) @@ -987,18 +982,18 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de { if (bulletinUrl[0] != '\0') { - UTIL_Format(error, maxlength, "Known malware detected and blocked. See %s for more info", bulletinUrl); + smcore.Format(error, maxlength, "Known malware detected and blocked. See %s for more info", bulletinUrl); } else { - UTIL_Format(error, maxlength, "Possible malware or illegal plugin detected and blocked"); + smcore.Format(error, maxlength, "Possible malware or illegal plugin detected and blocked"); } } pPlugin->m_status = Plugin_BadLoad; } else { if (bulletinUrl[0] != '\0') { - g_Logger.LogMessage("%s: Known malware detected. See %s for more info, blocking disabled in core.cfg", pPlugin->GetFilename(), bulletinUrl); + smcore.Log("%s: Known malware detected. See %s for more info, blocking disabled in core.cfg", pPlugin->GetFilename(), bulletinUrl); } else { - g_Logger.LogMessage("%s: Possible malware or illegal plugin detected, blocking disabled in core.cfg", pPlugin->GetFilename()); + smcore.Log("%s: Possible malware or illegal plugin detected, blocking disabled in core.cfg", pPlugin->GetFilename()); } } } @@ -1068,11 +1063,11 @@ IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType typ { if (m_LoadingLocked) { - UTIL_Format(error, maxlength, "There is a global plugin loading lock in effect"); + smcore.Format(error, maxlength, "There is a global plugin loading lock in effect"); } else { - UTIL_Format(error, maxlength, "This plugin is blocked from loading (see plugin_settings.cfg)"); + smcore.Format(error, maxlength, "This plugin is blocked from loading (see plugin_settings.cfg)"); } } return NULL; @@ -1102,7 +1097,7 @@ void CPluginManager::LoadAutoPlugin(const char *plugin) if ((res=_LoadPlugin(&pl, plugin, false, PluginType_MapUpdated, error, sizeof(error))) == LoadRes_Failure) { - g_Logger.LogError("[SM] Failed to load plugin \"%s\": %s.", plugin, error); + smcore.LogError("[SM] Failed to load plugin \"%s\": %s.", plugin, error); pl->SetErrorState( pl->GetStatus() <= Plugin_Created ? Plugin_BadLoad : pl->GetStatus(), "%s", @@ -1127,7 +1122,7 @@ void CPluginManager::AddPlugin(CPlugin *pPlugin) } m_plugins.push_back(pPlugin); - sm_trie_insert(m_LoadLookup, pPlugin->m_filename, pPlugin); + m_LoadLookup.insert(pPlugin->m_filename, pPlugin); } void CPluginManager::LoadAll_SecondPass() @@ -1144,7 +1139,7 @@ void CPluginManager::LoadAll_SecondPass() error[0] = '\0'; if (!RunSecondPass(pPlugin, error, sizeof(error))) { - g_Logger.LogError("[SM] Unable to load plugin \"%s\": %s", pPlugin->GetFilename(), error); + smcore.LogError("[SM] Unable to load plugin \"%s\": %s", pPlugin->GetFilename(), error); pPlugin->SetErrorState(Plugin_Failed, "%s", error); } } @@ -1185,7 +1180,7 @@ bool CPluginManager::FindOrRequirePluginDeps(CPlugin *pPlugin, char *error, size { continue; } - g_LibSys.GetFileFromPath(pathfile, sizeof(pathfile), pPlugin->GetFilename()); + libsys->GetFileFromPath(pathfile, sizeof(pathfile), pPlugin->GetFilename()); if (strcmp(pathfile, file) == 0) { continue; @@ -1194,7 +1189,7 @@ bool CPluginManager::FindOrRequirePluginDeps(CPlugin *pPlugin, char *error, size { IPluginFunction *pFunc; char buffer[64]; - UTIL_Format(buffer, sizeof(buffer), "__pl_%s_SetNTVOptional", &pubvar->name[5]); + smcore.Format(buffer, sizeof(buffer), "__pl_%s_SetNTVOptional", &pubvar->name[5]); if ((pFunc=pBase->GetFunctionByName(buffer))) { cell_t res; @@ -1203,7 +1198,7 @@ bool CPluginManager::FindOrRequirePluginDeps(CPlugin *pPlugin, char *error, size { if (error) { - UTIL_Format(error, maxlength, "Fatal error during initializing plugin load"); + smcore.Format(error, maxlength, "Fatal error during initializing plugin load"); } return false; } @@ -1236,7 +1231,7 @@ bool CPluginManager::FindOrRequirePluginDeps(CPlugin *pPlugin, char *error, size { if (error) { - UTIL_Format(error, maxlength, "Could not find required plugin \"%s\"", name); + smcore.Format(error, maxlength, "Could not find required plugin \"%s\"", name); } return false; } @@ -1286,9 +1281,9 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass /* Attempt to auto-load if necessary */ if (ext->autoload) { - g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file); + libsys->PathFormat(path, PLATFORM_MAX_PATH, "%s", file); bool bErrorOnMissing = ext->required ? true : false; - g_Extensions.LoadAutoExtension(path, bErrorOnMissing); + g_Extensions.LoadAutoExtension(path); } } else if (pass == 2) @@ -1296,7 +1291,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass /* Is this required? */ if (ext->required) { - g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file); + libsys->PathFormat(path, PLATFORM_MAX_PATH, "%s", file); if ((pExt = g_Extensions.FindExtensionByFile(path)) == NULL) { pExt = g_Extensions.FindExtensionByName(name); @@ -1308,7 +1303,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass { if (error) { - UTIL_Format(error, maxlength, "Required extension \"%s\" file(\"%s\") not running", name, file); + smcore.Format(error, maxlength, "Required extension \"%s\" file(\"%s\") not running", name, file); } return false; } @@ -1321,7 +1316,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass { IPluginFunction *pFunc; char buffer[64]; - UTIL_Format(buffer, sizeof(buffer), "__ext_%s_SetNTVOptional", &pubvar->name[6]); + smcore.Format(buffer, sizeof(buffer), "__ext_%s_SetNTVOptional", &pubvar->name[6]); if ((pFunc = pBase->GetFunctionByName(buffer)) != NULL) { @@ -1331,7 +1326,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass { if (error) { - UTIL_Format(error, maxlength, "Fatal error during plugin initialization (ext req)"); + smcore.Format(error, maxlength, "Fatal error during plugin initialization (ext req)"); } return false; } @@ -1376,7 +1371,7 @@ bool CPluginManager::RunSecondPass(CPlugin *pPlugin, char *error, size_t maxleng { if (error) { - UTIL_Format(error, maxlength, "Native \"%s\" was not found", native->name); + smcore.Format(error, maxlength, "Native \"%s\" was not found", native->name); } return false; } @@ -1518,14 +1513,14 @@ bool CPluginManager::UnloadPlugin(IPlugin *plugin) if (pContext != NULL && pContext->IsInExec()) { char buffer[255]; - UTIL_Format(buffer, sizeof(buffer), "sm plugins unload %s\n", plugin->GetFilename()); + smcore.Format(buffer, sizeof(buffer), "sm plugins unload %s\n", plugin->GetFilename()); engine->ServerCommand(buffer); return false; } /* Remove us from the lookup table and linked list */ m_plugins.remove(pPlugin); - sm_trie_delete(m_LoadLookup, pPlugin->m_filename); + m_LoadLookup.remove(pPlugin->m_filename); /* Go through our libraries and tell other plugins they're gone */ List::iterator s_iter; @@ -1831,7 +1826,7 @@ bool CPluginManager::TestAliasMatch(const char *alias, const char *localpath) bool CPluginManager::IsLateLoadTime() const { - return (m_AllPluginsLoaded || !g_SourceMod.IsMapLoading()); + return (m_AllPluginsLoaded || !smcore.IsMapLoading()); } void CPluginManager::OnSourceModAllInitialized() @@ -1839,34 +1834,34 @@ void CPluginManager::OnSourceModAllInitialized() m_MyIdent = g_ShareSys.CreateCoreIdentity(); 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; - g_PluginType = g_HandleSys.CreateType("Plugin", this, 0, NULL, &sec, m_MyIdent, NULL); + g_PluginType = handlesys->CreateType("Plugin", this, 0, NULL, &sec, m_MyIdent, NULL); g_PluginIdent = g_ShareSys.CreateIdentType("PLUGIN"); - g_RootMenu.AddRootConsoleCommand("plugins", "Manage Plugins", this); + rootmenu->AddRootConsoleCommand("plugins", "Manage Plugins", this); - g_ShareSys.AddInterface(NULL, this); + g_ShareSys.AddInterface(NULL, GetOldAPI()); - m_pOnLibraryAdded = g_Forwards.CreateForward("OnLibraryAdded", ET_Ignore, 1, NULL, Param_String); - m_pOnLibraryRemoved = g_Forwards.CreateForward("OnLibraryRemoved", ET_Ignore, 1, NULL, Param_String); + m_pOnLibraryAdded = forwardsys->CreateForward("OnLibraryAdded", ET_Ignore, 1, NULL, Param_String); + m_pOnLibraryRemoved = forwardsys->CreateForward("OnLibraryRemoved", ET_Ignore, 1, NULL, Param_String); } void CPluginManager::OnSourceModShutdown() { - g_RootMenu.RemoveRootConsoleCommand("plugins", this); + rootmenu->RemoveRootConsoleCommand("plugins", this); UnloadAll(); - g_HandleSys.RemoveType(g_PluginType, m_MyIdent); + handlesys->RemoveType(g_PluginType, m_MyIdent); g_ShareSys.DestroyIdentType(g_PluginIdent); g_ShareSys.DestroyIdentity(m_MyIdent); - g_Forwards.ReleaseForward(m_pOnLibraryAdded); - g_Forwards.ReleaseForward(m_pOnLibraryRemoved); + forwardsys->ReleaseForward(m_pOnLibraryAdded); + forwardsys->ReleaseForward(m_pOnLibraryRemoved); } ConfigResult CPluginManager::OnSourceModConfigChanged(const char *key, @@ -1882,7 +1877,7 @@ ConfigResult CPluginManager::OnSourceModConfigChanged(const char *key, } else if (strcasecmp(value, "no") == 0) { m_bBlockBadPlugins = false; } else { - UTIL_Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\""); + smcore.Format(error, maxlength, "Invalid value: must be \"yes\" or \"no\""); return ConfigResult_Reject; } return ConfigResult_Accept; @@ -1911,7 +1906,7 @@ IPlugin *CPluginManager::PluginFromHandle(Handle_t handle, HandleError *err) sec.pOwner = NULL; sec.pIdentity = m_MyIdent; - if ((_err=g_HandleSys.ReadHandle(handle, g_PluginType, &sec, (void **)&pPlugin)) != HandleError_None) + if ((_err=handlesys->ReadHandle(handle, g_PluginType, &sec, (void **)&pPlugin)) != HandleError_None) { pPlugin = NULL; } @@ -1964,12 +1959,17 @@ const char *CPluginManager::GetStatusText(PluginStatus st) } } +static inline bool IS_STR_FILLED(const char *text) +{ + return text[0] != '\0'; +} + void CPluginManager::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) { char buffer[256]; @@ -1978,12 +1978,12 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c if (!plnum) { - g_RootMenu.ConsolePrint("[SM] No plugins loaded"); + rootmenu->ConsolePrint("[SM] No plugins loaded"); return; } else { - g_RootMenu.ConsolePrint("[SM] Listing %d plugin%s:", GetPluginCount(), (plnum > 1) ? "s" : ""); + rootmenu->ConsolePrint("[SM] Listing %d plugin%s:", GetPluginCount(), (plnum > 1) ? "s" : ""); } CPlugin *pl; @@ -1998,7 +1998,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c const sm_plugininfo_t *info = pl->GetPublicInfo(); if (pl->GetStatus() != Plugin_Running && !pl->IsSilentlyFailed()) { - len += UTIL_Format(buffer, sizeof(buffer), " %02d <%s>", id, GetStatusText(pl->GetStatus())); + len += smcore.Format(buffer, sizeof(buffer), " %02d <%s>", id, GetStatusText(pl->GetStatus())); if (pl->GetStatus() <= Plugin_Error) { @@ -2008,32 +2008,32 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c } else { - len += UTIL_Format(buffer, sizeof(buffer), " %02d", id); + len += smcore.Format(buffer, sizeof(buffer), " %02d", id); } if (pl->GetStatus() < Plugin_Created) { if (pl->IsSilentlyFailed()) - len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " Disabled:"); - len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " \"%s\"", (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename()); + len += smcore.Format(&buffer[len], sizeof(buffer)-len, " Disabled:"); + len += smcore.Format(&buffer[len], sizeof(buffer)-len, " \"%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); + len += smcore.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); + smcore.Format(&buffer[len], sizeof(buffer)-len, " by %s", info->author); } } else { - UTIL_Format(&buffer[len], sizeof(buffer)-len, " %s", pl->m_filename); + smcore.Format(&buffer[len], sizeof(buffer)-len, " %s", pl->m_filename); } - g_RootMenu.ConsolePrint("%s", buffer); + rootmenu->ConsolePrint("%s", buffer); } if (!m_FailList.empty()) { - g_RootMenu.ConsolePrint("Load Errors:"); + rootmenu->ConsolePrint("Load Errors:"); SourceHook::List::iterator _iter; @@ -2042,7 +2042,7 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c for (_iter=m_FailList.begin(); _iter!=m_FailList.end(); _iter++) { pl = (CPlugin *)*_iter; - g_RootMenu.ConsolePrint("%s: %s",(IS_STR_FILLED(pl->GetPublicInfo()->name)) ? pl->GetPublicInfo()->name : pl->GetFilename(), pl->m_errormsg); + rootmenu->ConsolePrint("%s: %s",(IS_STR_FILLED(pl->GetPublicInfo()->name)) ? pl->GetPublicInfo()->name : pl->GetFilename(), pl->m_errormsg); } } @@ -2052,33 +2052,33 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c { if (argcount < 4) { - g_RootMenu.ConsolePrint("[SM] Usage: sm plugins load "); + rootmenu->ConsolePrint("[SM] Usage: sm plugins load "); return; } char error[128]; bool wasloaded; - const char *filename = command.Arg(3); + const char *filename = smcore.Arg(command, 3); char pluginfile[256]; - const char *ext = g_LibSys.GetFileExtension(filename) ? "" : ".smx"; - g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", filename, ext); + const char *ext = libsys->GetFileExtension(filename) ? "" : ".smx"; + g_pSM->BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", filename, ext); IPlugin *pl = LoadPlugin(pluginfile, false, PluginType_MapUpdated, error, sizeof(error), &wasloaded); if (wasloaded) { - g_RootMenu.ConsolePrint("[SM] Plugin %s is already loaded.", pluginfile); + rootmenu->ConsolePrint("[SM] Plugin %s is already loaded.", pluginfile); return; } if (pl) { - g_RootMenu.ConsolePrint("[SM] Loaded plugin %s successfully.", pluginfile); + rootmenu->ConsolePrint("[SM] Loaded plugin %s successfully.", pluginfile); } else { - g_RootMenu.ConsolePrint("[SM] Plugin %s failed to load: %s.", pluginfile, error); + rootmenu->ConsolePrint("[SM] Plugin %s failed to load: %s.", pluginfile, error); } return; @@ -2087,13 +2087,13 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c { if (argcount < 4) { - g_RootMenu.ConsolePrint("[SM] Usage: sm plugins unload <#|file>"); + rootmenu->ConsolePrint("[SM] Usage: sm plugins unload <#|file>"); return; } CPlugin *pl; char *end; - const char *arg = command.Arg(3); + const char *arg = smcore.Arg(command, 3); int id = strtol(arg, &end, 10); if (*end == '\0') @@ -2101,21 +2101,23 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c pl = GetPluginByOrder(id); if (!pl) { - g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", id); + rootmenu->ConsolePrint("[SM] Plugin index %d not found.", id); return; } } else { char pluginfile[256]; - const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx"; - g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext); + const char *ext = libsys->GetFileExtension(arg) ? "" : ".smx"; + g_pSM->BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext); - if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl)) + CPlugin **pluginpp = m_LoadLookup.retrieve(pluginfile); + if (!pluginpp || !*pluginpp) { - g_RootMenu.ConsolePrint("[SM] Plugin %s is not loaded.", pluginfile); + rootmenu->ConsolePrint("[SM] Plugin %s is not loaded.", pluginfile); return; } + pl = *pluginpp; } char name[PLATFORM_MAX_PATH]; @@ -2123,20 +2125,20 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c if (pl->GetStatus() < Plugin_Created) { const sm_plugininfo_t *info = pl->GetPublicInfo(); - UTIL_Format(name, sizeof(name), (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename()); + smcore.Format(name, sizeof(name), (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename()); } else { - UTIL_Format(name, sizeof(name), "%s", pl->GetFilename()); + smcore.Format(name, sizeof(name), "%s", pl->GetFilename()); } if (UnloadPlugin(pl)) { - g_RootMenu.ConsolePrint("[SM] Plugin %s unloaded successfully.", name); + rootmenu->ConsolePrint("[SM] Plugin %s unloaded successfully.", name); } else { - g_RootMenu.ConsolePrint("[SM] Failed to unload plugin %s.", name); + rootmenu->ConsolePrint("[SM] Failed to unload plugin %s.", name); } return; @@ -2144,19 +2146,19 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c else if (strcmp(cmd, "unload_all") == 0) { g_PluginSys.UnloadAll(); - g_RootMenu.ConsolePrint("[SM] All plugins have been unloaded."); + rootmenu->ConsolePrint("[SM] All plugins have been unloaded."); return; } else if (strcmp(cmd, "load_lock") == 0) { if (m_LoadingLocked) { - g_RootMenu.ConsolePrint("[SM] There is already a loading lock in effect."); + rootmenu->ConsolePrint("[SM] There is already a loading lock in effect."); } else { m_LoadingLocked = true; - g_RootMenu.ConsolePrint("[SM] Loading is now locked; no plugins will be loaded or re-loaded."); + rootmenu->ConsolePrint("[SM] Loading is now locked; no plugins will be loaded or re-loaded."); } return; } @@ -2165,11 +2167,11 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c if (m_LoadingLocked) { m_LoadingLocked = false; - g_RootMenu.ConsolePrint("[SM] The loading lock is no longer in effect."); + rootmenu->ConsolePrint("[SM] The loading lock is no longer in effect."); } else { - g_RootMenu.ConsolePrint("[SM] There was no loading lock in effect."); + rootmenu->ConsolePrint("[SM] There was no loading lock in effect."); } return; } @@ -2177,13 +2179,13 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c { if (argcount < 4) { - g_RootMenu.ConsolePrint("[SM] Usage: sm plugins info <#>"); + rootmenu->ConsolePrint("[SM] Usage: sm plugins info <#>"); return; } CPlugin *pl; char *end; - const char *arg = command.Arg(3); + const char *arg = smcore.Arg(command, 3); int id = strtol(arg, &end, 10); if (*end == '\0') @@ -2191,62 +2193,64 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c pl = GetPluginByOrder(id); if (!pl) { - g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", id); + rootmenu->ConsolePrint("[SM] Plugin index %d not found.", id); return; } } else { char pluginfile[256]; - const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx"; - g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext); + const char *ext = libsys->GetFileExtension(arg) ? "" : ".smx"; + g_pSM->BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext); - if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl)) + CPlugin **pluginpp = m_LoadLookup.retrieve(pluginfile); + if (!pluginpp || !*pluginpp) { - g_RootMenu.ConsolePrint("[SM] Plugin %s is not loaded.", pluginfile); + rootmenu->ConsolePrint("[SM] Plugin %s is not loaded.", pluginfile); return; } + pl = *pluginpp; } const sm_plugininfo_t *info = pl->GetPublicInfo(); - g_RootMenu.ConsolePrint(" Filename: %s", pl->GetFilename()); + rootmenu->ConsolePrint(" Filename: %s", pl->GetFilename()); if (pl->GetStatus() <= Plugin_Error) { if (IS_STR_FILLED(info->name)) { if (IS_STR_FILLED(info->description)) { - g_RootMenu.ConsolePrint(" Title: %s (%s)", info->name, info->description); + rootmenu->ConsolePrint(" Title: %s (%s)", info->name, info->description); } else { - g_RootMenu.ConsolePrint(" Title: %s", info->name); + rootmenu->ConsolePrint(" Title: %s", info->name); } } if (IS_STR_FILLED(info->author)) { - g_RootMenu.ConsolePrint(" Author: %s", info->author); + rootmenu->ConsolePrint(" Author: %s", info->author); } if (IS_STR_FILLED(info->version)) { - g_RootMenu.ConsolePrint(" Version: %s", info->version); + rootmenu->ConsolePrint(" Version: %s", info->version); } if (IS_STR_FILLED(info->url)) { - g_RootMenu.ConsolePrint(" URL: %s", info->url); + rootmenu->ConsolePrint(" URL: %s", info->url); } if (pl->GetStatus() == Plugin_Error) { - g_RootMenu.ConsolePrint(" Error: %s", pl->m_errormsg); + rootmenu->ConsolePrint(" Error: %s", pl->m_errormsg); } else { if (pl->GetStatus() == Plugin_Running) { - g_RootMenu.ConsolePrint(" Status: running"); + rootmenu->ConsolePrint(" Status: running"); } else { - g_RootMenu.ConsolePrint(" Status: not running"); + rootmenu->ConsolePrint(" Status: not running"); } const char *typestr = ""; @@ -2264,11 +2268,11 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c break; } - g_RootMenu.ConsolePrint(" Reloads: %s", typestr); + rootmenu->ConsolePrint(" Reloads: %s", typestr); } if (pl->m_FileVersion >= 3) { - g_RootMenu.ConsolePrint(" Timestamp: %s", pl->m_DateTime); + rootmenu->ConsolePrint(" Timestamp: %s", pl->m_DateTime); } unsigned char *pCodeHash = pl->m_pRuntime->GetCodeHash(); @@ -2276,21 +2280,21 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c char combinedHash[33]; for (int i = 0; i < 16; i++) - UTIL_Format(combinedHash + (i * 2), 3, "%02x", pCodeHash[i] ^ pDataHash[i]); + smcore.Format(combinedHash + (i * 2), 3, "%02x", pCodeHash[i] ^ pDataHash[i]); - g_RootMenu.ConsolePrint(" Hash: %s", combinedHash); + rootmenu->ConsolePrint(" Hash: %s", combinedHash); } else { - g_RootMenu.ConsolePrint(" Load error: %s", pl->m_errormsg); + rootmenu->ConsolePrint(" Load error: %s", pl->m_errormsg); if (pl->GetStatus() < Plugin_Created) { - g_RootMenu.ConsolePrint(" File info: (title \"%s\") (version \"%s\")", + rootmenu->ConsolePrint(" File info: (title \"%s\") (version \"%s\")", info->name ? info->name : "", info->version ? info->version : ""); if (IS_STR_FILLED(info->url)) { - g_RootMenu.ConsolePrint(" File URL: %s", info->url); + rootmenu->ConsolePrint(" File URL: %s", info->url); } } } @@ -2299,21 +2303,21 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c } else if (strcmp(cmd, "refresh") == 0) { - g_SourceMod.DoGlobalPluginLoads(); - g_RootMenu.ConsolePrint("[SM] The plugin list has been refreshed and reloaded."); + smcore.DoGlobalPluginLoads(); + rootmenu->ConsolePrint("[SM] The plugin list has been refreshed and reloaded."); return; } else if (strcmp(cmd, "reload") == 0) { if (argcount < 4) { - g_RootMenu.ConsolePrint("[SM] Usage: sm plugins reload <#|file>"); + rootmenu->ConsolePrint("[SM] Usage: sm plugins reload <#|file>"); return; } CPlugin *pl; char *end; - const char *arg = command.Arg(3); + const char *arg = smcore.Arg(command, 3); int id = strtol(arg, &end, 10); if (*end == '\0') @@ -2321,21 +2325,23 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c pl = GetPluginByOrder(id); if (!pl) { - g_RootMenu.ConsolePrint("[SM] Plugin index %d not found.", id); + rootmenu->ConsolePrint("[SM] Plugin index %d not found.", id); return; } } else { char pluginfile[256]; - const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx"; - g_SourceMod.BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext); + const char *ext = libsys->GetFileExtension(arg) ? "" : ".smx"; + g_pSM->BuildPath(Path_None, pluginfile, sizeof(pluginfile), "%s%s", arg, ext); - if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl)) + CPlugin **pluginpp = m_LoadLookup.retrieve(pluginfile); + if (!pluginpp || !*pluginpp) { - g_RootMenu.ConsolePrint("[SM] Plugin %s is not loaded.", pluginfile); + rootmenu->ConsolePrint("[SM] Plugin %s is not loaded.", pluginfile); return; } + pl = *pluginpp; } char name[PLATFORM_MAX_PATH]; @@ -2347,11 +2353,11 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c if (ReloadPlugin(pl)) { - g_RootMenu.ConsolePrint("[SM] Plugin %s reloaded successfully.", name); + rootmenu->ConsolePrint("[SM] Plugin %s reloaded successfully.", name); } else { - g_RootMenu.ConsolePrint("[SM] Failed to reload plugin %s.", name); + rootmenu->ConsolePrint("[SM] Failed to reload plugin %s.", name); } return; @@ -2359,16 +2365,16 @@ void CPluginManager::OnRootConsoleCommand(const char *cmdname, const CCommand &c } /* Draw the main menu */ - g_RootMenu.ConsolePrint("SourceMod Plugins Menu:"); - g_RootMenu.DrawGenericOption("info", "Information about a plugin"); - g_RootMenu.DrawGenericOption("list", "Show loaded plugins"); - g_RootMenu.DrawGenericOption("load", "Load a plugin"); - g_RootMenu.DrawGenericOption("load_lock", "Prevents any more plugins from being loaded"); - g_RootMenu.DrawGenericOption("load_unlock", "Re-enables plugin loading"); - g_RootMenu.DrawGenericOption("refresh", "Reloads/refreshes all plugins in the plugins folder"); - g_RootMenu.DrawGenericOption("reload", "Reloads a plugin"); - g_RootMenu.DrawGenericOption("unload", "Unload a plugin"); - g_RootMenu.DrawGenericOption("unload_all", "Unloads all plugins"); + rootmenu->ConsolePrint("SourceMod Plugins Menu:"); + rootmenu->DrawGenericOption("info", "Information about a plugin"); + rootmenu->DrawGenericOption("list", "Show loaded plugins"); + rootmenu->DrawGenericOption("load", "Load a plugin"); + rootmenu->DrawGenericOption("load_lock", "Prevents any more plugins from being loaded"); + rootmenu->DrawGenericOption("load_unlock", "Re-enables plugin loading"); + rootmenu->DrawGenericOption("refresh", "Reloads/refreshes all plugins in the plugins folder"); + rootmenu->DrawGenericOption("reload", "Reloads a plugin"); + rootmenu->DrawGenericOption("unload", "Unload a plugin"); + rootmenu->DrawGenericOption("unload_all", "Unloads all plugins"); } bool CPluginManager::ReloadPlugin(CPlugin *pl) @@ -2418,7 +2424,7 @@ bool CPluginManager::ReloadPlugin(CPlugin *pl) return true; } -void CPluginManager::ReloadOrUnloadPlugins() +void CPluginManager::RefreshAll() { /* If we're in a load lock, just skip this whole bit. */ if (m_LoadingLocked) @@ -2573,7 +2579,7 @@ int CPluginManager::GetOrderOfPlugin(IPlugin *pl) return -1; } -CPlugin *CPluginManager::FindPluginByConsoleArg(const char *arg) +SMPlugin *CPluginManager::FindPluginByConsoleArg(const char *arg) { int id; char *end; @@ -2592,10 +2598,11 @@ CPlugin *CPluginManager::FindPluginByConsoleArg(const char *arg) else { char pluginfile[256]; - const char *ext = g_LibSys.GetFileExtension(arg) ? "" : ".smx"; - UTIL_Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext); + const char *ext = libsys->GetFileExtension(arg) ? "" : ".smx"; + smcore.Format(pluginfile, sizeof(pluginfile), "%s%s", arg, ext); - if (!sm_trie_retrieve(m_LoadLookup, pluginfile, (void **)&pl)) + CPlugin **pluginpp = m_LoadLookup.retrieve(pluginfile); + if (!pluginpp || !*pluginpp) { return NULL; } @@ -2619,82 +2626,68 @@ void CPluginManager::SyncMaxClients(int max_clients) } } -void CPluginManager::ListPluginsToClient(CPlayer *player, const CCommand &args) +void CPluginManager::ListPlugins(CVector *list) { - char buffer[256]; - unsigned int id = 0; - int plnum = GetPluginCount(); - edict_t *e = player->GetEdict(); - unsigned int start = 0; + List::iterator iter; - if (!plnum) + for (iter = m_plugins.begin(); iter != m_plugins.end(); iter++) { - ClientConsolePrint(e, "[SM] No plugins found."); - return; - } - - if (args.ArgC() > 2) - { - start = atoi(args.Arg(2)); - } - - CPlugin *pl; - SourceHook::List::iterator iter; - SourceHook::List m_FailList; - - for (iter = m_plugins.begin(); - iter != m_plugins.end(); - iter++) - { - 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->m_filename); - } - ClientConsolePrint(e, "%s", buffer); - } - - /* See if we can get more plugins */ - while (iter != m_plugins.end()) - { - if ((*iter)->GetStatus() == Plugin_Running) - { - break; - } - } - - /* Do we actually have more plugins? */ - if (iter != m_plugins.end()) - { - ClientConsolePrint(e, "To see more, type \"sm plugins %d\"", id); + list->push_back((*iter)); } } + +class OldPluginAPI : public IPluginManager +{ +public: + IPlugin *LoadPlugin(const char *path, + bool debug, + PluginType type, + char error[], + size_t maxlength, + bool *wasloaded) + { + return g_PluginSys.LoadPlugin(path, debug, type, error, maxlength, wasloaded); + } + + bool UnloadPlugin(IPlugin *plugin) + { + return g_PluginSys.UnloadPlugin(plugin); + } + + IPlugin *FindPluginByContext(const sp_context_t *ctx) + { + return g_PluginSys.FindPluginByContext(ctx); + } + + unsigned int GetPluginCount() + { + return g_PluginSys.GetPluginCount(); + } + + IPluginIterator *GetPluginIterator() + { + return g_PluginSys.GetPluginIterator(); + } + + void AddPluginsListener(IPluginsListener *listener) + { + g_PluginSys.AddPluginsListener(listener); + } + + void RemovePluginsListener(IPluginsListener *listener) + { + g_PluginSys.RemovePluginsListener(listener); + } + + IPlugin *PluginFromHandle(Handle_t handle, HandleError *err) + { + return g_PluginSys.PluginFromHandle(handle, err); + } +}; + +static OldPluginAPI sOldPluginAPI; + +IPluginManager *CPluginManager::GetOldAPI() +{ + return &sOldPluginAPI; +} diff --git a/core/PluginSys.h b/core/logic/PluginSys.h similarity index 90% rename from core/PluginSys.h rename to core/logic/PluginSys.h index 5b21b985..df4254de 100644 --- a/core/PluginSys.h +++ b/core/logic/PluginSys.h @@ -42,19 +42,9 @@ #include #include #include -#include "sm_globals.h" -#include "sm_trie.h" -#include "sourcemod.h" +#include "common_logic.h" +#include #include -#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 m_RequiredLibs; List m_Libraries; - Trie *m_pProps; + KTrie m_pProps; bool m_FakeNativesMissing; bool m_LibraryMissing; CVector 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::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(PluginFromHandle(hndl, errp)); + } + void ListPlugins(CVector *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 m_listeners; List m_plugins; CStack m_iters; - Trie *m_LoadLookup; + KTrie m_LoadLookup; bool m_AllPluginsLoaded; IdentityToken_t *m_MyIdent; diff --git a/core/ShareSys.cpp b/core/logic/ShareSys.cpp similarity index 88% rename from core/ShareSys.cpp rename to core/logic/ShareSys.cpp index 9655a4c2..2adfc37d 100644 --- a/core/ShareSys.cpp +++ b/core/logic/ShareSys.cpp @@ -30,11 +30,11 @@ */ #include "ShareSys.h" -#include "HandleSys.h" #include "ExtensionSys.h" -#include "LibrarySys.h" +#include +#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; diff --git a/core/ShareSys.h b/core/logic/ShareSys.h similarity index 95% rename from core/ShareSys.h rename to core/logic/ShareSys.h index b7deea2c..a221da7f 100644 --- a/core/ShareSys.h +++ b/core/logic/ShareSys.h @@ -36,8 +36,7 @@ #include #include #include -#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 { diff --git a/core/logic/common_logic.cpp b/core/logic/common_logic.cpp index 7610923b..c859ac25 100644 --- a/core/logic/common_logic.cpp +++ b/core/logic/common_logic.cpp @@ -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 */ diff --git a/core/logic/common_logic.h b/core/logic/common_logic.h index 207e9603..f008d4e3 100644 --- a/core/logic/common_logic.h +++ b/core/logic/common_logic.h @@ -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_ */ diff --git a/core/logic/intercom.h b/core/logic/intercom.h index 7e89af52..a157d811 100644 --- a/core/logic/intercom.h +++ b/core/logic/intercom.h @@ -29,20 +29,27 @@ * Version: $Id$ */ -#include -#include -#include - #ifndef _INCLUDE_SOURCEMOD_INTERCOM_H_ #define _INCLUDE_SOURCEMOD_INTERCOM_H_ +#include +#include +#include +#include +#include +#include +#include +#include + 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 *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 *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_ */ - diff --git a/core/logic/msvc10/logic.vcxproj b/core/logic/msvc10/logic.vcxproj index a4dd817b..869f548e 100644 --- a/core/logic/msvc10/logic.vcxproj +++ b/core/logic/msvc10/logic.vcxproj @@ -113,10 +113,17 @@ + + + + + + + @@ -151,12 +158,17 @@ + + + + + @@ -168,9 +180,6 @@ - - - diff --git a/core/logic/msvc10/logic.vcxproj.filters b/core/logic/msvc10/logic.vcxproj.filters index 20ce954e..ab1d9776 100644 --- a/core/logic/msvc10/logic.vcxproj.filters +++ b/core/logic/msvc10/logic.vcxproj.filters @@ -123,6 +123,27 @@ Natives + + Natives + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + @@ -191,10 +212,20 @@ Header Files - - - - Resource Files - + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + \ No newline at end of file diff --git a/core/smn_fakenatives.cpp b/core/logic/smn_fakenatives.cpp similarity index 93% rename from core/smn_fakenatives.cpp rename to core/logic/smn_fakenatives.cpp index f5c3c24c..6f09c1a5 100644 --- a/core/smn_fakenatives.cpp +++ b/core/logic/smn_fakenatives.cpp @@ -31,11 +31,11 @@ #include #include -#include "sm_trie.h" -#include "sm_globals.h" +#include +#include +#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); diff --git a/core/logic/smn_players.cpp b/core/logic/smn_players.cpp index 45c995c4..0f3b2155 100644 --- a/core/logic/smn_players.cpp +++ b/core/logic/smn_players.cpp @@ -34,8 +34,8 @@ #include #include #include -#include "AutoHandleRooter.h" #include "CellArray.h" +#include "AutoHandleRooter.h" using namespace SourceHook; using namespace SourceMod; diff --git a/core/logic_bridge.cpp b/core/logic_bridge.cpp index 9a605014..9ce55d98 100644 --- a/core/logic_bridge.cpp +++ b/core/logic_bridge.cpp @@ -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; @@ -206,21 +220,78 @@ static bool symbols_are_hidden() 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(&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) diff --git a/core/logic_bridge.h b/core/logic_bridge.h index efc22a5d..0fd0cdfc 100644 --- a/core/logic_bridge.h +++ b/core/logic_bridge.h @@ -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_ */ - diff --git a/core/msvc10/sourcemod_mm.vcxproj b/core/msvc10/sourcemod_mm.vcxproj index e037503e..82b0283b 100644 --- a/core/msvc10/sourcemod_mm.vcxproj +++ b/core/msvc10/sourcemod_mm.vcxproj @@ -2098,11 +2098,9 @@ - - @@ -2111,12 +2109,8 @@ - - - - true true @@ -2170,7 +2164,6 @@ - @@ -2308,11 +2301,9 @@ - - @@ -2321,12 +2312,8 @@ - - - - diff --git a/core/msvc10/sourcemod_mm.vcxproj.filters b/core/msvc10/sourcemod_mm.vcxproj.filters index 4aa062fa..0bb5412e 100644 --- a/core/msvc10/sourcemod_mm.vcxproj.filters +++ b/core/msvc10/sourcemod_mm.vcxproj.filters @@ -69,9 +69,6 @@ Source Files - - Source Files - Source Files @@ -81,9 +78,6 @@ Source Files - - Source Files - Source Files @@ -108,24 +102,12 @@ Source Files - - Source Files - - - Source Files - Source Files Source Files - - Source Files - - - Source Files - Source Files @@ -168,9 +150,6 @@ Natives - - Natives - Natives @@ -251,9 +230,6 @@ Header Files - - Header Files - Header Files @@ -263,9 +239,6 @@ Header Files - - Header Files - Header Files @@ -290,24 +263,12 @@ Header Files - - Header Files - - - Header Files - Header Files Header Files - - Header Files - - - Header Files - Header Files diff --git a/core/msvc11/sourcemod_mm.sln b/core/msvc11/sourcemod_mm.sln new file mode 100644 index 00000000..c720ff55 --- /dev/null +++ b/core/msvc11/sourcemod_mm.sln @@ -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 diff --git a/core/msvc11/sourcemod_mm.vcxproj b/core/msvc11/sourcemod_mm.vcxproj new file mode 100644 index 00000000..22185bd9 --- /dev/null +++ b/core/msvc11/sourcemod_mm.vcxproj @@ -0,0 +1,2479 @@ + + + + + CrazyDebug - Alien Swarm + Win32 + + + CrazyDebug - Bloody Good Time + Win32 + + + CrazyDebug - CS GO + Win32 + + + CrazyDebug - CSS + Win32 + + + CrazyDebug - Dark Messiah + Win32 + + + CrazyDebug - Episode 1 + Win32 + + + CrazyDebug - EYE + Win32 + + + CrazyDebug - Left 4 Dead 2 + Win32 + + + CrazyDebug - Left 4 Dead + Win32 + + + CrazyDebug - Old Metamod + Win32 + + + CrazyDebug - Orange Box Valve + Win32 + + + CrazyDebug - Orange Box + Win32 + + + Debug - Alien Swarm + Win32 + + + Debug - Bloody Good Time + Win32 + + + Debug - CS GO + Win32 + + + Debug - CSS + Win32 + + + Debug - Dark Messiah + Win32 + + + Debug - Episode 1 + Win32 + + + Debug - EYE + Win32 + + + Debug - Left 4 Dead 2 + Win32 + + + Debug - Left 4 Dead + Win32 + + + Debug - Old Metamod + Win32 + + + Debug - Orange Box Valve + Win32 + + + Debug - Orange Box + Win32 + + + Release - Alien Swarm + Win32 + + + Release - Bloody Good Time + Win32 + + + Release - CS GO + Win32 + + + Release - CSS + Win32 + + + Release - Dark Messiah + Win32 + + + Release - Episode 1 + Win32 + + + Release - EYE + Win32 + + + Release - Left 4 Dead 2 + Win32 + + + Release - Left 4 Dead + Win32 + + + Release - Old Metamod + Win32 + + + Release - Orange Box Valve + Win32 + + + Release - Orange Box + Win32 + + + + {E39527CD-7CAB-4420-97CC-DA1B93B260BC} + sourcemod_mm + Win32Proj + + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + true + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + v110 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30128.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(Configuration)\ + true + true + $(SolutionDir)$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(Configuration)\ + true + true + $(SolutionDir)$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(Configuration)\ + false + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + sourcemod.2.swarm + sourcemod.2.swarm + sourcemod.2.swarm + sourcemod.2.bgt + sourcemod.2.bgt + sourcemod.2.bgt + sourcemod.2.csgo + sourcemod.2.csgo + sourcemod.2.csgo + sourcemod.2.ep1 + sourcemod.2.ep1 + sourcemod.2.ep1 + sourcemod.2.eye + sourcemod.2.eye + sourcemod.2.eye + sourcemod.2.l4d + sourcemod.2.l4d + sourcemod.2.l4d + sourcemod.2.l4d2 + sourcemod.2.l4d2 + sourcemod.2.l4d2 + sourcemod.1.ep1 + sourcemod.1.ep1 + sourcemod.1.ep1 + sourcemod.2.ep2 + sourcemod.2.ep2 + sourcemod.2.ep2 + sourcemod.2.ep2v + sourcemod.2.css + sourcemod.2.ep2v + sourcemod.2.css + sourcemod.2.ep2v + sourcemod.2.css + + + sourcemod.2.darkm + + + sourcemod.2.darkm + + + sourcemod.2.darkm + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\mathlib;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(MMSOURCE19)\core-legacy;$(MMSOURCE19)\core-legacy\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;$(HL2SDK)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\mathlib;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(MMSOURCE19)\core-legacy;$(MMSOURCE19)\core-legacy\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;$(HL2SDK)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\mathlib;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(MMSOURCE19)\core-legacy;$(MMSOURCE19)\core-legacy\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;$(HL2SDK)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-DARKM)\public;$(HL2SDK-DARKM)\public\dlls;$(HL2SDK-DARKM)\public\engine;$(HL2SDK-DARKM)\public\mathlib;$(HL2SDK-DARKM)\public\tier0;$(HL2SDK-DARKM)\public\tier1;$(HL2SDK-DARKM)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=2;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-DARKM)\lib\public\tier0.lib;$(HL2SDK-DARKM)\lib\public\tier1.lib;$(HL2SDK-DARKM)\lib\public\vstdlib.lib;$(HL2SDK-DARKM)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-DARKM)\public;$(HL2SDK-DARKM)\public\dlls;$(HL2SDK-DARKM)\public\engine;$(HL2SDK-DARKM)\public\mathlib;$(HL2SDK-DARKM)\public\tier0;$(HL2SDK-DARKM)\public\tier1;$(HL2SDK-DARKM)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=2;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-DARKM)\lib\public\tier0.lib;$(HL2SDK-DARKM)\lib\public\tier1.lib;$(HL2SDK-DARKM)\lib\public\vstdlib.lib;$(HL2SDK-DARKM)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-DARKM)\public;$(HL2SDK-DARKM)\public\dlls;$(HL2SDK-DARKM)\public\engine;$(HL2SDK-DARKM)\public\mathlib;$(HL2SDK-DARKM)\public\tier0;$(HL2SDK-DARKM)\public\tier1;$(HL2SDK-DARKM)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=2;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-DARKM)\lib\public\tier0.lib;$(HL2SDK-DARKM)\lib\public\tier1.lib;$(HL2SDK-DARKM)\lib\public\vstdlib.lib;$(HL2SDK-DARKM)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKOB)\public;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\game\server;$(HL2SDKOB)\public\mathlib;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKOB)\lib\public\tier0.lib;$(HL2SDKOB)\lib\public\tier1.lib;$(HL2SDKOB)\lib\public\vstdlib.lib;$(HL2SDKOB)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKOB)\public;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\game\server;$(HL2SDKOB)\public\mathlib;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKOB)\lib\public\tier0.lib;$(HL2SDKOB)\lib\public\tier1.lib;$(HL2SDKOB)\lib\public\vstdlib.lib;$(HL2SDKOB)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKOB)\public;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\game\server;$(HL2SDKOB)\public\mathlib;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(HL2SDKOB)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=3;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKOB)\lib\public\tier0.lib;$(HL2SDKOB)\lib\public\tier1.lib;$(HL2SDKOB)\lib\public\vstdlib.lib;$(HL2SDKOB)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\mathlib;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;$(HL2SDK)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\mathlib;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;$(HL2SDK)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\mathlib;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(HL2SDK)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;$(HL2SDK)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKL4D)\public;$(HL2SDKL4D)\public\engine;$(HL2SDKL4D)\public\game\server;$(HL2SDKL4D)\public\mathlib;$(HL2SDKL4D)\public\tier0;$(HL2SDKL4D)\public\tier1;$(HL2SDKL4D)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=8;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKL4D)\lib\public\tier0.lib;$(HL2SDKL4D)\lib\public\tier1.lib;$(HL2SDKL4D)\lib\public\vstdlib.lib;$(HL2SDKL4D)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKL4D)\public;$(HL2SDKL4D)\public\engine;$(HL2SDKL4D)\public\game\server;$(HL2SDKL4D)\public\mathlib;$(HL2SDKL4D)\public\tier0;$(HL2SDKL4D)\public\tier1;$(HL2SDKL4D)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=8;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKL4D)\lib\public\tier0.lib;$(HL2SDKL4D)\lib\public\tier1.lib;$(HL2SDKL4D)\lib\public\vstdlib.lib;$(HL2SDKL4D)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKL4D)\public;$(HL2SDKL4D)\public\engine;$(HL2SDKL4D)\public\game\server;$(HL2SDKL4D)\public\mathlib;$(HL2SDKL4D)\public\tier0;$(HL2SDKL4D)\public\tier1;$(HL2SDKL4D)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=8;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKL4D)\lib\public\tier0.lib;$(HL2SDKL4D)\lib\public\tier1.lib;$(HL2SDKL4D)\lib\public\vstdlib.lib;$(HL2SDKL4D)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\mathlib;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(HL2SDKOBVALVE)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=7;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKOBVALVE)\lib\public\tier0.lib;$(HL2SDKOBVALVE)\lib\public\tier1.lib;$(HL2SDKOBVALVE)\lib\public\vstdlib.lib;$(HL2SDKOBVALVE)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSS)\public;$(HL2SDKCSS)\public\engine;$(HL2SDKCSS)\public\game\server;$(HL2SDKCSS)\public\mathlib;$(HL2SDKCSS)\public\tier0;$(HL2SDKCSS)\public\tier1;$(HL2SDKCSS)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKCSS)\lib\public\tier0.lib;$(HL2SDKCSS)\lib\public\tier1.lib;$(HL2SDKCSS)\lib\public\vstdlib.lib;$(HL2SDKCSS)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\mathlib;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(HL2SDKOBVALVE)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=7;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKOBVALVE)\lib\public\tier0.lib;$(HL2SDKOBVALVE)\lib\public\tier1.lib;$(HL2SDKOBVALVE)\lib\public\vstdlib.lib;$(HL2SDKOBVALVE)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSS)\public;$(HL2SDKCSS)\public\engine;$(HL2SDKCSS)\public\game\server;$(HL2SDKCSS)\public\mathlib;$(HL2SDKCSS)\public\tier0;$(HL2SDKCSS)\public\tier1;$(HL2SDKCSS)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKCSS)\lib\public\tier0.lib;$(HL2SDKCSS)\lib\public\tier1.lib;$(HL2SDKCSS)\lib\public\vstdlib.lib;$(HL2SDKCSS)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\mathlib;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(HL2SDKOBVALVE)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=7;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKOBVALVE)\lib\public\tier0.lib;$(HL2SDKOBVALVE)\lib\public\tier1.lib;$(HL2SDKOBVALVE)\lib\public\vstdlib.lib;$(HL2SDKOBVALVE)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSS)\public;$(HL2SDKCSS)\public\engine;$(HL2SDKCSS)\public\game\server;$(HL2SDKCSS)\public\mathlib;$(HL2SDKCSS)\public\tier0;$(HL2SDKCSS)\public\tier1;$(HL2SDKCSS)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=6;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKCSS)\lib\public\tier0.lib;$(HL2SDKCSS)\lib\public\tier1.lib;$(HL2SDKCSS)\lib\public\vstdlib.lib;$(HL2SDKCSS)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKL4D2)\public;$(HL2SDKL4D2)\public\engine;$(HL2SDKL4D2)\public\game\server;$(HL2SDKL4D2)\public\mathlib;$(HL2SDKL4D2)\public\tier0;$(HL2SDKL4D2)\public\tier1;$(HL2SDKL4D2)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=9;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKL4D2)\lib\public\tier0.lib;$(HL2SDKL4D2)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;$(HL2SDKL4D2)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKL4D2)\public;$(HL2SDKL4D2)\public\engine;$(HL2SDKL4D2)\public\game\server;$(HL2SDKL4D2)\public\mathlib;$(HL2SDKL4D2)\public\tier0;$(HL2SDKL4D2)\public\tier1;$(HL2SDKL4D2)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=9;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKL4D2)\lib\public\tier0.lib;$(HL2SDKL4D2)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;$(HL2SDKL4D2)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKL4D2)\public;$(HL2SDKL4D2)\public\engine;$(HL2SDKL4D2)\public\game\server;$(HL2SDKL4D2)\public\mathlib;$(HL2SDKL4D2)\public\tier0;$(HL2SDKL4D2)\public\tier1;$(HL2SDKL4D2)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=9;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKL4D2)\lib\public\tier0.lib;$(HL2SDKL4D2)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;$(HL2SDKL4D2)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-BGT)\public;$(HL2SDK-BGT)\public\engine;$(HL2SDK-BGT)\public\game\server;$(HL2SDK-BGT)\public\mathlib;$(HL2SDK-BGT)\public\tier0;$(HL2SDK-BGT)\public\tier1;$(HL2SDK-BGT)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=4;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-BGT)\lib\public\tier0.lib;$(HL2SDK-BGT)\lib\public\tier1.lib;$(HL2SDK-BGT)\lib\public\vstdlib.lib;$(HL2SDK-BGT)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-BGT)\public;$(HL2SDK-BGT)\public\engine;$(HL2SDK-BGT)\public\game\server;$(HL2SDK-BGT)\public\mathlib;$(HL2SDK-BGT)\public\tier0;$(HL2SDK-BGT)\public\tier1;$(HL2SDK-BGT)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=4;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-BGT)\lib\public\tier0.lib;$(HL2SDK-BGT)\lib\public\tier1.lib;$(HL2SDK-BGT)\lib\public\vstdlib.lib;$(HL2SDK-BGT)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-BGT)\public;$(HL2SDK-BGT)\public\engine;$(HL2SDK-BGT)\public\game\server;$(HL2SDK-BGT)\public\mathlib;$(HL2SDK-BGT)\public\tier0;$(HL2SDK-BGT)\public\tier1;$(HL2SDK-BGT)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=4;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-BGT)\lib\public\tier0.lib;$(HL2SDK-BGT)\lib\public\tier1.lib;$(HL2SDK-BGT)\lib\public\vstdlib.lib;$(HL2SDK-BGT)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-EYE)\public;$(HL2SDK-EYE)\public\engine;$(HL2SDK-EYE)\public\game\server;$(HL2SDK-EYE)\public\mathlib;$(HL2SDK-EYE)\public\tier0;$(HL2SDK-EYE)\public\tier1;$(HL2SDK-EYE)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=5;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-EYE)\lib\public\tier0.lib;$(HL2SDK-EYE)\lib\public\tier1.lib;$(HL2SDK-EYE)\lib\public\vstdlib.lib;$(HL2SDK-EYE)\lib\public\mathlib.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-EYE)\public;$(HL2SDK-EYE)\public\engine;$(HL2SDK-EYE)\public\game\server;$(HL2SDK-EYE)\public\mathlib;$(HL2SDK-EYE)\public\tier0;$(HL2SDK-EYE)\public\tier1;$(HL2SDK-EYE)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=5;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-EYE)\lib\public\tier0.lib;$(HL2SDK-EYE)\lib\public\tier1.lib;$(HL2SDK-EYE)\lib\public\vstdlib.lib;$(HL2SDK-EYE)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-EYE)\public;$(HL2SDK-EYE)\public\engine;$(HL2SDK-EYE)\public\game\server;$(HL2SDK-EYE)\public\mathlib;$(HL2SDK-EYE)\public\tier0;$(HL2SDK-EYE)\public\tier1;$(HL2SDK-EYE)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=5;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-EYE)\lib\public\tier0.lib;$(HL2SDK-EYE)\lib\public\tier1.lib;$(HL2SDK-EYE)\lib\public\vstdlib.lib;$(HL2SDK-EYE)\lib\public\mathlib.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-SWARM)\public;$(HL2SDK-SWARM)\public\engine;$(HL2SDK-SWARM)\public\game\server;$(HL2SDK-SWARM)\public\mathlib;$(HL2SDK-SWARM)\public\tier0;$(HL2SDK-SWARM)\public\tier1;$(HL2SDK-SWARM)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=10;COMPILER_MSVC;COMPILER_MSVC32;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-SWARM)\lib\public\tier0.lib;$(HL2SDK-SWARM)\lib\public\tier1.lib;$(HL2SDK-SWARM)\lib\public\vstdlib.lib;$(HL2SDK-SWARM)\lib\public\mathlib.lib;$(HL2SDK-SWARM)\lib\public\interfaces.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-SWARM)\public;$(HL2SDK-SWARM)\public\engine;$(HL2SDK-SWARM)\public\game\server;$(HL2SDK-SWARM)\public\mathlib;$(HL2SDK-SWARM)\public\tier0;$(HL2SDK-SWARM)\public\tier1;$(HL2SDK-SWARM)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=10;COMPILER_MSVC;COMPILER_MSVC32;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-SWARM)\lib\public\tier0.lib;$(HL2SDK-SWARM)\lib\public\tier1.lib;$(HL2SDK-SWARM)\lib\public\vstdlib.lib;$(HL2SDK-SWARM)\lib\public\mathlib.lib;$(HL2SDK-SWARM)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDK-SWARM)\public;$(HL2SDK-SWARM)\public\engine;$(HL2SDK-SWARM)\public\game\server;$(HL2SDK-SWARM)\public\mathlib;$(HL2SDK-SWARM)\public\tier0;$(HL2SDK-SWARM)\public\tier1;$(HL2SDK-SWARM)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=10;COMPILER_MSVC;COMPILER_MSVC32;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDK-SWARM)\lib\public\tier0.lib;$(HL2SDK-SWARM)\lib\public\tier1.lib;$(HL2SDK-SWARM)\lib\public\vstdlib.lib;$(HL2SDK-SWARM)\lib\public\mathlib.lib;$(HL2SDK-SWARM)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSGO)\common\protobuf-2.3.0\src;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\engine\protobuf;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\game\shared\csgo\protobuf;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\public\tier1;$(HL2SDKCSGO)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + _ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=12;COMPILER_MSVC;COMPILER_MSVC32;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;dbghelp.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Disabled + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSGO)\common\protobuf-2.3.0\src;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\engine\protobuf;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\game\shared\csgo\protobuf;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\public\tier1;$(HL2SDKCSGO)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + _ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=12;COMPILER_MSVC;COMPILER_MSVC32;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKCSGO)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_EYE=5 /D SE_CSS=6 /D SE_ORANGEBOXVALVE=7 /D SE_LEFT4DEAD=8 /D SE_LEFT4DEAD2=9 /D SE_ALIENSWARM=10 /D SE_PORTAL2=11 /D SE_CSGO=12 + Speed + ..\;..\systems;..\..\public;..\..\public\sourcepawn;$(HL2SDKCSGO)\common\protobuf-2.3.0\src;$(HL2SDKCSGO)\public;$(HL2SDKCSGO)\public\engine;$(HL2SDKCSGO)\public\engine\protobuf;$(HL2SDKCSGO)\public\game\server;$(HL2SDKCSGO)\public\game\shared\csgo\protobuf;$(HL2SDKCSGO)\public\mathlib;$(HL2SDKCSGO)\public\tier0;$(HL2SDKCSGO)\public\tier1;$(HL2SDKCSGO)\public\vstdlib;$(MMSOURCE19)\core;$(MMSOURCE19)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SOURCEMOD_MM_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SOURCEMOD_BUILD;SM_DEFAULT_THREADER;SOURCE_ENGINE=12;COMPILER_MSVC;COMPILER_MSVC32;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + true + + + BINARY_NAME="\"$(TargetFileName)\"";%(PreprocessorDefinitions) + ..\..\public;%(AdditionalIncludeDirectories) + + + $(HL2SDKCSGO)\lib\public\tier0.lib;$(HL2SDKCSGO)\lib\public\tier1.lib;$(HL2SDKCSGO)\lib\public\vstdlib.lib;$(HL2SDKCSGO)\lib\public\mathlib.lib;$(HL2SDKCSGO)\lib\public\interfaces.lib;Wsock32.lib;%(AdditionalDependencies) + $(OutDir)$(TargetFileName) + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + IF NOT "%SMOUTDIR%"=="" copy /Y "$(TargetDir)$(TargetFileName)" "%SMOUTDIR%\bin" + + + + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + + + + + + + + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + + + + + + + + + true + true + true + + + + + + + + + + + + + + + + + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + + + + + + \ No newline at end of file diff --git a/core/sm_autonatives.cpp b/core/sm_autonatives.cpp index 21522e22..e4ff2b95 100644 --- a/core/sm_autonatives.cpp +++ b/core/sm_autonatives.cpp @@ -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); } diff --git a/core/sm_autonatives.h b/core/sm_autonatives.h index 7545442a..c3b0d22b 100644 --- a/core/sm_autonatives.h +++ b/core/sm_autonatives.h @@ -50,8 +50,4 @@ public: sp_nativeinfo_t *m_NativeList; }; -class CNativeOwner; - -extern CNativeOwner *g_pCoreNatives; - #endif //_INCLUDE_SOURCEMOD_CORE_AUTONATIVES_H_ diff --git a/core/sm_srvcmds.cpp b/core/sm_srvcmds.cpp index 3cf93160..bdddf527 100644 --- a/core/sm_srvcmds.cpp +++ b/core/sm_srvcmds.cpp @@ -32,10 +32,9 @@ #include "sm_srvcmds.h" #include #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); } } diff --git a/core/sm_srvcmds.h b/core/sm_srvcmds.h index 6f6d3771..d16d26b7 100644 --- a/core/sm_srvcmds.h +++ b/core/sm_srvcmds.h @@ -34,7 +34,6 @@ #include "sourcemod.h" #include -#include "PluginSys.h" #include "sourcemm_api.h" #include #include diff --git a/core/sm_stringutil.cpp b/core/sm_stringutil.cpp index 0d6b9d0a..8c5167e6 100644 --- a/core/sm_stringutil.cpp +++ b/core/sm_stringutil.cpp @@ -32,11 +32,12 @@ #include #include #include +#include #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; diff --git a/core/smn_bitbuffer.cpp b/core/smn_bitbuffer.cpp index 15df1b53..5f4249d2 100644 --- a/core/smn_bitbuffer.cpp +++ b/core/smn_bitbuffer.cpp @@ -34,11 +34,12 @@ #ifndef USE_PROTOBUF_USERMESSAGES #include "sourcemod.h" -#include "HandleSys.h" #include #include #include #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); diff --git a/core/smn_console.cpp b/core/smn_console.cpp index 33ac781d..294b1f2f 100644 --- a/core/smn_console.cpp +++ b/core/smn_console.cpp @@ -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 @@ -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); } diff --git a/core/smn_core.cpp b/core/smn_core.cpp index ebadeef3..80a33b5f 100644 --- a/core/smn_core.cpp +++ b/core/smn_core.cpp @@ -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 #include +#include "logic_bridge.h" #if defined PLATFORM_WINDOWS #include @@ -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') diff --git a/core/smn_database.cpp b/core/smn_database.cpp index 3c048238..bb156147 100644 --- a/core/smn_database.cpp +++ b/core/smn_database.cpp @@ -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; diff --git a/core/smn_events.cpp b/core/smn_events.cpp index ea6dd32b..61a1f923 100644 --- a/core/smn_events.cpp +++ b/core/smn_events.cpp @@ -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); diff --git a/core/smn_halflife.cpp b/core/smn_halflife.cpp index ec6c1d14..a96d7ba7 100644 --- a/core/smn_halflife.cpp +++ b/core/smn_halflife.cpp @@ -32,7 +32,6 @@ #include "sm_globals.h" #include "sourcemod.h" #include "sourcemm_api.h" -#include "HandleSys.h" #include "PlayerManager.h" #include "HalfLife2.h" diff --git a/core/smn_hudtext.cpp b/core/smn_hudtext.cpp index 8aba07a2..d7eb30d2 100644 --- a/core/smn_hudtext.cpp +++ b/core/smn_hudtext.cpp @@ -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 @@ -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) diff --git a/core/smn_keyvalues.cpp b/core/smn_keyvalues.cpp index 35cca4a9..5da08c76 100644 --- a/core/smn_keyvalues.cpp +++ b/core/smn_keyvalues.cpp @@ -32,10 +32,10 @@ #include "sourcemod.h" #include "sourcemm_api.h" #include "sm_stringutil.h" -#include "HandleSys.h" #include "HalfLife2.h" #include #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); diff --git a/core/smn_menus.cpp b/core/smn_menus.cpp index 06dac35f..c863bd79 100644 --- a/core/smn_menus.cpp +++ b/core/smn_menus.cpp @@ -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) diff --git a/core/smn_protobuf.cpp b/core/smn_protobuf.cpp index 0c8d4ec5..cc34c1e1 100644 --- a/core/smn_protobuf.cpp +++ b/core/smn_protobuf.cpp @@ -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(innerMsg)), NULL, g_pCoreIdent, NULL); + Handle_t outHndl = handlesys->CreateHandle(g_ProtobufType, new SMProtobufMessage(const_cast(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; diff --git a/core/smn_usermsgs.cpp b/core/smn_usermsgs.cpp index 911d1893..42c80dfa 100644 --- a/core/smn_usermsgs.cpp +++ b/core/smn_usermsgs.cpp @@ -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(&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(&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(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; diff --git a/core/sourcemm_api.cpp b/core/sourcemm_api.cpp index 274f807b..dcd74160 100644 --- a/core/sourcemm_api.cpp +++ b/core/sourcemm_api.cpp @@ -33,9 +33,9 @@ #include "sourcemm_api.h" #include #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) diff --git a/core/sourcemod.cpp b/core/sourcemod.cpp index db348eb4..deec9ac4 100644 --- a/core/sourcemod.cpp +++ b/core/sourcemod.cpp @@ -34,11 +34,8 @@ #include "sourcemm_api.h" #include "LibrarySys.h" #include -#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); diff --git a/core/logic/AutoHandleRooter.h b/public/AutoHandleRooter.h similarity index 95% rename from core/logic/AutoHandleRooter.h rename to public/AutoHandleRooter.h index 3233c8a8..d7aae7b0 100644 --- a/core/logic/AutoHandleRooter.h +++ b/public/AutoHandleRooter.h @@ -32,7 +32,6 @@ #ifndef _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_ #define _INCLUDE_SOURCEMOD_AUTO_HANDLE_ROOTER_H_ -#include "common_logic.h" #include class AutoHandleRooter diff --git a/public/IExtensionSys.h b/public/IExtensionSys.h index a7652143..e71833f8 100644 --- a/public/IExtensionSys.h +++ b/public/IExtensionSys.h @@ -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. diff --git a/public/IHandleSys.h b/public/IHandleSys.h index 48ae46fd..e2387b58 100644 --- a/public/IHandleSys.h +++ b/public/IHandleSys.h @@ -52,7 +52,7 @@ #include #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; }; } diff --git a/public/ILibrarySys.h b/public/ILibrarySys.h index b4cc05b4..d52315e2 100644 --- a/public/ILibrarySys.h +++ b/public/ILibrarySys.h @@ -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; }; } diff --git a/public/IShareSys.h b/public/IShareSys.h index 367d0b68..0e245a92 100644 --- a/public/IShareSys.h +++ b/public/IShareSys.h @@ -38,7 +38,7 @@ */ #include - +#include 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; + }; }