Whew, massive-ish reorgranization for extensions and such. I will inevitably be shot for this.
(Yes, bail, it all compiles on both platforms) --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40763
This commit is contained in:
		
							parent
							
								
									9d9369079a
								
							
						
					
					
						commit
						9decd4196a
					
				| @ -12,9 +12,9 @@ SOURCEMM = ../../../../sourcemm | |||||||
| PROJECT = batsupport | PROJECT = batsupport | ||||||
| 
 | 
 | ||||||
| #Uncomment for SourceMM-enabled extensions
 | #Uncomment for SourceMM-enabled extensions
 | ||||||
| #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so  | ||||||
| 
 | 
 | ||||||
| OBJECTS = extension.cpp smsdk_ext.cpp | OBJECTS = sdk/smsdk_ext.cpp extension.cpp | ||||||
| 
 | 
 | ||||||
| ##############################################
 | ##############################################
 | ||||||
| ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ||||||
| @ -32,7 +32,7 @@ SMM_TRUNK = $(SOURCEMM)/trunk | |||||||
| 
 | 
 | ||||||
| LINK = $(LINK_HL2) -static-libgcc | LINK = $(LINK_HL2) -static-libgcc | ||||||
| 
 | 
 | ||||||
| INCLUDE = -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | ||||||
|           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 |           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 | ||||||
| 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | ||||||
| 
 | 
 | ||||||
| @ -65,11 +65,10 @@ $(BIN_DIR)/%.o: %.cpp | |||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | ||||||
| 
 | 
 | ||||||
| all: | all: | ||||||
| 	mkdir -p $(BIN_DIR) | 	mkdir -p $(BIN_DIR)/sdk | ||||||
| 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | ||||||
| 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | ||||||
| 	$(MAKE) extension | 	$(MAKE) extension | ||||||
| 	rm -rf $(BINARY) |  | ||||||
| 
 | 
 | ||||||
| extension: $(OBJ_LINUX) | extension: $(OBJ_LINUX) | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | ||||||
| @ -81,7 +80,8 @@ default: all | |||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -rf Release/*.o | 	rm -rf Release/*.o | ||||||
|  | 	rm -rf Release/sdk/*.o | ||||||
| 	rm -rf Release/$(BINARY) | 	rm -rf Release/$(BINARY) | ||||||
| 	rm -rf Debug/*.o | 	rm -rf Debug/*.o | ||||||
|  | 	rm -rf Debug/sdk/*.o | ||||||
| 	rm -rf Debug/$(BINARY) | 	rm -rf Debug/$(BINARY) | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,4 +1,26 @@ | |||||||
| // vim: set ts=4 :
 | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod BAT Support Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  * This program is free software; you can redistribute it and/or | ||||||
|  |  * modify it under the terms of the GNU General Public License | ||||||
|  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  |  * of the License, or (at your option) any later version. | ||||||
|  |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  |  *  | ||||||
|  |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #include <IAdminSystem.h> | #include <IAdminSystem.h> | ||||||
| #include <IPlayerHelpers.h> | #include <IPlayerHelpers.h> | ||||||
| #include "extension.h" | #include "extension.h" | ||||||
| @ -8,7 +30,7 @@ IAdminSystem *admins = NULL; | |||||||
| IPlayerManager *players = NULL; | IPlayerManager *players = NULL; | ||||||
| SMEXT_LINK(&g_BatSupport); | SMEXT_LINK(&g_BatSupport); | ||||||
| 
 | 
 | ||||||
| bool BatSupport::SDK_OnLoad(char *error, size_t err_max, bool late) | bool BatSupport::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	SM_GET_IFACE(ADMINSYS, admins); | 	SM_GET_IFACE(ADMINSYS, admins); | ||||||
| 	SM_GET_IFACE(PLAYERMANAGER, players); | 	SM_GET_IFACE(PLAYERMANAGER, players); | ||||||
| @ -35,7 +57,7 @@ void BatSupport::SDK_OnUnload() | |||||||
| 	m_hooks.clear(); | 	m_hooks.clear(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool BatSupport::SDK_OnMetamodLoad(char *error, size_t err_max, bool late) | bool BatSupport::SDK_OnMetamodLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	g_SMAPI->AddListener(this, this); | 	g_SMAPI->AddListener(this, this); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,7 +1,34 @@ | |||||||
| // vim: set ts=4 :
 | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod BAT Support Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  * This program is free software; you can redistribute it and/or | ||||||
|  |  * modify it under the terms of the GNU General Public License | ||||||
|  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  |  * of the License, or (at your option) any later version. | ||||||
|  |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  |  *  | ||||||
|  |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file extension.h | ||||||
|  |  * @brief BAT Support extension code header. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #include "smsdk_ext.h" | #include "smsdk_ext.h" | ||||||
| #include "BATInterface.h" | #include "BATInterface.h" | ||||||
| #include <sh_list.h> | #include <sh_list.h> | ||||||
| @ -22,25 +49,25 @@ class BatSupport : | |||||||
| 	public AdminInterface, | 	public AdminInterface, | ||||||
| 	public IClientListener | 	public IClientListener | ||||||
| { | { | ||||||
| public: //SDKExtension
 | public: // SDKExtension
 | ||||||
| 	bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	void SDK_OnUnload(); | 	void SDK_OnUnload(); | ||||||
| 	bool SDK_OnMetamodLoad(char *error, size_t err_max, bool late); | 	bool SDK_OnMetamodLoad(char *error, size_t maxlength, bool late); | ||||||
| public: //IMetamodListener
 | public: // IMetamodListener
 | ||||||
| 	void *OnMetamodQuery(const char *iface, int *ret); | 	void *OnMetamodQuery(const char *iface, int *ret); | ||||||
| public: //AdminInterface
 | public: // AdminInterface
 | ||||||
| 	bool RegisterFlag(const char *Class,const char *Flag,const char *Description); | 	bool RegisterFlag(const char *Class, const char *Flag, const char *Description); | ||||||
| 	bool IsClient(int id); | 	bool IsClient(int id); | ||||||
| 	bool HasFlag(int id,const char *Flag); | 	bool HasFlag(int id, const char *Flag); | ||||||
| 	int GetInterfaceVersion(); | 	int GetInterfaceVersion(); | ||||||
| 	const char* GetModName(); | 	const char* GetModName(); | ||||||
| 	void AddEventListner(AdminInterfaceListner *ptr); | 	void AddEventListner(AdminInterfaceListner *ptr); | ||||||
| 	void RemoveListner(AdminInterfaceListner *ptr); | 	void RemoveListner(AdminInterfaceListner *ptr); | ||||||
| public: //IClientListener
 | public: // IClientListener
 | ||||||
| 	void OnClientAuthorized(int client, const char *authstring); | 	void OnClientAuthorized(int client, const char *authstring); | ||||||
| private: | private: | ||||||
| 	List<AdminInterfaceListner *> m_hooks; | 	List<AdminInterfaceListner *> m_hooks; | ||||||
| 	List<CustomFlag> m_flags; | 	List<CustomFlag> m_flags; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
|  |  | ||||||
| Microsoft Visual Studio Solution File, Format Version 9.00 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||||||
| # Visual Studio 2005 | # Visual Studio 2005 | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BatSupport", "BatSupport.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BatSupport", "BatSupport.vcproj", "{E2FDA25A-3F36-46CE-A4EB-F4AB60011386}" | ||||||
| EndProject | EndProject | ||||||
| Global | Global | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||||
| @ -9,10 +9,10 @@ Global | |||||||
| 		Release|Win32 = Release|Win32 | 		Release|Win32 = Release|Win32 | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32 | 		{E2FDA25A-3F36-46CE-A4EB-F4AB60011386}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32 | 		{E2FDA25A-3F36-46CE-A4EB-F4AB60011386}.Debug|Win32.Build.0 = Debug|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32 | 		{E2FDA25A-3F36-46CE-A4EB-F4AB60011386}.Release|Win32.ActiveCfg = Release|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32 | 		{E2FDA25A-3F36-46CE-A4EB-F4AB60011386}.Release|Win32.Build.0 = Release|Win32 | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(SolutionProperties) = preSolution | 	GlobalSection(SolutionProperties) = preSolution | ||||||
| 		HideSolutionNode = FALSE | 		HideSolutionNode = FALSE | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| 	ProjectType="Visual C++" | 	ProjectType="Visual C++" | ||||||
| 	Version="8.00" | 	Version="8.00" | ||||||
| 	Name="BatSupport" | 	Name="BatSupport" | ||||||
| 	ProjectGUID="{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" | 	ProjectGUID="{E2FDA25A-3F36-46ce-A4EB-F4AB60011386}" | ||||||
| 	RootNamespace="BatSupport" | 	RootNamespace="BatSupport" | ||||||
| 	Keyword="Win32Proj" | 	Keyword="Win32Proj" | ||||||
| 	> | 	> | ||||||
| @ -40,161 +40,7 @@ | |||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				Optimization="0" | 				Optimization="0" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" |  | ||||||
| 				MinimalRebuild="true" |  | ||||||
| 				BasicRuntimeChecks="3" |  | ||||||
| 				RuntimeLibrary="1" |  | ||||||
| 				UsePrecompiledHeader="0" |  | ||||||
| 				WarningLevel="3" |  | ||||||
| 				Detect64BitPortabilityProblems="false" |  | ||||||
| 				DebugInformationFormat="4" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCManagedResourceCompilerTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCResourceCompilerTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCPreLinkEventTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCLinkerTool" |  | ||||||
| 				OutputFile="$(OutDir)\sample.ext.dll" |  | ||||||
| 				LinkIncremental="2" |  | ||||||
| 				GenerateDebugInformation="true" |  | ||||||
| 				SubSystem="2" |  | ||||||
| 				TargetMachine="1" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCALinkTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCManifestTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCXDCMakeTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCBscMakeTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCFxCopTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCAppVerifierTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCWebDeploymentTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCPostBuildEventTool" |  | ||||||
| 			/> |  | ||||||
| 		</Configuration> |  | ||||||
| 		<Configuration |  | ||||||
| 			Name="Release|Win32" |  | ||||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" |  | ||||||
| 			IntermediateDirectory="$(ConfigurationName)" |  | ||||||
| 			ConfigurationType="2" |  | ||||||
| 			CharacterSet="2" |  | ||||||
| 			WholeProgramOptimization="1" |  | ||||||
| 			> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCPreBuildEventTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCCustomBuildTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCXMLDataGeneratorTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCWebServiceProxyGeneratorTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCMIDLTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCCLCompilerTool" |  | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" |  | ||||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" |  | ||||||
| 				RuntimeLibrary="0" |  | ||||||
| 				UsePrecompiledHeader="0" |  | ||||||
| 				WarningLevel="3" |  | ||||||
| 				Detect64BitPortabilityProblems="false" |  | ||||||
| 				DebugInformationFormat="3" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCManagedResourceCompilerTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCResourceCompilerTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCPreLinkEventTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCLinkerTool" |  | ||||||
| 				OutputFile="$(OutDir)\sample.ext.dll" |  | ||||||
| 				LinkIncremental="1" |  | ||||||
| 				GenerateDebugInformation="true" |  | ||||||
| 				SubSystem="2" |  | ||||||
| 				OptimizeReferences="2" |  | ||||||
| 				EnableCOMDATFolding="2" |  | ||||||
| 				TargetMachine="1" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCALinkTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCManifestTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCXDCMakeTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCBscMakeTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCFxCopTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCAppVerifierTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCWebDeploymentTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCPostBuildEventTool" |  | ||||||
| 			/> |  | ||||||
| 		</Configuration> |  | ||||||
| 		<Configuration |  | ||||||
| 			Name="Debug|Win32" |  | ||||||
| 			OutputDirectory="$(SolutionDir)$(ConfigurationName)" |  | ||||||
| 			IntermediateDirectory="$(ConfigurationName)" |  | ||||||
| 			ConfigurationType="2" |  | ||||||
| 			CharacterSet="2" |  | ||||||
| 			> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCPreBuildEventTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCCustomBuildTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCXMLDataGeneratorTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCWebServiceProxyGeneratorTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCMIDLTool" |  | ||||||
| 			/> |  | ||||||
| 			<Tool |  | ||||||
| 				Name="VCCLCompilerTool" |  | ||||||
| 				Optimization="0" |  | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" |  | ||||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | ||||||
| 				MinimalRebuild="true" | 				MinimalRebuild="true" | ||||||
| 				BasicRuntimeChecks="3" | 				BasicRuntimeChecks="3" | ||||||
| @ -272,7 +118,7 @@ | |||||||
| 			/> | 			/> | ||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE" | 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE" | ||||||
| 				RuntimeLibrary="0" | 				RuntimeLibrary="0" | ||||||
| 				UsePrecompiledHeader="0" | 				UsePrecompiledHeader="0" | ||||||
| @ -331,7 +177,7 @@ | |||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Source Files" | 			Name="Source Files" | ||||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | 			UniqueIdentifier="{863879FA-7F21-4e8c-8BCE-361A3ECB41CC}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\extension.cpp" | 				RelativePath="..\extension.cpp" | ||||||
| @ -341,7 +187,7 @@ | |||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Header Files" | 			Name="Header Files" | ||||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | 			UniqueIdentifier="{C7385807-ED7A-4b43-9447-993597508211}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\BATInterface.h" | 				RelativePath="..\BATInterface.h" | ||||||
| @ -351,26 +197,27 @@ | |||||||
| 				RelativePath="..\extension.h" | 				RelativePath="..\extension.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_config.h" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Resource Files" | 			Name="Resource Files" | ||||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | 			UniqueIdentifier="{B3C3137B-2DF6-40b9-883E-EF7D84114CEA}" | ||||||
| 			> | 			> | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="SDK" | 			Name="SourceMod SDK" | ||||||
|  | 			UniqueIdentifier="{A47503F4-3D11-4b37-851B-34562E7425A6}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\smsdk_ext.cpp" | 				RelativePath="..\sdk\smsdk_config.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\smsdk_ext.h" | 				RelativePath="..\sdk\smsdk_ext.cpp" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_ext.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 		</Filter> | 		</Filter> | ||||||
|  | |||||||
							
								
								
									
										48
									
								
								extensions/batsupport/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								extensions/batsupport/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,48 @@ | |||||||
|  | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_config.h | ||||||
|  |  * @brief Contains macros for configuring basic extension information. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* Basic information exposed publicly */ | ||||||
|  | #define SMEXT_CONF_NAME			"BAT Support" | ||||||
|  | #define SMEXT_CONF_DESCRIPTION	"Adds support for BAT's AdminInterface" | ||||||
|  | #define SMEXT_CONF_VERSION		"1.0.0.0" | ||||||
|  | #define SMEXT_CONF_AUTHOR		"AlliedModders" | ||||||
|  | #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 | ||||||
|  | #define SMEXT_CONF_LOGTAG		"BATSUPPORT" | ||||||
|  | #define SMEXT_CONF_LICENSE		"GPL" | ||||||
|  | #define SMEXT_CONF_DATESTRING	__DATE__ | ||||||
|  | 
 | ||||||
|  | /** 
 | ||||||
|  |  * @brief Exposes plugin's main interface. | ||||||
|  |  */ | ||||||
|  | #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Sets whether or not this plugin required Metamod. | ||||||
|  |  * NOTE: Uncomment to enable, comment to disable. | ||||||
|  |  */ | ||||||
|  | #define SMEXT_CONF_METAMOD		 | ||||||
|  | 
 | ||||||
|  | #endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 | ||||||
| @ -5,11 +5,13 @@ | |||||||
|  * All rights reserved. |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -44,7 +46,7 @@ SDKExtension::SDKExtension() | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late) | bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	g_pShareSys = sys; | 	g_pShareSys = sys; | ||||||
| 	myself = me; | 	myself = me; | ||||||
| @ -56,7 +58,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	{ | 	{ | ||||||
| 		if (error) | 		if (error) | ||||||
| 		{ | 		{ | ||||||
| 			snprintf(error, err_max, "Metamod attach failed"); | 			snprintf(error, maxlength, "Metamod attach failed"); | ||||||
| 		} | 		} | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| @ -66,7 +68,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	SM_GET_IFACE(SOURCEMOD, g_pSM); | 	SM_GET_IFACE(SOURCEMOD, g_pSM); | ||||||
| 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | ||||||
| 
 | 
 | ||||||
| 	if (SDK_OnLoad(error, err_max, late)) | 	if (SDK_OnLoad(error, maxlength, late)) | ||||||
| 	{ | 	{ | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 		m_WeAreUnloaded = true; | 		m_WeAreUnloaded = true; | ||||||
| @ -142,7 +144,7 @@ const char *SDKExtension::GetExtensionURL() | |||||||
| 	return SMEXT_CONF_URL; | 	return SMEXT_CONF_URL; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnLoad(char *error, size_t err_max, bool late) | bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -287,17 +289,17 @@ const char *SDKExtension::GetVersion() | |||||||
| 	return GetExtensionVerString(); | 	return GetExtensionVerString(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late) | bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -330,4 +332,3 @@ void operator delete[](void * ptr) | |||||||
| 	free(ptr); | 	free(ptr); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 |  | ||||||
| @ -5,11 +5,13 @@ | |||||||
|  * All rights reserved. |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -52,11 +54,11 @@ public: | |||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -78,21 +80,21 @@ public: | |||||||
| 	 * @brief Called when Metamod is attached, before the extension version is called. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @param late			Whether or not Metamod considers this a late load. | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late); | 	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod is detaching, after the extension version is called. | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	 * NOTE: By default this is blocked unless sent from SourceMod. | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodUnload(char *error, size_t err_max); | 	virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod's pause state is changing. | 	 * @brief Called when Metamod's pause state is changing. | ||||||
| @ -100,14 +102,14 @@ public: | |||||||
| 	 * | 	 * | ||||||
| 	 * @param paused		Pause state being set. | 	 * @param paused		Pause state being set. | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max); | 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| public: //IExtensionInterface
 | public: // IExtensionInterface
 | ||||||
| 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late); | 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late); | ||||||
| 	virtual void OnExtensionUnload(); | 	virtual void OnExtensionUnload(); | ||||||
| 	virtual void OnExtensionsAllLoaded(); | 	virtual void OnExtensionsAllLoaded(); | ||||||
| 
 | 
 | ||||||
| @ -136,9 +138,9 @@ public: //IExtensionInterface | |||||||
| 	/** Returns date string */ | 	/** Returns date string */ | ||||||
| 	virtual const char *GetExtensionDateString(); | 	virtual const char *GetExtensionDateString(); | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| public: //ISmmPlugin
 | public: // ISmmPlugin
 | ||||||
| 	/** Called when the extension is attached to Metamod. */ | 	/** Called when the extension is attached to Metamod. */ | ||||||
| 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late); | 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late); | ||||||
| 	/** Returns the author to MM */ | 	/** Returns the author to MM */ | ||||||
| 	virtual const char *GetAuthor(); | 	virtual const char *GetAuthor(); | ||||||
| 	/** Returns the name to MM */ | 	/** Returns the name to MM */ | ||||||
| @ -185,12 +187,27 @@ extern IServerGameDLL *gamedll; | |||||||
| /** Creates a SourceMod interface macro pair */ | /** Creates a SourceMod interface macro pair */ | ||||||
| #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | ||||||
| /** Automates retrieving SourceMod interfaces */ | /** Automates retrieving SourceMod interfaces */ | ||||||
| #define SM_GET_IFACE(prefix,addr) \ | #define SM_GET_IFACE(prefix, addr) \ | ||||||
| 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) { \ | 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \ | ||||||
| 	 if (error) { \ | 	{ \ | ||||||
| 		snprintf(error, err_max, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | 		if (error) \ | ||||||
| 	 } \ | 		{ \ | ||||||
| 	 return false; \ | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
|  | 	} | ||||||
|  | /** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */ | ||||||
|  | #define SM_GET_LATE_IFACE(prefix, addr) \ | ||||||
|  | 	g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr) | ||||||
|  | /** Validates a SourceMod interface pointer */ | ||||||
|  | #define SM_CHECK_IFACE(prefix, addr) \ | ||||||
|  | 	if (!addr) \ | ||||||
|  | 	{ \ | ||||||
|  | 		if (error) \ | ||||||
|  | 		{ \ | ||||||
|  | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | ||||||
| @ -1,33 +0,0 @@ | |||||||
| // vim: set ts=4 :
 |  | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @file smsdk_config.h |  | ||||||
|  * @brief Contains macros for configuring basic extension information. |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| /* Basic information exposed publically */ |  | ||||||
| #define SMEXT_CONF_NAME			"BAT Support" |  | ||||||
| #define SMEXT_CONF_DESCRIPTION	"Adds support for BAT's AdminInterface" |  | ||||||
| #define SMEXT_CONF_VERSION		"1.0.0.0" |  | ||||||
| #define SMEXT_CONF_AUTHOR		"AlliedModders" |  | ||||||
| #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 |  | ||||||
| #define SMEXT_CONF_LOGTAG		"BATSUPPORT" |  | ||||||
| #define SMEXT_CONF_LICENSE		"GPL" |  | ||||||
| #define SMEXT_CONF_DATESTRING	__DATE__ |  | ||||||
| 
 |  | ||||||
| /** 
 |  | ||||||
|  * @brief Exposes plugin's main interface. |  | ||||||
|  */ |  | ||||||
| #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @brief Sets whether or not this plugin required Metamod. |  | ||||||
|  * NOTE: Uncomment to enable, comment to disable. |  | ||||||
|  * NOTE: This is enabled automatically if a Metamod build is chosen in  |  | ||||||
|  *		 the Visual Studio project. |  | ||||||
|  */ |  | ||||||
| #define SMEXT_CONF_METAMOD		 |  | ||||||
| 
 |  | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 |  | ||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ PROJECT = bintools | |||||||
| #Uncomment for SourceMM-enabled extensions
 | #Uncomment for SourceMM-enabled extensions
 | ||||||
| #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | ||||||
| 
 | 
 | ||||||
| OBJECTS = extension.cpp smsdk_ext.cpp jit_call.cpp CallWrapper.cpp CallMaker.cpp | OBJECTS = sdk/smsdk_ext.cpp extension.cpp jit_call.cpp CallWrapper.cpp CallMaker.cpp | ||||||
| 
 | 
 | ||||||
| ##############################################
 | ##############################################
 | ||||||
| ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ||||||
| @ -32,7 +32,7 @@ SMM_TRUNK = $(SOURCEMM)/trunk | |||||||
| 
 | 
 | ||||||
| LINK = $(LINK_HL2) -static-libgcc | LINK = $(LINK_HL2) -static-libgcc | ||||||
| 
 | 
 | ||||||
| INCLUDE = -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | ||||||
|           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 |           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 | ||||||
| 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit \
 | 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions -I$(SMSDK)/public/jit \
 | ||||||
| 	-I$(SMSDK)/public/jit/x86 | 	-I$(SMSDK)/public/jit/x86 | ||||||
| @ -66,11 +66,10 @@ $(BIN_DIR)/%.o: %.cpp | |||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | ||||||
| 
 | 
 | ||||||
| all: | all: | ||||||
| 	mkdir -p $(BIN_DIR) | 	mkdir -p $(BIN_DIR)/sdk | ||||||
| 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | ||||||
| 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | ||||||
| 	$(MAKE) extension | 	$(MAKE) extension | ||||||
| 	rm -rf $(BINARY) |  | ||||||
| 
 | 
 | ||||||
| extension: $(OBJ_LINUX) | extension: $(OBJ_LINUX) | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | ||||||
| @ -82,7 +81,8 @@ default: all | |||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -rf Release/*.o | 	rm -rf Release/*.o | ||||||
|  | 	rm -rf Release/sdk/*.o | ||||||
| 	rm -rf Release/$(BINARY) | 	rm -rf Release/$(BINARY) | ||||||
| 	rm -rf Debug/*.o | 	rm -rf Debug/*.o | ||||||
|  | 	rm -rf Debug/sdk/*.o | ||||||
| 	rm -rf Debug/$(BINARY) | 	rm -rf Debug/$(BINARY) | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -21,16 +26,16 @@ | |||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * @file extension.cpp |  * @file extension.cpp | ||||||
|  * @brief Implement extension code here. |  * @brief Implements BinTools extension code. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| BinTools g_BinTools;		/**< Global singleton for your extension's main interface */ | BinTools g_BinTools;		/**< Global singleton for extension's main interface */ | ||||||
| CallMaker g_CallMaker; | CallMaker g_CallMaker; | ||||||
| ISourcePawnEngine *g_SPEngine; | ISourcePawnEngine *g_SPEngine; | ||||||
| 
 | 
 | ||||||
| SMEXT_LINK(&g_BinTools); | SMEXT_LINK(&g_BinTools); | ||||||
| 
 | 
 | ||||||
| bool BinTools::SDK_OnLoad(char *error, size_t err_max, bool late) | bool BinTools::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	g_SPEngine = g_pSM->GetScriptingEngine(); | 	g_SPEngine = g_pSM->GetScriptingEngine(); | ||||||
| 	g_pShareSys->AddInterface(myself, &g_CallMaker); | 	g_pShareSys->AddInterface(myself, &g_CallMaker); | ||||||
|  | |||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -24,12 +29,11 @@ | |||||||
|  * @brief Sample extension code header. |  * @brief Sample extension code header. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| #include "smsdk_ext.h" | #include "smsdk_ext.h" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * @brief Sample implementation of the SDK Extension. |  * @brief Implementation of the BinTools extension. | ||||||
|  * Note: Uncomment one of the pre-defined virtual functions in order to use it. |  * Note: Uncomment one of the pre-defined virtual functions in order to use it. | ||||||
|  */ |  */ | ||||||
| class BinTools : public SDKExtension | class BinTools : public SDKExtension | ||||||
| @ -39,11 +43,11 @@ public: | |||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -65,22 +69,45 @@ public: | |||||||
| 	 * @brief this is called when Core wants to know if your extension is working. | 	 * @brief this is called when Core wants to know if your extension is working. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @return			True if working, false otherwise. | 	 * @return			True if working, false otherwise. | ||||||
| 	 */ | 	 */ | ||||||
| 	//virtual void QueryRunning(char *error, size_t maxlength);
 | 	//virtual bool QueryRunning(char *error, size_t maxlength);
 | ||||||
| public: | public: | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * Read smext_base.h for documentation on these. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
 | ||||||
| 
 | 
 | ||||||
| 	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late);
 | 	/**
 | ||||||
| 	//virtual bool SDK_OnMetamodUnload(char *error, size_t err_max);
 | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max);
 | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
 | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when Metamod's pause state is changing. | ||||||
|  | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param paused		Pause state being set. | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
 | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| extern ISourcePawnEngine *g_SPEngine; | extern ISourcePawnEngine *g_SPEngine; | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | ||||||
|  | |||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -1,17 +1,22 @@ | |||||||
| /**
 | /**
 | ||||||
|  * vim: set ts=4 : |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  |  * SourceMod BinTools Extension | ||||||
|  * All rights reserved. |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  |  * This program is free software; you can redistribute it and/or | ||||||
|  * used or modified under the Terms and Conditions of its License Agreement,  |  * modify it under the terms of the GNU General Public License | ||||||
|  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  * works must be licensed under the GNU General Public License (version 2 or  |  * of the License, or (at your option) any later version. | ||||||
|  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  *  |  *  | ||||||
|  * To view the latest information, see: http://www.sourcemod.net/license.php
 |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
|  |  | ||||||
| Microsoft Visual Studio Solution File, Format Version 9.00 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||||||
| # Visual Studio 2005 | # Visual Studio 2005 | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bintools", "bintools.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bintools", "bintools.vcproj", "{E38F65D9-74B2-4373-B46A-DBB76F579F98}" | ||||||
| EndProject | EndProject | ||||||
| Global | Global | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||||
| @ -9,10 +9,10 @@ Global | |||||||
| 		Release|Win32 = Release|Win32 | 		Release|Win32 = Release|Win32 | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32 | 		{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32 | 		{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Debug|Win32.Build.0 = Debug|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32 | 		{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release|Win32.ActiveCfg = Release|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32 | 		{E38F65D9-74B2-4373-B46A-DBB76F579F98}.Release|Win32.Build.0 = Release|Win32 | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(SolutionProperties) = preSolution | 	GlobalSection(SolutionProperties) = preSolution | ||||||
| 		HideSolutionNode = FALSE | 		HideSolutionNode = FALSE | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| 	ProjectType="Visual C++" | 	ProjectType="Visual C++" | ||||||
| 	Version="8.00" | 	Version="8.00" | ||||||
| 	Name="bintools" | 	Name="bintools" | ||||||
| 	ProjectGUID="{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" | 	ProjectGUID="{E38F65D9-74B2-4373-B46A-DBB76F579F98}" | ||||||
| 	RootNamespace="bintools" | 	RootNamespace="bintools" | ||||||
| 	Keyword="Win32Proj" | 	Keyword="Win32Proj" | ||||||
| 	> | 	> | ||||||
| @ -40,7 +40,7 @@ | |||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				Optimization="0" | 				Optimization="0" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\extensions;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | ||||||
| 				MinimalRebuild="true" | 				MinimalRebuild="true" | ||||||
| 				BasicRuntimeChecks="3" | 				BasicRuntimeChecks="3" | ||||||
| @ -117,7 +117,7 @@ | |||||||
| 			/> | 			/> | ||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\extensions;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\jit;..\..\..\public\jit\x86;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;BINTOOLS_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | ||||||
| 				RuntimeLibrary="0" | 				RuntimeLibrary="0" | ||||||
| 				UsePrecompiledHeader="0" | 				UsePrecompiledHeader="0" | ||||||
| @ -176,46 +176,37 @@ | |||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Source Files" | 			Name="Source Files" | ||||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | 			UniqueIdentifier="{0318D835-E129-4fe0-9B9C-C810AC179F31}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\extension.cpp" | 				RelativePath="..\extension.cpp" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_ext.cpp" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Header Files" | 			Name="Header Files" | ||||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | 			UniqueIdentifier="{9021A2EF-600E-4028-AE3E-9DDA4C94264C}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\extension.h" | 				RelativePath="..\extension.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_config.h" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_ext.h" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Resource Files" | 			Name="Resource Files" | ||||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | 			UniqueIdentifier="{C06F7BFF-18EE-4994-8572-D6383011354B}" | ||||||
| 			> | 			> | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="BinTools" | 			Name="BinTools" | ||||||
|  | 			UniqueIdentifier="{7BD12831-E179-4961-A3B0-BA9FCF311C7E}" | ||||||
| 			> | 			> | ||||||
| 			<Filter | 			<Filter | ||||||
| 				Name="Header Files" | 				Name="Header Files" | ||||||
|  | 				Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||||
|  | 				UniqueIdentifier="{2B033553-ECC7-42cc-AD11-D1D985D8BC5A}" | ||||||
| 				> | 				> | ||||||
| 				<File | 				<File | ||||||
| 					RelativePath="..\CallMaker.h" | 					RelativePath="..\CallMaker.h" | ||||||
| @ -232,6 +223,8 @@ | |||||||
| 			</Filter> | 			</Filter> | ||||||
| 			<Filter | 			<Filter | ||||||
| 				Name="Source Files" | 				Name="Source Files" | ||||||
|  | 				Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||||
|  | 				UniqueIdentifier="{F70EA5AC-224C-448f-A72D-11C2D06208B3}" | ||||||
| 				> | 				> | ||||||
| 				<File | 				<File | ||||||
| 					RelativePath="..\CallMaker.cpp" | 					RelativePath="..\CallMaker.cpp" | ||||||
| @ -247,6 +240,32 @@ | |||||||
| 				</File> | 				</File> | ||||||
| 			</Filter> | 			</Filter> | ||||||
| 		</Filter> | 		</Filter> | ||||||
|  | 		<Filter | ||||||
|  | 			Name="SourceMod SDK" | ||||||
|  | 			UniqueIdentifier="{6183251D-B1E4-4cc6-93B2-A0111B2115BA}" | ||||||
|  | 			> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_config.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_ext.cpp" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_ext.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 		</Filter> | ||||||
|  | 		<Filter | ||||||
|  | 			Name="Interfaces" | ||||||
|  | 			UniqueIdentifier="{7DE81EA3-99D9-4f34-823A-B314791F3514}" | ||||||
|  | 			> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\..\..\public\extensions\IBinTools.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 		</Filter> | ||||||
| 	</Files> | 	</Files> | ||||||
| 	<Globals> | 	<Globals> | ||||||
| 	</Globals> | 	</Globals> | ||||||
|  | |||||||
							
								
								
									
										48
									
								
								extensions/bintools/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								extensions/bintools/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,48 @@ | |||||||
|  | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_config.h | ||||||
|  |  * @brief Contains macros for configuring basic extension information. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* Basic information exposed publicly */ | ||||||
|  | #define SMEXT_CONF_NAME			"Sample Extension" | ||||||
|  | #define SMEXT_CONF_DESCRIPTION	"Sample extension to help developers" | ||||||
|  | #define SMEXT_CONF_VERSION		"0.0.0.0" | ||||||
|  | #define SMEXT_CONF_AUTHOR		"AlliedModders" | ||||||
|  | #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 | ||||||
|  | #define SMEXT_CONF_LOGTAG		"SAMPLE" | ||||||
|  | #define SMEXT_CONF_LICENSE		"GPL" | ||||||
|  | #define SMEXT_CONF_DATESTRING	__DATE__ | ||||||
|  | 
 | ||||||
|  | /** 
 | ||||||
|  |  * @brief Exposes plugin's main interface. | ||||||
|  |  */ | ||||||
|  | #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Sets whether or not this plugin required Metamod. | ||||||
|  |  * NOTE: Uncomment to enable, comment to disable. | ||||||
|  |  */ | ||||||
|  | //#define SMEXT_CONF_METAMOD		
 | ||||||
|  | 
 | ||||||
|  | #endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 | ||||||
| @ -5,11 +5,13 @@ | |||||||
|  * All rights reserved. |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -44,7 +46,7 @@ SDKExtension::SDKExtension() | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late) | bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	g_pShareSys = sys; | 	g_pShareSys = sys; | ||||||
| 	myself = me; | 	myself = me; | ||||||
| @ -56,7 +58,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	{ | 	{ | ||||||
| 		if (error) | 		if (error) | ||||||
| 		{ | 		{ | ||||||
| 			snprintf(error, err_max, "Metamod attach failed"); | 			snprintf(error, maxlength, "Metamod attach failed"); | ||||||
| 		} | 		} | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| @ -66,7 +68,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	SM_GET_IFACE(SOURCEMOD, g_pSM); | 	SM_GET_IFACE(SOURCEMOD, g_pSM); | ||||||
| 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | ||||||
| 
 | 
 | ||||||
| 	if (SDK_OnLoad(error, err_max, late)) | 	if (SDK_OnLoad(error, maxlength, late)) | ||||||
| 	{ | 	{ | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 		m_WeAreUnloaded = true; | 		m_WeAreUnloaded = true; | ||||||
| @ -142,7 +144,7 @@ const char *SDKExtension::GetExtensionURL() | |||||||
| 	return SMEXT_CONF_URL; | 	return SMEXT_CONF_URL; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnLoad(char *error, size_t err_max, bool late) | bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -287,17 +289,17 @@ const char *SDKExtension::GetVersion() | |||||||
| 	return GetExtensionVerString(); | 	return GetExtensionVerString(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late) | bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -330,4 +332,3 @@ void operator delete[](void * ptr) | |||||||
| 	free(ptr); | 	free(ptr); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 |  | ||||||
| @ -5,11 +5,13 @@ | |||||||
|  * All rights reserved. |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -52,11 +54,11 @@ public: | |||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -78,21 +80,21 @@ public: | |||||||
| 	 * @brief Called when Metamod is attached, before the extension version is called. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @param late			Whether or not Metamod considers this a late load. | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late); | 	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod is detaching, after the extension version is called. | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	 * NOTE: By default this is blocked unless sent from SourceMod. | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodUnload(char *error, size_t err_max); | 	virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod's pause state is changing. | 	 * @brief Called when Metamod's pause state is changing. | ||||||
| @ -100,14 +102,14 @@ public: | |||||||
| 	 * | 	 * | ||||||
| 	 * @param paused		Pause state being set. | 	 * @param paused		Pause state being set. | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max); | 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| public: //IExtensionInterface
 | public: // IExtensionInterface
 | ||||||
| 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late); | 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late); | ||||||
| 	virtual void OnExtensionUnload(); | 	virtual void OnExtensionUnload(); | ||||||
| 	virtual void OnExtensionsAllLoaded(); | 	virtual void OnExtensionsAllLoaded(); | ||||||
| 
 | 
 | ||||||
| @ -136,9 +138,9 @@ public: //IExtensionInterface | |||||||
| 	/** Returns date string */ | 	/** Returns date string */ | ||||||
| 	virtual const char *GetExtensionDateString(); | 	virtual const char *GetExtensionDateString(); | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| public: //ISmmPlugin
 | public: // ISmmPlugin
 | ||||||
| 	/** Called when the extension is attached to Metamod. */ | 	/** Called when the extension is attached to Metamod. */ | ||||||
| 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late); | 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late); | ||||||
| 	/** Returns the author to MM */ | 	/** Returns the author to MM */ | ||||||
| 	virtual const char *GetAuthor(); | 	virtual const char *GetAuthor(); | ||||||
| 	/** Returns the name to MM */ | 	/** Returns the name to MM */ | ||||||
| @ -185,12 +187,27 @@ extern IServerGameDLL *gamedll; | |||||||
| /** Creates a SourceMod interface macro pair */ | /** Creates a SourceMod interface macro pair */ | ||||||
| #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | ||||||
| /** Automates retrieving SourceMod interfaces */ | /** Automates retrieving SourceMod interfaces */ | ||||||
| #define SM_GET_IFACE(prefix,addr) \ | #define SM_GET_IFACE(prefix, addr) \ | ||||||
| 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) { \ | 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \ | ||||||
| 	 if (error) { \ | 	{ \ | ||||||
| 		snprintf(error, err_max, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | 		if (error) \ | ||||||
| 	 } \ | 		{ \ | ||||||
| 	 return false; \ | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
|  | 	} | ||||||
|  | /** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */ | ||||||
|  | #define SM_GET_LATE_IFACE(prefix, addr) \ | ||||||
|  | 	g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr) | ||||||
|  | /** Validates a SourceMod interface pointer */ | ||||||
|  | #define SM_CHECK_IFACE(prefix, addr) \ | ||||||
|  | 	if (!addr) \ | ||||||
|  | 	{ \ | ||||||
|  | 		if (error) \ | ||||||
|  | 		{ \ | ||||||
|  | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | ||||||
| @ -1,33 +0,0 @@ | |||||||
| // vim: set ts=4 :
 |  | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @file smsdk_config.h |  | ||||||
|  * @brief Contains macros for configuring basic extension information. |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| /* Basic information exposed publically */ |  | ||||||
| #define SMEXT_CONF_NAME			"Sample Extension" |  | ||||||
| #define SMEXT_CONF_DESCRIPTION	"Sample extension to help developers" |  | ||||||
| #define SMEXT_CONF_VERSION		"0.0.0.0" |  | ||||||
| #define SMEXT_CONF_AUTHOR		"AlliedModders" |  | ||||||
| #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 |  | ||||||
| #define SMEXT_CONF_LOGTAG		"SAMPLE" |  | ||||||
| #define SMEXT_CONF_LICENSE		"GPL" |  | ||||||
| #define SMEXT_CONF_DATESTRING	__DATE__ |  | ||||||
| 
 |  | ||||||
| /** 
 |  | ||||||
|  * @brief Exposes plugin's main interface. |  | ||||||
|  */ |  | ||||||
| #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @brief Sets whether or not this plugin required Metamod. |  | ||||||
|  * NOTE: Uncomment to enable, comment to disable. |  | ||||||
|  * NOTE: This is enabled automatically if a Metamod build is chosen in  |  | ||||||
|  *		 the Visual Studio project. |  | ||||||
|  */ |  | ||||||
| //#define SMEXT_CONF_METAMOD		
 |  | ||||||
| 
 |  | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 |  | ||||||
| @ -14,7 +14,7 @@ PROJECT = geoip | |||||||
| #Uncomment for SourceMM-enabled extensions
 | #Uncomment for SourceMM-enabled extensions
 | ||||||
| #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | ||||||
| 
 | 
 | ||||||
| OBJECTS = extension.cpp smsdk_ext.cpp GeoIP.c | OBJECTS = sdk/smsdk_ext.cpp extension.cpp GeoIP.c | ||||||
| 
 | 
 | ||||||
| ##############################################
 | ##############################################
 | ||||||
| ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ||||||
| @ -32,7 +32,7 @@ SMM_TRUNK = $(SOURCEMM)/trunk | |||||||
| 
 | 
 | ||||||
| LINK = $(LINK_HL2) -static-libgcc | LINK = $(LINK_HL2) -static-libgcc | ||||||
| 
 | 
 | ||||||
| INCLUDE = -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | ||||||
|           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 |           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 | ||||||
| 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | ||||||
| 
 | 
 | ||||||
| @ -60,7 +60,7 @@ endif | |||||||
| BINARY = $(PROJECT).ext.so | BINARY = $(PROJECT).ext.so | ||||||
| 
 | 
 | ||||||
| OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) | OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) | ||||||
| OBJ_LINUX := $(OBJECTS:%.c=$(BIN_DIR)/%.o) | OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o) | ||||||
| 
 | 
 | ||||||
| $(BIN_DIR)/%.o: %.cpp | $(BIN_DIR)/%.o: %.cpp | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | ||||||
| @ -69,11 +69,10 @@ $(BIN_DIR)/%.o: %.c | |||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $< | 	$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $< | ||||||
| 
 | 
 | ||||||
| all: | all: | ||||||
| 	mkdir -p $(BIN_DIR) | 	mkdir -p $(BIN_DIR)/sdk | ||||||
| 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | ||||||
| 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | ||||||
| 	$(MAKE) extension | 	$(MAKE) extension | ||||||
| 	rm -rf $(BINARY) |  | ||||||
| 
 | 
 | ||||||
| extension: $(OBJ_LINUX) | extension: $(OBJ_LINUX) | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | ||||||
| @ -85,7 +84,8 @@ default: all | |||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -rf Release/*.o | 	rm -rf Release/*.o | ||||||
|  | 	rm -rf Release/sdk/*.o | ||||||
| 	rm -rf Release/$(BINARY) | 	rm -rf Release/$(BINARY) | ||||||
| 	rm -rf Debug/*.o | 	rm -rf Debug/*.o | ||||||
|  | 	rm -rf Debug/sdk/*.o | ||||||
| 	rm -rf Debug/$(BINARY) | 	rm -rf Debug/$(BINARY) | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * GeoIP SourceMod Extension, (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod GeoIP Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
| @ -20,21 +24,25 @@ | |||||||
| #include "extension.h" | #include "extension.h" | ||||||
| #include "GeoIP.h" | #include "GeoIP.h" | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file extension.cpp | ||||||
|  |  * @brief Implement extension code here. | ||||||
|  |  */ | ||||||
| GeoIP_Extension g_GeoIP; | GeoIP_Extension g_GeoIP; | ||||||
| GeoIP *gi = NULL; | GeoIP *gi = NULL; | ||||||
| 
 | 
 | ||||||
| SMEXT_LINK(&g_GeoIP); | SMEXT_LINK(&g_GeoIP); | ||||||
| 
 | 
 | ||||||
| bool GeoIP_Extension::SDK_OnLoad(char *error, size_t err_max, bool late) | bool GeoIP_Extension::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	char path[PLATFORM_MAX_PATH+1]; | 	char path[PLATFORM_MAX_PATH]; | ||||||
| 
 | 
 | ||||||
| 	g_pSM->BuildPath(Path_SM, path, sizeof(path), "configs/geoip/GeoIP.dat"); | 	g_pSM->BuildPath(Path_SM, path, sizeof(path), "configs/geoip/GeoIP.dat"); | ||||||
| 	gi = GeoIP_open(path, GEOIP_MEMORY_CACHE); | 	gi = GeoIP_open(path, GEOIP_MEMORY_CACHE); | ||||||
| 
 | 
 | ||||||
| 	if (!gi) | 	if (!gi) | ||||||
| 	{ | 	{ | ||||||
| 		snprintf(error, err_max, "Failed to instantiate GeoIP!"); | 		snprintf(error, maxlength, "Failed to instantiate GeoIP!"); | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -113,4 +121,3 @@ const sp_nativeinfo_t geoip_natives[] = | |||||||
| 	{"GeoipCountry",		sm_Geoip_Country}, | 	{"GeoipCountry",		sm_Geoip_Country}, | ||||||
| 	{NULL,					NULL}, | 	{NULL,					NULL}, | ||||||
| }; | }; | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * GeoIP SourceMod Extension, (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod GeoIP Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
| @ -20,12 +24,16 @@ | |||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file extension.h | ||||||
|  |  * @brief GeoIP extension code header. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #include "smsdk_ext.h" | #include "smsdk_ext.h" | ||||||
| 
 | 
 | ||||||
| #define GEOIPDATADIR "" |  | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * @brief GeoIP implementation of the SDK Extension. |  * @brief Implementation of the GeoIP extension. | ||||||
|  * Note: Uncomment one of the pre-defined virtual functions in order to use it. |  * Note: Uncomment one of the pre-defined virtual functions in order to use it. | ||||||
|  */ |  */ | ||||||
| class GeoIP_Extension : public SDKExtension | class GeoIP_Extension : public SDKExtension | ||||||
| @ -35,11 +43,11 @@ public: | |||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -61,22 +69,45 @@ public: | |||||||
| 	 * @brief this is called when Core wants to know if your extension is working. | 	 * @brief this is called when Core wants to know if your extension is working. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @return			True if working, false otherwise. | 	 * @return			True if working, false otherwise. | ||||||
| 	 */ | 	 */ | ||||||
| 	//virtual void QueryRunning(char *error, size_t maxlength);
 | 	//virtual bool QueryRunning(char *error, size_t maxlength);
 | ||||||
| public: | public: | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * Read smext_base.h for documentation on these. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
 | ||||||
| 
 | 
 | ||||||
| 	//virtual bool SDK_OnMetamodLoad(char *error, size_t err_max, bool late);
 | 	/**
 | ||||||
| 	//virtual bool SDK_OnMetamodUnload(char *error, size_t err_max);
 | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max);
 | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
 | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when Metamod's pause state is changing. | ||||||
|  | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param paused		Pause state being set. | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
 | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| extern const sp_nativeinfo_t geoip_natives[]; | extern const sp_nativeinfo_t geoip_natives[]; | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
|  |  | ||||||
| Microsoft Visual Studio Solution File, Format Version 9.00 | Microsoft Visual Studio Solution File, Format Version 9.00 | ||||||
| # Visual Studio 2005 | # Visual Studio 2005 | ||||||
| Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geoip", "geoip.vcproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "geoip", "geoip.vcproj", "{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}" | ||||||
| EndProject | EndProject | ||||||
| Global | Global | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||||
| @ -9,10 +9,10 @@ Global | |||||||
| 		Release|Win32 = Release|Win32 | 		Release|Win32 = Release|Win32 | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | 	GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32 | 		{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Debug|Win32.ActiveCfg = Debug|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32 | 		{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Debug|Win32.Build.0 = Debug|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32 | 		{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Release|Win32.ActiveCfg = Release|Win32 | ||||||
| 		{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32 | 		{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Release|Win32.Build.0 = Release|Win32 | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(SolutionProperties) = preSolution | 	GlobalSection(SolutionProperties) = preSolution | ||||||
| 		HideSolutionNode = FALSE | 		HideSolutionNode = FALSE | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ | |||||||
| 	ProjectType="Visual C++" | 	ProjectType="Visual C++" | ||||||
| 	Version="8.00" | 	Version="8.00" | ||||||
| 	Name="geoip" | 	Name="geoip" | ||||||
| 	ProjectGUID="{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" | 	ProjectGUID="{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}" | ||||||
| 	RootNamespace="geoip" | 	RootNamespace="geoip" | ||||||
| 	Keyword="Win32Proj" | 	Keyword="Win32Proj" | ||||||
| 	> | 	> | ||||||
| @ -40,7 +40,7 @@ | |||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				Optimization="0" | 				Optimization="0" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;geoip_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" | 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;geoip_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" | ||||||
| 				MinimalRebuild="true" | 				MinimalRebuild="true" | ||||||
| 				BasicRuntimeChecks="3" | 				BasicRuntimeChecks="3" | ||||||
| @ -118,7 +118,7 @@ | |||||||
| 			/> | 			/> | ||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;geoip_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" | 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;geoip_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE" | ||||||
| 				RuntimeLibrary="0" | 				RuntimeLibrary="0" | ||||||
| 				UsePrecompiledHeader="0" | 				UsePrecompiledHeader="0" | ||||||
| @ -188,10 +188,6 @@ | |||||||
| 				RelativePath="..\GeoIP.c" | 				RelativePath="..\GeoIP.c" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_ext.cpp" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Header Files" | 			Name="Header Files" | ||||||
| @ -206,14 +202,6 @@ | |||||||
| 				RelativePath="..\GeoIP.h" | 				RelativePath="..\GeoIP.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_config.h" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_ext.h" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\svn_version.h" | 				RelativePath="..\svn_version.h" | ||||||
| 				> | 				> | ||||||
| @ -229,6 +217,22 @@ | |||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 		</Filter> | 		</Filter> | ||||||
|  | 		<Filter | ||||||
|  | 			Name="SourceMod SDK" | ||||||
|  | 			> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_config.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_ext.cpp" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_ext.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 		</Filter> | ||||||
| 	</Files> | 	</Files> | ||||||
| 	<Globals> | 	<Globals> | ||||||
| 	</Globals> | 	</Globals> | ||||||
|  | |||||||
							
								
								
									
										49
									
								
								extensions/geoip/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								extensions/geoip/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | |||||||
|  | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | #include "svn_version.h" | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_config.h | ||||||
|  |  * @brief Contains macros for configuring basic extension information. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* Basic information exposed publicly */ | ||||||
|  | #define SMEXT_CONF_NAME			"GeoIP" | ||||||
|  | #define SMEXT_CONF_DESCRIPTION	"NO IDEA WHAT THIS MODULE DOES" //:TODO:
 | ||||||
|  | #define SMEXT_CONF_VERSION		SVN_FULL_VERSION | ||||||
|  | #define SMEXT_CONF_AUTHOR		"AlliedModders" | ||||||
|  | #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 | ||||||
|  | #define SMEXT_CONF_LOGTAG		"GEOIP" | ||||||
|  | #define SMEXT_CONF_LICENSE		"GPL" | ||||||
|  | #define SMEXT_CONF_DATESTRING	__DATE__ | ||||||
|  | 
 | ||||||
|  | /** 
 | ||||||
|  |  * @brief Exposes plugin's main interface. | ||||||
|  |  */ | ||||||
|  | #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Sets whether or not this plugin required Metamod. | ||||||
|  |  * NOTE: Uncomment to enable, comment to disable. | ||||||
|  |  */ | ||||||
|  | //#define SMEXT_CONF_METAMOD		
 | ||||||
|  | 
 | ||||||
|  | #endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 | ||||||
							
								
								
									
										334
									
								
								extensions/geoip/sdk/smsdk_ext.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										334
									
								
								extensions/geoip/sdk/smsdk_ext.cpp
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,334 @@ | |||||||
|  | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include <stdio.h> | ||||||
|  | #include <malloc.h> | ||||||
|  | #include "smsdk_ext.h" | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_ext.cpp | ||||||
|  |  * @brief Contains wrappers for making Extensions easier to write. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | IShareSys *g_pShareSys = NULL;			/**< Share system */ | ||||||
|  | IExtension *myself = NULL;				/**< Ourself */ | ||||||
|  | IHandleSys *g_pHandleSys = NULL;		/**< Handle system */ | ||||||
|  | ISourceMod *g_pSM = NULL;				/**< SourceMod helpers */ | ||||||
|  | IForwardManager *g_pForwards = NULL;	/**< Forward system */ | ||||||
|  | 
 | ||||||
|  | /** Exports the main interface */ | ||||||
|  | PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI() | ||||||
|  | { | ||||||
|  | 	return g_pExtensionIface; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | SDKExtension::SDKExtension() | ||||||
|  | { | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 	m_SourceMMLoaded = false; | ||||||
|  | 	m_WeAreUnloaded = false; | ||||||
|  | 	m_WeGotPauseChange = false; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late) | ||||||
|  | { | ||||||
|  | 	g_pShareSys = sys; | ||||||
|  | 	myself = me; | ||||||
|  | 
 | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 	m_WeAreUnloaded = true; | ||||||
|  | 
 | ||||||
|  | 	if (!m_SourceMMLoaded) | ||||||
|  | 	{ | ||||||
|  | 		if (error) | ||||||
|  | 		{ | ||||||
|  | 			snprintf(error, maxlength, "Metamod attach failed"); | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | 	SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys); | ||||||
|  | 	SM_GET_IFACE(SOURCEMOD, g_pSM); | ||||||
|  | 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | ||||||
|  | 
 | ||||||
|  | 	if (SDK_OnLoad(error, maxlength, late)) | ||||||
|  | 	{ | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 		m_WeAreUnloaded = true; | ||||||
|  | #endif | ||||||
|  | 		return true; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::IsMetamodExtension() | ||||||
|  | { | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 	return true; | ||||||
|  | #else | ||||||
|  | 	return false; | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void SDKExtension::OnExtensionPauseChange(bool state) | ||||||
|  | { | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 	m_WeGotPauseChange = true; | ||||||
|  | #endif | ||||||
|  | 	SDK_OnPauseChange(state); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void SDKExtension::OnExtensionsAllLoaded() | ||||||
|  | { | ||||||
|  | 	SDK_OnAllLoaded(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void SDKExtension::OnExtensionUnload() | ||||||
|  | { | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 	m_WeAreUnloaded = true; | ||||||
|  | #endif | ||||||
|  | 	SDK_OnUnload(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetExtensionAuthor() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_AUTHOR; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetExtensionDateString() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_DATESTRING; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetExtensionDescription() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_DESCRIPTION; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetExtensionVerString() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_VERSION; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetExtensionName() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_NAME; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetExtensionTag() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_LOGTAG; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetExtensionURL() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_URL; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
|  | { | ||||||
|  | 	return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void SDKExtension::SDK_OnUnload() | ||||||
|  | { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void SDKExtension::SDK_OnPauseChange(bool paused) | ||||||
|  | { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void SDKExtension::SDK_OnAllLoaded() | ||||||
|  | { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 
 | ||||||
|  | PluginId g_PLID = 0;						/**< Metamod plugin ID */ | ||||||
|  | ISmmPlugin *g_PLAPI = NULL;					/**< Metamod plugin API */ | ||||||
|  | SourceHook::ISourceHook *g_SHPtr = NULL;	/**< SourceHook pointer */ | ||||||
|  | ISmmAPI *g_SMAPI = NULL;					/**< SourceMM API pointer */ | ||||||
|  | 
 | ||||||
|  | IVEngineServer *engine = NULL;				/**< IVEngineServer pointer */ | ||||||
|  | IServerGameDLL *gamedll = NULL;				/**< IServerGameDLL pointer */ | ||||||
|  | 
 | ||||||
|  | /** Exposes the extension to Metamod */ | ||||||
|  | SMM_API void *PL_EXPOSURE(const char *name, int *code) | ||||||
|  | { | ||||||
|  | 	if (name && !strcmp(name, PLAPI_NAME)) | ||||||
|  | 	{ | ||||||
|  | 		if (code) | ||||||
|  | 		{ | ||||||
|  | 			*code = IFACE_OK; | ||||||
|  | 		} | ||||||
|  | 		return static_cast<void *>(g_pExtensionIface); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	if (code) | ||||||
|  | 	{ | ||||||
|  | 		*code = IFACE_FAILED; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return NULL; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late) | ||||||
|  | { | ||||||
|  | 	PLUGIN_SAVEVARS(); | ||||||
|  | 
 | ||||||
|  | 	GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); | ||||||
|  | 	GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); | ||||||
|  | 
 | ||||||
|  | 	m_SourceMMLoaded = true; | ||||||
|  | 
 | ||||||
|  | 	return SDK_OnMetamodLoad(ismm, error, maxlen, late); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::Unload(char *error, size_t maxlen) | ||||||
|  | { | ||||||
|  | 	if (!m_WeAreUnloaded) | ||||||
|  | 	{ | ||||||
|  | 		if (error) | ||||||
|  | 		{ | ||||||
|  | 			snprintf(error, maxlen, "This extension must be unloaded by SourceMod."); | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	return SDK_OnMetamodUnload(error, maxlen); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::Pause(char *error, size_t maxlength) | ||||||
|  | { | ||||||
|  | 	if (!m_WeGotPauseChange) | ||||||
|  | 	{ | ||||||
|  | 		if (error) | ||||||
|  | 		{ | ||||||
|  | 			snprintf(error, maxlen, "This extension must be paused by SourceMod."); | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	m_WeGotPauseChange = false; | ||||||
|  | 
 | ||||||
|  | 	return SDK_OnMetamodPauseChange(true, error, maxlen); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::Unpause(char *error, size_t maxlen) | ||||||
|  | { | ||||||
|  | 	if (!m_WeGotPauseChange) | ||||||
|  | 	{ | ||||||
|  | 		if (error) | ||||||
|  | 		{ | ||||||
|  | 			snprintf(error, maxlen, "This extension must be unpaused by SourceMod."); | ||||||
|  | 		} | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	m_WeGotPauseChange = false; | ||||||
|  | 
 | ||||||
|  | 	return SDK_OnMetamodPauseChange(false, error, maxlen); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetAuthor() | ||||||
|  | { | ||||||
|  | 	return GetExtensionAuthor(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetDate() | ||||||
|  | { | ||||||
|  | 	return GetExtensionDateString(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetDescription() | ||||||
|  | { | ||||||
|  | 	return GetExtensionDescription(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetLicense() | ||||||
|  | { | ||||||
|  | 	return SMEXT_CONF_LICENSE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetLogTag() | ||||||
|  | { | ||||||
|  | 	return GetExtensionTag(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetName() | ||||||
|  | { | ||||||
|  | 	return GetExtensionName(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetURL() | ||||||
|  | { | ||||||
|  | 	return GetExtensionURL(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const char *SDKExtension::GetVersion() | ||||||
|  | { | ||||||
|  | 	return GetExtensionVerString(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late) | ||||||
|  | { | ||||||
|  | 	return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength) | ||||||
|  | { | ||||||
|  | 	return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength) | ||||||
|  | { | ||||||
|  | 	return true; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | /* Overload a few things to prevent libstdc++ linking */ | ||||||
|  | #if defined __linux__ | ||||||
|  | extern "C" void __cxa_pure_virtual(void) | ||||||
|  | { | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void *operator new(size_t size) | ||||||
|  | { | ||||||
|  | 	return malloc(size); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void *operator new[](size_t size)  | ||||||
|  | { | ||||||
|  | 	return malloc(size); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void operator delete(void *ptr)  | ||||||
|  | { | ||||||
|  | 	free(ptr); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | void operator delete[](void * ptr) | ||||||
|  | { | ||||||
|  | 	free(ptr); | ||||||
|  | } | ||||||
|  | #endif | ||||||
| @ -5,11 +5,13 @@ | |||||||
|  * All rights reserved. |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -52,11 +54,11 @@ public: | |||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -78,21 +80,21 @@ public: | |||||||
| 	 * @brief Called when Metamod is attached, before the extension version is called. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @param late			Whether or not Metamod considers this a late load. | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod is detaching, after the extension version is called. | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	 * NOTE: By default this is blocked unless sent from SourceMod. | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodUnload(char *error, size_t err_max); | 	virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod's pause state is changing. | 	 * @brief Called when Metamod's pause state is changing. | ||||||
| @ -100,14 +102,14 @@ public: | |||||||
| 	 * | 	 * | ||||||
| 	 * @param paused		Pause state being set. | 	 * @param paused		Pause state being set. | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max); | 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| public: //IExtensionInterface
 | public: // IExtensionInterface
 | ||||||
| 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late); | 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late); | ||||||
| 	virtual void OnExtensionUnload(); | 	virtual void OnExtensionUnload(); | ||||||
| 	virtual void OnExtensionsAllLoaded(); | 	virtual void OnExtensionsAllLoaded(); | ||||||
| 
 | 
 | ||||||
| @ -136,9 +138,9 @@ public: //IExtensionInterface | |||||||
| 	/** Returns date string */ | 	/** Returns date string */ | ||||||
| 	virtual const char *GetExtensionDateString(); | 	virtual const char *GetExtensionDateString(); | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| public: //ISmmPlugin
 | public: // ISmmPlugin
 | ||||||
| 	/** Called when the extension is attached to Metamod. */ | 	/** Called when the extension is attached to Metamod. */ | ||||||
| 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late); | 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late); | ||||||
| 	/** Returns the author to MM */ | 	/** Returns the author to MM */ | ||||||
| 	virtual const char *GetAuthor(); | 	virtual const char *GetAuthor(); | ||||||
| 	/** Returns the name to MM */ | 	/** Returns the name to MM */ | ||||||
| @ -185,12 +187,27 @@ extern IServerGameDLL *gamedll; | |||||||
| /** Creates a SourceMod interface macro pair */ | /** Creates a SourceMod interface macro pair */ | ||||||
| #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | ||||||
| /** Automates retrieving SourceMod interfaces */ | /** Automates retrieving SourceMod interfaces */ | ||||||
| #define SM_GET_IFACE(prefix,addr) \ | #define SM_GET_IFACE(prefix, addr) \ | ||||||
| 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) { \ | 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \ | ||||||
| 	 if (error) { \ | 	{ \ | ||||||
| 		snprintf(error, err_max, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | 		if (error) \ | ||||||
| 	 } \ | 		{ \ | ||||||
| 	 return false; \ | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
|  | 	} | ||||||
|  | /** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */ | ||||||
|  | #define SM_GET_LATE_IFACE(prefix, addr) \ | ||||||
|  | 	g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr) | ||||||
|  | /** Validates a SourceMod interface pointer */ | ||||||
|  | #define SM_CHECK_IFACE(prefix, addr) \ | ||||||
|  | 	if (!addr) \ | ||||||
|  | 	{ \ | ||||||
|  | 		if (error) \ | ||||||
|  | 		{ \ | ||||||
|  | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | ||||||
| @ -1,48 +0,0 @@ | |||||||
| /**
 |  | ||||||
|  * GeoIP SourceMod Extension, (C)2007 AlliedModders LLC.  All rights reserved. |  | ||||||
|  * |  | ||||||
|  * This program is free software; you can redistribute it and/or |  | ||||||
|  * modify it under the terms of the GNU General Public License |  | ||||||
|  * as published by the Free Software Foundation; either version 2 |  | ||||||
|  * of the License, or (at your option) any later version. |  | ||||||
|  * This program is distributed in the hope that it will be useful, |  | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  | ||||||
|  * GNU General Public License for more details. |  | ||||||
|  *  |  | ||||||
|  * You should have received a copy of the GNU General Public License |  | ||||||
|  * along with this program; if not, write to the Free Software |  | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  | ||||||
|  * |  | ||||||
|  * Version: $Id$ |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| 
 |  | ||||||
| #include "svn_version.h" |  | ||||||
| 
 |  | ||||||
| /* Basic information exposed publically */ |  | ||||||
| #define SMEXT_CONF_NAME			"GeoIP" |  | ||||||
| #define SMEXT_CONF_DESCRIPTION	"NO IDEA WHAT THIS MODULE DOES" //:TODO:
 |  | ||||||
| #define SMEXT_CONF_VERSION		SVN_FULL_VERSION |  | ||||||
| #define SMEXT_CONF_AUTHOR		"AlliedModders" |  | ||||||
| #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 |  | ||||||
| #define SMEXT_CONF_LOGTAG		"GEOIP" |  | ||||||
| #define SMEXT_CONF_LICENSE		"GPL" |  | ||||||
| #define SMEXT_CONF_DATESTRING	__DATE__ |  | ||||||
| 
 |  | ||||||
| /** 
 |  | ||||||
|  * @brief Exposes plugin's main interface. |  | ||||||
|  */ |  | ||||||
| #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @brief Sets whether or not this plugin required Metamod. |  | ||||||
|  * NOTE: Uncomment to enable, comment to disable. |  | ||||||
|  * NOTE: This is enabled automatically if a Metamod build is chosen in  |  | ||||||
|  *		 the Visual Studio project. |  | ||||||
|  */ |  | ||||||
| //#define SMEXT_CONF_METAMOD		
 |  | ||||||
| 
 |  | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 |  | ||||||
| @ -1,324 +0,0 @@ | |||||||
| /**
 |  | ||||||
|  * =============================================================== |  | ||||||
|  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved. |  | ||||||
|  * =============================================================== |  | ||||||
|  * |  | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  | ||||||
|  * may change at any time.  To view the latest information, see: |  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  | ||||||
|  * |  | ||||||
|  * Version: $Id$ |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| #include <stdio.h> |  | ||||||
| #include <malloc.h> |  | ||||||
| #include "smsdk_ext.h" |  | ||||||
| 
 |  | ||||||
| IShareSys *g_pShareSys = NULL; |  | ||||||
| IExtension *myself = NULL; |  | ||||||
| IHandleSys *g_pHandleSys = NULL; |  | ||||||
| ISourceMod *g_pSM = NULL; |  | ||||||
| IForwardManager *g_pForwards = NULL; |  | ||||||
| 
 |  | ||||||
| PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI() |  | ||||||
| { |  | ||||||
| 	return g_pExtensionIface; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| SDKExtension::SDKExtension() |  | ||||||
| { |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 	m_SourceMMLoaded = false; |  | ||||||
| 	m_WeAreUnloaded = false; |  | ||||||
| 	m_WeGotPauseChange = false; |  | ||||||
| #endif |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late) |  | ||||||
| { |  | ||||||
| 	g_pShareSys = sys; |  | ||||||
| 	myself = me; |  | ||||||
| 
 |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 	m_WeAreUnloaded = true; |  | ||||||
| 
 |  | ||||||
| 	if (!m_SourceMMLoaded) |  | ||||||
| 	{ |  | ||||||
| 		if (error) |  | ||||||
| 		{ |  | ||||||
| 			snprintf(error, err_max, "Metamod attach failed"); |  | ||||||
| 		} |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| 	SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys); |  | ||||||
| 	SM_GET_IFACE(SOURCEMOD, g_pSM); |  | ||||||
| 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); |  | ||||||
| 
 |  | ||||||
| 	if (SDK_OnLoad(error, err_max, late)) |  | ||||||
| 	{ |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 		m_WeAreUnloaded = true; |  | ||||||
| #endif |  | ||||||
| 		return true; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return false; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::IsMetamodExtension() |  | ||||||
| { |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 	return true; |  | ||||||
| #else |  | ||||||
| 	return false; |  | ||||||
| #endif |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void SDKExtension::OnExtensionPauseChange(bool state) |  | ||||||
| { |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 	m_WeGotPauseChange = true; |  | ||||||
| #endif |  | ||||||
| 	SDK_OnPauseChange(state); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void SDKExtension::OnExtensionsAllLoaded() |  | ||||||
| { |  | ||||||
| 	SDK_OnAllLoaded(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void SDKExtension::OnExtensionUnload() |  | ||||||
| { |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 	m_WeAreUnloaded = true; |  | ||||||
| #endif |  | ||||||
| 	SDK_OnUnload(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetExtensionAuthor() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_AUTHOR; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetExtensionDateString() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_DATESTRING; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetExtensionDescription() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_DESCRIPTION; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetExtensionVerString() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_VERSION; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetExtensionName() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_NAME; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetExtensionTag() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_LOGTAG; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetExtensionURL() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_URL; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::SDK_OnLoad(char *error, size_t err_max, bool late) |  | ||||||
| { |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void SDKExtension::SDK_OnUnload() |  | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void SDKExtension::SDK_OnPauseChange(bool paused) |  | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void SDKExtension::SDK_OnAllLoaded() |  | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 
 |  | ||||||
| PluginId g_PLID = 0; |  | ||||||
| ISmmPlugin *g_PLAPI = NULL; |  | ||||||
| SourceHook::ISourceHook *g_SHPtr = NULL; |  | ||||||
| ISmmAPI *g_SMAPI = NULL; |  | ||||||
| 
 |  | ||||||
| IVEngineServer *engine = NULL; |  | ||||||
| IServerGameDLL *gamedll = NULL; |  | ||||||
| 
 |  | ||||||
| SMM_API void *PL_EXPOSURE(const char *name, int *code) |  | ||||||
| { |  | ||||||
| 	if (name && !strcmp(name, PLAPI_NAME)) |  | ||||||
| 	{ |  | ||||||
| 		if (code) |  | ||||||
| 		{ |  | ||||||
| 			*code = IFACE_OK; |  | ||||||
| 		} |  | ||||||
| 		return static_cast<void *>(g_pExtensionIface); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	if (code) |  | ||||||
| 	{ |  | ||||||
| 		*code = IFACE_FAILED; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return NULL; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late) |  | ||||||
| { |  | ||||||
| 	PLUGIN_SAVEVARS(); |  | ||||||
| 
 |  | ||||||
| 	GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); |  | ||||||
| 	GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); |  | ||||||
| 
 |  | ||||||
| 	m_SourceMMLoaded = true; |  | ||||||
| 
 |  | ||||||
| 	return SDK_OnMetamodLoad(error, maxlen, late); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::Unload(char *error, size_t maxlen) |  | ||||||
| { |  | ||||||
| 	if (!m_WeAreUnloaded) |  | ||||||
| 	{ |  | ||||||
| 		if (error) |  | ||||||
| 		{ |  | ||||||
| 			snprintf(error, maxlen, "This extension must be unloaded by SourceMod."); |  | ||||||
| 		} |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return SDK_OnMetamodUnload(error, maxlen); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::Pause(char *error, size_t maxlen) |  | ||||||
| { |  | ||||||
| 	if (!m_WeGotPauseChange) |  | ||||||
| 	{ |  | ||||||
| 		if (error) |  | ||||||
| 		{ |  | ||||||
| 			snprintf(error, maxlen, "This extension must be paused by SourceMod."); |  | ||||||
| 		} |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_WeGotPauseChange = false; |  | ||||||
| 
 |  | ||||||
| 	return SDK_OnMetamodPauseChange(true, error, maxlen); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::Unpause(char *error, size_t maxlen) |  | ||||||
| { |  | ||||||
| 	if (!m_WeGotPauseChange) |  | ||||||
| 	{ |  | ||||||
| 		if (error) |  | ||||||
| 		{ |  | ||||||
| 			snprintf(error, maxlen, "This extension must be unpaused by SourceMod."); |  | ||||||
| 		} |  | ||||||
| 		return false; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	m_WeGotPauseChange = false; |  | ||||||
| 
 |  | ||||||
| 	return SDK_OnMetamodPauseChange(false, error, maxlen); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetAuthor() |  | ||||||
| { |  | ||||||
| 	return GetExtensionAuthor(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetDate() |  | ||||||
| { |  | ||||||
| 	return GetExtensionDateString(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetDescription() |  | ||||||
| { |  | ||||||
| 	return GetExtensionDescription(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetLicense() |  | ||||||
| { |  | ||||||
| 	return SMEXT_CONF_LICENSE; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetLogTag() |  | ||||||
| { |  | ||||||
| 	return GetExtensionTag(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetName() |  | ||||||
| { |  | ||||||
| 	return GetExtensionName(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetURL() |  | ||||||
| { |  | ||||||
| 	return GetExtensionURL(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const char *SDKExtension::GetVersion() |  | ||||||
| { |  | ||||||
| 	return GetExtensionVerString(); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::SDK_OnMetamodLoad(char *error, size_t err_max, bool late) |  | ||||||
| { |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t err_max) |  | ||||||
| { |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max) |  | ||||||
| { |  | ||||||
| 	return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| /* Overload a few things to prevent libstdc++ linking */ |  | ||||||
| #if defined __linux__ |  | ||||||
| extern "C" void __cxa_pure_virtual(void) |  | ||||||
| { |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void *operator new(size_t size) |  | ||||||
| { |  | ||||||
| 	return malloc(size); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void *operator new[](size_t size)  |  | ||||||
| { |  | ||||||
| 	return malloc(size); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void operator delete(void *ptr)  |  | ||||||
| { |  | ||||||
| 	free(ptr); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void operator delete[](void * ptr) |  | ||||||
| { |  | ||||||
| 	free(ptr); |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| @ -1,158 +0,0 @@ | |||||||
| /**
 |  | ||||||
|  * =============================================================== |  | ||||||
|  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved. |  | ||||||
|  * =============================================================== |  | ||||||
|  * |  | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  | ||||||
|  * may change at any time.  To view the latest information, see: |  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  | ||||||
|  * |  | ||||||
|  * Version: $Id$ |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ |  | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ |  | ||||||
| 
 |  | ||||||
| #include "smsdk_config.h" |  | ||||||
| #include <IExtensionSys.h> |  | ||||||
| #include <IHandleSys.h> |  | ||||||
| #include <sp_vm_api.h> |  | ||||||
| #include <sm_platform.h> |  | ||||||
| #include <ISourceMod.h> |  | ||||||
| #include <IForwardSys.h> |  | ||||||
| 
 |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| #include <ISmmPlugin.h> |  | ||||||
| #include <eiface.h> |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| using namespace SourceMod; |  | ||||||
| using namespace SourcePawn; |  | ||||||
| 
 |  | ||||||
| class SDKExtension :  |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 	public ISmmPlugin, |  | ||||||
| #endif |  | ||||||
| 	public IExtensionInterface |  | ||||||
| { |  | ||||||
| public: |  | ||||||
| 	SDKExtension(); |  | ||||||
| public: |  | ||||||
| 	/**
 |  | ||||||
| 	 * @brief This is called after the initial loading sequence has been processed. |  | ||||||
| 	 * |  | ||||||
| 	 * @param error		Error message buffer. |  | ||||||
| 	 * @param err_max	Size of error message buffer. |  | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. |  | ||||||
| 	 * @return			True to succeed loading, false to fail. |  | ||||||
| 	 */ |  | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); |  | ||||||
| 	 |  | ||||||
| 	/**
 |  | ||||||
| 	 * @brief This is called right before the extension is unloaded. |  | ||||||
| 	 */ |  | ||||||
| 	virtual void SDK_OnUnload(); |  | ||||||
| 
 |  | ||||||
| 	/**
 |  | ||||||
| 	 * @brief This is called once all known extensions have been loaded. |  | ||||||
| 	 */ |  | ||||||
| 	virtual void SDK_OnAllLoaded(); |  | ||||||
| 
 |  | ||||||
| 	/**
 |  | ||||||
| 	 * @brief Called when the pause state is changed. |  | ||||||
| 	 */ |  | ||||||
| 	virtual void SDK_OnPauseChange(bool paused); |  | ||||||
| 
 |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| 	/**
 |  | ||||||
| 	 * @brief Called when Metamod is attached, before the extension version is called. |  | ||||||
| 	 * |  | ||||||
| 	 * @param error			Error buffer. |  | ||||||
| 	 * @param err_max		Maximum size of error buffer. |  | ||||||
| 	 * @param late			Whether or not Metamod considers this a late load. |  | ||||||
| 	 * @return				True to succeed, false to fail. |  | ||||||
| 	 */ |  | ||||||
| 	virtual bool SDK_OnMetamodLoad(char *error, size_t err_max, bool late); |  | ||||||
| 
 |  | ||||||
| 	/**
 |  | ||||||
| 	 * @brief Called when Metamod is detaching, after the extension version is called. |  | ||||||
| 	 * NOTE: By default this is blocked unless sent from SourceMod. |  | ||||||
| 	 * |  | ||||||
| 	 * @param error			Error buffer. |  | ||||||
| 	 * @param err_max		Maximum size of error buffer. |  | ||||||
| 	 * @return				True to succeed, false to fail. |  | ||||||
| 	 */ |  | ||||||
| 	virtual bool SDK_OnMetamodUnload(char *error, size_t err_max); |  | ||||||
| 
 |  | ||||||
| 	/**
 |  | ||||||
| 	 * @brief Called when Metamod's pause state is changing. |  | ||||||
| 	 * NOTE: By default this is blocked unless sent from SourceMod. |  | ||||||
| 	 * |  | ||||||
| 	 * @param paused		Pause state being set. |  | ||||||
| 	 * @param error			Error buffer. |  | ||||||
| 	 * @param err_max		Maximum size of error buffer. |  | ||||||
| 	 * @return				True to succeed, false to fail. |  | ||||||
| 	 */ |  | ||||||
| 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max); |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| public: //IExtensionInterface
 |  | ||||||
| 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late); |  | ||||||
| 	virtual void OnExtensionUnload(); |  | ||||||
| 	virtual void OnExtensionsAllLoaded(); |  | ||||||
| 	virtual bool IsMetamodExtension(); |  | ||||||
| 	virtual void OnExtensionPauseChange(bool state); |  | ||||||
| 	virtual const char *GetExtensionName(); |  | ||||||
| 	virtual const char *GetExtensionURL(); |  | ||||||
| 	virtual const char *GetExtensionTag(); |  | ||||||
| 	virtual const char *GetExtensionAuthor(); |  | ||||||
| 	virtual const char *GetExtensionVerString(); |  | ||||||
| 	virtual const char *GetExtensionDescription(); |  | ||||||
| 	virtual const char *GetExtensionDateString(); |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| public: //ISmmPlugin
 |  | ||||||
| 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late); |  | ||||||
| 	virtual const char *GetAuthor(); |  | ||||||
| 	virtual const char *GetName(); |  | ||||||
| 	virtual const char *GetDescription(); |  | ||||||
| 	virtual const char *GetURL(); |  | ||||||
| 	virtual const char *GetLicense(); |  | ||||||
| 	virtual const char *GetVersion(); |  | ||||||
| 	virtual const char *GetDate(); |  | ||||||
| 	virtual const char *GetLogTag(); |  | ||||||
| 	virtual bool Unload(char *error, size_t maxlen); |  | ||||||
| 	virtual bool Pause(char *error, size_t maxlen); |  | ||||||
| 	virtual bool Unpause(char *error, size_t maxlen); |  | ||||||
| private: |  | ||||||
| 	bool m_SourceMMLoaded; |  | ||||||
| 	bool m_WeAreUnloaded; |  | ||||||
| 	bool m_WeGotPauseChange; |  | ||||||
| #endif |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| extern SDKExtension *g_pExtensionIface; |  | ||||||
| 
 |  | ||||||
| extern IShareSys *g_pShareSys; |  | ||||||
| extern IExtension *myself; |  | ||||||
| extern IHandleSys *g_pHandleSys; |  | ||||||
| extern ISourceMod *g_pSM; |  | ||||||
| extern IForwardManager *g_pForwards; |  | ||||||
| 
 |  | ||||||
| #if defined SMEXT_CONF_METAMOD |  | ||||||
| PLUGIN_GLOBALVARS(); |  | ||||||
| extern IVEngineServer *engine; |  | ||||||
| extern IServerGameDLL *gamedll; |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION |  | ||||||
| #define SM_GET_IFACE(prefix,addr) \ |  | ||||||
| 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) { \ |  | ||||||
| 	 if (error) { \ |  | ||||||
| 		snprintf(error, err_max, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ |  | ||||||
| 	 } \ |  | ||||||
| 	 return false; \ |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 |  | ||||||
| @ -14,7 +14,7 @@ PROJECT = threader | |||||||
| #Uncomment for SourceMM-enabled extensions
 | #Uncomment for SourceMM-enabled extensions
 | ||||||
| #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | ||||||
| 
 | 
 | ||||||
| OBJECTS = extension.cpp smsdk_ext.cpp thread/BaseWorker.cpp thread/PosixThreads.cpp \
 | OBJECTS = sdk/smsdk_ext.cpp extension.cpp thread/BaseWorker.cpp thread/PosixThreads.cpp \
 | ||||||
| 	  thread/ThreadWorker.cpp | 	  thread/ThreadWorker.cpp | ||||||
| 
 | 
 | ||||||
| ##############################################
 | ##############################################
 | ||||||
| @ -33,7 +33,7 @@ SMM_TRUNK = $(SOURCEMM)/trunk | |||||||
| 
 | 
 | ||||||
| LINK = $(LINK_HL2) -lpthread -static-libgcc | LINK = $(LINK_HL2) -lpthread -static-libgcc | ||||||
| 
 | 
 | ||||||
| INCLUDE = -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | INCLUDE = -I. -I.. -Isdk -Ithread -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | ||||||
|           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 |           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 | ||||||
| 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | ||||||
| 
 | 
 | ||||||
| @ -61,20 +61,16 @@ endif | |||||||
| BINARY = $(PROJECT).ext.so | BINARY = $(PROJECT).ext.so | ||||||
| 
 | 
 | ||||||
| OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) | OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) | ||||||
| OBJ_LINUX := $(OBJECTS:%.c=$(BIN_DIR)/%.o) |  | ||||||
| 
 | 
 | ||||||
| $(BIN_DIR)/%.o: %.cpp | $(BIN_DIR)/%.o: %.cpp | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | ||||||
| 
 | 
 | ||||||
| $(BIN_DIR)/%.o: %.c |  | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $< |  | ||||||
| 
 |  | ||||||
| all: | all: | ||||||
|  | 	mkdir -p $(BIN_DIR)/sdk | ||||||
| 	mkdir -p $(BIN_DIR)/thread | 	mkdir -p $(BIN_DIR)/thread | ||||||
| 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | ||||||
| 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | ||||||
| 	$(MAKE) extension | 	$(MAKE) extension | ||||||
| 	rm -rf $(BINARY) |  | ||||||
| 
 | 
 | ||||||
| extension: $(OBJ_LINUX) | extension: $(OBJ_LINUX) | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | ||||||
| @ -86,7 +82,10 @@ default: all | |||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -rf Release/*.o | 	rm -rf Release/*.o | ||||||
|  | 	rm -rf Release/sdk/*.o | ||||||
|  | 	rm -rf Release/thread/*.o | ||||||
| 	rm -rf Release/$(BINARY) | 	rm -rf Release/$(BINARY) | ||||||
| 	rm -rf Debug/*.o | 	rm -rf Debug/*.o | ||||||
|  | 	rm -rf Debug/sdk/*.o | ||||||
|  | 	rm -rf Debug/thread/*.o | ||||||
| 	rm -rf Debug/$(BINARY) | 	rm -rf Debug/$(BINARY) | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threading Extension, (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threading Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
| @ -20,12 +24,17 @@ | |||||||
| #include "extension.h" | #include "extension.h" | ||||||
| #include "thread/ThreadSupport.h" | #include "thread/ThreadSupport.h" | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file extension.cpp | ||||||
|  |  * @brief Implements threader extension code. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| Sample g_Sample; | Sample g_Sample; | ||||||
| MainThreader g_Threader; | MainThreader g_Threader; | ||||||
| 
 | 
 | ||||||
| SMEXT_LINK(&g_Sample); | SMEXT_LINK(&g_Sample); | ||||||
| 
 | 
 | ||||||
| bool Sample::SDK_OnLoad(char *error, size_t err_max, bool late) | bool Sample::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	g_pShareSys->AddInterface(myself, &g_Threader); | 	g_pShareSys->AddInterface(myself, &g_Threader); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threading Extension, (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threading Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
| @ -20,10 +24,15 @@ | |||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file extension.h | ||||||
|  |  * @brief Threader extension code header. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #include "smsdk_ext.h" | #include "smsdk_ext.h" | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * @brief Sample implementation of the SDK Extension. |  * @brief Implementation of the threader extension. | ||||||
|  * Note: Uncomment one of the pre-defined virtual functions in order to use it. |  * Note: Uncomment one of the pre-defined virtual functions in order to use it. | ||||||
|  */ |  */ | ||||||
| class Sample : public SDKExtension | class Sample : public SDKExtension | ||||||
| @ -33,11 +42,11 @@ public: | |||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -59,20 +68,43 @@ public: | |||||||
| 	 * @brief this is called when Core wants to know if your extension is working. | 	 * @brief this is called when Core wants to know if your extension is working. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @return			True if working, false otherwise. | 	 * @return			True if working, false otherwise. | ||||||
| 	 */ | 	 */ | ||||||
| 	//virtual void QueryRunning(char *error, size_t maxlength);
 | 	//virtual bool QueryRunning(char *error, size_t maxlength);
 | ||||||
| public: | public: | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * Read smext_base.h for documentation on these. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
 | ||||||
| 
 | 
 | ||||||
| 	//virtual bool SDK_OnMetamodLoad(char *error, size_t err_max, bool late);
 | 	/**
 | ||||||
| 	//virtual bool SDK_OnMetamodUnload(char *error, size_t err_max);
 | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max);
 | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
 | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when Metamod's pause state is changing. | ||||||
|  | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param paused		Pause state being set. | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
 | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ | |||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				Optimization="0" | 				Optimization="0" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;THREADER_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SM_DEFAULT_THREADER" | 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;THREADER_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SM_DEFAULT_THREADER" | ||||||
| 				MinimalRebuild="true" | 				MinimalRebuild="true" | ||||||
| 				BasicRuntimeChecks="3" | 				BasicRuntimeChecks="3" | ||||||
| @ -117,7 +117,7 @@ | |||||||
| 			/> | 			/> | ||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\extensions;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;THREADER_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SM_DEFAULT_THREADER" | 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;THREADER_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;SM_DEFAULT_THREADER" | ||||||
| 				RuntimeLibrary="0" | 				RuntimeLibrary="0" | ||||||
| 				UsePrecompiledHeader="0" | 				UsePrecompiledHeader="0" | ||||||
| @ -176,7 +176,7 @@ | |||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Source Files" | 			Name="Source Files" | ||||||
| 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | 			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||||
| 			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" | 			UniqueIdentifier="{AF1F0882-7834-4b25-8FF4-8AE88FF3D230}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\extension.cpp" | 				RelativePath="..\extension.cpp" | ||||||
| @ -186,7 +186,7 @@ | |||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Header Files" | 			Name="Header Files" | ||||||
| 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | 			Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||||
| 			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" | 			UniqueIdentifier="{58F53513-7C9D-4829-8207-87DB91891933}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\extension.h" | 				RelativePath="..\extension.h" | ||||||
| @ -200,7 +200,7 @@ | |||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Resource Files" | 			Name="Resource Files" | ||||||
| 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | 			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" | ||||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | 			UniqueIdentifier="{30794439-9707-4eb8-856E-1C744BC92016}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\version.rc" | 				RelativePath="..\version.rc" | ||||||
| @ -208,26 +208,30 @@ | |||||||
| 			</File> | 			</File> | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="SDK" | 			Name="SourceMod SDK" | ||||||
|  | 			UniqueIdentifier="{E312F93E-1E7F-4eda-B714-99948F5010E4}" | ||||||
| 			> | 			> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\smsdk_config.h" | 				RelativePath="..\sdk\smsdk_config.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\smsdk_ext.cpp" | 				RelativePath="..\sdk\smsdk_ext.cpp" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File | 			<File | ||||||
| 				RelativePath="..\smsdk_ext.h" | 				RelativePath="..\sdk\smsdk_ext.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Threader" | 			Name="Threader" | ||||||
|  | 			UniqueIdentifier="{D832C58B-B863-4673-9DD4-9C6AC8090957}" | ||||||
| 			> | 			> | ||||||
| 			<Filter | 			<Filter | ||||||
| 				Name="Source Files" | 				Name="Source Files" | ||||||
|  | 				Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" | ||||||
|  | 				UniqueIdentifier="{2C648E20-AD2B-40db-B8ED-43D383549B98}" | ||||||
| 				> | 				> | ||||||
| 				<File | 				<File | ||||||
| 					RelativePath="..\thread\BaseWorker.cpp" | 					RelativePath="..\thread\BaseWorker.cpp" | ||||||
| @ -244,6 +248,8 @@ | |||||||
| 			</Filter> | 			</Filter> | ||||||
| 			<Filter | 			<Filter | ||||||
| 				Name="Header Files" | 				Name="Header Files" | ||||||
|  | 				Filter="h;hpp;hxx;hm;inl;inc;xsd" | ||||||
|  | 				UniqueIdentifier="{A68ED1BF-A883-4cdf-AF82-6E82ACFF1752}" | ||||||
| 				> | 				> | ||||||
| 				<File | 				<File | ||||||
| 					RelativePath="..\thread\BaseWorker.h" | 					RelativePath="..\thread\BaseWorker.h" | ||||||
| @ -267,6 +273,15 @@ | |||||||
| 				</File> | 				</File> | ||||||
| 			</Filter> | 			</Filter> | ||||||
| 		</Filter> | 		</Filter> | ||||||
|  | 		<Filter | ||||||
|  | 			Name="Interfaces" | ||||||
|  | 			UniqueIdentifier="{71DC7197-8B2B-4eec-9598-83C6AA9454FF}" | ||||||
|  | 			> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\..\..\public\extensions\IThreader.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 		</Filter> | ||||||
| 	</Files> | 	</Files> | ||||||
| 	<Globals> | 	<Globals> | ||||||
| 	</Globals> | 	</Globals> | ||||||
|  | |||||||
							
								
								
									
										49
									
								
								extensions/threader/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								extensions/threader/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,49 @@ | |||||||
|  | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | #include "svn_version.h" | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_config.h | ||||||
|  |  * @brief Contains macros for configuring basic extension information. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* Basic information exposed publicly */ | ||||||
|  | #define SMEXT_CONF_NAME			"Threader" | ||||||
|  | #define SMEXT_CONF_DESCRIPTION	"Provides threading to other modules" | ||||||
|  | #define SMEXT_CONF_VERSION		SVN_FULL_VERSION | ||||||
|  | #define SMEXT_CONF_AUTHOR		"AlliedModders" | ||||||
|  | #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 | ||||||
|  | #define SMEXT_CONF_LOGTAG		"THREADER" | ||||||
|  | #define SMEXT_CONF_LICENSE		"GPL" | ||||||
|  | #define SMEXT_CONF_DATESTRING	__DATE__ | ||||||
|  | 
 | ||||||
|  | /** 
 | ||||||
|  |  * @brief Exposes plugin's main interface. | ||||||
|  |  */ | ||||||
|  | #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Sets whether or not this plugin required Metamod. | ||||||
|  |  * NOTE: Uncomment to enable, comment to disable. | ||||||
|  |  */ | ||||||
|  | //#define SMEXT_CONF_METAMOD		
 | ||||||
|  | 
 | ||||||
|  | #endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 | ||||||
| @ -5,11 +5,13 @@ | |||||||
|  * All rights reserved. |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -44,7 +46,7 @@ SDKExtension::SDKExtension() | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late) | bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	g_pShareSys = sys; | 	g_pShareSys = sys; | ||||||
| 	myself = me; | 	myself = me; | ||||||
| @ -56,7 +58,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	{ | 	{ | ||||||
| 		if (error) | 		if (error) | ||||||
| 		{ | 		{ | ||||||
| 			snprintf(error, err_max, "Metamod attach failed"); | 			snprintf(error, maxlength, "Metamod attach failed"); | ||||||
| 		} | 		} | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| @ -66,7 +68,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	SM_GET_IFACE(SOURCEMOD, g_pSM); | 	SM_GET_IFACE(SOURCEMOD, g_pSM); | ||||||
| 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | ||||||
| 
 | 
 | ||||||
| 	if (SDK_OnLoad(error, err_max, late)) | 	if (SDK_OnLoad(error, maxlength, late)) | ||||||
| 	{ | 	{ | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 		m_WeAreUnloaded = true; | 		m_WeAreUnloaded = true; | ||||||
| @ -142,7 +144,7 @@ const char *SDKExtension::GetExtensionURL() | |||||||
| 	return SMEXT_CONF_URL; | 	return SMEXT_CONF_URL; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnLoad(char *error, size_t err_max, bool late) | bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -198,7 +200,7 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, | |||||||
| 
 | 
 | ||||||
| 	m_SourceMMLoaded = true; | 	m_SourceMMLoaded = true; | ||||||
| 
 | 
 | ||||||
| 	return SDK_OnMetamodLoad(error, maxlen, late); | 	return SDK_OnMetamodLoad(ismm, error, maxlen, late); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::Unload(char *error, size_t maxlen) | bool SDKExtension::Unload(char *error, size_t maxlen) | ||||||
| @ -287,17 +289,17 @@ const char *SDKExtension::GetVersion() | |||||||
| 	return GetExtensionVerString(); | 	return GetExtensionVerString(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodLoad(char *error, size_t err_max, bool late) | bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -330,4 +332,3 @@ void operator delete[](void * ptr) | |||||||
| 	free(ptr); | 	free(ptr); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 |  | ||||||
| @ -1,13 +1,17 @@ | |||||||
| /**
 | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved. |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -15,6 +19,11 @@ | |||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ | #define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ | ||||||
| 
 | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_ext.h | ||||||
|  |  * @brief Contains wrappers for making Extensions easier to write. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #include "smsdk_config.h" | #include "smsdk_config.h" | ||||||
| #include <IExtensionSys.h> | #include <IExtensionSys.h> | ||||||
| #include <IHandleSys.h> | #include <IHandleSys.h> | ||||||
| @ -38,17 +47,18 @@ class SDKExtension : | |||||||
| 	public IExtensionInterface | 	public IExtensionInterface | ||||||
| { | { | ||||||
| public: | public: | ||||||
|  | 	/** Constructor */ | ||||||
| 	SDKExtension(); | 	SDKExtension(); | ||||||
| public: | public: | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -70,21 +80,21 @@ public: | |||||||
| 	 * @brief Called when Metamod is attached, before the extension version is called. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @param late			Whether or not Metamod considers this a late load. | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodLoad(char *error, size_t err_max, bool late); | 	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod is detaching, after the extension version is called. | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	 * NOTE: By default this is blocked unless sent from SourceMod. | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodUnload(char *error, size_t err_max); | 	virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength); | ||||||
| 
 | 
 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief Called when Metamod's pause state is changing. | 	 * @brief Called when Metamod's pause state is changing. | ||||||
| @ -92,38 +102,66 @@ public: | |||||||
| 	 * | 	 * | ||||||
| 	 * @param paused		Pause state being set. | 	 * @param paused		Pause state being set. | ||||||
| 	 * @param error			Error buffer. | 	 * @param error			Error buffer. | ||||||
| 	 * @param err_max		Maximum size of error buffer. | 	 * @param maxlength		Maximum size of error buffer. | ||||||
| 	 * @return				True to succeed, false to fail. | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max); | 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| public: //IExtensionInterface
 | public: // IExtensionInterface
 | ||||||
| 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late); | 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late); | ||||||
| 	virtual void OnExtensionUnload(); | 	virtual void OnExtensionUnload(); | ||||||
| 	virtual void OnExtensionsAllLoaded(); | 	virtual void OnExtensionsAllLoaded(); | ||||||
|  | 
 | ||||||
|  | 	/** Returns whether or not this is a Metamod-based extension */ | ||||||
| 	virtual bool IsMetamodExtension(); | 	virtual bool IsMetamodExtension(); | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when the pause state changes. | ||||||
|  | 	 *  | ||||||
|  | 	 * @param state			True if being paused, false if being unpaused. | ||||||
|  | 	 */ | ||||||
| 	virtual void OnExtensionPauseChange(bool state); | 	virtual void OnExtensionPauseChange(bool state); | ||||||
|  | 
 | ||||||
|  | 	/** Returns name */ | ||||||
| 	virtual const char *GetExtensionName(); | 	virtual const char *GetExtensionName(); | ||||||
|  | 	/** Returns URL */ | ||||||
| 	virtual const char *GetExtensionURL(); | 	virtual const char *GetExtensionURL(); | ||||||
|  | 	/** Returns log tag */ | ||||||
| 	virtual const char *GetExtensionTag(); | 	virtual const char *GetExtensionTag(); | ||||||
|  | 	/** Returns author */ | ||||||
| 	virtual const char *GetExtensionAuthor(); | 	virtual const char *GetExtensionAuthor(); | ||||||
|  | 	/** Returns version string */ | ||||||
| 	virtual const char *GetExtensionVerString(); | 	virtual const char *GetExtensionVerString(); | ||||||
|  | 	/** Returns description string */ | ||||||
| 	virtual const char *GetExtensionDescription(); | 	virtual const char *GetExtensionDescription(); | ||||||
|  | 	/** Returns date string */ | ||||||
| 	virtual const char *GetExtensionDateString(); | 	virtual const char *GetExtensionDateString(); | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| public: //ISmmPlugin
 | public: // ISmmPlugin
 | ||||||
| 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late); | 	/** Called when the extension is attached to Metamod. */ | ||||||
|  | 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, bool late); | ||||||
|  | 	/** Returns the author to MM */ | ||||||
| 	virtual const char *GetAuthor(); | 	virtual const char *GetAuthor(); | ||||||
|  | 	/** Returns the name to MM */ | ||||||
| 	virtual const char *GetName(); | 	virtual const char *GetName(); | ||||||
|  | 	/** Returns the description to MM */ | ||||||
| 	virtual const char *GetDescription(); | 	virtual const char *GetDescription(); | ||||||
|  | 	/** Returns the URL to MM */ | ||||||
| 	virtual const char *GetURL(); | 	virtual const char *GetURL(); | ||||||
|  | 	/** Returns the license to MM */ | ||||||
| 	virtual const char *GetLicense(); | 	virtual const char *GetLicense(); | ||||||
|  | 	/** Returns the version string to MM */ | ||||||
| 	virtual const char *GetVersion(); | 	virtual const char *GetVersion(); | ||||||
|  | 	/** Returns the date string to MM */ | ||||||
| 	virtual const char *GetDate(); | 	virtual const char *GetDate(); | ||||||
|  | 	/** Returns the logtag to MM */ | ||||||
| 	virtual const char *GetLogTag(); | 	virtual const char *GetLogTag(); | ||||||
|  | 	/** Called on unload */ | ||||||
| 	virtual bool Unload(char *error, size_t maxlen); | 	virtual bool Unload(char *error, size_t maxlen); | ||||||
|  | 	/** Called on pause */ | ||||||
| 	virtual bool Pause(char *error, size_t maxlen); | 	virtual bool Pause(char *error, size_t maxlen); | ||||||
|  | 	/** Called on unpause */ | ||||||
| 	virtual bool Unpause(char *error, size_t maxlen); | 	virtual bool Unpause(char *error, size_t maxlen); | ||||||
| private: | private: | ||||||
| 	bool m_SourceMMLoaded; | 	bool m_SourceMMLoaded; | ||||||
| @ -146,13 +184,30 @@ extern IVEngineServer *engine; | |||||||
| extern IServerGameDLL *gamedll; | extern IServerGameDLL *gamedll; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | /** Creates a SourceMod interface macro pair */ | ||||||
| #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | ||||||
| #define SM_GET_IFACE(prefix,addr) \ | /** Automates retrieving SourceMod interfaces */ | ||||||
| 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) { \ | #define SM_GET_IFACE(prefix, addr) \ | ||||||
| 	 if (error) { \ | 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \ | ||||||
| 		snprintf(error, err_max, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | 	{ \ | ||||||
| 	 } \ | 		if (error) \ | ||||||
| 	 return false; \ | 		{ \ | ||||||
|  | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
|  | 	} | ||||||
|  | /** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */ | ||||||
|  | #define SM_GET_LATE_IFACE(prefix, addr) \ | ||||||
|  | 	g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr) | ||||||
|  | /** Validates a SourceMod interface pointer */ | ||||||
|  | #define SM_CHECK_IFACE(prefix, addr) \ | ||||||
|  | 	if (!addr) \ | ||||||
|  | 	{ \ | ||||||
|  | 		if (error) \ | ||||||
|  | 		{ \ | ||||||
|  | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | ||||||
| @ -1,47 +0,0 @@ | |||||||
| /**
 |  | ||||||
|  * SourceMod Threading Extension, (C)2007 AlliedModders LLC.  All rights reserved. |  | ||||||
|  * |  | ||||||
|  * This program is free software; you can redistribute it and/or |  | ||||||
|  * modify it under the terms of the GNU General Public License |  | ||||||
|  * as published by the Free Software Foundation; either version 2 |  | ||||||
|  * of the License, or (at your option) any later version. |  | ||||||
|  * This program is distributed in the hope that it will be useful, |  | ||||||
|  * but WITHOUT ANY WARRANTY; without even the implied warranty of |  | ||||||
|  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the |  | ||||||
|  * GNU General Public License for more details. |  | ||||||
|  *  |  | ||||||
|  * You should have received a copy of the GNU General Public License |  | ||||||
|  * along with this program; if not, write to the Free Software |  | ||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |  | ||||||
|  * |  | ||||||
|  * Version: $Id$ |  | ||||||
|  */ |  | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| 
 |  | ||||||
| #include "svn_version.h" |  | ||||||
| 
 |  | ||||||
| /* Basic information exposed publically */ |  | ||||||
| #define SMEXT_CONF_NAME			"Threader" |  | ||||||
| #define SMEXT_CONF_DESCRIPTION	"Provides threading to other modules" |  | ||||||
| #define SMEXT_CONF_VERSION		SVN_FULL_VERSION |  | ||||||
| #define SMEXT_CONF_AUTHOR		"AlliedModders" |  | ||||||
| #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 |  | ||||||
| #define SMEXT_CONF_LOGTAG		"THREADER" |  | ||||||
| #define SMEXT_CONF_LICENSE		"GPL" |  | ||||||
| #define SMEXT_CONF_DATESTRING	__DATE__ |  | ||||||
| 
 |  | ||||||
| /** 
 |  | ||||||
|  * @brief Exposes plugin's main interface. |  | ||||||
|  */ |  | ||||||
| #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @brief Sets whether or not this plugin required Metamod. |  | ||||||
|  * NOTE: Uncomment to enable, comment to disable. |  | ||||||
|  * NOTE: This is enabled automatically if a Metamod build is chosen in  |  | ||||||
|  *		 the Visual Studio project. |  | ||||||
|  */ |  | ||||||
| //#define SMEXT_CONF_METAMOD		
 |  | ||||||
| 
 |  | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 |  | ||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
| @ -295,4 +299,3 @@ void PosixThreader::PosixEventSignal::DestroyThis() | |||||||
| { | { | ||||||
|         delete this; |         delete this; | ||||||
| } | } | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
| @ -321,4 +325,3 @@ void WinThreader::WinEvent::DestroyThis() | |||||||
| { | { | ||||||
| 	delete this; | 	delete this; | ||||||
| } | } | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,5 +1,9 @@ | |||||||
| /**
 | /**
 | ||||||
|  * SourceMod Threader API (C)2007 AlliedModders LLC.  All rights reserved. |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod Threader API | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or |  * This program is free software; you can redistribute it and/or | ||||||
|  * modify it under the terms of the GNU General Public License |  * modify it under the terms of the GNU General Public License | ||||||
|  | |||||||
| @ -14,7 +14,7 @@ PROJECT = sample | |||||||
| #Uncomment for SourceMM-enabled extensions
 | #Uncomment for SourceMM-enabled extensions
 | ||||||
| #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | #LINK_HL2 = $(HL2LIB)/tier1_i486.a vstdlib_i486.so tier0_i486.so 
 | ||||||
| 
 | 
 | ||||||
| OBJECTS = extension.cpp smsdk_ext.cpp | OBJECTS = sdk/smsdk_ext.cpp extension.cpp | ||||||
| 
 | 
 | ||||||
| ##############################################
 | ##############################################
 | ||||||
| ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ###
 | ||||||
| @ -32,7 +32,7 @@ SMM_TRUNK = $(SOURCEMM)/trunk | |||||||
| 
 | 
 | ||||||
| LINK = $(LINK_HL2) -static-libgcc | LINK = $(LINK_HL2) -static-libgcc | ||||||
| 
 | 
 | ||||||
| INCLUDE = -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | INCLUDE = -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/dlls -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
 | ||||||
|           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 |           -I$(HL2PUB)/vstdlib -I$(HL2SDK)/tier1 -I$(SMM_TRUNK) -I$(SMM_TRUNK)/sourcehook -I$(SMM_TRUNK)/sourcemm \
 | ||||||
| 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | 	  -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
 | ||||||
| 
 | 
 | ||||||
| @ -65,11 +65,10 @@ $(BIN_DIR)/%.o: %.cpp | |||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< | ||||||
| 
 | 
 | ||||||
| all: | all: | ||||||
| 	mkdir -p $(BIN_DIR) | 	mkdir -p $(BIN_DIR)/sdk | ||||||
| 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | 	ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so | ||||||
| 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | 	ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so | ||||||
| 	$(MAKE) extension | 	$(MAKE) extension | ||||||
| 	rm -rf $(BINARY) |  | ||||||
| 
 | 
 | ||||||
| extension: $(OBJ_LINUX) | extension: $(OBJ_LINUX) | ||||||
| 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | 	$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY) | ||||||
| @ -81,7 +80,8 @@ default: all | |||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -rf Release/*.o | 	rm -rf Release/*.o | ||||||
|  | 	rm -rf Release/sdk/*.o | ||||||
| 	rm -rf Release/$(BINARY) | 	rm -rf Release/$(BINARY) | ||||||
| 	rm -rf Debug/*.o | 	rm -rf Debug/*.o | ||||||
|  | 	rm -rf Debug/sdk/*.o | ||||||
| 	rm -rf Debug/$(BINARY) | 	rm -rf Debug/$(BINARY) | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,4 +1,26 @@ | |||||||
| // vim: set ts=4 :
 | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * Sample SourceMod Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  * This program is free software; you can redistribute it and/or | ||||||
|  |  * modify it under the terms of the GNU General Public License | ||||||
|  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  |  * of the License, or (at your option) any later version. | ||||||
|  |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  |  *  | ||||||
|  |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #include "extension.h" | #include "extension.h" | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
| @ -6,7 +28,6 @@ | |||||||
|  * @brief Implement extension code here. |  * @brief Implement extension code here. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| Sample g_Sample;		/**< Global singleton for your extension's main interface */ | Sample g_Sample;		/**< Global singleton for extension's main interface */ | ||||||
| 
 | 
 | ||||||
| SMEXT_LINK(&g_Sample); | SMEXT_LINK(&g_Sample); | ||||||
| 
 |  | ||||||
|  | |||||||
| @ -1,4 +1,26 @@ | |||||||
| // vim: set ts=4 :
 | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * Sample SourceMod Extension | ||||||
|  |  * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  * This program is free software; you can redistribute it and/or | ||||||
|  |  * modify it under the terms of the GNU General Public License | ||||||
|  |  * as published by the Free Software Foundation; either version 2 | ||||||
|  |  * of the License, or (at your option) any later version. | ||||||
|  |  * This program is distributed in the hope that it will be useful, | ||||||
|  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
|  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||||
|  |  * GNU General Public License for more details. | ||||||
|  |  *  | ||||||
|  |  * You should have received a copy of the GNU General Public License | ||||||
|  |  * along with this program; if not, write to the Free Software | ||||||
|  |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | #define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ | ||||||
| 
 | 
 | ||||||
| @ -7,7 +29,6 @@ | |||||||
|  * @brief Sample extension code header. |  * @brief Sample extension code header. | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| #include "smsdk_ext.h" | #include "smsdk_ext.h" | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -22,11 +43,11 @@ public: | |||||||
| 	 * @brief This is called after the initial loading sequence has been processed. | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @param late		Whether or not the module was loaded after map load. | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
| 	 * @return			True to succeed loading, false to fail. | 	 * @return			True to succeed loading, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
| 	//virtual bool SDK_OnLoad(char *error, size_t err_max, bool late);
 | 	//virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late);
 | ||||||
| 	 | 	 | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * @brief This is called right before the extension is unloaded. | 	 * @brief This is called right before the extension is unloaded. | ||||||
| @ -48,20 +69,43 @@ public: | |||||||
| 	 * @brief this is called when Core wants to know if your extension is working. | 	 * @brief this is called when Core wants to know if your extension is working. | ||||||
| 	 * | 	 * | ||||||
| 	 * @param error		Error message buffer. | 	 * @param error		Error message buffer. | ||||||
| 	 * @param err_max	Size of error message buffer. | 	 * @param maxlength	Size of error message buffer. | ||||||
| 	 * @return			True if working, false otherwise. | 	 * @return			True if working, false otherwise. | ||||||
| 	 */ | 	 */ | ||||||
| 	//virtual void QueryRunning(char *error, size_t maxlength);
 | 	//virtual bool QueryRunning(char *error, size_t maxlength);
 | ||||||
| public: | public: | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 	/**
 | 	/**
 | ||||||
| 	 * Read smext_base.h for documentation on these. | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
| 	 */ | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late);
 | ||||||
| 
 | 
 | ||||||
| 	//virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late);
 | 	/**
 | ||||||
| 	//virtual bool SDK_OnMetamodUnload(char *error, size_t err_max);
 | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
| 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max);
 | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength);
 | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when Metamod's pause state is changing. | ||||||
|  | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param paused		Pause state being set. | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength);
 | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | #endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
 | ||||||
|  | |||||||
| @ -40,7 +40,7 @@ | |||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				Optimization="0" | 				Optimization="0" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | ||||||
| 				MinimalRebuild="true" | 				MinimalRebuild="true" | ||||||
| 				BasicRuntimeChecks="3" | 				BasicRuntimeChecks="3" | ||||||
| @ -117,7 +117,7 @@ | |||||||
| 			/> | 			/> | ||||||
| 			<Tool | 			<Tool | ||||||
| 				Name="VCCLCompilerTool" | 				Name="VCCLCompilerTool" | ||||||
| 				AdditionalIncludeDirectories="..\..\..\public;..\..\..\public\sourcepawn" | 				AdditionalIncludeDirectories="..;..\sdk;..\..\..\public;..\..\..\public\sourcepawn" | ||||||
| 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD" | ||||||
| 				RuntimeLibrary="0" | 				RuntimeLibrary="0" | ||||||
| 				UsePrecompiledHeader="0" | 				UsePrecompiledHeader="0" | ||||||
| @ -182,10 +182,6 @@ | |||||||
| 				RelativePath="..\extension.cpp" | 				RelativePath="..\extension.cpp" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_ext.cpp" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Header Files" | 			Name="Header Files" | ||||||
| @ -196,14 +192,6 @@ | |||||||
| 				RelativePath="..\extension.h" | 				RelativePath="..\extension.h" | ||||||
| 				> | 				> | ||||||
| 			</File> | 			</File> | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_config.h" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 			<File |  | ||||||
| 				RelativePath="..\smsdk_ext.h" |  | ||||||
| 				> |  | ||||||
| 			</File> |  | ||||||
| 		</Filter> | 		</Filter> | ||||||
| 		<Filter | 		<Filter | ||||||
| 			Name="Resource Files" | 			Name="Resource Files" | ||||||
| @ -211,6 +199,23 @@ | |||||||
| 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | 			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" | ||||||
| 			> | 			> | ||||||
| 		</Filter> | 		</Filter> | ||||||
|  | 		<Filter | ||||||
|  | 			Name="SourceMod SDK" | ||||||
|  | 			UniqueIdentifier="{31958233-BB2D-4e41-A8F9-CE8A4684F436}" | ||||||
|  | 			> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_config.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_ext.cpp" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 			<File | ||||||
|  | 				RelativePath="..\sdk\smsdk_ext.h" | ||||||
|  | 				> | ||||||
|  | 			</File> | ||||||
|  | 		</Filter> | ||||||
| 	</Files> | 	</Files> | ||||||
| 	<Globals> | 	<Globals> | ||||||
| 	</Globals> | 	</Globals> | ||||||
|  | |||||||
							
								
								
									
										48
									
								
								public/sample_ext/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								public/sample_ext/sdk/smsdk_config.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,48 @@ | |||||||
|  | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_config.h | ||||||
|  |  * @brief Contains macros for configuring basic extension information. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /* Basic information exposed publicly */ | ||||||
|  | #define SMEXT_CONF_NAME			"Sample Extension" | ||||||
|  | #define SMEXT_CONF_DESCRIPTION	"Sample extension to help developers" | ||||||
|  | #define SMEXT_CONF_VERSION		"0.0.0.0" | ||||||
|  | #define SMEXT_CONF_AUTHOR		"AlliedModders" | ||||||
|  | #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 | ||||||
|  | #define SMEXT_CONF_LOGTAG		"SAMPLE" | ||||||
|  | #define SMEXT_CONF_LICENSE		"GPL" | ||||||
|  | #define SMEXT_CONF_DATESTRING	__DATE__ | ||||||
|  | 
 | ||||||
|  | /** 
 | ||||||
|  |  * @brief Exposes plugin's main interface. | ||||||
|  |  */ | ||||||
|  | #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @brief Sets whether or not this plugin required Metamod. | ||||||
|  |  * NOTE: Uncomment to enable, comment to disable. | ||||||
|  |  */ | ||||||
|  | //#define SMEXT_CONF_METAMOD		
 | ||||||
|  | 
 | ||||||
|  | #endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 | ||||||
| @ -1,13 +1,17 @@ | |||||||
| /**
 | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved. |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  * =============================================================== |  * =============================================================== | ||||||
|  * |  * | ||||||
|  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  * or modified under the Terms and Conditions of its License Agreement, which is found  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  * may change at any time.  To view the latest information, see: |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  *   http://www.sourcemod.net/license.php
 |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  * |  * | ||||||
|  * Version: $Id$ |  * Version: $Id$ | ||||||
|  */ |  */ | ||||||
| @ -16,12 +20,18 @@ | |||||||
| #include <malloc.h> | #include <malloc.h> | ||||||
| #include "smsdk_ext.h" | #include "smsdk_ext.h" | ||||||
| 
 | 
 | ||||||
| IShareSys *g_pShareSys = NULL; | /**
 | ||||||
| IExtension *myself = NULL; |  * @file smsdk_ext.cpp | ||||||
| IHandleSys *g_pHandleSys = NULL; |  * @brief Contains wrappers for making Extensions easier to write. | ||||||
| ISourceMod *g_pSM = NULL; |  */ | ||||||
| IForwardManager *g_pForwards = NULL; |  | ||||||
| 
 | 
 | ||||||
|  | IShareSys *g_pShareSys = NULL;			/**< Share system */ | ||||||
|  | IExtension *myself = NULL;				/**< Ourself */ | ||||||
|  | IHandleSys *g_pHandleSys = NULL;		/**< Handle system */ | ||||||
|  | ISourceMod *g_pSM = NULL;				/**< SourceMod helpers */ | ||||||
|  | IForwardManager *g_pForwards = NULL;	/**< Forward system */ | ||||||
|  | 
 | ||||||
|  | /** Exports the main interface */ | ||||||
| PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI() | PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI() | ||||||
| { | { | ||||||
| 	return g_pExtensionIface; | 	return g_pExtensionIface; | ||||||
| @ -36,7 +46,7 @@ SDKExtension::SDKExtension() | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t err_max, bool late) | bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	g_pShareSys = sys; | 	g_pShareSys = sys; | ||||||
| 	myself = me; | 	myself = me; | ||||||
| @ -48,7 +58,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	{ | 	{ | ||||||
| 		if (error) | 		if (error) | ||||||
| 		{ | 		{ | ||||||
| 			snprintf(error, err_max, "Metamod attach failed"); | 			snprintf(error, maxlength, "Metamod attach failed"); | ||||||
| 		} | 		} | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| @ -58,7 +68,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, | |||||||
| 	SM_GET_IFACE(SOURCEMOD, g_pSM); | 	SM_GET_IFACE(SOURCEMOD, g_pSM); | ||||||
| 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | 	SM_GET_IFACE(FORWARDMANAGER, g_pForwards); | ||||||
| 
 | 
 | ||||||
| 	if (SDK_OnLoad(error, err_max, late)) | 	if (SDK_OnLoad(error, maxlength, late)) | ||||||
| 	{ | 	{ | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 		m_WeAreUnloaded = true; | 		m_WeAreUnloaded = true; | ||||||
| @ -134,7 +144,7 @@ const char *SDKExtension::GetExtensionURL() | |||||||
| 	return SMEXT_CONF_URL; | 	return SMEXT_CONF_URL; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnLoad(char *error, size_t err_max, bool late) | bool SDKExtension::SDK_OnLoad(char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -153,14 +163,15 @@ void SDKExtension::SDK_OnAllLoaded() | |||||||
| 
 | 
 | ||||||
| #if defined SMEXT_CONF_METAMOD | #if defined SMEXT_CONF_METAMOD | ||||||
| 
 | 
 | ||||||
| PluginId g_PLID = 0; | PluginId g_PLID = 0;						/**< Metamod plugin ID */ | ||||||
| ISmmPlugin *g_PLAPI = NULL; | ISmmPlugin *g_PLAPI = NULL;					/**< Metamod plugin API */ | ||||||
| SourceHook::ISourceHook *g_SHPtr = NULL; | SourceHook::ISourceHook *g_SHPtr = NULL;	/**< SourceHook pointer */ | ||||||
| ISmmAPI *g_SMAPI = NULL; | ISmmAPI *g_SMAPI = NULL;					/**< SourceMM API pointer */ | ||||||
| 
 | 
 | ||||||
| IVEngineServer *engine = NULL; | IVEngineServer *engine = NULL;				/**< IVEngineServer pointer */ | ||||||
| IServerGameDLL *gamedll = NULL; | IServerGameDLL *gamedll = NULL;				/**< IServerGameDLL pointer */ | ||||||
| 
 | 
 | ||||||
|  | /** Exposes the extension to Metamod */ | ||||||
| SMM_API void *PL_EXPOSURE(const char *name, int *code) | SMM_API void *PL_EXPOSURE(const char *name, int *code) | ||||||
| { | { | ||||||
| 	if (name && !strcmp(name, PLAPI_NAME)) | 	if (name && !strcmp(name, PLAPI_NAME)) | ||||||
| @ -189,7 +200,7 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen, | |||||||
| 
 | 
 | ||||||
| 	m_SourceMMLoaded = true; | 	m_SourceMMLoaded = true; | ||||||
| 
 | 
 | ||||||
| 	return SDK_OnMetamodLoad(error, maxlen, late); | 	return SDK_OnMetamodLoad(ismm, error, maxlen, late); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::Unload(char *error, size_t maxlen) | bool SDKExtension::Unload(char *error, size_t maxlen) | ||||||
| @ -278,17 +289,17 @@ const char *SDKExtension::GetVersion() | |||||||
| 	return GetExtensionVerString(); | 	return GetExtensionVerString(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodLoad(char *error, size_t err_max, bool late) | bool SDKExtension::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max) | bool SDKExtension::SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength) | ||||||
| { | { | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| @ -321,4 +332,3 @@ void operator delete[](void * ptr) | |||||||
| 	free(ptr); | 	free(ptr); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 |  | ||||||
							
								
								
									
										213
									
								
								public/sample_ext/sdk/smsdk_ext.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										213
									
								
								public/sample_ext/sdk/smsdk_ext.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,213 @@ | |||||||
|  | /**
 | ||||||
|  |  * vim: set ts=4 : | ||||||
|  |  * =============================================================== | ||||||
|  |  * SourceMod, Copyright (C) 2004-2007 AlliedModders LLC.  | ||||||
|  |  * All rights reserved. | ||||||
|  |  * =============================================================== | ||||||
|  |  * | ||||||
|  |  *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be  | ||||||
|  |  * used or modified under the Terms and Conditions of its License Agreement,  | ||||||
|  |  * which is found in public/licenses/LICENSE.txt.  As of this notice, derivative  | ||||||
|  |  * works must be licensed under the GNU General Public License (version 2 or  | ||||||
|  |  * greater).  A copy of the GPL is included under public/licenses/GPL.txt. | ||||||
|  |  *  | ||||||
|  |  * To view the latest information, see: http://www.sourcemod.net/license.php
 | ||||||
|  |  * | ||||||
|  |  * Version: $Id$ | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #ifndef _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ | ||||||
|  | #define _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * @file smsdk_ext.h | ||||||
|  |  * @brief Contains wrappers for making Extensions easier to write. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include "smsdk_config.h" | ||||||
|  | #include <IExtensionSys.h> | ||||||
|  | #include <IHandleSys.h> | ||||||
|  | #include <sp_vm_api.h> | ||||||
|  | #include <sm_platform.h> | ||||||
|  | #include <ISourceMod.h> | ||||||
|  | #include <IForwardSys.h> | ||||||
|  | 
 | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | #include <ISmmPlugin.h> | ||||||
|  | #include <eiface.h> | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | using namespace SourceMod; | ||||||
|  | using namespace SourcePawn; | ||||||
|  | 
 | ||||||
|  | class SDKExtension :  | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 	public ISmmPlugin, | ||||||
|  | #endif | ||||||
|  | 	public IExtensionInterface | ||||||
|  | { | ||||||
|  | public: | ||||||
|  | 	/** Constructor */ | ||||||
|  | 	SDKExtension(); | ||||||
|  | public: | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief This is called after the initial loading sequence has been processed. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error		Error message buffer. | ||||||
|  | 	 * @param maxlength	Size of error message buffer. | ||||||
|  | 	 * @param late		Whether or not the module was loaded after map load. | ||||||
|  | 	 * @return			True to succeed loading, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	virtual bool SDK_OnLoad(char *error, size_t maxlength, bool late); | ||||||
|  | 	 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief This is called right before the extension is unloaded. | ||||||
|  | 	 */ | ||||||
|  | 	virtual void SDK_OnUnload(); | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief This is called once all known extensions have been loaded. | ||||||
|  | 	 */ | ||||||
|  | 	virtual void SDK_OnAllLoaded(); | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when the pause state is changed. | ||||||
|  | 	 */ | ||||||
|  | 	virtual void SDK_OnPauseChange(bool paused); | ||||||
|  | 
 | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when Metamod is attached, before the extension version is called. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @param late			Whether or not Metamod considers this a late load. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	virtual bool SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlength, bool late); | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when Metamod is detaching, after the extension version is called. | ||||||
|  | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	virtual bool SDK_OnMetamodUnload(char *error, size_t maxlength); | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when Metamod's pause state is changing. | ||||||
|  | 	 * NOTE: By default this is blocked unless sent from SourceMod. | ||||||
|  | 	 * | ||||||
|  | 	 * @param paused		Pause state being set. | ||||||
|  | 	 * @param error			Error buffer. | ||||||
|  | 	 * @param maxlength		Maximum size of error buffer. | ||||||
|  | 	 * @return				True to succeed, false to fail. | ||||||
|  | 	 */ | ||||||
|  | 	virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t maxlength); | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | public: //IExtensionInterface
 | ||||||
|  | 	virtual bool OnExtensionLoad(IExtension *me, IShareSys *sys, char *error, size_t maxlength, bool late); | ||||||
|  | 	virtual void OnExtensionUnload(); | ||||||
|  | 	virtual void OnExtensionsAllLoaded(); | ||||||
|  | 
 | ||||||
|  | 	/** Returns whether or not this is a Metamod-based extension */ | ||||||
|  | 	virtual bool IsMetamodExtension(); | ||||||
|  | 
 | ||||||
|  | 	/**
 | ||||||
|  | 	 * @brief Called when the pause state changes. | ||||||
|  | 	 *  | ||||||
|  | 	 * @param state			True if being paused, false if being unpaused. | ||||||
|  | 	 */ | ||||||
|  | 	virtual void OnExtensionPauseChange(bool state); | ||||||
|  | 
 | ||||||
|  | 	/** Returns name */ | ||||||
|  | 	virtual const char *GetExtensionName(); | ||||||
|  | 	/** Returns URL */ | ||||||
|  | 	virtual const char *GetExtensionURL(); | ||||||
|  | 	/** Returns log tag */ | ||||||
|  | 	virtual const char *GetExtensionTag(); | ||||||
|  | 	/** Returns author */ | ||||||
|  | 	virtual const char *GetExtensionAuthor(); | ||||||
|  | 	/** Returns version string */ | ||||||
|  | 	virtual const char *GetExtensionVerString(); | ||||||
|  | 	/** Returns description string */ | ||||||
|  | 	virtual const char *GetExtensionDescription(); | ||||||
|  | 	/** Returns date string */ | ||||||
|  | 	virtual const char *GetExtensionDateString(); | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | public: //ISmmPlugin
 | ||||||
|  | 	/** Called when the extension is attached to Metamod. */ | ||||||
|  | 	virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late); | ||||||
|  | 	/** Returns the author to MM */ | ||||||
|  | 	virtual const char *GetAuthor(); | ||||||
|  | 	/** Returns the name to MM */ | ||||||
|  | 	virtual const char *GetName(); | ||||||
|  | 	/** Returns the description to MM */ | ||||||
|  | 	virtual const char *GetDescription(); | ||||||
|  | 	/** Returns the URL to MM */ | ||||||
|  | 	virtual const char *GetURL(); | ||||||
|  | 	/** Returns the license to MM */ | ||||||
|  | 	virtual const char *GetLicense(); | ||||||
|  | 	/** Returns the version string to MM */ | ||||||
|  | 	virtual const char *GetVersion(); | ||||||
|  | 	/** Returns the date string to MM */ | ||||||
|  | 	virtual const char *GetDate(); | ||||||
|  | 	/** Returns the logtag to MM */ | ||||||
|  | 	virtual const char *GetLogTag(); | ||||||
|  | 	/** Called on unload */ | ||||||
|  | 	virtual bool Unload(char *error, size_t maxlength); | ||||||
|  | 	/** Called on pause */ | ||||||
|  | 	virtual bool Pause(char *error, size_t maxlength); | ||||||
|  | 	/** Called on unpause */ | ||||||
|  | 	virtual bool Unpause(char *error, size_t maxlength); | ||||||
|  | private: | ||||||
|  | 	bool m_SourceMMLoaded; | ||||||
|  | 	bool m_WeAreUnloaded; | ||||||
|  | 	bool m_WeGotPauseChange; | ||||||
|  | #endif | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | extern SDKExtension *g_pExtensionIface; | ||||||
|  | 
 | ||||||
|  | extern IShareSys *g_pShareSys; | ||||||
|  | extern IExtension *myself; | ||||||
|  | extern IHandleSys *g_pHandleSys; | ||||||
|  | extern ISourceMod *g_pSM; | ||||||
|  | extern IForwardManager *g_pForwards; | ||||||
|  | 
 | ||||||
|  | #if defined SMEXT_CONF_METAMOD | ||||||
|  | PLUGIN_GLOBALVARS(); | ||||||
|  | extern IVEngineServer *engine; | ||||||
|  | extern IServerGameDLL *gamedll; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | /** Creates a SourceMod interface macro pair */ | ||||||
|  | #define SM_MKIFACE(name) SMINTERFACE_##name##_NAME, SMINTERFACE_##name##_VERSION | ||||||
|  | /** Automates retrieving SourceMod interfaces */ | ||||||
|  | #define SM_GET_IFACE(prefix, addr) \ | ||||||
|  | 	if (!g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr)) \ | ||||||
|  | 	{ \ | ||||||
|  | 		if (error) \ | ||||||
|  | 		{ \ | ||||||
|  | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
|  | 	} | ||||||
|  | /** Automates retrieving SourceMod interfaces when needed outside of SDK_OnLoad() */ | ||||||
|  | #define SM_GET_LATE_IFACE(prefix, addr) \ | ||||||
|  | 	g_pShareSys->RequestInterface(SM_MKIFACE(prefix), myself, (SMInterface **)&addr) | ||||||
|  | /** Validates a SourceMod interface pointer */ | ||||||
|  | #define SM_CHECK_IFACE(prefix, addr) \ | ||||||
|  | 	if (!addr) \ | ||||||
|  | 	{ \ | ||||||
|  | 		if (error) \ | ||||||
|  | 		{ \ | ||||||
|  | 			snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ | ||||||
|  | 			return false; \ | ||||||
|  | 		} \ | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | #endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
 | ||||||
| @ -1,33 +0,0 @@ | |||||||
| // vim: set ts=4 :
 |  | ||||||
| #ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| #define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @file smsdk_config.h |  | ||||||
|  * @brief Contains macros for configuring basic extension information. |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| /* Basic information exposed publically */ |  | ||||||
| #define SMEXT_CONF_NAME			"Sample Extension" |  | ||||||
| #define SMEXT_CONF_DESCRIPTION	"Sample extension to help developers" |  | ||||||
| #define SMEXT_CONF_VERSION		"0.0.0.0" |  | ||||||
| #define SMEXT_CONF_AUTHOR		"AlliedModders" |  | ||||||
| #define SMEXT_CONF_URL			"http://www.sourcemod.net/"
 |  | ||||||
| #define SMEXT_CONF_LOGTAG		"SAMPLE" |  | ||||||
| #define SMEXT_CONF_LICENSE		"GPL" |  | ||||||
| #define SMEXT_CONF_DATESTRING	__DATE__ |  | ||||||
| 
 |  | ||||||
| /** 
 |  | ||||||
|  * @brief Exposes plugin's main interface. |  | ||||||
|  */ |  | ||||||
| #define SMEXT_LINK(name) SDKExtension *g_pExtensionIface = name; |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * @brief Sets whether or not this plugin required Metamod. |  | ||||||
|  * NOTE: Uncomment to enable, comment to disable. |  | ||||||
|  * NOTE: This is enabled automatically if a Metamod build is chosen in  |  | ||||||
|  *		 the Visual Studio project. |  | ||||||
|  */ |  | ||||||
| //#define SMEXT_CONF_METAMOD		
 |  | ||||||
| 
 |  | ||||||
| #endif //_INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
 |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user