From 0d5a3c7d6b656fc75c02286b55c2d8473e845109 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 19 Apr 2005 22:05:41 +0000 Subject: [PATCH] Initial import of stub plugin --HG-- extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4032 --- sourcemm/stub_mm/LICENSE.txt | 29 +++++++ sourcemm/stub_mm/meta_hooks.h | 16 ++++ sourcemm/stub_mm/stub_mm.cpp | 108 ++++++++++++++++++++++++ sourcemm/stub_mm/stub_mm.h | 45 ++++++++++ sourcemm/stub_mm/stub_mm.sln | 21 +++++ sourcemm/stub_mm/stub_mm.vcproj | 143 ++++++++++++++++++++++++++++++++ 6 files changed, 362 insertions(+) create mode 100644 sourcemm/stub_mm/LICENSE.txt create mode 100644 sourcemm/stub_mm/meta_hooks.h create mode 100644 sourcemm/stub_mm/stub_mm.cpp create mode 100644 sourcemm/stub_mm/stub_mm.h create mode 100644 sourcemm/stub_mm/stub_mm.sln create mode 100644 sourcemm/stub_mm/stub_mm.vcproj diff --git a/sourcemm/stub_mm/LICENSE.txt b/sourcemm/stub_mm/LICENSE.txt new file mode 100644 index 0000000..17aaa7f --- /dev/null +++ b/sourcemm/stub_mm/LICENSE.txt @@ -0,0 +1,29 @@ +The software is Copyright (C) 2004-2005, Metamod:Source Development Team. + +Metamod:Source is distributed under the "zLib/libpng" license, which is reproduced +below: + +----------------------------------------------------------------------------- + +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. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software in + a product, an acknowledgment in the product documentation would be + appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and must not + be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source distribution. + +----------------------------------------------------------------------------- + +The zLib/libpng license has been approved by the "Open Source Initiative" +organization. diff --git a/sourcemm/stub_mm/meta_hooks.h b/sourcemm/stub_mm/meta_hooks.h new file mode 100644 index 0000000..eb39094 --- /dev/null +++ b/sourcemm/stub_mm/meta_hooks.h @@ -0,0 +1,16 @@ +/* ======== stub_mm ======== +* Copyright (C) 2004-2005 Metamod:Source Development Team +* No warranties of any kind +* +* License: zlib/libpng +* +* Author(s): David "BAILOPAN" Anderson +* ============================ +*/ + +#ifndef _INCLUDE_META_HOOKS_H +#define _INCLUDE_META_HOOKS_H + +SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int); + +#endif //_INCLUDE_META_HOOKS_H diff --git a/sourcemm/stub_mm/stub_mm.cpp b/sourcemm/stub_mm/stub_mm.cpp new file mode 100644 index 0000000..a093b05 --- /dev/null +++ b/sourcemm/stub_mm/stub_mm.cpp @@ -0,0 +1,108 @@ +/* ======== stub_mm ======== +* Copyright (C) 2004-2005 Metamod:Source Development Team +* No warranties of any kind +* +* License: zlib/libpng +* +* Author(s): David "BAILOPAN" Anderson +* ============================ +*/ + +#include +#include "stub_mm.h" + +StubPlugin g_StubPlugin; + +PLUGIN_EXPOSE(SamplePlugin, g_StubPlugin); + +//This has all of the necessary hook declarations. Read it! +#include "meta_hooks.h" + +void StubPlugin::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) +{ + META_LOG(g_PLAPI, "ServerActivate() called: edictCount=%d, clientMax=%d", edictCount, clientMax); + RETURN_META(MRES_IGNORED); +} + +bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen) +{ + PLUGIN_SAVEVARS(); + + m_ServerDll = (IServerGameDLL *)((ismm->serverFactory())(INTERFACEVERSION_SERVERGAMEDLL, NULL)); + + if (!m_ServerDll) + { + snprintf(error, maxlen, "Could not find interface %s", INTERFACEVERSION_SERVERGAMEDLL); + return false; + } + + SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true); + + m_ServerDll_CC = SH_GET_CALLCLASS(IServerGameDLL, m_ServerDll); + + return true; +} + +bool StubPlugin::Unload(char *error, size_t maxlen) +{ + SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true); + + SH_RELEASE_CALLCLASS(m_ServerDll_CC); + + return true; +} + +bool StubPlugin::Pause(char *error, size_t maxlen) +{ + return true; +} + +bool StubPlugin::Unpause(char *error, size_t maxlen) +{ + return true; +} + +void StubPlugin::AllPluginsLoaded() +{ + +} + +const char *StubPlugin::GetAuthor() +{ + return "AUTHOR"; +} + +const char *StubPlugin::GetName() +{ + return "Stub Plugin"; +} + +const char *StubPlugin::GetDescription() +{ + return "Stub Plugin"; +} + +const char *StubPlugin::GetURL() +{ + return "http://www.mysite.com/"; +} + +const char *StubPlugin::GetLicense() +{ + return "zlib/libpng"; +} + +const char *StubPlugin::GetVersion() +{ + return "1.00"; +} + +const char *StubPlugin::GetDate() +{ + return __DATE__; +} + +const char *StubPlugin::GetLogTag() +{ + return "STUB"; +} diff --git a/sourcemm/stub_mm/stub_mm.h b/sourcemm/stub_mm/stub_mm.h new file mode 100644 index 0000000..c829802 --- /dev/null +++ b/sourcemm/stub_mm/stub_mm.h @@ -0,0 +1,45 @@ +/* ======== stub_mm ======== +* Copyright (C) 2004-2005 Metamod:Source Development Team +* No warranties of any kind +* +* License: zlib/libpng +* +* Author(s): David "BAILOPAN" Anderson +* ============================ +*/ + +#ifndef _INCLUDE_SAMPLEPLUGIN_H +#define _INCLUDE_SAMPLEPLUGIN_H + +#include + +class StubPlugin : public ISmmPlugin +{ +public: + bool Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen); + 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(); +public: + //Called on ServerActivate. Same definition as server plugins + void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax); +private: + IServerGameDLL *m_ServerDll; + IServerGameDLL *m_ServerDll_CC; +}; + +extern StubPlugin g_StubPlugin; + +PLUGIN_GLOBALVARS(); + +#endif //_INCLUDE_SAMPLEPLUGIN_H diff --git a/sourcemm/stub_mm/stub_mm.sln b/sourcemm/stub_mm/stub_mm.sln new file mode 100644 index 0000000..e7177c1 --- /dev/null +++ b/sourcemm/stub_mm/stub_mm.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stub_mm", "stub_mm.vcproj", "{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Debug.ActiveCfg = Debug|Win32 + {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Debug.Build.0 = Debug|Win32 + {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release.ActiveCfg = Release|Win32 + {836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/sourcemm/stub_mm/stub_mm.vcproj b/sourcemm/stub_mm/stub_mm.vcproj new file mode 100644 index 0000000..4e24559 --- /dev/null +++ b/sourcemm/stub_mm/stub_mm.vcproj @@ -0,0 +1,143 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +