added new stub_mm plugin
authorDavid Anderson <dvander@alliedmods.net>
Sat Oct 06 17:01:51 2007 +0000 (2007-10-06)
changeset 378771bb7db49de
parent 377 185f66cb03cd
child 379 e8a3f2617a3e
added new stub_mm plugin
stub_mm/msvc8/stub_mm.sln
stub_mm/msvc8/stub_mm.vcproj
stub_mm/stub_mm.cpp
stub_mm/stub_mm.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/stub_mm/msvc8/stub_mm.sln	Sat Oct 06 17:01:51 2007 +0000
     1.3 @@ -0,0 +1,20 @@
     1.4 +
     1.5 +Microsoft Visual Studio Solution File, Format Version 9.00
     1.6 +# Visual Studio 2005
     1.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stub_mm", "stub_mm.vcproj", "{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}"
     1.8 +EndProject
     1.9 +Global
    1.10 +	GlobalSection(SolutionConfigurationPlatforms) = preSolution
    1.11 +		Debug|Win32 = Debug|Win32
    1.12 +		Release|Win32 = Release|Win32
    1.13 +	EndGlobalSection
    1.14 +	GlobalSection(ProjectConfigurationPlatforms) = postSolution
    1.15 +		{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Debug|Win32.ActiveCfg = Debug|Win32
    1.16 +		{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Debug|Win32.Build.0 = Debug|Win32
    1.17 +		{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Release|Win32.ActiveCfg = Release|Win32
    1.18 +		{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}.Release|Win32.Build.0 = Release|Win32
    1.19 +	EndGlobalSection
    1.20 +	GlobalSection(SolutionProperties) = preSolution
    1.21 +		HideSolutionNode = FALSE
    1.22 +	EndGlobalSection
    1.23 +EndGlobal
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/stub_mm/msvc8/stub_mm.vcproj	Sat Oct 06 17:01:51 2007 +0000
     2.3 @@ -0,0 +1,207 @@
     2.4 +<?xml version="1.0" encoding="Windows-1252"?>
     2.5 +<VisualStudioProject
     2.6 +	ProjectType="Visual C++"
     2.7 +	Version="8.00"
     2.8 +	Name="stub_mm"
     2.9 +	ProjectGUID="{E62E5876-E1E2-41A0-85CA-1B41B9DA55F9}"
    2.10 +	RootNamespace="stub_mm"
    2.11 +	Keyword="Win32Proj"
    2.12 +	>
    2.13 +	<Platforms>
    2.14 +		<Platform
    2.15 +			Name="Win32"
    2.16 +		/>
    2.17 +	</Platforms>
    2.18 +	<ToolFiles>
    2.19 +	</ToolFiles>
    2.20 +	<Configurations>
    2.21 +		<Configuration
    2.22 +			Name="Debug|Win32"
    2.23 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
    2.24 +			IntermediateDirectory="$(ConfigurationName)"
    2.25 +			ConfigurationType="2"
    2.26 +			CharacterSet="2"
    2.27 +			>
    2.28 +			<Tool
    2.29 +				Name="VCPreBuildEventTool"
    2.30 +			/>
    2.31 +			<Tool
    2.32 +				Name="VCCustomBuildTool"
    2.33 +			/>
    2.34 +			<Tool
    2.35 +				Name="VCXMLDataGeneratorTool"
    2.36 +			/>
    2.37 +			<Tool
    2.38 +				Name="VCWebServiceProxyGeneratorTool"
    2.39 +			/>
    2.40 +			<Tool
    2.41 +				Name="VCMIDLTool"
    2.42 +			/>
    2.43 +			<Tool
    2.44 +				Name="VCCLCompilerTool"
    2.45 +				Optimization="0"
    2.46 +				AdditionalIncludeDirectories="..\..\sourcemm;..\..\sourcehook"
    2.47 +				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;STUB_MM_EXPORTS"
    2.48 +				MinimalRebuild="true"
    2.49 +				BasicRuntimeChecks="3"
    2.50 +				RuntimeLibrary="1"
    2.51 +				UsePrecompiledHeader="0"
    2.52 +				WarningLevel="3"
    2.53 +				Detect64BitPortabilityProblems="false"
    2.54 +				DebugInformationFormat="4"
    2.55 +			/>
    2.56 +			<Tool
    2.57 +				Name="VCManagedResourceCompilerTool"
    2.58 +			/>
    2.59 +			<Tool
    2.60 +				Name="VCResourceCompilerTool"
    2.61 +			/>
    2.62 +			<Tool
    2.63 +				Name="VCPreLinkEventTool"
    2.64 +			/>
    2.65 +			<Tool
    2.66 +				Name="VCLinkerTool"
    2.67 +				AdditionalDependencies="tier0.lib vstdlib.lib tier2.lib"
    2.68 +				OutputFile="$(OutDir)\stub_mm.dll"
    2.69 +				LinkIncremental="2"
    2.70 +				GenerateDebugInformation="true"
    2.71 +				SubSystem="2"
    2.72 +				TargetMachine="1"
    2.73 +			/>
    2.74 +			<Tool
    2.75 +				Name="VCALinkTool"
    2.76 +			/>
    2.77 +			<Tool
    2.78 +				Name="VCManifestTool"
    2.79 +			/>
    2.80 +			<Tool
    2.81 +				Name="VCXDCMakeTool"
    2.82 +			/>
    2.83 +			<Tool
    2.84 +				Name="VCBscMakeTool"
    2.85 +			/>
    2.86 +			<Tool
    2.87 +				Name="VCFxCopTool"
    2.88 +			/>
    2.89 +			<Tool
    2.90 +				Name="VCAppVerifierTool"
    2.91 +			/>
    2.92 +			<Tool
    2.93 +				Name="VCWebDeploymentTool"
    2.94 +			/>
    2.95 +			<Tool
    2.96 +				Name="VCPostBuildEventTool"
    2.97 +			/>
    2.98 +		</Configuration>
    2.99 +		<Configuration
   2.100 +			Name="Release|Win32"
   2.101 +			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
   2.102 +			IntermediateDirectory="$(ConfigurationName)"
   2.103 +			ConfigurationType="2"
   2.104 +			CharacterSet="2"
   2.105 +			WholeProgramOptimization="1"
   2.106 +			>
   2.107 +			<Tool
   2.108 +				Name="VCPreBuildEventTool"
   2.109 +			/>
   2.110 +			<Tool
   2.111 +				Name="VCCustomBuildTool"
   2.112 +			/>
   2.113 +			<Tool
   2.114 +				Name="VCXMLDataGeneratorTool"
   2.115 +			/>
   2.116 +			<Tool
   2.117 +				Name="VCWebServiceProxyGeneratorTool"
   2.118 +			/>
   2.119 +			<Tool
   2.120 +				Name="VCMIDLTool"
   2.121 +			/>
   2.122 +			<Tool
   2.123 +				Name="VCCLCompilerTool"
   2.124 +				AdditionalIncludeDirectories="..\..\sourcemm;..\..\sourcehook"
   2.125 +				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STUB_MM_EXPORTS"
   2.126 +				RuntimeLibrary="0"
   2.127 +				UsePrecompiledHeader="0"
   2.128 +				WarningLevel="3"
   2.129 +				Detect64BitPortabilityProblems="false"
   2.130 +				DebugInformationFormat="3"
   2.131 +			/>
   2.132 +			<Tool
   2.133 +				Name="VCManagedResourceCompilerTool"
   2.134 +			/>
   2.135 +			<Tool
   2.136 +				Name="VCResourceCompilerTool"
   2.137 +			/>
   2.138 +			<Tool
   2.139 +				Name="VCPreLinkEventTool"
   2.140 +			/>
   2.141 +			<Tool
   2.142 +				Name="VCLinkerTool"
   2.143 +				AdditionalDependencies="tier0.lib vstdlib.lib tier2.lib"
   2.144 +				OutputFile="$(OutDir)\stub_mm.dll"
   2.145 +				LinkIncremental="1"
   2.146 +				GenerateDebugInformation="true"
   2.147 +				SubSystem="2"
   2.148 +				OptimizeReferences="2"
   2.149 +				EnableCOMDATFolding="2"
   2.150 +				TargetMachine="1"
   2.151 +			/>
   2.152 +			<Tool
   2.153 +				Name="VCALinkTool"
   2.154 +			/>
   2.155 +			<Tool
   2.156 +				Name="VCManifestTool"
   2.157 +			/>
   2.158 +			<Tool
   2.159 +				Name="VCXDCMakeTool"
   2.160 +			/>
   2.161 +			<Tool
   2.162 +				Name="VCBscMakeTool"
   2.163 +			/>
   2.164 +			<Tool
   2.165 +				Name="VCFxCopTool"
   2.166 +			/>
   2.167 +			<Tool
   2.168 +				Name="VCAppVerifierTool"
   2.169 +			/>
   2.170 +			<Tool
   2.171 +				Name="VCWebDeploymentTool"
   2.172 +			/>
   2.173 +			<Tool
   2.174 +				Name="VCPostBuildEventTool"
   2.175 +			/>
   2.176 +		</Configuration>
   2.177 +	</Configurations>
   2.178 +	<References>
   2.179 +	</References>
   2.180 +	<Files>
   2.181 +		<Filter
   2.182 +			Name="Source Files"
   2.183 +			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
   2.184 +			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
   2.185 +			>
   2.186 +			<File
   2.187 +				RelativePath="..\stub_mm.cpp"
   2.188 +				>
   2.189 +			</File>
   2.190 +		</Filter>
   2.191 +		<Filter
   2.192 +			Name="Header Files"
   2.193 +			Filter="h;hpp;hxx;hm;inl;inc;xsd"
   2.194 +			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
   2.195 +			>
   2.196 +			<File
   2.197 +				RelativePath="..\stub_mm.h"
   2.198 +				>
   2.199 +			</File>
   2.200 +		</Filter>
   2.201 +		<Filter
   2.202 +			Name="Resource Files"
   2.203 +			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
   2.204 +			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
   2.205 +			>
   2.206 +		</Filter>
   2.207 +	</Files>
   2.208 +	<Globals>
   2.209 +	</Globals>
   2.210 +</VisualStudioProject>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/stub_mm/stub_mm.cpp	Sat Oct 06 17:01:51 2007 +0000
     3.3 @@ -0,0 +1,108 @@
     3.4 +/**
     3.5 + * vim: set ts=4 :
     3.6 + * ======================================================
     3.7 + * Metamod:Source Stub Plugin
     3.8 + * Written by AlliedModders LLC.
     3.9 + * ======================================================
    3.10 + *
    3.11 + * This software is provided 'as-is', without any express or implied warranty.
    3.12 + * In no event will the authors be held liable for any damages arising from 
    3.13 + * the use of this software.
    3.14 + *
    3.15 + * This stub plugin is public domain.
    3.16 + *
    3.17 + * Version: $Id$
    3.18 + */
    3.19 +
    3.20 +#include <stdio.h>
    3.21 +#include "stub_mm.h"
    3.22 +
    3.23 +SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
    3.24 +
    3.25 +StubPlugin g_StubPlugin;
    3.26 +IServerGameDLL *server = NULL;
    3.27 +int hidServerActivate = 0;
    3.28 +
    3.29 +PLUGIN_EXPOSE(StubPlugin, g_StubPlugin);
    3.30 +bool StubPlugin::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late)
    3.31 +{
    3.32 +	PLUGIN_SAVEVARS();
    3.33 +
    3.34 +	GET_V_IFACE_ANY(GetServerFactory, server, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
    3.35 +
    3.36 +	hidServerActivate = SH_ADD_HOOK(IServerGameDLL, ServerActivate, server, SH_STATIC(Hook_ServerActivate), true);
    3.37 +
    3.38 +	return true;
    3.39 +}
    3.40 +
    3.41 +bool StubPlugin::Unload(char *error, size_t maxlen)
    3.42 +{
    3.43 +	if (hidServerActivate != 0)
    3.44 +	{
    3.45 +		SH_REMOVE_HOOK_ID(hidServerActivate);
    3.46 +	}
    3.47 +
    3.48 +	return true;
    3.49 +}
    3.50 +
    3.51 +void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
    3.52 +{
    3.53 +	META_LOG(g_PLAPI, "ServerActivate() called: edictCount = %d, clientMax = %d", edictCount, clientMax);
    3.54 +}
    3.55 +
    3.56 +void StubPlugin::AllPluginsLoaded()
    3.57 +{
    3.58 +	/* This is where we'd do stuff that relies on the mod or other plugins 
    3.59 +	 * being initialized (for example, cvars added and events registered).
    3.60 +	 */
    3.61 +}
    3.62 +
    3.63 +bool StubPlugin::Pause(char *error, size_t maxlen)
    3.64 +{
    3.65 +	return true;
    3.66 +}
    3.67 +
    3.68 +bool StubPlugin::Unpause(char *error, size_t maxlen)
    3.69 +{
    3.70 +	return true;
    3.71 +}
    3.72 +
    3.73 +const char *StubPlugin::GetLicense()
    3.74 +{
    3.75 +	return "Public Domain";
    3.76 +}
    3.77 +
    3.78 +const char *StubPlugin::GetVersion()
    3.79 +{
    3.80 +	return "1.0.0.0";
    3.81 +}
    3.82 +
    3.83 +const char *StubPlugin::GetDate()
    3.84 +{
    3.85 +	return __DATE__;
    3.86 +}
    3.87 +
    3.88 +const char *StubPlugin::GetLogTag()
    3.89 +{
    3.90 +	return "STUB";
    3.91 +}
    3.92 +
    3.93 +const char *StubPlugin::GetAuthor()
    3.94 +{
    3.95 +	return "AlliedModders LLC";
    3.96 +}
    3.97 +
    3.98 +const char *StubPlugin::GetDescription()
    3.99 +{
   3.100 +	return "Sample empty plugin";
   3.101 +}
   3.102 +
   3.103 +const char *StubPlugin::GetName()
   3.104 +{
   3.105 +	return "Stub Plugin";
   3.106 +}
   3.107 +
   3.108 +const char *StubPlugin::GetURL()
   3.109 +{
   3.110 +	return "http://www.sourcemm.net/";
   3.111 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/stub_mm/stub_mm.h	Sat Oct 06 17:01:51 2007 +0000
     4.3 @@ -0,0 +1,47 @@
     4.4 +/**
     4.5 + * vim: set ts=4 :
     4.6 + * ======================================================
     4.7 + * Metamod:Source Stub Plugin
     4.8 + * Written by AlliedModders LLC.
     4.9 + * ======================================================
    4.10 + *
    4.11 + * This software is provided 'as-is', without any express or implied warranty.
    4.12 + * In no event will the authors be held liable for any damages arising from 
    4.13 + * the use of this software.
    4.14 + *
    4.15 + * This stub plugin is public domain.
    4.16 + *
    4.17 + * Version: $Id$
    4.18 + */
    4.19 +
    4.20 +#ifndef _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
    4.21 +#define _INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_
    4.22 +
    4.23 +#include <ISmmPlugin.h>
    4.24 +
    4.25 +class StubPlugin : public ISmmPlugin
    4.26 +{
    4.27 +public:
    4.28 +	bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late);
    4.29 +	bool Unload(char *error, size_t maxlen);
    4.30 +	bool Pause(char *error, size_t maxlen);
    4.31 +	bool Unpause(char *error, size_t maxlen);
    4.32 +	void AllPluginsLoaded();
    4.33 +public:
    4.34 +	const char *GetAuthor();
    4.35 +	const char *GetName();
    4.36 +	const char *GetDescription();
    4.37 +	const char *GetURL();
    4.38 +	const char *GetLicense();
    4.39 +	const char *GetVersion();
    4.40 +	const char *GetDate();
    4.41 +	const char *GetLogTag();
    4.42 +};
    4.43 +
    4.44 +void Hook_ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
    4.45 +
    4.46 +extern StubPlugin g_StubPlugin;
    4.47 +
    4.48 +PLUGIN_GLOBALVARS();
    4.49 +
    4.50 +#endif //_INCLUDE_METAMOD_SOURCE_STUB_PLUGIN_H_