Hi
Please let me post all code, details regarding the stub_mm plug-in which builds fine but is not loaded by Linux-Ep1 server.
.H file:
Code:
/**
* vim: set ts=4 sw=4 tw=99 noet :
* ======================================================
* Metamod:Source Stub Plugin
* Written by AlliedModders LLC.
* ======================================================
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* This stub plugin is public domain.
*/
#ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
#define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
#ifndef WIN32
#define _vsnprintf vsnprintf
#define stricmp strcasecmp
#endif
#include <ISmmPlugin.h>
#if defined WIN32 && !defined snprintf
#define snprintf _snprintf
#endif
class StubPlugin : public ISmmPlugin
{
public:
bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
bool Unload(char *error, size_t maxlen);
bool Pause(char *error, size_t maxlen);
bool Unpause(char *error, size_t maxlen);
void AllPluginsLoaded();
public:
const char *GetAuthor();
const char *GetName();
const char *GetDescription();
const char *GetURL();
const char *GetLicense();
const char *GetVersion();
const char *GetDate();
const char *GetLogTag();
};
void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
extern StubPlugin g_StubPlugin;
PLUGIN_GLOBALVARS();
#endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
.CPP file:
Code:
/**
* vim: set ts=4 sw=4 tw=99 noet :
* ======================================================
* Metamod:Source Stub Plugin
* Written by AlliedModders LLC.
* ======================================================
*
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from
* the use of this software.
*
* This stub plugin is public domain.
*/
#include <stdio.h>
#include "stub_mm.h"
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
StubPlugin g_StubPlugin;
IServerGameDLL *server = NULL;
PLUGIN_EXPOSE(StubPlugin, g_StubPlugin);
bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
PLUGIN_SAVEVARS();
/* Make sure we build on MM:S 1.4 */
#if defined METAMOD_PLAPI_VERSION
GET_V_IFACE_ANY(GetServerFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
#else
GET_V_IFACE_ANY(serverFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
#endif
SH_ADD_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, server, Hook_ServerActivate, true);
return true;
}
bool StubPlugin::Unload(char *error, size_t maxlen)
{
SH_REMOVE_HOOK_STATICFUNC(IServerGameDLL, ServerActivate, server, Hook_ServerActivate, true);
return true;
}
void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
{
META_LOG(g_PLAPI, "ServerActivate() called: edictCount = %d, clientMax = %d", edictCount, clientMax);
}
void StubPlugin::AllPluginsLoaded()
{
/* This is where we'd do stuff that relies on the mod or other plugins
* being initialized (for example, cvars added and events registered).
*/
}
bool StubPlugin::Pause(char *error, size_t maxlen)
{
return true;
}
bool StubPlugin::Unpause(char *error, size_t maxlen)
{
return true;
}
const char *StubPlugin::GetLicense()
{
return "Public Domain";
}
const char *StubPlugin::GetVersion()
{
return "1.0.0.0";
}
const char *StubPlugin::GetDate()
{
return __DATE__;
}
const char *StubPlugin::GetLogTag()
{
return "STUB";
}
const char *StubPlugin::GetAuthor()
{
return "AlliedModders LLC";
}
const char *StubPlugin::GetDescription()
{
return "Sample empty plugin";
}
const char *StubPlugin::GetName()
{
return "Stub Plugin";
}
const char *StubPlugin::GetURL()
{
return "http://www.sourcemm.net/";
}
In above kindly note I've added a define, without which plug-in was not compiling:
Code:
#ifndef WIN32
#define _vsnprintf vsnprintf
#define stricmp strcasecmp
#endif
Please note additional files/dependancies I've set up:
Linker:
Code:
../../../hl2sdk/linux_sdk/tier1_i486.a
Compiler options:
Defines:
Code:
_LINUX
_DEBUG
_USRDLL
STUB_MM_EXPORTS
SOURCE_ENGINE=1
SE_EPISODEONE=1
SE_DARKMESSIAH=2
SE_ORANGEBOX=3
SE_ORANGEBOXVALVE=4
SE_LEFT4DEAD=5
SE_LEFT4DEAD2=6
SE_ALIENSWARM=7
Search directories:
Code:
<"../../core-legacy/sourcehook" />
<"../../../hl2sdk/public" />
<"../../../hl2sdk/public/dlls" />
<"../../../hl2sdk/public/engine" />
<"../../../hl2sdk/public/tier0" />
<"../../../hl2sdk/public/tier1" />
<"../../../hl2sdk/public/vstdlib" />
Error I get while trying to load:
Code:
Failed to load plugin addons/stub/bin/stub_mm ([2]).
Currently I am using metamod 1.9 dev version (but initially I was using the stable 1.8 version which was also not working):
Code:
Metamod:Source version 1.9.0-dev
Build ID: 768:e6394d70ced0-dev
Loaded As: Valve Server Plugin
Compiled on: Dec 12 2011
Plugin interface version: 11:7
SourceHook version: 4:4
http://www.metamodsource.net/
Any ideas for this thing? Is it just with me, or is Linux-Ep1 no longer being supported?
Thanks for reading this, and for your time.