1.1 --- a/core/systems/ShareSys.h Mon May 26 07:48:26 2008 +0000
1.2 +++ b/core/systems/ShareSys.h Mon May 26 07:51:11 2008 +0000
1.3 @@ -35,6 +35,7 @@
1.4 #include <IShareSys.h>
1.5 #include <IHandleSys.h>
1.6 #include <sh_list.h>
1.7 +#include <sm_trie_tpl.h>
1.8 #include "sm_globals.h"
1.9 #include "sourcemod.h"
1.10
1.11 @@ -60,11 +61,38 @@
1.12 IExtension *owner;
1.13 };
1.14
1.15 +class CNativeOwner;
1.16 +class CPlugin;
1.17 +struct NativeEntry;
1.18 +
1.19 +struct ReplaceNative
1.20 +{
1.21 + CNativeOwner *owner;
1.22 + SPVM_NATIVE_FUNC func;
1.23 +};
1.24 +
1.25 +struct FakeNative
1.26 +{
1.27 + char name[64];
1.28 + IPluginContext *ctx;
1.29 + IPluginFunction *call;
1.30 +};
1.31 +
1.32 +struct NativeEntry
1.33 +{
1.34 + CNativeOwner *owner;
1.35 + SPVM_NATIVE_FUNC func;
1.36 + const char *name;
1.37 + ReplaceNative replacement;
1.38 + FakeNative *fake;
1.39 +};
1.40 +
1.41 class ShareSystem :
1.42 public IShareSys,
1.43 public SMGlobalClass,
1.44 public IHandleTypeDispatch
1.45 {
1.46 + friend class CNativeOwner;
1.47 public:
1.48 ShareSystem();
1.49 public: //IShareSys
1.50 @@ -96,12 +124,25 @@
1.51 {
1.52 return &m_IdentRoot;
1.53 }
1.54 +public:
1.55 + void BindNativesToPlugin(CPlugin *pPlugin, bool bCoreOnly);
1.56 + void BindNativeToPlugin(CPlugin *pPlugin, NativeEntry *pEntry);
1.57 + NativeEntry *AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKENATIVE_FUNC func);
1.58 +private:
1.59 + NativeEntry *AddNativeToCache(CNativeOwner *pOwner, const sp_nativeinfo_t *ntv);
1.60 + void ClearNativeFromCache(CNativeOwner *pOwner, const char *name);
1.61 + NativeEntry *FindNative(const char *name);
1.62 + void BindNativeToPlugin(CPlugin *pPlugin,
1.63 + sp_native_t *ntv,
1.64 + uint32_t index,
1.65 + NativeEntry *pEntry);
1.66 private:
1.67 List<IfaceInfo> m_Interfaces;
1.68 HandleType_t m_TypeRoot;
1.69 IdentityToken_t m_IdentRoot;
1.70 HandleType_t m_IfaceType;
1.71 IdentityType_t m_CoreType;
1.72 + KTrie<NativeEntry *> m_NtvCache;
1.73 };
1.74
1.75 extern ShareSystem g_ShareSys;