Initial import of stub plugin
authorDavid Anderson <dvander@alliedmods.net>
Tue Apr 19 22:05:41 2005 +0000 (2005-04-19)
changeset 31543ffb5f4908
parent 30 b36f706275e4
child 32 865a89091543
Initial import of stub plugin
sourcemm/stub_mm/LICENSE.txt
sourcemm/stub_mm/meta_hooks.h
sourcemm/stub_mm/stub_mm.cpp
sourcemm/stub_mm/stub_mm.h
sourcemm/stub_mm/stub_mm.sln
sourcemm/stub_mm/stub_mm.vcproj
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sourcemm/stub_mm/LICENSE.txt	Tue Apr 19 22:05:41 2005 +0000
     1.3 @@ -0,0 +1,29 @@
     1.4 +The software is Copyright (C) 2004-2005, Metamod:Source Development Team.
     1.5 +
     1.6 +Metamod:Source is distributed under the "zLib/libpng" license, which is reproduced
     1.7 +below:
     1.8 +
     1.9 +-----------------------------------------------------------------------------
    1.10 +
    1.11 +This software is provided "as-is", without any express or implied warranty.
    1.12 +In no event will the authors be held liable for any damages arising from
    1.13 +the use of this software.
    1.14 +
    1.15 +Permission is granted to anyone to use this software for any purpose,
    1.16 +including commercial applications, and to alter it and redistribute it
    1.17 +freely, subject to the following restrictions:
    1.18 +
    1.19 +1. The origin of this software must not be misrepresented; you must not
    1.20 +   claim that you wrote the original software. If you use this software in
    1.21 +   a product, an acknowledgment in the product documentation would be
    1.22 +   appreciated but is not required.
    1.23 +
    1.24 +2. Altered source versions must be plainly marked as such, and must not
    1.25 +   be misrepresented as being the original software.
    1.26 +
    1.27 +3. This notice may not be removed or altered from any source distribution.
    1.28 +
    1.29 +-----------------------------------------------------------------------------
    1.30 +
    1.31 +The zLib/libpng license has been approved by the "Open Source Initiative"
    1.32 +organization.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/sourcemm/stub_mm/meta_hooks.h	Tue Apr 19 22:05:41 2005 +0000
     2.3 @@ -0,0 +1,16 @@
     2.4 +/* ======== stub_mm ========
     2.5 +* Copyright (C) 2004-2005 Metamod:Source Development Team
     2.6 +* No warranties of any kind
     2.7 +*
     2.8 +* License: zlib/libpng
     2.9 +*
    2.10 +* Author(s): David "BAILOPAN" Anderson
    2.11 +* ============================
    2.12 +*/
    2.13 +
    2.14 +#ifndef _INCLUDE_META_HOOKS_H
    2.15 +#define _INCLUDE_META_HOOKS_H
    2.16 +
    2.17 +SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
    2.18 +
    2.19 +#endif //_INCLUDE_META_HOOKS_H
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/sourcemm/stub_mm/stub_mm.cpp	Tue Apr 19 22:05:41 2005 +0000
     3.3 @@ -0,0 +1,108 @@
     3.4 +/* ======== stub_mm ========
     3.5 +* Copyright (C) 2004-2005 Metamod:Source Development Team
     3.6 +* No warranties of any kind
     3.7 +*
     3.8 +* License: zlib/libpng
     3.9 +*
    3.10 +* Author(s): David "BAILOPAN" Anderson
    3.11 +* ============================
    3.12 +*/
    3.13 +
    3.14 +#include <oslink.h>
    3.15 +#include "stub_mm.h"
    3.16 +
    3.17 +StubPlugin g_StubPlugin;
    3.18 +
    3.19 +PLUGIN_EXPOSE(SamplePlugin, g_StubPlugin);
    3.20 +
    3.21 +//This has all of the necessary hook declarations.  Read it!
    3.22 +#include "meta_hooks.h"
    3.23 +
    3.24 +void StubPlugin::ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
    3.25 +{
    3.26 +	META_LOG(g_PLAPI, "ServerActivate() called: edictCount=%d, clientMax=%d", edictCount, clientMax);
    3.27 +	RETURN_META(MRES_IGNORED);
    3.28 +}
    3.29 +
    3.30 +bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen)
    3.31 +{
    3.32 +	PLUGIN_SAVEVARS();
    3.33 +
    3.34 +	m_ServerDll = (IServerGameDLL *)((ismm->serverFactory())(INTERFACEVERSION_SERVERGAMEDLL, NULL));
    3.35 +
    3.36 +	if (!m_ServerDll)
    3.37 +	{
    3.38 +		snprintf(error, maxlen, "Could not find interface %s", INTERFACEVERSION_SERVERGAMEDLL);
    3.39 +		return false;
    3.40 +	}
    3.41 +
    3.42 +	SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true);
    3.43 +
    3.44 +	m_ServerDll_CC = SH_GET_CALLCLASS(IServerGameDLL, m_ServerDll);
    3.45 +
    3.46 +	return true;
    3.47 +}
    3.48 +
    3.49 +bool StubPlugin::Unload(char *error, size_t maxlen)
    3.50 +{
    3.51 +	SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_StubPlugin, ServerActivate, true);
    3.52 +
    3.53 +	SH_RELEASE_CALLCLASS(m_ServerDll_CC);
    3.54 +
    3.55 +	return true;
    3.56 +}
    3.57 +
    3.58 +bool StubPlugin::Pause(char *error, size_t maxlen)
    3.59 +{
    3.60 +	return true;
    3.61 +}
    3.62 +
    3.63 +bool StubPlugin::Unpause(char *error, size_t maxlen)
    3.64 +{
    3.65 +	return true;
    3.66 +}
    3.67 +
    3.68 +void StubPlugin::AllPluginsLoaded()
    3.69 +{
    3.70 +
    3.71 +}
    3.72 +
    3.73 +const char *StubPlugin::GetAuthor()
    3.74 +{
    3.75 +	return "AUTHOR";
    3.76 +}
    3.77 +
    3.78 +const char *StubPlugin::GetName()
    3.79 +{
    3.80 +	return "Stub Plugin";
    3.81 +}
    3.82 +
    3.83 +const char *StubPlugin::GetDescription()
    3.84 +{
    3.85 +	return "Stub Plugin";
    3.86 +}
    3.87 +
    3.88 +const char *StubPlugin::GetURL()
    3.89 +{
    3.90 +	return "http://www.mysite.com/";
    3.91 +}
    3.92 +
    3.93 +const char *StubPlugin::GetLicense()
    3.94 +{
    3.95 +	return "zlib/libpng";
    3.96 +}
    3.97 +
    3.98 +const char *StubPlugin::GetVersion()
    3.99 +{
   3.100 +	return "1.00";
   3.101 +}
   3.102 +
   3.103 +const char *StubPlugin::GetDate()
   3.104 +{
   3.105 +	return __DATE__;
   3.106 +}
   3.107 +
   3.108 +const char *StubPlugin::GetLogTag()
   3.109 +{
   3.110 +	return "STUB";
   3.111 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/sourcemm/stub_mm/stub_mm.h	Tue Apr 19 22:05:41 2005 +0000
     4.3 @@ -0,0 +1,45 @@
     4.4 +/* ======== stub_mm ========
     4.5 +* Copyright (C) 2004-2005 Metamod:Source Development Team
     4.6 +* No warranties of any kind
     4.7 +*
     4.8 +* License: zlib/libpng
     4.9 +*
    4.10 +* Author(s): David "BAILOPAN" Anderson
    4.11 +* ============================
    4.12 +*/
    4.13 +
    4.14 +#ifndef _INCLUDE_SAMPLEPLUGIN_H
    4.15 +#define _INCLUDE_SAMPLEPLUGIN_H
    4.16 +
    4.17 +#include <ISmmPlugin.h>
    4.18 +
    4.19 +class StubPlugin : public ISmmPlugin
    4.20 +{
    4.21 +public:
    4.22 +	bool Load(PluginId id, ISmmAPI *ismm, factories *list, char *error, size_t maxlen);
    4.23 +	bool Unload(char *error, size_t maxlen);
    4.24 +	bool Pause(char *error, size_t maxlen);
    4.25 +	bool Unpause(char *error, size_t maxlen);
    4.26 +	void AllPluginsLoaded();
    4.27 +public:
    4.28 +	const char *GetAuthor();
    4.29 +	const char *GetName();
    4.30 +	const char *GetDescription();
    4.31 +	const char *GetURL();
    4.32 +	const char *GetLicense();
    4.33 +	const char *GetVersion();
    4.34 +	const char *GetDate();
    4.35 +	const char *GetLogTag();
    4.36 +public:
    4.37 +	//Called on ServerActivate.  Same definition as server plugins
    4.38 +	void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
    4.39 +private:
    4.40 +	IServerGameDLL *m_ServerDll;
    4.41 +	IServerGameDLL *m_ServerDll_CC;
    4.42 +};
    4.43 +
    4.44 +extern StubPlugin g_StubPlugin;
    4.45 +
    4.46 +PLUGIN_GLOBALVARS();
    4.47 +
    4.48 +#endif //_INCLUDE_SAMPLEPLUGIN_H
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/sourcemm/stub_mm/stub_mm.sln	Tue Apr 19 22:05:41 2005 +0000
     5.3 @@ -0,0 +1,21 @@
     5.4 +Microsoft Visual Studio Solution File, Format Version 8.00
     5.5 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stub_mm", "stub_mm.vcproj", "{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}"
     5.6 +	ProjectSection(ProjectDependencies) = postProject
     5.7 +	EndProjectSection
     5.8 +EndProject
     5.9 +Global
    5.10 +	GlobalSection(SolutionConfiguration) = preSolution
    5.11 +		Debug = Debug
    5.12 +		Release = Release
    5.13 +	EndGlobalSection
    5.14 +	GlobalSection(ProjectConfiguration) = postSolution
    5.15 +		{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Debug.ActiveCfg = Debug|Win32
    5.16 +		{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Debug.Build.0 = Debug|Win32
    5.17 +		{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release.ActiveCfg = Release|Win32
    5.18 +		{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}.Release.Build.0 = Release|Win32
    5.19 +	EndGlobalSection
    5.20 +	GlobalSection(ExtensibilityGlobals) = postSolution
    5.21 +	EndGlobalSection
    5.22 +	GlobalSection(ExtensibilityAddIns) = postSolution
    5.23 +	EndGlobalSection
    5.24 +EndGlobal
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/sourcemm/stub_mm/stub_mm.vcproj	Tue Apr 19 22:05:41 2005 +0000
     6.3 @@ -0,0 +1,143 @@
     6.4 +<?xml version="1.0" encoding="Windows-1252"?>
     6.5 +<VisualStudioProject
     6.6 +	ProjectType="Visual C++"
     6.7 +	Version="7.10"
     6.8 +	Name="stub_mm"
     6.9 +	ProjectGUID="{836E726E-AB80-43AB-9A8F-0E6EE680B0F6}"
    6.10 +	Keyword="Win32Proj">
    6.11 +	<Platforms>
    6.12 +		<Platform
    6.13 +			Name="Win32"/>
    6.14 +	</Platforms>
    6.15 +	<Configurations>
    6.16 +		<Configuration
    6.17 +			Name="Debug|Win32"
    6.18 +			OutputDirectory="Debug"
    6.19 +			IntermediateDirectory="Debug"
    6.20 +			ConfigurationType="2"
    6.21 +			CharacterSet="2">
    6.22 +			<Tool
    6.23 +				Name="VCCLCompilerTool"
    6.24 +				Optimization="0"
    6.25 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;STUB_MM_EXPORTS"
    6.26 +				MinimalRebuild="TRUE"
    6.27 +				BasicRuntimeChecks="3"
    6.28 +				RuntimeLibrary="5"
    6.29 +				UsePrecompiledHeader="0"
    6.30 +				WarningLevel="3"
    6.31 +				Detect64BitPortabilityProblems="FALSE"
    6.32 +				DebugInformationFormat="4"/>
    6.33 +			<Tool
    6.34 +				Name="VCCustomBuildTool"/>
    6.35 +			<Tool
    6.36 +				Name="VCLinkerTool"
    6.37 +				AdditionalDependencies="tier0.lib"
    6.38 +				ShowProgress="0"
    6.39 +				OutputFile="$(OutDir)/stub_mm.dll"
    6.40 +				LinkIncremental="2"
    6.41 +				GenerateDebugInformation="TRUE"
    6.42 +				ProgramDatabaseFile="$(OutDir)/stub_mm.pdb"
    6.43 +				SubSystem="2"
    6.44 +				ImportLibrary="$(OutDir)/stub_mm.lib"
    6.45 +				TargetMachine="1"/>
    6.46 +			<Tool
    6.47 +				Name="VCMIDLTool"/>
    6.48 +			<Tool
    6.49 +				Name="VCPostBuildEventTool"/>
    6.50 +			<Tool
    6.51 +				Name="VCPreBuildEventTool"/>
    6.52 +			<Tool
    6.53 +				Name="VCPreLinkEventTool"/>
    6.54 +			<Tool
    6.55 +				Name="VCResourceCompilerTool"/>
    6.56 +			<Tool
    6.57 +				Name="VCWebServiceProxyGeneratorTool"/>
    6.58 +			<Tool
    6.59 +				Name="VCXMLDataGeneratorTool"/>
    6.60 +			<Tool
    6.61 +				Name="VCWebDeploymentTool"/>
    6.62 +			<Tool
    6.63 +				Name="VCManagedWrapperGeneratorTool"/>
    6.64 +			<Tool
    6.65 +				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
    6.66 +		</Configuration>
    6.67 +		<Configuration
    6.68 +			Name="Release|Win32"
    6.69 +			OutputDirectory="Release"
    6.70 +			IntermediateDirectory="Release"
    6.71 +			ConfigurationType="2"
    6.72 +			CharacterSet="2">
    6.73 +			<Tool
    6.74 +				Name="VCCLCompilerTool"
    6.75 +				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STUB_MM_EXPORTS"
    6.76 +				RuntimeLibrary="4"
    6.77 +				UsePrecompiledHeader="0"
    6.78 +				WarningLevel="3"
    6.79 +				Detect64BitPortabilityProblems="FALSE"
    6.80 +				DebugInformationFormat="3"/>
    6.81 +			<Tool
    6.82 +				Name="VCCustomBuildTool"/>
    6.83 +			<Tool
    6.84 +				Name="VCLinkerTool"
    6.85 +				AdditionalDependencies="tier0.lib"
    6.86 +				OutputFile="$(OutDir)/stub_mm.dll"
    6.87 +				LinkIncremental="1"
    6.88 +				GenerateDebugInformation="TRUE"
    6.89 +				SubSystem="2"
    6.90 +				OptimizeReferences="2"
    6.91 +				EnableCOMDATFolding="2"
    6.92 +				ImportLibrary="$(OutDir)/stub_mm.lib"
    6.93 +				TargetMachine="1"/>
    6.94 +			<Tool
    6.95 +				Name="VCMIDLTool"/>
    6.96 +			<Tool
    6.97 +				Name="VCPostBuildEventTool"/>
    6.98 +			<Tool
    6.99 +				Name="VCPreBuildEventTool"/>
   6.100 +			<Tool
   6.101 +				Name="VCPreLinkEventTool"/>
   6.102 +			<Tool
   6.103 +				Name="VCResourceCompilerTool"/>
   6.104 +			<Tool
   6.105 +				Name="VCWebServiceProxyGeneratorTool"/>
   6.106 +			<Tool
   6.107 +				Name="VCXMLDataGeneratorTool"/>
   6.108 +			<Tool
   6.109 +				Name="VCWebDeploymentTool"/>
   6.110 +			<Tool
   6.111 +				Name="VCManagedWrapperGeneratorTool"/>
   6.112 +			<Tool
   6.113 +				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
   6.114 +		</Configuration>
   6.115 +	</Configurations>
   6.116 +	<References>
   6.117 +	</References>
   6.118 +	<Files>
   6.119 +		<Filter
   6.120 +			Name="Source Files"
   6.121 +			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
   6.122 +			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
   6.123 +			<File
   6.124 +				RelativePath=".\stub_mm.cpp">
   6.125 +			</File>
   6.126 +		</Filter>
   6.127 +		<Filter
   6.128 +			Name="Header Files"
   6.129 +			Filter="h;hpp;hxx;hm;inl;inc;xsd"
   6.130 +			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
   6.131 +			<File
   6.132 +				RelativePath=".\meta_hooks.h">
   6.133 +			</File>
   6.134 +			<File
   6.135 +				RelativePath=".\stub_mm.h">
   6.136 +			</File>
   6.137 +		</Filter>
   6.138 +		<Filter
   6.139 +			Name="Resource Files"
   6.140 +			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
   6.141 +			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
   6.142 +		</Filter>
   6.143 +	</Files>
   6.144 +	<Globals>
   6.145 +	</Globals>
   6.146 +</VisualStudioProject>