1.1 --- a/core/logic/intercom.h Fri Mar 29 12:28:02 2013 -0400
1.2 +++ b/core/logic/intercom.h Fri Mar 29 11:37:29 2013 -0700
1.3 @@ -29,20 +29,27 @@
1.4 * Version: $Id$
1.5 */
1.6
1.7 +#ifndef _INCLUDE_SOURCEMOD_INTERCOM_H_
1.8 +#define _INCLUDE_SOURCEMOD_INTERCOM_H_
1.9 +
1.10 #include <sp_vm_api.h>
1.11 #include <IHandleSys.h>
1.12 #include <IShareSys.h>
1.13 -
1.14 -#ifndef _INCLUDE_SOURCEMOD_INTERCOM_H_
1.15 -#define _INCLUDE_SOURCEMOD_INTERCOM_H_
1.16 +#include <IPluginSys.h>
1.17 +#include <sh_string.h>
1.18 +#include <sp_vm_api.h>
1.19 +#include <sh_vector.h>
1.20 +#include <IExtensionSys.h>
1.21
1.22 using namespace SourceMod;
1.23 +using namespace SourcePawn;
1.24 +using namespace SourceHook;
1.25
1.26 /**
1.27 * Add 1 to the RHS of this expression to bump the intercom file
1.28 * This is to prevent mismatching core/logic binaries
1.29 */
1.30 -#define SM_LOGIC_MAGIC (0x0F47C0DE - 18)
1.31 +#define SM_LOGIC_MAGIC (0x0F47C0DE - 19)
1.32
1.33 #if defined SM_LOGIC
1.34 class IVEngineServer
1.35 @@ -75,6 +82,12 @@
1.36
1.37 class IVEngineServer;
1.38 class ConVar;
1.39 +class SMGlobalClass;
1.40 +
1.41 +namespace SourceMod
1.42 +{
1.43 + class IChangeableForward;
1.44 +}
1.45
1.46 struct ServerGlobals
1.47 {
1.48 @@ -83,17 +96,79 @@
1.49 float *frametime;
1.50 };
1.51
1.52 +struct AutoConfig
1.53 +{
1.54 + SourceHook::String autocfg;
1.55 + SourceHook::String folder;
1.56 + bool create;
1.57 +};
1.58 +
1.59 +enum LibraryAction
1.60 +{
1.61 + LibraryAction_Removed,
1.62 + LibraryAction_Added
1.63 +};
1.64 +
1.65 +class CNativeOwner;
1.66 +
1.67 +class SMPlugin : public IPlugin
1.68 +{
1.69 +public:
1.70 + virtual size_t GetConfigCount() = 0;
1.71 + virtual AutoConfig *GetConfig(size_t i) = 0;
1.72 + virtual void AddLibrary(const char *name) = 0;
1.73 + virtual void AddConfig(bool create, const char *cfg, const char *folder) = 0;
1.74 + virtual void SetErrorState(PluginStatus status, const char *fmt, ...) = 0;
1.75 +};
1.76 +
1.77 +class IScriptManager
1.78 +{
1.79 +public:
1.80 + virtual void LoadAll(const char *config_path, const char *plugins_path) = 0;
1.81 + virtual void RefreshAll() = 0;
1.82 + virtual void Shutdown() = 0;
1.83 + virtual IdentityToken_t *GetIdentity() = 0;
1.84 + virtual void SyncMaxClients(int maxClients) = 0;
1.85 + virtual void AddPluginsListener(IPluginsListener *listener) = 0;
1.86 + virtual void RemovePluginsListener(IPluginsListener *listener) = 0;
1.87 + virtual IPluginIterator *GetPluginIterator() = 0;
1.88 + virtual void OnLibraryAction(const char *name, LibraryAction action) = 0;
1.89 + virtual bool LibraryExists(const char *name) = 0;
1.90 + virtual SMPlugin *FindPluginByOrder(unsigned num) = 0;
1.91 + virtual SMPlugin *FindPluginByIdentity(IdentityToken_t *ident) = 0;
1.92 + virtual SMPlugin *FindPluginByContext(IPluginContext *ctx) = 0;
1.93 + virtual SMPlugin *FindPluginByContext(sp_context_t *ctx) = 0;
1.94 + virtual SMPlugin *FindPluginByConsoleArg(const char *text) = 0;
1.95 + virtual SMPlugin *FindPluginByHandle(Handle_t hndl, HandleError *errp) = 0;
1.96 + virtual bool UnloadPlugin(IPlugin *plugin) = 0;
1.97 + virtual void ListPlugins(CVector<SMPlugin *> *plugins) = 0;
1.98 + virtual void AddFunctionsToForward(const char *name, IChangeableForward *fwd) = 0;
1.99 +};
1.100 +
1.101 +class IExtensionSys : public IExtensionManager
1.102 +{
1.103 +public:
1.104 + virtual IExtension *LoadAutoExtension(const char *name) = 0;
1.105 + virtual void TryAutoload() = 0;
1.106 + virtual void Shutdown() = 0;
1.107 + virtual IExtension *FindExtensionByFile(const char *name) = 0;
1.108 + virtual bool LibraryExists(const char *name) = 0;
1.109 + virtual void CallOnCoreMapStart(edict_t *edictList, int edictCount, int maxClients) = 0;
1.110 + virtual IExtension *GetExtensionFromIdent(IdentityToken_t *token) = 0;
1.111 + virtual void BindChildPlugin(IExtension *ext, SMPlugin *plugin) = 0;
1.112 + virtual void AddRawDependency(IExtension *myself, IdentityToken_t *token, void *iface) = 0;
1.113 + virtual void ListExtensions(CVector<IExtension *> *list) = 0;
1.114 +};
1.115 +
1.116 +class CCommand;
1.117 +
1.118 struct sm_core_t
1.119 {
1.120 /* Objects */
1.121 - IHandleSys *handlesys;
1.122 - IdentityToken_t *core_ident;
1.123 ISourceMod *sm;
1.124 ILibrarySys *libsys;
1.125 IVEngineServer *engine;
1.126 - IShareSys *sharesys;
1.127 IRootConsole *rootmenu;
1.128 - IPluginManager *pluginsys;
1.129 IForwardManager *forwardsys;
1.130 ITimerSystem *timersys;
1.131 IPlayerManager *playerhelpers;
1.132 @@ -102,11 +177,11 @@
1.133 ISourcePawnEngine **spe1;
1.134 ISourcePawnEngine2 **spe2;
1.135 /* Functions */
1.136 - void (*AddNatives)(sp_nativeinfo_t* nlist);
1.137 ConVar * (*FindConVar)(const char*);
1.138 unsigned int (*strncopy)(char*, const char*, size_t);
1.139 char * (*TrimWhitespace)(char *, size_t &);
1.140 void (*LogError)(const char*, ...);
1.141 + void (*LogFatal)(const char*, ...);
1.142 void (*Log)(const char*, ...);
1.143 void (*LogToFile)(FILE *fp, const char*, ...);
1.144 void (*LogToGame)(const char *message);
1.145 @@ -122,6 +197,15 @@
1.146 const char * (*GetSourceEngineName)();
1.147 bool (*SymbolsAreHidden)();
1.148 const char * (*GetCoreConfigValue)(const char*);
1.149 + bool (*IsMapLoading)();
1.150 + bool (*IsMapRunning)();
1.151 + int (*Argc)(const CCommand &args);
1.152 + const char * (*Arg)(const CCommand &args, int arg);
1.153 + int (*LoadMMSPlugin)(const char *file, bool *ok, char *error, size_t maxlength);
1.154 + void (*UnloadMMSPlugin)(int id);
1.155 + void (*DoGlobalPluginLoads)();
1.156 + bool (*AreConfigsExecuted)();
1.157 + void (*ExecuteConfigs)(IPluginContext *ctx);
1.158 /* Data */
1.159 ServerGlobals *serverGlobals;
1.160 void * serverFactory;
1.161 @@ -145,6 +229,14 @@
1.162 bool (*OnLogPrint)(const char *msg); // true to supercede
1.163 IDebugListener *debugger;
1.164 void (*GenerateError)(IPluginContext *, cell_t, int, const char *, ...);
1.165 + void (*AddNatives)(sp_nativeinfo_t *natives);
1.166 + void (*DumpHandles)(void (*dumpfn)(const char *fmt, ...));
1.167 + IScriptManager *scripts;
1.168 + IShareSys *sharesys;
1.169 + IExtensionSys *extsys;
1.170 + IHandleSys *handlesys;
1.171 + IdentityToken_t *core_ident;
1.172 + float sentinel;
1.173 };
1.174
1.175 typedef void (*LogicInitFunction)(const sm_core_t *core, sm_logic_t *logic);
1.176 @@ -152,4 +244,3 @@
1.177 typedef ITextParsers *(*GetITextParsers)();
1.178
1.179 #endif /* _INCLUDE_SOURCEMOD_INTERCOM_H_ */
1.180 -