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:
Scott Ehlert
2007-05-09 05:20:03 +00:00
parent 9d9369079a
commit 9decd4196a
61 changed files with 1665 additions and 1255 deletions
+6 -6
View File
@@ -14,7 +14,7 @@ PROJECT = geoip
#Uncomment for SourceMM-enabled extensions
#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 ###
@@ -32,7 +32,7 @@ SMM_TRUNK = $(SOURCEMM)/trunk
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$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(SMSDK)/public/extensions \
@@ -60,7 +60,7 @@ endif
BINARY = $(PROJECT).ext.so
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
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
@@ -69,11 +69,10 @@ $(BIN_DIR)/%.o: %.c
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
all:
mkdir -p $(BIN_DIR)
mkdir -p $(BIN_DIR)/sdk
ln -sf $(SRCDS)/bin/vstdlib_i486.so vstdlib_i486.so
ln -sf $(SRCDS)/bin/tier0_i486.so tier0_i486.so
$(MAKE) extension
rm -rf $(BINARY)
extension: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
@@ -85,7 +84,8 @@ default: all
clean:
rm -rf Release/*.o
rm -rf Release/sdk/*.o
rm -rf Release/$(BINARY)
rm -rf Debug/*.o
rm -rf Debug/sdk/*.o
rm -rf Debug/$(BINARY)
+12 -5
View File
@@ -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
* modify it under the terms of the GNU General Public License
@@ -20,21 +24,25 @@
#include "extension.h"
#include "GeoIP.h"
/**
* @file extension.cpp
* @brief Implement extension code here.
*/
GeoIP_Extension g_GeoIP;
GeoIP *gi = NULL;
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");
gi = GeoIP_open(path, GEOIP_MEMORY_CACHE);
if (!gi)
{
snprintf(error, err_max, "Failed to instantiate GeoIP!");
snprintf(error, maxlength, "Failed to instantiate GeoIP!");
return false;
}
@@ -113,4 +121,3 @@ const sp_nativeinfo_t geoip_natives[] =
{"GeoipCountry", sm_Geoip_Country},
{NULL, NULL},
};
+43 -12
View File
@@ -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
* modify it under the terms of the GNU General Public License
@@ -20,12 +24,16 @@
#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
/**
* @file extension.h
* @brief GeoIP extension code header.
*/
#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.
*/
class GeoIP_Extension : public SDKExtension
@@ -35,11 +43,11 @@ 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 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 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.
@@ -61,22 +69,45 @@ public:
* @brief this is called when Core wants to know if your extension is working.
*
* @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.
*/
//virtual void QueryRunning(char *error, size_t maxlength);
//virtual bool QueryRunning(char *error, size_t maxlength);
public:
#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);
//virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max);
/**
* @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
};
extern const sp_nativeinfo_t geoip_natives[];
#endif //_INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_
+5 -5
View File
@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# 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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -9,10 +9,10 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.ActiveCfg = Debug|Win32
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug|Win32.Build.0 = Debug|Win32
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.ActiveCfg = Release|Win32
{B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release|Win32.Build.0 = Release|Win32
{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Debug|Win32.ActiveCfg = Debug|Win32
{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Debug|Win32.Build.0 = Debug|Win32
{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Release|Win32.ActiveCfg = Release|Win32
{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+19 -15
View File
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="8.00"
Name="geoip"
ProjectGUID="{B3E797CF-4E77-4C9D-B8A8-7589B6902206}"
ProjectGUID="{698EAEE7-0EFC-4017-9B88-ECCAAF42FD5F}"
RootNamespace="geoip"
Keyword="Win32Proj"
>
@@ -40,7 +40,7 @@
<Tool
Name="VCCLCompilerTool"
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"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -118,7 +118,7 @@
/>
<Tool
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"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
@@ -188,10 +188,6 @@
RelativePath="..\GeoIP.c"
>
</File>
<File
RelativePath="..\smsdk_ext.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
@@ -206,14 +202,6 @@
RelativePath="..\GeoIP.h"
>
</File>
<File
RelativePath="..\smsdk_config.h"
>
</File>
<File
RelativePath="..\smsdk_ext.h"
>
</File>
<File
RelativePath="..\svn_version.h"
>
@@ -229,6 +217,22 @@
>
</File>
</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>
<Globals>
</Globals>
+49
View 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_
@@ -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
* 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
* 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$
*/
@@ -16,12 +20,18 @@
#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;
/**
* @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;
@@ -36,7 +46,7 @@ SDKExtension::SDKExtension()
#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;
myself = me;
@@ -48,7 +58,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
{
if (error)
{
snprintf(error, err_max, "Metamod attach failed");
snprintf(error, maxlength, "Metamod attach failed");
}
return false;
}
@@ -58,7 +68,7 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
SM_GET_IFACE(SOURCEMOD, g_pSM);
SM_GET_IFACE(FORWARDMANAGER, g_pForwards);
if (SDK_OnLoad(error, err_max, late))
if (SDK_OnLoad(error, maxlength, late))
{
#if defined SMEXT_CONF_METAMOD
m_WeAreUnloaded = true;
@@ -134,7 +144,7 @@ const char *SDKExtension::GetExtensionURL()
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;
}
@@ -153,14 +163,15 @@ 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;
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;
IServerGameDLL *gamedll = NULL;
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))
@@ -189,7 +200,7 @@ bool SDKExtension::Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlen,
m_SourceMMLoaded = true;
return SDK_OnMetamodLoad(error, maxlen, late);
return SDK_OnMetamodLoad(ismm, error, maxlen, late);
}
bool SDKExtension::Unload(char *error, size_t maxlen)
@@ -206,7 +217,7 @@ bool SDKExtension::Unload(char *error, size_t maxlen)
return SDK_OnMetamodUnload(error, maxlen);
}
bool SDKExtension::Pause(char *error, size_t maxlen)
bool SDKExtension::Pause(char *error, size_t maxlength)
{
if (!m_WeGotPauseChange)
{
@@ -278,17 +289,17 @@ const char *SDKExtension::GetVersion()
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;
}
bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t err_max)
bool SDKExtension::SDK_OnMetamodUnload(char *error, size_t maxlength)
{
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;
}
@@ -321,4 +332,3 @@ void operator delete[](void * ptr)
free(ptr);
}
#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
* 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
* 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$
*/
@@ -15,6 +19,11 @@
#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>
@@ -38,17 +47,18 @@ class SDKExtension :
public IExtensionInterface
{
public:
/** Constructor */
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 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 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.
@@ -70,21 +80,21 @@ public:
* @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 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(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.
* NOTE: By default this is blocked unless sent from SourceMod.
*
* @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.
*/
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.
@@ -92,38 +102,66 @@ public:
*
* @param paused Pause state being set.
* @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.
*/
virtual bool SDK_OnMetamodPauseChange(bool paused, char *error, size_t err_max);
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 err_max, bool late);
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
virtual bool Load(PluginId id, ISmmAPI *ismm, char *error, size_t maxlength, bool late);
public: // ISmmPlugin
/** 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();
/** 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 maxlen);
/** Called on pause */
virtual bool Pause(char *error, size_t maxlen);
/** Called on unpause */
virtual bool Unpause(char *error, size_t maxlen);
private:
bool m_SourceMMLoaded;
@@ -146,13 +184,30 @@ extern IVEngineServer *engine;
extern IServerGameDLL *gamedll;
#endif
/** Creates a SourceMod interface macro pair */
#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; \
/** 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_
#endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_
-48
View File
@@ -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_