Deprecate CreateInterface (#2001)
* Deprecate CreateInterface Co-authored-by: KitRifty <4492504+KitRifty@users.noreply.github.com> * Expose the 'newer' data * Update smsdk_ext.cpp --------- Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com> Co-authored-by: KitRifty <4492504+KitRifty@users.noreply.github.com>
This commit is contained in:
parent
7747beb4cf
commit
11c8084ccd
@ -297,6 +297,12 @@ void SDKExtension::SDK_OnDependenciesDropped()
|
||||
|
||||
#if defined SMEXT_CONF_METAMOD
|
||||
|
||||
#if defined _MSC_VER
|
||||
#define SMEXT_DLL_EXPORT extern "C" __declspec(dllexport)
|
||||
#else
|
||||
#define SMEXT_DLL_EXPORT extern "C" __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
PluginId g_PLID = 0; /**< Metamod plugin ID */
|
||||
ISmmPlugin *g_PLAPI = NULL; /**< Metamod plugin API */
|
||||
SourceHook::ISourceHook *g_SHPtr = NULL; /**< SourceHook pointer */
|
||||
@ -308,27 +314,9 @@ IServerGameDLL *gamedll = NULL; /**< IServerGameDLL pointer */
|
||||
#endif
|
||||
|
||||
/** Exposes the extension to Metamod */
|
||||
SMM_API void *PL_EXPOSURE(const char *name, int *code)
|
||||
SMEXT_DLL_EXPORT METAMOD_PLUGIN *CreateInterface_MMS(const MetamodVersionInfo *mvi, const MetamodLoaderInfo *mli)
|
||||
{
|
||||
#if defined METAMOD_PLAPI_VERSION
|
||||
if (name && !strcmp(name, METAMOD_PLAPI_NAME))
|
||||
#else
|
||||
if (name && !strcmp(name, PLAPI_NAME))
|
||||
#endif
|
||||
{
|
||||
if (code)
|
||||
{
|
||||
*code = META_IFACE_OK;
|
||||
}
|
||||
return static_cast<void *>(g_pExtensionIface);
|
||||
}
|
||||
|
||||
if (code)
|
||||
{
|
||||
*code = META_IFACE_FAILED;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return g_pExtensionIface->SDK_OnMetamodCreateInterface(mvi, mli);
|
||||
}
|
||||
|
||||
bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
|
||||
@ -457,6 +445,11 @@ const char *SDKExtension::GetVersion()
|
||||
return GetExtensionVerString();
|
||||
}
|
||||
|
||||
METAMOD_PLUGIN *SDKExtension::SDK_OnMetamodCreateInterface(const MetamodVersionInfo *mvi, const MetamodLoaderInfo *mli)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late)
|
||||
{
|
||||
return true;
|
||||
|
@ -152,6 +152,15 @@ public:
|
||||
virtual void SDK_OnDependenciesDropped();
|
||||
|
||||
#if defined SMEXT_CONF_METAMOD
|
||||
/**
|
||||
* @brief Called when Metamod is requesting the extension (ISmmPlugin) interface.
|
||||
*
|
||||
* @param mvi Struct that contains Metamod version, SourceHook version, Plugin version and Source Engine version.
|
||||
* @param mli Struct that contains the library file name and path being loaded.
|
||||
* @return The ISmmPlugin interface.
|
||||
*/
|
||||
virtual METAMOD_PLUGIN *SDK_OnMetamodCreateInterface(const MetamodVersionInfo *mvi, const MetamodLoaderInfo *mli);
|
||||
|
||||
/**
|
||||
* @brief Called when Metamod is attached, before the extension version is called.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user