Use internal sp::Environment directly in core/logic.
Also remove ISourcePawnEngine and ISourcePawnEngine2 pointers since they're now redundant.
This commit is contained in:
@@ -32,11 +32,6 @@
|
||||
#include <IAdminSystem.h>
|
||||
#include <amtl/am-function.h>
|
||||
|
||||
namespace SourcePawn {
|
||||
class ISourcePawnEngine;
|
||||
class ISourcePawnEngine2;
|
||||
} // namespace SourcePawn
|
||||
|
||||
// SDK types.
|
||||
#if defined(SM_LOGIC)
|
||||
class ConCommandBase {};
|
||||
|
||||
@@ -78,7 +78,6 @@ public:
|
||||
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;
|
||||
|
||||
@@ -75,6 +75,8 @@ struct sm_logic_t
|
||||
bool (*ParseEntityLumpString)(const char *entityString, int &status, size_t &position);
|
||||
const char * (*GetEntityLumpString)();
|
||||
void (*Shutdown)();
|
||||
void (*SetJitEnabled)(bool enabled);
|
||||
void (*SetDebugMetadataFlags)(int flags);
|
||||
IScriptManager *scripts;
|
||||
IShareSys *sharesys;
|
||||
IExtensionSys *extsys;
|
||||
|
||||
@@ -82,7 +82,7 @@ void ConCmdManager::OnUnlinkConCommandBase(ConCommandBase *pBase, const char *na
|
||||
CmdHook *hook = *iter;
|
||||
|
||||
IPluginContext *pContext = hook->pf->GetParentContext();
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
// The list is guaranteed to exist.
|
||||
PluginHookList *list;
|
||||
|
||||
@@ -356,7 +356,7 @@ Handle_t ConVarManager::CreateConVar(IPluginContext *pContext, const char *name,
|
||||
ConVarInfo *pInfo = NULL;
|
||||
Handle_t hndl = 0;
|
||||
|
||||
IPlugin *plugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *plugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
/* Find out if the convar exists already */
|
||||
pConVar = icvar->FindVar(name);
|
||||
|
||||
+1
-1
@@ -764,7 +764,7 @@ void SM_ConfigsExecuted_Plugin(unsigned int serial)
|
||||
|
||||
void SM_ExecuteForPlugin(IPluginContext *ctx)
|
||||
{
|
||||
SMPlugin *plugin = scripts->FindPluginByContext(ctx->GetContext());
|
||||
SMPlugin *plugin = scripts->FindPluginByContext(ctx);
|
||||
|
||||
unsigned int num = plugin->GetConfigCount();
|
||||
if (!num)
|
||||
|
||||
@@ -184,7 +184,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct
|
||||
if (!m_EventHooks.retrieve(name, &pHook))
|
||||
{
|
||||
EventHookList *pHookList;
|
||||
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
|
||||
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext());
|
||||
|
||||
/* Check plugin for an existing EventHook list */
|
||||
if (!plugin->GetProperty("EventHooks", (void **)&pHookList))
|
||||
@@ -297,7 +297,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun
|
||||
/* If reference count is now 0, free hook structure */
|
||||
|
||||
EventHookList *pHookList;
|
||||
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
|
||||
IPlugin *plugin = scripts->FindPluginByContext(pFunction->GetParentContext());
|
||||
|
||||
/* Get plugin's event hook list */
|
||||
if (!plugin->GetProperty("EventHooks", (void**)&pHookList))
|
||||
|
||||
@@ -16,6 +16,7 @@ for cxx in builder.targets:
|
||||
'SM_DEFAULT_THREADER',
|
||||
'SM_LOGIC'
|
||||
]
|
||||
SP.AddVmFlags(binary)
|
||||
|
||||
if binary.compiler.target.platform == 'linux':
|
||||
binary.compiler.postlink += ['-lpthread', '-lrt', '-lm']
|
||||
|
||||
@@ -34,12 +34,13 @@
|
||||
#include <stdarg.h>
|
||||
#include "DebugReporter.h"
|
||||
#include "Logger.h"
|
||||
#include "sourcepawn/vm/environment.h"
|
||||
|
||||
DebugReport g_DbgReporter;
|
||||
|
||||
void DebugReport::OnSourceModAllInitialized()
|
||||
{
|
||||
g_pSourcePawn->SetDebugListener(this);
|
||||
g_pPawnEnv->SetDebugListener(this);
|
||||
}
|
||||
|
||||
void DebugReport::OnDebugSpew(const char *msg, ...)
|
||||
@@ -68,10 +69,10 @@ void DebugReport::GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err,
|
||||
char buffer[512];
|
||||
ke::SafeVsprintf(buffer, sizeof(buffer), message, ap);
|
||||
|
||||
const char *plname = pluginsys->FindPluginByContext(ctx->GetContext())->GetFilename();
|
||||
const char *plname = pluginsys->FindPluginByContext(ctx)->GetFilename();
|
||||
|
||||
if (err >= 0) {
|
||||
const char *error = g_pSourcePawn2->GetErrorString(err);
|
||||
const char *error = g_pPawnEnv->GetErrorString(err);
|
||||
if (error)
|
||||
g_Logger.LogError("[SM] Plugin \"%s\" encountered error %d: %s", plname, err, error);
|
||||
else
|
||||
@@ -134,7 +135,7 @@ void DebugReport::ReportError(const IErrorReport &report, IFrameIterator &iter)
|
||||
{
|
||||
if (iter.IsScriptedFrame())
|
||||
{
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(iter.Context()->GetContext());
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(iter.Context());
|
||||
if (plugin)
|
||||
{
|
||||
blame = plugin->GetFilename();
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <IHandleSys.h>
|
||||
#include <IForwardSys.h>
|
||||
#include <IPlayerHelpers.h>
|
||||
#include <sourcepawn/vm/environment.h>
|
||||
#include "ExtensionSys.h"
|
||||
#include "GameConfigs.h"
|
||||
#include "common_logic.h"
|
||||
@@ -479,11 +480,6 @@ void CPlugin::Call_OnLibraryAdded(const char *lib)
|
||||
pFunction->Execute(&result);
|
||||
}
|
||||
|
||||
void *CPlugin::GetPluginStructure()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Only called during plugin construction.
|
||||
bool CPlugin::TryCompile()
|
||||
{
|
||||
@@ -491,7 +487,7 @@ bool CPlugin::TryCompile()
|
||||
g_pSM->BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", m_filename);
|
||||
|
||||
char loadmsg[255];
|
||||
m_pRuntime.reset(g_pSourcePawn2->LoadBinaryFromFile(fullpath, loadmsg, sizeof(loadmsg)));
|
||||
m_pRuntime.reset(g_pPawnEnv->LoadBinaryFromFile(fullpath, loadmsg, sizeof(loadmsg)));
|
||||
if (!m_pRuntime) {
|
||||
EvictWithError(Plugin_BadLoad, "Unable to load plugin (%s)", loadmsg);
|
||||
return false;
|
||||
@@ -515,11 +511,6 @@ IPluginContext *CPlugin::GetBaseContext()
|
||||
return m_pRuntime->GetDefaultContext();
|
||||
}
|
||||
|
||||
sp_context_t *CPlugin::GetContext()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *CPlugin::GetFilename()
|
||||
{
|
||||
return m_filename;
|
||||
@@ -1535,12 +1526,9 @@ void CPluginManager::UnloadPluginImpl(CPlugin *pPlugin)
|
||||
delete pPlugin;
|
||||
}
|
||||
|
||||
IPlugin *CPluginManager::FindPluginByContext(const sp_context_t *ctx)
|
||||
SMPlugin *CPluginManager::FindPluginByContext(IPluginContext *pContext)
|
||||
{
|
||||
IPlugin *pPlugin;
|
||||
IPluginContext *pContext;
|
||||
|
||||
pContext = reinterpret_cast<IPluginContext *>(const_cast<sp_context_t *>(ctx));
|
||||
SMPlugin *pPlugin;
|
||||
|
||||
if (pContext->GetKey(2, (void **)&pPlugin))
|
||||
{
|
||||
@@ -1550,7 +1538,7 @@ IPlugin *CPluginManager::FindPluginByContext(const sp_context_t *ctx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CPlugin *CPluginManager::GetPluginByCtx(const sp_context_t *ctx)
|
||||
CPlugin *CPluginManager::GetPluginByCtx(IPluginContext *ctx)
|
||||
{
|
||||
return (CPlugin *)FindPluginByContext(ctx);
|
||||
}
|
||||
@@ -2355,7 +2343,7 @@ public:
|
||||
return g_PluginSys.UnloadPlugin(plugin);
|
||||
}
|
||||
|
||||
IPlugin *FindPluginByContext(const sp_context_t *ctx) override
|
||||
IPlugin *FindPluginByContext(IPluginContext *ctx) override
|
||||
{
|
||||
return g_PluginSys.FindPluginByContext(ctx);
|
||||
}
|
||||
|
||||
+2
-10
@@ -105,8 +105,6 @@ public:
|
||||
public:
|
||||
PluginType GetType();
|
||||
SourcePawn::IPluginContext *GetBaseContext();
|
||||
sp_context_t *GetContext();
|
||||
void *GetPluginStructure();
|
||||
const char *GetFilename();
|
||||
bool IsDebugging();
|
||||
PluginStatus GetStatus();
|
||||
@@ -332,7 +330,7 @@ public: //IScriptManager
|
||||
size_t maxlength,
|
||||
bool *wasloaded);
|
||||
bool UnloadPlugin(IPlugin *plugin);
|
||||
IPlugin *FindPluginByContext(const sp_context_t *ctx);
|
||||
SMPlugin *FindPluginByContext(IPluginContext *ctx);
|
||||
unsigned int GetPluginCount();
|
||||
IPluginIterator *GetPluginIterator();
|
||||
void AddPluginsListener(IPluginsListener *listener);
|
||||
@@ -345,12 +343,6 @@ public: //IScriptManager
|
||||
SMPlugin *FindPluginByIdentity(IdentityToken_t *ident) {
|
||||
return GetPluginFromIdentity(ident);
|
||||
}
|
||||
SMPlugin *FindPluginByContext(IPluginContext *ctx) {
|
||||
return GetPluginByCtx(ctx->GetContext());
|
||||
}
|
||||
SMPlugin *FindPluginByContext(sp_context_t *ctx) {
|
||||
return GetPluginByCtx(ctx);
|
||||
}
|
||||
SMPlugin *FindPluginByConsoleArg(const char *text);
|
||||
SMPlugin *FindPluginByHandle(Handle_t hndl, HandleError *errp) {
|
||||
return static_cast<SMPlugin *>(PluginFromHandle(hndl, errp));
|
||||
@@ -399,7 +391,7 @@ public:
|
||||
/**
|
||||
* Internal version of FindPluginByContext()
|
||||
*/
|
||||
CPlugin *GetPluginByCtx(const sp_context_t *ctx);
|
||||
CPlugin *GetPluginByCtx(IPluginContext *ctx);
|
||||
|
||||
/**
|
||||
* Gets status text for a status code
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ProfileTools.h"
|
||||
#include <stdarg.h>
|
||||
#include <am-string.h>
|
||||
#include <sourcepawn/vm/environment.h>
|
||||
|
||||
ProfileToolManager g_ProfileToolManager;
|
||||
|
||||
@@ -87,8 +88,8 @@ ProfileToolManager::StartFromConsole(IProfilingTool *tool)
|
||||
return;
|
||||
}
|
||||
|
||||
g_pSourcePawn2->SetProfilingTool(active_);
|
||||
g_pSourcePawn2->EnableProfiling();
|
||||
g_pPawnEnv->SetProfilingTool(active_);
|
||||
g_pPawnEnv->EnableProfiling();
|
||||
rootmenu->ConsolePrint("Started profiling with %s.", active_->Name());
|
||||
|
||||
default_ = active_;
|
||||
@@ -117,8 +118,8 @@ ProfileToolManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
|
||||
rootmenu->ConsolePrint("No profiler is active.");
|
||||
return;
|
||||
}
|
||||
g_pSourcePawn2->DisableProfiling();
|
||||
g_pSourcePawn2->SetProfilingTool(nullptr);
|
||||
g_pPawnEnv->DisableProfiling();
|
||||
g_pPawnEnv->SetProfilingTool(nullptr);
|
||||
active_->Stop(render_help);
|
||||
active_ = nullptr;
|
||||
return;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <ISourceMod.h>
|
||||
#include <bridge/include/CoreProvider.h>
|
||||
#include "HandleSys.h"
|
||||
#include <sourcepawn/vm/environment.h>
|
||||
|
||||
RootConsoleMenu g_RootMenu;
|
||||
|
||||
@@ -235,11 +236,10 @@ void RootConsoleMenu::OnRootConsoleCommand(const char *cmdname, const ICommandAr
|
||||
{
|
||||
ConsolePrint(" SourceMod Version Information:");
|
||||
ConsolePrint(" SourceMod Version: %s", SOURCEMOD_VERSION);
|
||||
if (g_pSourcePawn2->IsJitEnabled())
|
||||
ConsolePrint(" SourcePawn Engine: %s (build %s)", g_pSourcePawn2->GetEngineName(), g_pSourcePawn2->GetVersionString());
|
||||
if (g_pPawnEnv->IsJitEnabled())
|
||||
ConsolePrint(" SourcePawn Engine: %s (build %s)", g_pPawnEnv->GetEngineName(), g_pPawnEnv->GetVersionString());
|
||||
else
|
||||
ConsolePrint(" SourcePawn Engine: %s (build %s NO JIT)", g_pSourcePawn2->GetEngineName(), g_pSourcePawn2->GetVersionString());
|
||||
ConsolePrint(" SourcePawn API: v1 = %d, v2 = %d", g_pSourcePawn->GetEngineAPIVersion(), g_pSourcePawn2->GetAPIVersion());
|
||||
ConsolePrint(" SourcePawn Engine: %s (build %s NO JIT)", g_pPawnEnv->GetEngineName(), g_pPawnEnv->GetVersionString());
|
||||
ConsolePrint(" Compiled on: %s", SOURCEMOD_BUILD_TIME);
|
||||
#if defined(SM_GENERATED_BUILD)
|
||||
ConsolePrint(" Built from: https://github.com/alliedmodders/sourcemod/commit/%s", SOURCEMOD_SHA);
|
||||
|
||||
@@ -433,7 +433,7 @@ AlreadyRefed<Native> ShareSystem::AddFakeNative(IPluginFunction *pFunc, const ch
|
||||
std::unique_ptr<FakeNative> fake(new FakeNative(name, pFunc));
|
||||
fake->wrapper = new DynamicNative(func, fake.get());
|
||||
|
||||
CNativeOwner *owner = g_PluginSys.GetPluginByCtx(fake->ctx->GetContext());
|
||||
CNativeOwner *owner = g_PluginSys.GetPluginByCtx(fake->ctx);
|
||||
|
||||
entry = new Native(owner, std::move(fake));
|
||||
m_NtvCache.insert(name, entry);
|
||||
|
||||
+40
-14
@@ -81,8 +81,7 @@ IPluginManager *pluginsys = g_PluginSys.GetOldAPI();
|
||||
IForwardManager *forwardsys = &g_Forwards;
|
||||
ServerGlobals serverGlobals;
|
||||
IAdminSystem *adminsys = &g_Admins;
|
||||
ISourcePawnEngine *g_pSourcePawn;
|
||||
ISourcePawnEngine2 *g_pSourcePawn2;
|
||||
sp::Environment *g_pPawnEnv;
|
||||
IScriptManager *scripts = &g_PluginSys;
|
||||
IExtensionSys *extsys = &g_Extensions;
|
||||
ILogger *logger = &g_Logger;
|
||||
@@ -161,18 +160,26 @@ public:
|
||||
}
|
||||
} sProviderCallbackListener;
|
||||
|
||||
static sp::Environment *g_pEnv = nullptr;
|
||||
|
||||
static void logic_shutdown()
|
||||
{
|
||||
if (g_pEnv)
|
||||
if (g_pPawnEnv)
|
||||
{
|
||||
g_pEnv->Shutdown();
|
||||
delete g_pEnv;
|
||||
g_pEnv = nullptr;
|
||||
g_pPawnEnv->Shutdown();
|
||||
delete g_pPawnEnv;
|
||||
g_pPawnEnv = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void logic_SetJitEnabled(bool enabled)
|
||||
{
|
||||
g_pPawnEnv->SetJitEnabled(enabled);
|
||||
}
|
||||
|
||||
static void logic_SetDebugMetadataFlags(int flags)
|
||||
{
|
||||
g_pPawnEnv->SetDebugMetadataFlags(flags);
|
||||
}
|
||||
|
||||
static sm_logic_t logic =
|
||||
{
|
||||
NULL,
|
||||
@@ -196,6 +203,8 @@ static sm_logic_t logic =
|
||||
ParseEntityLumpString,
|
||||
GetEntityLumpString,
|
||||
logic_shutdown,
|
||||
logic_SetJitEnabled,
|
||||
logic_SetDebugMetadataFlags,
|
||||
&g_PluginSys,
|
||||
&g_ShareSys,
|
||||
&g_Extensions,
|
||||
@@ -224,13 +233,30 @@ static void logic_init(CoreProvider* core, sm_logic_t* _logic)
|
||||
gamehelpers = core->gamehelpers;
|
||||
menus = core->menus;
|
||||
|
||||
g_pEnv = sp::Environment::New();
|
||||
g_pSourcePawn = g_pEnv->APIv1();
|
||||
g_pSourcePawn2 = g_pEnv->APIv2();
|
||||
g_pPawnEnv = sp::Environment::New();
|
||||
ISourcePawnEngine *spe1 = g_pPawnEnv->APIv1();
|
||||
|
||||
*core->spe1 = g_pSourcePawn;
|
||||
*core->spe2 = g_pSourcePawn2;
|
||||
*core->spe_env = g_pEnv;
|
||||
*core->spe1 = spe1;
|
||||
*core->spe2 = g_pPawnEnv->APIv2();
|
||||
*core->spe_env = g_pPawnEnv;
|
||||
|
||||
g_pPawnEnv->SetDebugListener(&g_DbgReporter);
|
||||
|
||||
const char *timeout = core->GetCoreConfigValue("SlowScriptTimeout");
|
||||
if (timeout == NULL)
|
||||
{
|
||||
timeout = "8";
|
||||
}
|
||||
if (atoi(timeout) != 0)
|
||||
{
|
||||
g_pPawnEnv->InstallWatchdogTimer(atoi(timeout) * 1000);
|
||||
}
|
||||
|
||||
const char *linedebugger = core->GetCoreConfigValue("EnableLineDebugging");
|
||||
if (linedebugger != NULL && strcasecmp(linedebugger, "yes") == 0)
|
||||
{
|
||||
g_pPawnEnv->EnableDebugBreak();
|
||||
}
|
||||
|
||||
SMGlobalClass::head = core->listeners;
|
||||
|
||||
|
||||
@@ -438,7 +438,7 @@ IPlugin *GetPluginFromHandle(IPluginContext *pContext, Handle_t hndl)
|
||||
{
|
||||
if (hndl == BAD_HANDLE)
|
||||
{
|
||||
return scripts->FindPluginByContext(pContext->GetContext());
|
||||
return scripts->FindPluginByContext(pContext);
|
||||
} else {
|
||||
HandleError err;
|
||||
IPlugin *pPlugin = scripts->FindPluginByHandle(hndl, &err);
|
||||
@@ -557,7 +557,7 @@ static cell_t SetFailState(IPluginContext *pContext, const cell_t *params)
|
||||
SMPlugin *pPlugin;
|
||||
|
||||
pContext->LocalToString(params[1], &str);
|
||||
pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
if (params[0] == 1)
|
||||
{
|
||||
@@ -606,7 +606,7 @@ static cell_t GetSysTickCount(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t AutoExecConfig(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
SMPlugin *plugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
SMPlugin *plugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
char *cfg, *folder;
|
||||
pContext->LocalToString(params[2], &cfg);
|
||||
@@ -653,7 +653,7 @@ static cell_t MarkNativeAsOptional(IPluginContext *pContext, const cell_t *param
|
||||
static cell_t RegPluginLibrary(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
char *name;
|
||||
SMPlugin *pl = scripts->FindPluginByContext(pContext->GetContext());
|
||||
SMPlugin *pl = scripts->FindPluginByContext(pContext);
|
||||
|
||||
pContext->LocalToString(params[1], &name);
|
||||
|
||||
@@ -695,7 +695,7 @@ static cell_t sm_LogAction(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
LogAction(pPlugin->GetMyHandle(), 2, params[1], params[2], buffer);
|
||||
|
||||
@@ -727,7 +727,7 @@ static cell_t LogToFile(IPluginContext *pContext, const cell_t *params)
|
||||
}
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
g_Logger.LogToOpenFile(fp, "[%s] %s", pPlugin->GetFilename(), buffer);
|
||||
|
||||
@@ -834,7 +834,7 @@ static cell_t RequireFeature(IPluginContext *pContext, const cell_t *params)
|
||||
char buffer[255];
|
||||
char *msg = buffer;
|
||||
char default_message[255];
|
||||
SMPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
SMPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
DetectExceptions eh(pContext);
|
||||
g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 3);
|
||||
@@ -1206,7 +1206,7 @@ static cell_t LogStackTrace(IPluginContext *pContext, const cell_t *params)
|
||||
std::vector<std::string> arr = g_DbgReporter.GetStackTrace(it);
|
||||
pContext->DestroyFrameIterator(it);
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
g_Logger.LogError("[SM] Stack trace requested: %s", buffer);
|
||||
g_Logger.LogError("[SM] Called from: %s", pPlugin->GetFilename());
|
||||
|
||||
@@ -190,7 +190,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(scripts->FindPluginByContext(pf->GetParentContext()->GetContext())),
|
||||
me(scripts->FindPluginByContext(pf->GetParentContext())),
|
||||
m_pQuery(NULL)
|
||||
{
|
||||
/* We always increase the reference count because this is potentially
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
m_Data = data;
|
||||
error[0] = '\0';
|
||||
strncopy(dbname, _dbname, sizeof(dbname));
|
||||
me = scripts->FindPluginByContext(m_pFunction->GetParentContext()->GetContext());
|
||||
me = scripts->FindPluginByContext(m_pFunction->GetParentContext());
|
||||
|
||||
m_pInfo = g_DBMan.GetDatabaseConf(dbname);
|
||||
if (!m_pInfo)
|
||||
@@ -424,7 +424,7 @@ static cell_t SQL_Connect(IPluginContext *pContext, const cell_t *params)
|
||||
IExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
|
||||
if (pExt)
|
||||
{
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext));
|
||||
}
|
||||
|
||||
return hndl;
|
||||
@@ -483,12 +483,12 @@ static cell_t ConnectToDbAsync(IPluginContext *pContext, const cell_t *params, A
|
||||
IExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
|
||||
if (pExt)
|
||||
{
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext));
|
||||
}
|
||||
|
||||
/* Finally, add to the thread if we can */
|
||||
TConnectOp *op = new TConnectOp(pf, driver, conf, acm, params[3]);
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
if (pPlugin->GetProperty("DisallowDBThreads", NULL)
|
||||
|| !g_DBMan.AddToThreadQueue(op, PrioQueue_High))
|
||||
{
|
||||
@@ -564,7 +564,7 @@ static cell_t SQL_ConnectEx(IPluginContext *pContext, const cell_t *params)
|
||||
IExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
|
||||
if (pExt)
|
||||
{
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext));
|
||||
}
|
||||
|
||||
return hndl;
|
||||
@@ -865,7 +865,7 @@ static cell_t SQL_TQuery(IPluginContext *pContext, const cell_t *params)
|
||||
level = PrioQueue_Low;
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
TQueryOp *op = new TQueryOp(db, pf, query, data);
|
||||
if (pPlugin->GetProperty("DisallowDBThreads", NULL)
|
||||
@@ -1488,7 +1488,7 @@ static cell_t SQL_ConnectCustom(IPluginContext *pContext, const cell_t *params)
|
||||
IExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
|
||||
if (pExt)
|
||||
{
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext->GetContext()));
|
||||
g_Extensions.BindChildPlugin(pExt, scripts->FindPluginByContext(pContext));
|
||||
}
|
||||
|
||||
return hndl;
|
||||
@@ -1808,7 +1808,7 @@ static cell_t SQL_ExecuteTransaction(IPluginContext *pContext, const cell_t *par
|
||||
// close the plugin's handle here.
|
||||
handlesys->FreeHandle(params[2], &sec);
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
if (pPlugin->GetProperty("DisallowDBThreads", NULL) || !g_DBMan.AddToThreadQueue(op, priority))
|
||||
{
|
||||
// Do everything right now.
|
||||
|
||||
@@ -59,7 +59,7 @@ cell_t FakeNativeRouter(IPluginContext *pContext, const cell_t *params, void *pD
|
||||
return pContext->ThrowNativeError("Plugin owning this native is currently paused.");
|
||||
}
|
||||
|
||||
CPlugin *pCaller = g_PluginSys.GetPluginByCtx(pContext->GetContext());
|
||||
CPlugin *pCaller = g_PluginSys.GetPluginByCtx(pContext);
|
||||
|
||||
/* Save any old data on the stack */
|
||||
FakeNative *pSaveNative = s_curnative;
|
||||
@@ -116,7 +116,7 @@ static cell_t CreateNative(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("Failed to create native \"%s\", function %x is not a valid function", name, params[2]);
|
||||
}
|
||||
|
||||
pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
|
||||
pPlugin = g_PluginSys.GetPluginByCtx(pContext);
|
||||
|
||||
if (!pPlugin->AddFakeNative(pFunction, name, FakeNativeRouter))
|
||||
{
|
||||
|
||||
@@ -945,7 +945,7 @@ static cell_t sm_LogMessage(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
g_Logger.LogMessage("[%s] %s", pPlugin->GetFilename(), buffer);
|
||||
|
||||
return 1;
|
||||
@@ -963,7 +963,7 @@ static cell_t sm_LogError(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
g_Logger.LogError("[%s] %s", pPlugin->GetFilename(), buffer);
|
||||
|
||||
return 1;
|
||||
@@ -1010,7 +1010,7 @@ static cell_t sm_LogToOpenFile(IPluginContext *pContext, const cell_t *params)
|
||||
return 0;
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
g_Logger.LogToOpenFile(sysfile->fp(), "[%s] %s", pPlugin->GetFilename(), buffer);
|
||||
|
||||
return 1;
|
||||
|
||||
@@ -321,7 +321,7 @@ public:
|
||||
|
||||
MTRand *RandObjForPlugin(IPluginContext *ctx)
|
||||
{
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(ctx->GetContext());
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(ctx);
|
||||
MTRand *mtrand;
|
||||
if (!plugin->GetProperty("core.logic.mtrand", (void**)&mtrand))
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ static cell_t sm_GetFunctionByName(IPluginContext *pContext, const cell_t *param
|
||||
|
||||
if (hndl == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(hndl, &err);
|
||||
|
||||
@@ -218,7 +218,7 @@ static cell_t sm_AddToForward(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
if (plHandle == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(plHandle, &err);
|
||||
|
||||
@@ -259,7 +259,7 @@ static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *param
|
||||
|
||||
if (plHandle == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(plHandle, &err);
|
||||
|
||||
@@ -300,7 +300,7 @@ static cell_t sm_RemoveAllFromForward(IPluginContext *pContext, const cell_t *pa
|
||||
|
||||
if (plHandle == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(plHandle, &err);
|
||||
|
||||
@@ -325,7 +325,7 @@ static cell_t sm_CallStartFunction(IPluginContext *pContext, const cell_t *param
|
||||
|
||||
if (hndl == 0)
|
||||
{
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
} else {
|
||||
pPlugin = pluginsys->PluginFromHandle(hndl, &err);
|
||||
|
||||
@@ -721,7 +721,7 @@ static void PawnFrameAction(void *pData)
|
||||
|
||||
static cell_t sm_AddFrameAction(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext);
|
||||
IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[1]);
|
||||
if (!pFunction)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
#include "common_logic.h"
|
||||
#include <bridge/include/IScriptManager.h>
|
||||
#include <IHandleSys.h>
|
||||
#include <IPluginSys.h>
|
||||
|
||||
@@ -108,7 +109,7 @@ static cell_t sm_CloneHandle(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
static cell_t sm_GetMyHandle(IPluginContext *pContext, const cell_t *params)
|
||||
{
|
||||
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
|
||||
return pPlugin->GetMyHandle();
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
static cell_t sm_TranslationPhraseExists(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
IPlugin *pl = pluginsys->FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = pluginsys->FindPluginByContext(pCtx);
|
||||
IPhraseCollection *collection = pl->GetPhrases();
|
||||
|
||||
char *phrase;
|
||||
@@ -49,7 +49,7 @@ static cell_t sm_TranslationPhraseExists(IPluginContext *pCtx, const cell_t *par
|
||||
|
||||
static cell_t sm_IsTranslatedForLanguage(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
IPlugin *pl = pluginsys->FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = pluginsys->FindPluginByContext(pCtx);
|
||||
IPhraseCollection *collection = pl->GetPhrases();
|
||||
|
||||
char *phrase;
|
||||
@@ -65,7 +65,7 @@ static cell_t sm_LoadTranslations(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
char *filename, *ext;
|
||||
char buffer[PLATFORM_MAX_PATH];
|
||||
IPlugin *pl = pluginsys->FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = pluginsys->FindPluginByContext(pCtx);
|
||||
|
||||
pCtx->LocalToString(params[1], &filename);
|
||||
ke::SafeStrcpy(buffer, sizeof(buffer), filename);
|
||||
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
m_FreePanelHandlers.pop();
|
||||
}
|
||||
handler->m_pFunc = pFunction;
|
||||
handler->m_pPlugin = scripts->FindPluginByContext(pFunction->GetParentContext()->GetContext());
|
||||
handler->m_pPlugin = scripts->FindPluginByContext(pFunction->GetParentContext());
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,7 @@ AddMultiTargetFilter(IPluginContext *ctx, const cell_t *params)
|
||||
ctx->LocalToString(params[3], &phrase);
|
||||
|
||||
bool phraseIsML = !!params[4];
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(ctx->GetContext());
|
||||
IPlugin *plugin = pluginsys->FindPluginByContext(ctx);
|
||||
|
||||
s_PlayerLogicHelpers.AddMultiTargetFilter(plugin, pattern, fun, phrase, phraseIsML);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ size_t Translate(char *buffer,
|
||||
unsigned int langid;
|
||||
*error = false;
|
||||
Translation pTrans;
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx);
|
||||
unsigned int max_params = 0;
|
||||
IPhraseCollection *pPhrases;
|
||||
|
||||
|
||||
@@ -422,8 +422,8 @@ CoreProviderImpl::CoreProviderImpl()
|
||||
this->playerhelpers = &g_Players;
|
||||
this->gamehelpers = &g_HL2;
|
||||
this->menus = &g_Menus;
|
||||
this->spe1 = &g_pSourcePawn;
|
||||
this->spe2 = &g_pSourcePawn2;
|
||||
this->spe1 = &g_pPawnEnv;
|
||||
this->spe2 = &g_pPawnEnv;
|
||||
this->spe_env = &g_pPawnEnv;
|
||||
this->GetCoreConfigValue = get_core_config_value;
|
||||
this->DoGlobalPluginLoads = do_global_plugin_loads;
|
||||
|
||||
+4
-2
@@ -195,9 +195,11 @@ public:
|
||||
static SMGlobalClass *head;
|
||||
};
|
||||
|
||||
extern SourcePawn::ISourcePawnEngine *g_pSourcePawn;
|
||||
extern SourcePawn::ISourcePawnEngine2 *g_pSourcePawn2;
|
||||
#if defined SM_LOGIC
|
||||
extern sp::Environment *g_pPawnEnv;
|
||||
#else
|
||||
extern SourcePawn::ISourcePawnEnvironment *g_pPawnEnv;
|
||||
#endif
|
||||
extern IdentityToken_t *g_pCoreIdent;
|
||||
|
||||
namespace SourceMod
|
||||
|
||||
@@ -750,7 +750,7 @@ static cell_t sm_RegServerCmd(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
if (!g_ConCmds.AddServerCommand(pFunction, name, help, params[4], pPlugin))
|
||||
{
|
||||
return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
|
||||
@@ -779,7 +779,7 @@ static cell_t sm_RegConsoleCmd(IPluginContext *pContext, const cell_t *params)
|
||||
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
|
||||
}
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
const char *group = pPlugin->GetFilename();
|
||||
if (!g_ConCmds.AddAdminCommand(pFunction, name, group, 0, help, params[4], pPlugin))
|
||||
{
|
||||
@@ -808,7 +808,7 @@ static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
|
||||
pContext->LocalToString(params[5], (char **)&group);
|
||||
pFunction = pContext->GetFunctionById(params[2]);
|
||||
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = scripts->FindPluginByContext(pContext);
|
||||
if (group[0] == '\0')
|
||||
{
|
||||
group = pPlugin->GetFilename();
|
||||
|
||||
@@ -169,7 +169,7 @@ MsgListenerWrapper *UsrMessageNatives::CreateListener(IPluginContext *pCtx)
|
||||
{
|
||||
MsgWrapperList *pList;
|
||||
MsgListenerWrapper *pListener;
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx);
|
||||
|
||||
if (m_FreeListeners.empty())
|
||||
{
|
||||
@@ -195,7 +195,7 @@ bool UsrMessageNatives::FindListener(int msgid, IPluginContext *pCtx, IPluginFun
|
||||
MsgWrapperList *pList;
|
||||
MsgWrapperIter _iter;
|
||||
MsgListenerWrapper *pListener;
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx);
|
||||
|
||||
if (!pl->GetProperty("MsgListeners", reinterpret_cast<void **>(&pList)))
|
||||
{
|
||||
@@ -221,7 +221,7 @@ bool UsrMessageNatives::DeleteListener(IPluginContext *pCtx, MsgWrapperIter iter
|
||||
{
|
||||
MsgWrapperList *pList;
|
||||
MsgListenerWrapper *pListener;
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx->GetContext());
|
||||
IPlugin *pl = scripts->FindPluginByContext(pCtx);
|
||||
|
||||
if (!pl->GetProperty("MsgListeners", reinterpret_cast<void **>(&pList)))
|
||||
{
|
||||
|
||||
+3
-34
@@ -59,8 +59,6 @@ SH_DECL_HOOK0(IVEngineServer, GetMapEntitiesString, SH_NOATTRIB, 0, const char *
|
||||
SourceModBase g_SourceMod;
|
||||
|
||||
SourceHook::String g_BaseDir;
|
||||
ISourcePawnEngine *g_pSourcePawn = NULL;
|
||||
ISourcePawnEngine2 *g_pSourcePawn2 = NULL;
|
||||
ISourcePawnEnvironment *g_pPawnEnv = NULL;
|
||||
IdentityToken_t *g_pCoreIdent = NULL;
|
||||
IForward *g_pOnMapInit = nullptr;
|
||||
@@ -119,9 +117,7 @@ ConfigResult SourceModBase::OnSourceModConfigChanged(const char *key,
|
||||
{
|
||||
sm_disable_jit = (strcasecmp(value, "yes") == 0) ? true : false;
|
||||
|
||||
if (g_pSourcePawn2) {
|
||||
g_pSourcePawn2->SetJitEnabled(!sm_disable_jit);
|
||||
}
|
||||
logicore.SetJitEnabled(!sm_disable_jit);
|
||||
|
||||
return ConfigResult_Accept;
|
||||
}
|
||||
@@ -145,9 +141,7 @@ ConfigResult SourceModBase::OnSourceModConfigChanged(const char *key,
|
||||
return ConfigResult_Reject;
|
||||
}
|
||||
|
||||
if (g_pPawnEnv) {
|
||||
g_pPawnEnv->SetDebugMetadataFlags(jit_metadata_flags);
|
||||
}
|
||||
logicore.SetDebugMetadataFlags(jit_metadata_flags);
|
||||
|
||||
return ConfigResult_Accept;
|
||||
}
|
||||
@@ -200,13 +194,6 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late
|
||||
/* There will always be a path by this point, since it was force-set above. */
|
||||
m_GotBasePath = true;
|
||||
|
||||
g_pSourcePawn2->SetDebugListener(logicore.debugger);
|
||||
|
||||
if (sm_disable_jit)
|
||||
g_pSourcePawn2->SetJitEnabled(!sm_disable_jit);
|
||||
|
||||
g_pPawnEnv->SetDebugMetadataFlags(jit_metadata_flags);
|
||||
|
||||
sSourceModInitialized = true;
|
||||
|
||||
/* Hook this now so we can detect startup without calling StartSourceMod() */
|
||||
@@ -285,22 +272,6 @@ void SourceModBase::StartSourceMod(bool late)
|
||||
extsys->LoadAutoExtension("updater.ext." PLATFORM_LIB_EXT);
|
||||
}
|
||||
|
||||
const char *timeout = GetCoreConfigValue("SlowScriptTimeout");
|
||||
if (timeout == NULL)
|
||||
{
|
||||
timeout = "8";
|
||||
}
|
||||
if (atoi(timeout) != 0)
|
||||
{
|
||||
g_pSourcePawn2->InstallWatchdogTimer(atoi(timeout) * 1000);
|
||||
}
|
||||
|
||||
const char *linedebugger = GetCoreConfigValue("EnableLineDebugging");
|
||||
if (linedebugger != NULL && strcasecmp(linedebugger, "yes") == 0)
|
||||
{
|
||||
g_pPawnEnv->EnableDebugBreak();
|
||||
}
|
||||
|
||||
SH_ADD_HOOK(IServerGameDLL, Think, gamedll, SH_MEMBER(logicore.callbacks, &IProviderCallbacks::OnThink), false);
|
||||
}
|
||||
|
||||
@@ -507,8 +478,6 @@ void SourceModBase::CloseSourceMod()
|
||||
sCoreProviderImpl.ShutdownBridge();
|
||||
|
||||
g_pPawnEnv = NULL;
|
||||
g_pSourcePawn2 = NULL;
|
||||
g_pSourcePawn = NULL;
|
||||
}
|
||||
|
||||
void SourceModBase::ShutdownServices()
|
||||
@@ -659,7 +628,7 @@ const char *SourceModBase::GetGameFolderName() const
|
||||
|
||||
ISourcePawnEngine *SourceModBase::GetScriptingEngine()
|
||||
{
|
||||
return g_pSourcePawn;
|
||||
return g_pPawnEnv;
|
||||
}
|
||||
|
||||
IVirtualMachine *SourceModBase::GetScriptingVM()
|
||||
|
||||
@@ -354,7 +354,7 @@ cell_t AddSettingsMenuItem(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
/* Track this in case the plugin unloads */
|
||||
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext);
|
||||
std::vector<char *> *pList = NULL;
|
||||
|
||||
if (!pPlugin->GetProperty("SettingsMenuItems", (void **)&pList, false) || !pList)
|
||||
@@ -424,7 +424,7 @@ cell_t AddSettingsPrefabMenuItem(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
/* Track this in case the plugin unloads */
|
||||
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext);
|
||||
std::vector<char *> *pList = NULL;
|
||||
|
||||
if (!pPlugin->GetProperty("SettingsMenuItems", (void **)&pList, false) || !pList)
|
||||
|
||||
@@ -255,7 +255,7 @@ void EntityOutputManager::CleanUpHook(omg_hooks *hook)
|
||||
|
||||
OnHookRemoved();
|
||||
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(hook->pf->GetParentContext()->GetContext());
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(hook->pf->GetParentContext());
|
||||
SourceHook::List<omg_hooks *> *pList = NULL;
|
||||
|
||||
if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList)
|
||||
|
||||
@@ -94,7 +94,7 @@ cell_t HookSingleEntityOutput(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
g_OutputManager.OnHookAdded();
|
||||
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext);
|
||||
SourceHook::List<omg_hooks *> *pList = NULL;
|
||||
|
||||
if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList)
|
||||
@@ -157,7 +157,7 @@ cell_t HookEntityOutput(IPluginContext *pContext, const cell_t *params)
|
||||
|
||||
g_OutputManager.OnHookAdded();
|
||||
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext->GetContext());
|
||||
IPlugin *pPlugin = plsys->FindPluginByContext(pContext);
|
||||
SourceHook::List<omg_hooks *> *pList = NULL;
|
||||
|
||||
if (!pPlugin->GetProperty("OutputHookList", (void **)&pList, false) || !pList)
|
||||
|
||||
+2
-16
@@ -142,20 +142,6 @@ namespace SourceMod
|
||||
*/
|
||||
virtual SourcePawn::IPluginContext *GetBaseContext() =0;
|
||||
|
||||
/**
|
||||
* @brief Deprecated, returns NULL.
|
||||
*
|
||||
* @return NULL.
|
||||
*/
|
||||
virtual sp_context_t *GetContext() =0;
|
||||
|
||||
/**
|
||||
* @brief Deprecated, returns NULL.
|
||||
*
|
||||
* @return NULL.
|
||||
*/
|
||||
virtual void *GetPluginStructure() =0;
|
||||
|
||||
/**
|
||||
* @brief Returns information about the plugin by reference.
|
||||
*
|
||||
@@ -388,10 +374,10 @@ namespace SourceMod
|
||||
* @brief Finds a plugin by its context.
|
||||
* Note: This function should be considered O(1).
|
||||
*
|
||||
* @param ctx Pointer to an sp_context_t.
|
||||
* @param ctx Pointer to an IPluginContext.
|
||||
* @return Pointer to a matching IPlugin, or NULL if none found.
|
||||
*/
|
||||
virtual IPlugin *FindPluginByContext(const sp_context_t *ctx) =0;
|
||||
virtual IPlugin *FindPluginByContext(SourcePawn::IPluginContext *ctx) =0;
|
||||
|
||||
/**
|
||||
* @brief Returns the number of plugins (both failed and loaded).
|
||||
|
||||
Reference in New Issue
Block a user