diff --git a/AMBuildScript b/AMBuildScript index 2f37874d..0b76b6d9 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -420,6 +420,7 @@ FileList = [ ['extensions', 'curl', 'AMBuilder'], ['extensions', 'geoip', 'AMBuilder'], ['extensions', 'mysql', 'AMBuilder'], + ['extensions', 'sdkhools', 'AMBuilder'], ['extensions', 'sdktools', 'AMBuilder'], ['extensions', 'topmenus', 'AMBuilder'], ['extensions', 'updater', 'AMBuilder'], diff --git a/extensions/sdkhooks/AMBuilder b/extensions/sdkhooks/AMBuilder new file mode 100644 index 00000000..406584c5 --- /dev/null +++ b/extensions/sdkhooks/AMBuilder @@ -0,0 +1,31 @@ +# vim: set ts=2 sw=2 tw=99 noet ft=python: +import os + +for i in SM.sdkInfo: + sdk = SM.sdkInfo[i] + if AMBuild.target['platform'] not in sdk['platform']: + continue + + compiler = SM.DefaultHL2Compiler('extensions/sdkhooks', i) + compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit')) + compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'jit', 'x86')) + + if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang': + compiler['CFLAGS'].append('-Wno-parentheses') + compiler['CXXFLAGS'].append('-Wno-invalid-offsetof') + + name = 'sdkhooks.ext.' + sdk['ext'] + extension = AMBuild.AddJob(name) + binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler) + SM.PreSetupHL2Job(extension, binary, i) + binary.AddSourceFiles('extensions/sdkhooks', [ + 'extension.cpp', + 'natives.cpp', + 'takedamageinfohack.cpp', + 'util.cpp', + 'sdk/smsdk_ext.cpp', + ]) + SM.PostSetupHL2Job(extension, binary, i) + SM.AutoVersion('extensions/sdkhooks', binary) + binary.SendToJob() + diff --git a/extensions/sdkhooks/Makefile b/extensions/sdkhooks/Makefile new file mode 100644 index 00000000..452026c8 --- /dev/null +++ b/extensions/sdkhooks/Makefile @@ -0,0 +1,198 @@ +# (C)2004-2008 SourceMod Development Team +# Makefile written by David "BAILOPAN" Anderson + +SMSDK = ../.. +HL2SDK_ORIG = ../../../hl2sdk +HL2SDK_OB = ../../../hl2sdk-ob +HL2SDK_CSS = ../../../hl2sdk-css +HL2SDK_OB_VALVE = ../../../hl2sdk-ob-valve +HL2SDK_L4D = ../../../hl2sdk-l4d +HL2SDK_L4D2 = ../../../hl2sdk-l4d2 +HL2SDK_CSGO = ../../../hl2sdk-csgo +MMSOURCE19 = ../../../mmsource-central + +##################################### +### EDIT BELOW FOR OTHER PROJECTS ### +##################################### + +PROJECT = sdkhooks + +#Uncomment for Metamod: Source enabled extension +USEMETA = true + +OBJECTS = sdk/smsdk_ext.cpp extension.cpp natives.cpp takedamageinfohack.cpp util.cpp + +############################################## +### CONFIGURE ANY OTHER FLAGS/OPTIONS HERE ### +############################################## + +C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing +C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3 +C_GCC4_FLAGS = -fvisibility=hidden +CPP_GCC4_FLAGS = -fvisibility-inlines-hidden +CPP = gcc + +override ENGSET = false +ifeq "$(ENGINE)" "original" + HL2SDK = $(HL2SDK_ORIG) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/linux_sdk + CFLAGS += -DSOURCE_ENGINE=1 + METAMOD = $(MMSOURCE19)/core-legacy + INCLUDE += -I$(HL2SDK)/public/dlls -I$(HL2SDK)/game_shared + GAMEFIX = 1.ep1 + override ENGSET = true +endif +ifeq "$(ENGINE)" "orangebox" + HL2SDK = $(HL2SDK_OB) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=3 + METAMOD = $(MMSOURCE19)/core + INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework + GAMEFIX = 2.ep2 + override ENGSET = true +endif +ifeq "$(ENGINE)" "css" + HL2SDK = $(HL2SDK_CSS) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=6 + METAMOD = $(MMSOURCE19)/core + INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework + GAMEFIX = 2.css + override ENGSET = true +endif +ifeq "$(ENGINE)" "orangeboxvalve" + HL2SDK = $(HL2SDK_OB_VALVE) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=7 + METAMOD = $(MMSOURCE19)/core + INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework + GAMEFIX = 2.ep2v + override ENGSET = true +endif +ifeq "$(ENGINE)" "left4dead" + HL2SDK = $(HL2SDK_L4D) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=8 + METAMOD = $(MMSOURCE19)/core + INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework + GAMEFIX = 2.l4d + override ENGSET = true +endif +ifeq "$(ENGINE)" "left4dead2" + HL2SDK = $(HL2SDK_L4D2) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=9 + METAMOD = $(MMSOURCE19)/core + INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework + GAMEFIX = 2.l4d2 + override ENGSET = true +endif +ifeq "$(ENGINE)" "csgo" + HL2SDK = $(HL2SDK_CSGO) + HL2PUB = $(HL2SDK)/public + HL2LIB = $(HL2SDK)/lib/linux + CFLAGS += -DSOURCE_ENGINE=12 + METAMOD = $(MMSOURCE19)/core + INCLUDE += -I$(HL2SDK)/public/game/server -I$(HL2SDK)/common -I$(HL2SDK)/game/shared -I$(HL2SDK)/public/toolframework + GAMEFIX = 2.csgo + override ENGSET = true +endif + +ifeq ($(ENGINE),$(filter $(ENGINE), csgo left4dead2 orangeboxvalve css)) + LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a libvstdlib.so libtier0.so +else + LINK_HL2 = $(HL2LIB)/tier1_i486.a $(HL2LIB)/mathlib_i486.a vstdlib_i486.so tier0_i486.so +endif + +ifeq "$(ENGINE)" "csgo" + LINK_HL2 += $(HL2LIB)/interfaces_i486.a +endif + +LINK += $(LINK_HL2) + +INCLUDE += -I. -I.. -Isdk -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/mathlib -I$(HL2PUB)/tier0 \ + -I$(HL2PUB)/tier1 -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK)/public -I$(SMSDK)/public/extensions \ + -I$(SMSDK)/public/sourcepawn + +CFLAGS += -DSE_EPISODEONE=1 -DSE_DARKMESSIAH=2 -DSE_ORANGEBOX=3 -DSE_BLOODYGOODTIME=4 -DSE_EYE=5 \ + -DSE_CSS=6 -DSE_ORANGEBOXVALVE=7 -DSE_LEFT4DEAD=8 -DSE_LEFT4DEAD2=9 -DSE_ALIENSWARM=10 + -DSE_PORTAL2=11 -DSE_CSGO=12 + +LINK += -m32 -ldl -lm + +CFLAGS += -D_LINUX -DPOSIX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \ + -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -DCOMPILER_GCC \ + -Wno-switch -Wall -Werror -Wno-uninitialized -Wno-invalid-offsetof -Wno-unused -mfpmath=sse -msse -DSOURCEMOD_BUILD -DHAVE_STDINT_H -m32 +CPPFLAGS += -Wno-non-virtual-dtor -fno-exceptions -fno-rtti -fno-threadsafe-statics + +################################################ +### DO NOT EDIT BELOW HERE FOR MOST PROJECTS ### +################################################ + +ifeq "$(DEBUG)" "true" + BIN_DIR = Debug + CFLAGS += $(C_DEBUG_FLAGS) +else + BIN_DIR = Release + CFLAGS += $(C_OPT_FLAGS) +endif + +ifeq "$(USEMETA)" "true" + BIN_DIR := $(BIN_DIR).$(ENGINE) +endif + +OS := $(shell uname -s) +ifeq "$(OS)" "Darwin" + LINK += -dynamiclib + BINARY = $(PROJECT).ext.$(GAMEFIX).dylib +else + LINK += -static-libgcc -shared + BINARY = $(PROJECT).ext.$(GAMEFIX).so +endif + +GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1) +ifeq "$(GCC_VERSION)" "4" + CFLAGS += $(C_GCC4_FLAGS) + CPPFLAGS += $(CPP_GCC4_FLAGS) +endif + +OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o) + +$(BIN_DIR)/%.o: %.cpp + $(CPP) $(INCLUDE) $(CFLAGS) $(CPPFLAGS) -o $@ -c $< + +all: check + mkdir -p $(BIN_DIR)/sdk +ifeq ($(ENGINE),$(filter $(ENGINE), csgo left4dead2 orangeboxvalve css)) + ln -sf $(HL2LIB)/libvstdlib.so libvstdlib.so; + ln -sf $(HL2LIB)/libtier0.so libtier0.so; +else + ln -sf $(HL2LIB)/vstdlib_i486.so vstdlib_i486.so; + ln -sf $(HL2LIB)/tier0_i486.so tier0_i486.so; +endif + $(MAKE) -f Makefile extension + +check: + if [ "$(USEMETA)" = "true" ] && [ "$(ENGSET)" = "false" ]; then \ + echo "You must supply ENGINE=left4dead or ENGINE=orangebox or ENGINE=original"; \ + exit 1; \ + fi + +extension: check $(OBJ_LINUX) + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY) + +debug: + $(MAKE) -f Makefile all DEBUG=true + +default: all + +clean: check + rm -rf $(BIN_DIR)/*.o + rm -rf $(BIN_DIR)/sdk/*.o + rm -rf $(BIN_DIR)/$(BINARY) diff --git a/extensions/sdkhooks/extension.cpp b/extensions/sdkhooks/extension.cpp new file mode 100644 index 00000000..bb94bfd1 --- /dev/null +++ b/extensions/sdkhooks/extension.cpp @@ -0,0 +1,1534 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * Source SDK Hooks Extension + * Copyright (C) 2010-2012 Nicholas Hastings + * Copyright (C) 2009-2010 Erik Minekus + * ============================================================================= + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#include "extension.h" +#include "compat_wrappers.h" +#include "macros.h" +#include "natives.h" +#include +#include + + +//#define SDKHOOKSDEBUG + +/** + * Globals + */ + +// Order MUST match SDKHookType enum +HookTypeData g_HookTypes[SDKHook_MAXHOOKS] = +{ +// Hook name DT required Supported (always false til later) + {"EndTouch", "", false}, + {"FireBulletsPost", "", false}, + {"OnTakeDamage", "", false}, + {"OnTakeDamagePost", "", false}, + {"PreThink", "DT_BasePlayer", false}, + {"PostThink", "DT_BasePlayer", false}, + {"SetTransmit", "", false}, + {"Spawn", "", false}, + {"StartTouch", "", false}, + {"Think", "", false}, + {"Touch", "", false}, + {"TraceAttack", "", false}, + {"TraceAttackPost", "", false}, + {"WeaponCanSwitchTo", "DT_BaseCombatCharacter", false}, + {"WeaponCanUse", "DT_BaseCombatCharacter", false}, + {"WeaponDrop", "DT_BaseCombatCharacter", false}, + {"WeaponEquip", "DT_BaseCombatCharacter", false}, + {"WeaponSwitch", "DT_BaseCombatCharacter", false}, + {"ShouldCollide", "", false}, + {"PreThinkPost", "DT_BasePlayer", false}, + {"PostThinkPost", "DT_BasePlayer", false}, + {"ThinkPost", "", false}, + {"EndTouchPost", "", false}, + {"GroundEntChangedPost", "", false}, + {"SpawnPost", "", false}, + {"StartTouchPost", "", false}, + {"TouchPost", "", false}, + {"VPhysicsUpdate", "", false}, + {"VPhysicsUpdatePost", "", false}, + {"WeaponCanSwitchToPost", "DT_BaseCombatCharacter", false}, + {"WeaponCanUsePost", "DT_BaseCombatCharacter", false}, + {"WeaponDropPost", "DT_BaseCombatCharacter", false}, + {"WeaponEquipPost", "DT_BaseCombatCharacter", false}, + {"WeaponSwitchPost", "DT_BaseCombatCharacter", false}, + {"Use", "", false}, + {"UsePost", "", false}, + {"Reload", "DT_BaseCombatWeapon", false}, + {"ReloadPost", "DT_BaseCombatWeapon", false}, + {"GetMaxHealth", "", false}, +}; + +SDKHooks g_Interface; +SMEXT_LINK(&g_Interface); + +CGlobalVars *gpGlobals; +CUtlVector g_HookList; + +CBitVec m_EntityExists; + +IBinTools *g_pBinTools = NULL; +ICvar *icvar = NULL; + +// global hooks and forwards +IForward *g_pOnEntityCreated = NULL; +IForward *g_pOnEntityDestroyed = NULL; + +#ifdef GAMEDESC_CAN_CHANGE +int g_hookOnGetGameDescription = 0; +IForward *g_pOnGetGameNameDescription = NULL; +#endif + +int g_hookOnGetMapEntitiesString = 0; +int g_hookOnLevelInit = 0; +IForward *g_pOnLevelInit = NULL; + +IGameConfig *g_pGameConf = NULL; +int g_SplineCount = 0; + +char g_szMapEntities[2097152]; + + +/** + * IServerGameDLL & IVEngineServer Hooks + */ +SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, const char *, const char *, const char *, const char *, bool, bool); +#ifdef GAMEDESC_CAN_CHANGE +SH_DECL_HOOK0(IServerGameDLL, GetGameDescription, SH_NOATTRIB, 0, const char *); +#endif +SH_DECL_HOOK0(IVEngineServer, GetMapEntitiesString, SH_NOATTRIB, 0, const char *); + + +/** + * CBaseEntity Hooks + */ +SH_DECL_MANUALHOOK1_void(EndTouch, 0, 0, 0, CBaseEntity *); +SH_DECL_MANUALHOOK1_void(FireBullets, 0, 0, 0, FireBulletsInfo_t const&); +#ifdef GETMAXHEALTH_IS_VIRTUAL +SH_DECL_MANUALHOOK0(GetMaxHealth, 0, 0, 0, int); +#endif +SH_DECL_MANUALHOOK0_void(GroundEntChanged, 0, 0, 0); +SH_DECL_MANUALHOOK1(OnTakeDamage, 0, 0, 0, int, CTakeDamageInfoHack &); +SH_DECL_MANUALHOOK0_void(PreThink, 0, 0, 0); +SH_DECL_MANUALHOOK0_void(PostThink, 0, 0, 0); +SH_DECL_MANUALHOOK0(Reload, 0, 0, 0, bool); +SH_DECL_MANUALHOOK2_void(SetTransmit, 0, 0, 0, CCheckTransmitInfo *, bool); +SH_DECL_MANUALHOOK2(ShouldCollide, 0, 0, 0, bool, int, int); +SH_DECL_MANUALHOOK0_void(Spawn, 0, 0, 0); +SH_DECL_MANUALHOOK1_void(StartTouch, 0, 0, 0, CBaseEntity *); +SH_DECL_MANUALHOOK0_void(Think, 0, 0, 0); +SH_DECL_MANUALHOOK1_void(Touch, 0, 0, 0, CBaseEntity *); +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS +SH_DECL_MANUALHOOK4_void(TraceAttack, 0, 0, 0, CTakeDamageInfoHack &, const Vector &, CGameTrace *, void *); +#else +SH_DECL_MANUALHOOK3_void(TraceAttack, 0, 0, 0, CTakeDamageInfoHack &, const Vector &, CGameTrace *); +#endif +SH_DECL_MANUALHOOK4_void(Use, 0, 0, 0, CBaseEntity *, CBaseEntity *, USE_TYPE, float); +SH_DECL_MANUALHOOK1_void(VPhysicsUpdate, 0, 0, 0, IPhysicsObject *); +SH_DECL_MANUALHOOK1(Weapon_CanSwitchTo, 0, 0, 0, bool, CBaseCombatWeapon *); +SH_DECL_MANUALHOOK1(Weapon_CanUse, 0, 0, 0, bool, CBaseCombatWeapon *); +SH_DECL_MANUALHOOK3_void(Weapon_Drop, 0, 0, 0, CBaseCombatWeapon *, const Vector *, const Vector *); +SH_DECL_MANUALHOOK1_void(Weapon_Equip, 0, 0, 0, CBaseCombatWeapon *); +SH_DECL_MANUALHOOK2(Weapon_Switch, 0, 0, 0, bool, CBaseCombatWeapon *, int); + + +/** + * Forwards + */ +bool SDKHooks::SDK_OnLoad(char *error, size_t maxlength, bool late) +{ + char buffer[256]; + g_pSM->BuildPath(Path_SM, buffer, sizeof(buffer)-1, "/extensions/sdkhooks.ext." PLATFORM_LIB_EXT); + if (libsys->PathExists(buffer) && libsys->IsPathFile(buffer)) + { + g_pSM->Format(error, maxlength-1, "SDKHooks 2.x cannot load while old version (sdkhooks.ext." PLATFORM_LIB_EXT ") is still in extensions dir"); + return false; + } + + g_pSM->BuildPath(Path_SM, buffer, sizeof(buffer)-1, "/gamedata/sdkhooks.games.txt"); + if (libsys->PathExists(buffer) && libsys->IsPathFile(buffer)) + { + g_pSM->Format(error, maxlength-1, "SDKHooks 2.x cannot load while old gamedata file (sdkhooks.games.txt) is still in gamedata dir"); + return false; + } + + sharesys->AddDependency(myself, "bintools.ext", true, true); + sharesys->AddNatives(myself, g_Natives); + sharesys->RegisterLibrary(myself, "sdkhooks"); + sharesys->AddCapabilityProvider(myself, this, "SDKHook_DmgCustomInOTD"); + sharesys->AddCapabilityProvider(myself, this, "SDKHook_LogicalEntSupport"); + + playerhelpers->AddClientListener(&g_Interface); + + plsys->AddPluginsListener(&g_Interface); + + g_pOnEntityCreated = forwards->CreateForward("OnEntityCreated", ET_Ignore, 2, NULL, Param_Cell, Param_String); + g_pOnEntityDestroyed = forwards->CreateForward("OnEntityDestroyed", ET_Ignore, 1, NULL, Param_Cell); +#ifdef GAMEDESC_CAN_CHANGE + g_pOnGetGameNameDescription = forwards->CreateForward("OnGetGameDescription", ET_Hook, 2, NULL, Param_String); +#endif + g_pOnLevelInit = forwards->CreateForward("OnLevelInit", ET_Hook, 2, NULL, Param_String, Param_String); + + buffer[0] = '\0'; + if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf, buffer, sizeof(buffer))) + { + if (buffer[0]) + { + g_pSM->Format(error, maxlength, "Could not read sdkhooks.games gamedata: %s", buffer); + } + + return false; + } + + void *gEntList = gamehelpers->GetGlobalEntityList(); + if (!gEntList) + { + g_pSM->Format(error, maxlength, "Cannot find gEntList pointer"); + return false; + } + + int offset = -1; /* 65572 */ + if (!g_pGameConf->GetOffset("EntityListeners", &offset)) + { + g_pSM->Format(error, maxlength, "Cannot find EntityListeners offset"); + return false; + } + + CUtlVector *pListeners = (CUtlVector *)((intptr_t)gEntList + offset); + pListeners->AddToTail(this); + + SetupHooks(); + +#if SOURCE_ENGINE >= SE_ORANGEBOX + int index; + CBaseHandle hndl; + for (IHandleEntity *pEnt = (IHandleEntity *)servertools->FirstEntity(); pEnt; pEnt = (IHandleEntity *)servertools->NextEntity((CBaseEntity *)pEnt)) + { + hndl = pEnt->GetRefEHandle(); + if (hndl == INVALID_EHANDLE_INDEX || !hndl.IsValid()) + continue; + + index = hndl.GetEntryIndex(); + m_EntityExists.Set(index); + } +#else + for (int i = 0; i < NUM_ENT_ENTRIES; i++) + { + if (gamehelpers->ReferenceToEntity(i) != NULL) + m_EntityExists.Set(i); + } +#endif + + return true; +} + +inline void HookLevelInit() +{ + assert(g_hookOnLevelInit == 0); + g_hookOnLevelInit = SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, &g_Interface, &SDKHooks::Hook_LevelInit, false); + assert(g_hookOnGetMapEntitiesString == 0); + g_hookOnGetMapEntitiesString = SH_ADD_HOOK_MEMFUNC(IVEngineServer, GetMapEntitiesString, engine, &g_Interface, &SDKHooks::Hook_GetMapEntitiesString, false); +} + +#ifdef GAMEDESC_CAN_CHANGE +inline void HookGetGameDescription() +{ + assert(g_hookOnGetGameDescription == 0); + g_hookOnGetGameDescription = SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GetGameDescription, gamedll, &g_Interface, &SDKHooks::Hook_GetGameDescription, false); +} +#endif + +void SDKHooks::SDK_OnAllLoaded() +{ + SM_GET_LATE_IFACE(BINTOOLS, g_pBinTools); + + if (!g_pBinTools) + { + g_pSM->LogError(myself, "Could not find interface: " SMINTERFACE_BINTOOLS_NAME); + return; + } + + if (g_pOnLevelInit->GetFunctionCount() > 0) + HookLevelInit(); +#ifdef GAMEDESC_CAN_CHANGE + if (g_pOnGetGameNameDescription->GetFunctionCount() > 0) + HookGetGameDescription(); +#endif +} + +#define KILL_HOOK_IF_ACTIVE(hook) \ + if (hook != 0) \ + { \ + SH_REMOVE_HOOK_ID(hook); \ + } + +void SDKHooks::SDK_OnUnload() +{ + // Remove left over hooks + HOOKLOOP + Unhook(i); + + KILL_HOOK_IF_ACTIVE(g_hookOnLevelInit); + KILL_HOOK_IF_ACTIVE(g_hookOnGetMapEntitiesString); + +#ifdef GAMEDESC_CAN_CHANGE + KILL_HOOK_IF_ACTIVE(g_hookOnGetGameDescription); +#endif + + forwards->ReleaseForward(g_pOnEntityCreated); + forwards->ReleaseForward(g_pOnEntityDestroyed); +#ifdef GAMEDESC_CAN_CHANGE + forwards->ReleaseForward(g_pOnGetGameNameDescription); +#endif + forwards->ReleaseForward(g_pOnLevelInit); + + plsys->RemovePluginsListener(&g_Interface); + + playerhelpers->RemoveClientListener(&g_Interface); + + sharesys->DropCapabilityProvider(myself, this, "SDKHook_DmgCustomInOTD"); + sharesys->DropCapabilityProvider(myself, this, "SDKHook_LogicalEntSupport"); + + void *gEntList = gamehelpers->GetGlobalEntityList(); + if (gEntList) + { + int offset = -1; /* 65572 */ + if (g_pGameConf->GetOffset("EntityListeners", &offset)) + { + CUtlVector *pListeners = (CUtlVector *)((intptr_t)gEntList + offset); + pListeners->FindAndRemove(this); + } + } + + gameconfs->CloseGameConfigFile(g_pGameConf); +} + +bool SDKHooks::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late) +{ + GET_V_IFACE_CURRENT(GetEngineFactory, icvar, ICvar, CVAR_INTERFACE_VERSION); + +#if SOURCE_ENGINE >= SE_ORANGEBOX + g_pCVar = icvar; +#endif + CONVAR_REGISTER(this); + + gpGlobals = ismm->GetCGlobals(); + + return true; +} + +void SDKHooks::OnPluginLoaded(IPlugin *plugin) +{ + if (g_pOnLevelInit->GetFunctionCount() > 0 && g_hookOnLevelInit == 0) + HookLevelInit(); + +#ifdef GAMEDESC_CAN_CHANGE + if (g_pOnGetGameNameDescription->GetFunctionCount() > 0 && g_hookOnGetGameDescription == 0) + HookGetGameDescription(); +#endif +} + +void SDKHooks::OnPluginUnloaded(IPlugin *plugin) +{ + IPluginContext *plugincontext = plugin->GetBaseContext(); + HOOKLOOP + { + if(g_HookList[i].callback->GetParentContext() == plugincontext) + Unhook(i); + } + + if (g_pOnLevelInit->GetFunctionCount() == 0) + { + KILL_HOOK_IF_ACTIVE(g_hookOnLevelInit); + KILL_HOOK_IF_ACTIVE(g_hookOnGetMapEntitiesString); + } + +#ifdef GAMEDESC_CAN_CHANGE + if (g_pOnGetGameNameDescription->GetFunctionCount() == 0) + KILL_HOOK_IF_ACTIVE(g_hookOnGetGameDescription); +#endif +} + +void SDKHooks::OnClientPutInServer(int client) +{ + g_pOnEntityCreated->PushCell(client); + + CBaseEntity *pPlayer = gamehelpers->ReferenceToEntity(client); + + const char * pName = gamehelpers->GetEntityClassname(pPlayer); + + g_pOnEntityCreated->PushString(pName ? pName : ""); + g_pOnEntityCreated->Execute(NULL); + + m_EntityExists.Set(client); +} + +bool SDKHooks::RegisterConCommandBase(ConCommandBase *pVar) +{ + /* Always call META_REGCVAR instead of going through the engine. */ + return META_REGCVAR(pVar); +} + +FeatureStatus SDKHooks::GetFeatureStatus(FeatureType type, const char *name) +{ + return FeatureStatus_Available; +} + +/** + * Functions + */ +cell_t SDKHooks::Call(int entity, SDKHookType type, int other) +{ + IPluginFunction *callback = NULL; + cell_t res, ret = Pl_Continue; + + HOOKLOOP + { + if(g_HookList[i].entity != entity || g_HookList[i].type != type) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + if(other > -2) + callback->PushCell(other); + + callback->Execute(&res); + if(res > ret) + ret = res; + } + + return ret; +} + +cell_t SDKHooks::Call(CBaseEntity *pEnt, SDKHookType type, int other) +{ + return Call(gamehelpers->EntityToBCompatRef(pEnt), type, other); +} + +cell_t SDKHooks::Call(CBaseEntity *pEnt, SDKHookType type, CBaseEntity *other) +{ + return Call(gamehelpers->EntityToBCompatRef(pEnt), type, gamehelpers->EntityToBCompatRef(other)); +} + +void SDKHooks::SetupHooks() +{ + int offset; + + // gamedata pre post + // (pre is not necessarily a prehook, just named without "Post" appeneded) + + CHECKOFFSET(EndTouch, true, true); + CHECKOFFSET(FireBullets, false, true); + CHECKOFFSET(GroundEntChanged, false, true); + CHECKOFFSET(OnTakeDamage, true, true); + CHECKOFFSET(PreThink, true, true); + CHECKOFFSET(PostThink, true, true); + CHECKOFFSET(Reload, true, true); + CHECKOFFSET(SetTransmit, true, false); + CHECKOFFSET(ShouldCollide, true, false); + CHECKOFFSET(Spawn, true, true); + CHECKOFFSET(StartTouch, true, true); + CHECKOFFSET(Think, true, true); + CHECKOFFSET(Touch, true, true); + CHECKOFFSET(TraceAttack, true, true); + CHECKOFFSET(Use, true, true); + CHECKOFFSET_W(CanSwitchTo, true, true); + CHECKOFFSET_W(CanUse, true, true); + CHECKOFFSET_W(Drop, true, true); + CHECKOFFSET_W(Equip, true, true); + CHECKOFFSET_W(Switch, true, true); + CHECKOFFSET(VPhysicsUpdate, true, true); + + // this one is in a class all its own -_- + offset = 0; + g_pGameConf->GetOffset("GroundEntChanged", &offset); + if (offset > 0) + { + SH_MANUALHOOK_RECONFIGURE(GroundEntChanged, offset, 0, 0); + g_HookTypes[SDKHook_GroundEntChangedPost].supported = true; + } + +#ifdef GETMAXHEALTH_IS_VIRTUAL + CHECKOFFSET(GetMaxHealth, true, false); +#endif +} + +HookReturn SDKHooks::Hook(int entity, SDKHookType type, IPluginFunction *callback) +{ + if(!g_HookTypes[type].supported) + return HookRet_NotSupported; + + CBaseEntity *pEnt = UTIL_GetCBaseEntity(entity); + if(!pEnt) + return HookRet_InvalidEntity; + if(type < 0 || type >= SDKHook_MAXHOOKS) + return HookRet_InvalidHookType; + +#if SOURCE_ENGINE >= SE_CSS + if(entity > 0 && entity <= playerhelpers->GetMaxClients()) + { + const char *id = engine->GetPlayerNetworkIDString(PEntityOfEntIndex(entity)); + g_SplineCount = strlen(id); + } +#endif + + if (!!strcmp(g_HookTypes[type].dtReq, "")) + { + sm_sendprop_info_t spi; + IServerUnknown *pUnk = (IServerUnknown *)pEnt; + + IServerNetworkable *pNet = pUnk->GetNetworkable(); + if (pNet && !UTIL_FindDataTable(pNet->GetServerClass()->m_pTable, g_HookTypes[type].dtReq, &spi, 0)) + return HookRet_BadEntForHookType; + } + + bool bHooked = false; + HOOKLOOP + { + if (g_HookList[i].entity == entity && g_HookList[i].type == type) + { + bHooked = true; + break; + } + } + if (!bHooked) + { + switch(type) + { + case SDKHook_EndTouch: + SH_ADD_MANUALHOOK_MEMFUNC(EndTouch, pEnt, &g_Interface, &SDKHooks::Hook_EndTouch, false); + break; + case SDKHook_EndTouchPost: + SH_ADD_MANUALHOOK_MEMFUNC(EndTouch, pEnt, &g_Interface, &SDKHooks::Hook_EndTouchPost, true); + break; + case SDKHook_FireBulletsPost: + SH_ADD_MANUALHOOK_MEMFUNC(FireBullets, pEnt, &g_Interface, &SDKHooks::Hook_FireBulletsPost, true); + break; +#ifdef GETMAXHEALTH_IS_VIRTUAL + case SDKHook_GetMaxHealth: + SH_ADD_MANUALHOOK_MEMFUNC(GetMaxHealth, pEnt, &g_Interface, &SDKHooks::Hook_GetMaxHealth, false); + break; +#endif + case SDKHook_GroundEntChangedPost: + SH_ADD_MANUALHOOK_MEMFUNC(GroundEntChanged, pEnt, &g_Interface, &SDKHooks::Hook_GroundEntChangedPost, true); + break; + case SDKHook_OnTakeDamage: + SH_ADD_MANUALHOOK_MEMFUNC(OnTakeDamage, pEnt, &g_Interface, &SDKHooks::Hook_OnTakeDamage, false); + break; + case SDKHook_OnTakeDamagePost: + SH_ADD_MANUALHOOK_MEMFUNC(OnTakeDamage, pEnt, &g_Interface, &SDKHooks::Hook_OnTakeDamagePost, true); + break; + case SDKHook_PreThink: + SH_ADD_MANUALHOOK_MEMFUNC(PreThink, pEnt, &g_Interface, &SDKHooks::Hook_PreThink, false); + break; + case SDKHook_PreThinkPost: + SH_ADD_MANUALHOOK_MEMFUNC(PreThink, pEnt, &g_Interface, &SDKHooks::Hook_PreThinkPost, true); + break; + case SDKHook_PostThink: + SH_ADD_MANUALHOOK_MEMFUNC(PostThink, pEnt, &g_Interface, &SDKHooks::Hook_PostThink, false); + break; + case SDKHook_PostThinkPost: + SH_ADD_MANUALHOOK_MEMFUNC(PostThink, pEnt, &g_Interface, &SDKHooks::Hook_PostThinkPost, true); + break; + case SDKHook_Reload: + SH_ADD_MANUALHOOK_MEMFUNC(Reload, pEnt, &g_Interface, &SDKHooks::Hook_Reload, false); + break; + case SDKHook_ReloadPost: + SH_ADD_MANUALHOOK_MEMFUNC(Reload, pEnt, &g_Interface, &SDKHooks::Hook_ReloadPost, true); + break; + case SDKHook_SetTransmit: + SH_ADD_MANUALHOOK_MEMFUNC(SetTransmit, pEnt, &g_Interface, &SDKHooks::Hook_SetTransmit, false); + break; + case SDKHook_Spawn: + SH_ADD_MANUALHOOK_MEMFUNC(Spawn, pEnt, &g_Interface, &SDKHooks::Hook_Spawn, false); + break; + case SDKHook_SpawnPost: + SH_ADD_MANUALHOOK_MEMFUNC(Spawn, pEnt, &g_Interface, &SDKHooks::Hook_SpawnPost, true); + break; + case SDKHook_StartTouch: + SH_ADD_MANUALHOOK_MEMFUNC(StartTouch, pEnt, &g_Interface, &SDKHooks::Hook_StartTouch, false); + break; + case SDKHook_StartTouchPost: + SH_ADD_MANUALHOOK_MEMFUNC(StartTouch, pEnt, &g_Interface, &SDKHooks::Hook_StartTouchPost, true); + break; + case SDKHook_Think: + SH_ADD_MANUALHOOK_MEMFUNC(Think, pEnt, &g_Interface, &SDKHooks::Hook_Think, false); + break; + case SDKHook_ThinkPost: + SH_ADD_MANUALHOOK_MEMFUNC(Think, pEnt, &g_Interface, &SDKHooks::Hook_ThinkPost, true); + break; + case SDKHook_Touch: + SH_ADD_MANUALHOOK_MEMFUNC(Touch, pEnt, &g_Interface, &SDKHooks::Hook_Touch, false); + break; + case SDKHook_TouchPost: + SH_ADD_MANUALHOOK_MEMFUNC(Touch, pEnt, &g_Interface, &SDKHooks::Hook_TouchPost, true); + break; + case SDKHook_TraceAttack: + SH_ADD_MANUALHOOK_MEMFUNC(TraceAttack, pEnt, &g_Interface, &SDKHooks::Hook_TraceAttack, false); + break; + case SDKHook_TraceAttackPost: + SH_ADD_MANUALHOOK_MEMFUNC(TraceAttack, pEnt, &g_Interface, &SDKHooks::Hook_TraceAttackPost, true); + break; + case SDKHook_Use: + SH_ADD_MANUALHOOK_MEMFUNC(Use, pEnt, &g_Interface, &SDKHooks::Hook_Use, false); + break; + case SDKHook_UsePost: + SH_ADD_MANUALHOOK_MEMFUNC(Use, pEnt, &g_Interface, &SDKHooks::Hook_UsePost, true); + break; + case SDKHook_VPhysicsUpdate: + SH_ADD_MANUALHOOK_MEMFUNC(VPhysicsUpdate, pEnt, &g_Interface, &SDKHooks::Hook_VPhysicsUpdate, false); + break; + case SDKHook_VPhysicsUpdatePost: + SH_ADD_MANUALHOOK_MEMFUNC(VPhysicsUpdate, pEnt, &g_Interface, &SDKHooks::Hook_VPhysicsUpdatePost, true); + break; + case SDKHook_WeaponCanSwitchTo: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_CanSwitchTo, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanSwitchTo, false); + break; + case SDKHook_WeaponCanSwitchToPost: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_CanSwitchTo, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanSwitchToPost, true); + break; + case SDKHook_WeaponCanUse: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_CanUse, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanUse, false); + break; + case SDKHook_WeaponCanUsePost: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_CanUse, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanUsePost, true); + break; + case SDKHook_WeaponDrop: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_Drop, pEnt, &g_Interface, &SDKHooks::Hook_WeaponDrop, false); + break; + case SDKHook_WeaponDropPost: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_Drop, pEnt, &g_Interface, &SDKHooks::Hook_WeaponDropPost, true); + break; + case SDKHook_WeaponEquip: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_Equip, pEnt, &g_Interface, &SDKHooks::Hook_WeaponEquip, false); + break; + case SDKHook_WeaponEquipPost: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_Equip, pEnt, &g_Interface, &SDKHooks::Hook_WeaponEquipPost, true); + break; + case SDKHook_WeaponSwitch: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_Switch, pEnt, &g_Interface, &SDKHooks::Hook_WeaponSwitch, false); + break; + case SDKHook_WeaponSwitchPost: + SH_ADD_MANUALHOOK_MEMFUNC(Weapon_Switch, pEnt, &g_Interface, &SDKHooks::Hook_WeaponSwitchPost, true); + break; + case SDKHook_ShouldCollide: + SH_ADD_MANUALHOOK_MEMFUNC(ShouldCollide, pEnt, &g_Interface, &SDKHooks::Hook_ShouldCollide, false); + break; + } + } + + // Add hook to hook list + HookList hook; + hook.entity = entity; + hook.type = type; + hook.callback = callback; + g_HookList.AddToTail(hook); +#ifdef SDKHOOKSDEBUG + META_CONPRINTF("DEBUG: Adding to hooklist (ent%d, type%s, cb%d). Total hook count %d\n", entity, g_szHookNames[type], callback, g_HookList.Count()); +#endif + return HookRet_Successful; +} + +void SDKHooks::Unhook(int index) +{ + CBaseEntity *pEnt = gamehelpers->ReferenceToEntity(g_HookList[index].entity); + if(!pEnt) + return; + + int iHooks = 0; + HOOKLOOP + { + if (g_HookList[i].entity == g_HookList[index].entity && g_HookList[i].type == g_HookList[index].type) + { + iHooks++; +#ifdef SDKHOOKSDEBUG + META_CONPRINTF("DEBUG: Found hook %d on entity %d\n", i, g_HookList[index].entity); +#endif + } + } + if (iHooks == 1) + { +#ifdef SDKHOOKSDEBUG + META_CONPRINTF("DEBUG: Removing hook for hooktype %d\n", g_HookList[index].type); +#endif + switch(g_HookList[index].type) + { + case SDKHook_EndTouch: + SH_REMOVE_MANUALHOOK_MEMFUNC(EndTouch, pEnt, &g_Interface, &SDKHooks::Hook_EndTouch, false); + break; + case SDKHook_EndTouchPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(EndTouch, pEnt, &g_Interface, &SDKHooks::Hook_EndTouchPost, true); + break; + case SDKHook_FireBulletsPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(FireBullets, pEnt, &g_Interface, &SDKHooks::Hook_FireBulletsPost, true); + break; +#ifdef GETMAXHEALTH_IS_VIRTUAL + case SDKHook_GetMaxHealth: + SH_REMOVE_MANUALHOOK_MEMFUNC(GetMaxHealth, pEnt, &g_Interface, &SDKHooks::Hook_GetMaxHealth, false); + break; +#endif + case SDKHook_GroundEntChangedPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(GroundEntChanged, pEnt, &g_Interface, &SDKHooks::Hook_GroundEntChangedPost, true); + break; + case SDKHook_OnTakeDamage: + SH_REMOVE_MANUALHOOK_MEMFUNC(OnTakeDamage, pEnt, &g_Interface, &SDKHooks::Hook_OnTakeDamage, false); + break; + case SDKHook_OnTakeDamagePost: + SH_REMOVE_MANUALHOOK_MEMFUNC(OnTakeDamage, pEnt, &g_Interface, &SDKHooks::Hook_OnTakeDamagePost, true); + break; + case SDKHook_PreThink: + SH_REMOVE_MANUALHOOK_MEMFUNC(PreThink, pEnt, &g_Interface, &SDKHooks::Hook_PreThink, false); + break; + case SDKHook_PreThinkPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(PreThink, pEnt, &g_Interface, &SDKHooks::Hook_PreThinkPost, true); + break; + case SDKHook_PostThink: + SH_REMOVE_MANUALHOOK_MEMFUNC(PostThink, pEnt, &g_Interface, &SDKHooks::Hook_PostThink, false); + break; + case SDKHook_PostThinkPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(PostThink, pEnt, &g_Interface, &SDKHooks::Hook_PostThinkPost, true); + break; + case SDKHook_Reload: + SH_REMOVE_MANUALHOOK_MEMFUNC(Reload, pEnt, &g_Interface, &SDKHooks::Hook_Reload, false); + break; + case SDKHook_ReloadPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Reload, pEnt, &g_Interface, &SDKHooks::Hook_ReloadPost, true); + break; + case SDKHook_SetTransmit: + SH_REMOVE_MANUALHOOK_MEMFUNC(SetTransmit, pEnt, &g_Interface, &SDKHooks::Hook_SetTransmit, false); + break; + case SDKHook_Spawn: + SH_REMOVE_MANUALHOOK_MEMFUNC(Spawn, pEnt, &g_Interface, &SDKHooks::Hook_Spawn, false); + break; + case SDKHook_SpawnPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Spawn, pEnt, &g_Interface, &SDKHooks::Hook_SpawnPost, true); + break; + case SDKHook_StartTouch: + SH_REMOVE_MANUALHOOK_MEMFUNC(StartTouch, pEnt, &g_Interface, &SDKHooks::Hook_StartTouch, false); + break; + case SDKHook_StartTouchPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(StartTouch, pEnt, &g_Interface, &SDKHooks::Hook_StartTouchPost, true); + break; + case SDKHook_Think: + SH_REMOVE_MANUALHOOK_MEMFUNC(Think, pEnt, &g_Interface, &SDKHooks::Hook_Think, false); + break; + case SDKHook_ThinkPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Think, pEnt, &g_Interface, &SDKHooks::Hook_ThinkPost, true); + break; + case SDKHook_Touch: + SH_REMOVE_MANUALHOOK_MEMFUNC(Touch, pEnt, &g_Interface, &SDKHooks::Hook_Touch, false); + break; + case SDKHook_TouchPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Touch, pEnt, &g_Interface, &SDKHooks::Hook_TouchPost, true); + break; + case SDKHook_TraceAttack: + SH_REMOVE_MANUALHOOK_MEMFUNC(TraceAttack, pEnt, &g_Interface, &SDKHooks::Hook_TraceAttack, false); + break; + case SDKHook_TraceAttackPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(TraceAttack, pEnt, &g_Interface, &SDKHooks::Hook_TraceAttackPost, true); + break; + case SDKHook_Use: + SH_REMOVE_MANUALHOOK_MEMFUNC(Use, pEnt, &g_Interface, &SDKHooks::Hook_Use, false); + break; + case SDKHook_UsePost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Use, pEnt, &g_Interface, &SDKHooks::Hook_UsePost, true); + break; + case SDKHook_VPhysicsUpdate: + SH_REMOVE_MANUALHOOK_MEMFUNC(VPhysicsUpdate, pEnt, &g_Interface, &SDKHooks::Hook_VPhysicsUpdate, false); + break; + case SDKHook_VPhysicsUpdatePost: + SH_REMOVE_MANUALHOOK_MEMFUNC(VPhysicsUpdate, pEnt, &g_Interface, &SDKHooks::Hook_VPhysicsUpdatePost, true); + break; + case SDKHook_WeaponCanSwitchTo: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_CanSwitchTo, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanSwitchTo, false); + break; + case SDKHook_WeaponCanSwitchToPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_CanSwitchTo, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanSwitchToPost, true); + break; + case SDKHook_WeaponCanUse: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_CanUse, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanUse, false); + break; + case SDKHook_WeaponCanUsePost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_CanUse, pEnt, &g_Interface, &SDKHooks::Hook_WeaponCanUsePost, true); + break; + case SDKHook_WeaponDrop: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_Drop, pEnt, &g_Interface, &SDKHooks::Hook_WeaponDrop, false); + break; + case SDKHook_WeaponDropPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_Drop, pEnt, &g_Interface, &SDKHooks::Hook_WeaponDropPost, true); + break; + case SDKHook_WeaponEquip: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_Equip, pEnt, &g_Interface, &SDKHooks::Hook_WeaponEquip, false); + break; + case SDKHook_WeaponEquipPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_Equip, pEnt, &g_Interface, &SDKHooks::Hook_WeaponEquipPost, true); + break; + case SDKHook_WeaponSwitch: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_Switch, pEnt, &g_Interface, &SDKHooks::Hook_WeaponSwitch, false); + break; + case SDKHook_WeaponSwitchPost: + SH_REMOVE_MANUALHOOK_MEMFUNC(Weapon_Switch, pEnt, &g_Interface, &SDKHooks::Hook_WeaponSwitchPost, true); + break; + case SDKHook_ShouldCollide: + SH_REMOVE_MANUALHOOK_MEMFUNC(ShouldCollide, pEnt, &g_Interface, &SDKHooks::Hook_ShouldCollide, false); + break; + default: + return; + } + } + g_HookList.Remove(index); +} + + +/** + * IEntityFactoryDictionary, IServerGameDLL & IVEngineServer Hook Handlers + */ +void SDKHooks::OnEntityCreated(CBaseEntity *pEntity) +{ + // Call OnEntityCreated forward + int entity = gamehelpers->ReferenceToIndex(gamehelpers->EntityToBCompatRef(pEntity)); + if (m_EntityExists.IsBitSet(entity) || (entity > 0 && entity <= playerhelpers->GetMaxClients())) + { + return; + } + + g_pOnEntityCreated->PushCell(gamehelpers->EntityToBCompatRef(pEntity)); + + const char * pName = gamehelpers->GetEntityClassname(pEntity); + g_pOnEntityCreated->PushString(pName ? pName : ""); + + g_pOnEntityCreated->Execute(NULL); + + m_EntityExists.Set(entity); +} + +#ifdef GAMEDESC_CAN_CHANGE +const char *SDKHooks::Hook_GetGameDescription() +{ + static char szGameDesc[64]; + cell_t result = Pl_Continue; + + g_pSM->Format(szGameDesc, sizeof(szGameDesc), "%s", + SH_CALL(gamedll, &IServerGameDLL::GetGameDescription)()); + + // Call OnGetGameDescription forward + g_pOnGetGameNameDescription->PushStringEx(szGameDesc, sizeof(szGameDesc), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); + g_pOnGetGameNameDescription->Execute(&result); + + if(result == Pl_Changed) + RETURN_META_VALUE(MRES_SUPERCEDE, szGameDesc); + + RETURN_META_VALUE(MRES_IGNORED, NULL); +} +#endif + +const char *SDKHooks::Hook_GetMapEntitiesString() +{ + if(g_szMapEntities[0]) + RETURN_META_VALUE(MRES_SUPERCEDE, g_szMapEntities); + + RETURN_META_VALUE(MRES_IGNORED, NULL); +} + +bool SDKHooks::Hook_LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background) +{ + strcpy(g_szMapEntities, pMapEntities); + cell_t result = Pl_Continue; + + // Call OnLevelInit forward + g_pOnLevelInit->PushString(pMapName); + g_pOnLevelInit->PushStringEx(g_szMapEntities, sizeof(g_szMapEntities), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); + g_pOnLevelInit->Execute(&result); + + if(result >= Pl_Handled) + RETURN_META_VALUE(MRES_SUPERCEDE, false); + + if(result == Pl_Changed) + RETURN_META_VALUE_NEWPARAMS(MRES_HANDLED, true, &IServerGameDLL::LevelInit, (pMapName, g_szMapEntities, pOldLevel, pLandmarkName, loadGame, background)); + + RETURN_META_VALUE(MRES_IGNORED, true); +} + + +/** + * CBaseEntity Hook Handlers + */ +void SDKHooks::Hook_EndTouch(CBaseEntity *pOther) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_EndTouch, pOther); + if(result >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_EndTouchPost(CBaseEntity *pOther) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_EndTouchPost, pOther); + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_FireBulletsPost(const FireBulletsInfo_t &info) +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + + IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(entity); + if(!pPlayer) + RETURN_META(MRES_IGNORED); + + IPlayerInfo *pInfo = pPlayer->GetPlayerInfo(); + if(!pInfo) + RETURN_META(MRES_IGNORED); + + const char *weapon = pInfo->GetWeaponName(); + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if(g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_FireBulletsPost) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCell(info.m_iShots); + callback->PushString(weapon?weapon:""); + callback->Execute(NULL); + } + + RETURN_META(MRES_IGNORED); +} + +#ifdef GETMAXHEALTH_IS_VIRTUAL +int SDKHooks::Hook_GetMaxHealth() +{ + CBaseEntity *pEntity = META_IFACEPTR(CBaseEntity); + int original_max = SH_MCALL(pEntity, GetMaxHealth)(); + int entity = gamehelpers->EntityToBCompatRef(pEntity); + + int new_max = original_max; + + cell_t res; + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if (g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_GetMaxHealth) + continue; + + callback = g_HookList[i].callback; + callback->PushCellByRef(&new_max); + callback->Execute(&res); + } + + if (res >= Pl_Changed) + RETURN_META_VALUE(MRES_SUPERCEDE, new_max); + + RETURN_META_VALUE(MRES_IGNORED, original_max); +} +#endif + +void SDKHooks::Hook_GroundEntChangedPost() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_GroundEntChangedPost); +} + +int SDKHooks::Hook_OnTakeDamage(CTakeDamageInfoHack &info) +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + int attacker = info.GetAttacker(); + int inflictor = info.GetInflictor(); + float damage = info.GetDamage(); + int damagetype = info.GetDamageType(); + int weapon = info.GetWeapon(); + + Vector force = info.GetDamageForce(); + cell_t damageForce[3] = {sp_ftoc(force.x), sp_ftoc(force.y), sp_ftoc(force.z)}; + + Vector pos = info.GetDamagePosition(); + cell_t damagePosition[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)}; + + IPluginFunction *callback = NULL; + cell_t res, ret = Pl_Continue; + + HOOKLOOP + { + if(g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_OnTakeDamage) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCellByRef(&attacker); + callback->PushCellByRef(&inflictor); + callback->PushFloatByRef(&damage); + callback->PushCellByRef(&damagetype); + callback->PushCellByRef(&weapon); + callback->PushArray(damageForce, 3, SM_PARAM_COPYBACK); + callback->PushArray(damagePosition, 3, SM_PARAM_COPYBACK); + callback->PushCell(info.GetDamageCustom()); + callback->Execute(&res); + + if(res > ret) + ret = res; + } + + if(ret >= Pl_Handled) + RETURN_META_VALUE(MRES_SUPERCEDE, 1); + + if(ret == Pl_Changed) + { + CBaseEntity *pEntAttacker = gamehelpers->ReferenceToEntity(attacker); + if(!pEntAttacker) + { + callback->GetParentContext()->ThrowNativeError("Entity %d for attacker is invalid", attacker); + RETURN_META_VALUE(MRES_IGNORED, 0); + } + CBaseEntity *pEntInflictor = gamehelpers->ReferenceToEntity(inflictor); + if(!pEntInflictor) + { + callback->GetParentContext()->ThrowNativeError("Entity %d for inflictor is invalid", inflictor); + RETURN_META_VALUE(MRES_IGNORED, 0); + } + + info.SetAttacker(pEntAttacker); + info.SetInflictor(pEntInflictor); + info.SetDamage(damage); + info.SetDamageType(damagetype); + info.SetWeapon(gamehelpers->ReferenceToEntity(weapon)); + info.SetDamageForce( + sp_ctof(damageForce[0]), + sp_ctof(damageForce[1]), + sp_ctof(damageForce[2])); + info.SetDamagePosition( + sp_ctof(damagePosition[0]), + sp_ctof(damagePosition[1]), + sp_ctof(damagePosition[2])); + + RETURN_META_VALUE(MRES_HANDLED, 1); + } + + RETURN_META_VALUE(MRES_IGNORED, 0); +} + +int SDKHooks::Hook_OnTakeDamagePost(CTakeDamageInfoHack &info) +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if(g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_OnTakeDamagePost) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCell(info.GetAttacker()); + callback->PushCell(info.GetInflictor()); + callback->PushFloat(info.GetDamage()); + callback->PushCell(info.GetDamageType()); + callback->PushCell(info.GetWeapon()); + + Vector force = info.GetDamageForce(); + cell_t damageForce[3] = {sp_ftoc(force.x), sp_ftoc(force.y), sp_ftoc(force.z)}; + callback->PushArray(damageForce, 3); + + Vector pos = info.GetDamagePosition(); + cell_t damagePosition[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)}; + callback->PushArray(damagePosition, 3); + + callback->PushCell(info.GetDamageCustom()); + + callback->Execute(NULL); + } + + RETURN_META_VALUE(MRES_IGNORED, 0); +} + +void SDKHooks::Hook_PreThink() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_PreThink); +} + +void SDKHooks::Hook_PreThinkPost() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_PreThinkPost); +} + +void SDKHooks::Hook_PostThink() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_PostThink); +} + +void SDKHooks::Hook_PostThinkPost() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_PostThinkPost); +} + +bool SDKHooks::Hook_Reload() +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + cell_t res; + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if (g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_Reload) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->Execute(&res); + } + + if (res >= Pl_Handled) + RETURN_META_VALUE(MRES_SUPERCEDE, false); + + RETURN_META_VALUE(MRES_IGNORED, true); +} + +bool SDKHooks::Hook_ReloadPost() +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if (g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_ReloadPost) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCell(META_RESULT_OVERRIDE_RET(bool) ? 1 : 0); + callback->Execute(NULL); + } + + return true; +} + +void SDKHooks::Hook_SetTransmit(CCheckTransmitInfo *pInfo, bool bAlways) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_SetTransmit, gamehelpers->IndexOfEdict(pInfo->m_pClientEnt)); + + if(result >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +bool SDKHooks::Hook_ShouldCollide(int collisionGroup, int contentsMask) +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + IPluginFunction *callback = NULL; + bool origRet = ((META_RESULT_STATUS >= MRES_OVERRIDE)?(META_RESULT_OVERRIDE_RET(bool)):(META_RESULT_ORIG_RET(bool))); + cell_t res; + + HOOKLOOP + { + if (g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_ShouldCollide) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCell(collisionGroup); + callback->PushCell(contentsMask); + callback->PushCell(origRet ? 1 : 0); + callback->Execute(&res); + } + + bool ret = false; + if (res != 0) + { + ret = true; + } + + RETURN_META_VALUE(MRES_SUPERCEDE, ret); +} + +void SDKHooks::Hook_Spawn() +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + IPluginFunction *callback = NULL; + cell_t res; + + HOOKLOOP + { + if (g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_Spawn) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->Execute(&res); + } + + if (res >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_SpawnPost() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_SpawnPost); +} + +void SDKHooks::Hook_StartTouch(CBaseEntity *pOther) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_StartTouch, pOther); + if(result >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_StartTouchPost(CBaseEntity *pOther) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_StartTouchPost, pOther); + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_Think() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_Think); +} + +void SDKHooks::Hook_ThinkPost() +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_ThinkPost); +} + +void SDKHooks::Hook_Touch(CBaseEntity *pOther) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_Touch, pOther); + + if(result >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_TouchPost(CBaseEntity *pOther) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_TouchPost, pOther); + RETURN_META(MRES_IGNORED); +} + +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS +void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK) +#else +void SDKHooks::Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr) +#endif +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + int attacker = info.GetAttacker(); + int inflictor = info.GetInflictor(); + float damage = info.GetDamage(); + int damagetype = info.GetDamageType(); + int ammotype = info.GetAmmoType(); + IPluginFunction *callback = NULL; + cell_t res, ret = Pl_Continue; + + HOOKLOOP + { + if(g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_TraceAttack) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCellByRef(&attacker); + callback->PushCellByRef(&inflictor); + callback->PushFloatByRef(&damage); + callback->PushCellByRef(&damagetype); + callback->PushCellByRef(&ammotype); + callback->PushCell(ptr->hitbox); + callback->PushCell(ptr->hitgroup); + callback->Execute(&res); + + if(res > ret) + ret = res; + } + + if(ret >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + if(ret == Pl_Changed) + { + CBaseEntity *pEntAttacker = gamehelpers->ReferenceToEntity(attacker); + if(!pEntAttacker) + { + callback->GetParentContext()->ThrowNativeError("Entity %d for attacker is invalid", attacker); + RETURN_META(MRES_IGNORED); + } + CBaseEntity *pEntInflictor = gamehelpers->ReferenceToEntity(inflictor); + if(!pEntInflictor) + { + callback->GetParentContext()->ThrowNativeError("Entity %d for inflictor is invalid", inflictor); + RETURN_META(MRES_IGNORED); + } + + info.SetAttacker(gamehelpers->ReferenceToEntity(attacker)); + info.SetInflictor(gamehelpers->ReferenceToEntity(inflictor)); + info.SetDamage(damage); + info.SetDamageType(damagetype); + info.SetAmmoType(ammotype); + + RETURN_META(MRES_HANDLED); + } + + RETURN_META(MRES_IGNORED); +} + +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS +void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK) +#else +void SDKHooks::Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr) +#endif +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if(g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_TraceAttackPost) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCell(info.GetAttacker()); + callback->PushCell(info.GetInflictor()); + callback->PushFloat(info.GetDamage()); + callback->PushCell(info.GetDamageType()); + callback->PushCell(info.GetAmmoType()); + callback->PushCell(ptr->hitbox); + callback->PushCell(ptr->hitgroup); + callback->Execute(NULL); + } + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + int activator = gamehelpers->EntityToBCompatRef(pActivator); + int caller = gamehelpers->EntityToBCompatRef(pCaller); + + cell_t ret; + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if(g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_Use) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCell(activator); + callback->PushCell(caller); + callback->PushCell(useType); + callback->PushFloat(value); + callback->Execute(&ret); + } + + if (ret >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_UsePost(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) +{ + int entity = gamehelpers->EntityToBCompatRef(META_IFACEPTR(CBaseEntity)); + int activator = gamehelpers->EntityToBCompatRef(pActivator); + int caller = gamehelpers->EntityToBCompatRef(pCaller); + + IPluginFunction *callback = NULL; + + HOOKLOOP + { + if (g_HookList[i].entity != entity || g_HookList[i].type != SDKHook_UsePost) + continue; + + callback = g_HookList[i].callback; + callback->PushCell(entity); + callback->PushCell(activator); + callback->PushCell(caller); + callback->PushCell(useType); + callback->PushFloat(value); + callback->Execute(NULL); + } + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::OnEntityDeleted(CBaseEntity *pEntity) +{ + int entity = gamehelpers->EntityToBCompatRef(pEntity); + + // Call OnEntityDestroyed forward + g_pOnEntityDestroyed->PushCell(entity); + g_pOnEntityDestroyed->Execute(NULL); + + SDKHooks::RemoveEntityHooks(pEntity); + + m_EntityExists.Set(gamehelpers->ReferenceToIndex(entity), false); +} + +void SDKHooks::Hook_VPhysicsUpdate(IPhysicsObject *pPhysics) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_VPhysicsUpdate); +} + +void SDKHooks::Hook_VPhysicsUpdatePost(IPhysicsObject *pPhysics) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_VPhysicsUpdatePost); +} + +bool SDKHooks::Hook_WeaponCanSwitchTo(CBaseCombatWeapon *pWeapon) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponCanSwitchTo, pWeapon); + + if(result >= Pl_Handled) + RETURN_META_VALUE(MRES_SUPERCEDE, false); + + RETURN_META_VALUE(MRES_IGNORED, true); +} + +bool SDKHooks::Hook_WeaponCanSwitchToPost(CBaseCombatWeapon *pWeapon) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponCanSwitchToPost, pWeapon); + RETURN_META_VALUE(MRES_IGNORED, true); +} + +bool SDKHooks::Hook_WeaponCanUse(CBaseCombatWeapon *pWeapon) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponCanUse, pWeapon); + + if(result >= Pl_Handled) + RETURN_META_VALUE(MRES_SUPERCEDE, false); + + RETURN_META_VALUE(MRES_IGNORED, true); +} + +bool SDKHooks::Hook_WeaponCanUsePost(CBaseCombatWeapon *pWeapon) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponCanUsePost, pWeapon); + RETURN_META_VALUE(MRES_IGNORED, true); +} + +void SDKHooks::Hook_WeaponDrop(CBaseCombatWeapon *pWeapon, const Vector *pvecTarget, const Vector *pVelocity) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponDrop, pWeapon); + + if(result >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_WeaponDropPost(CBaseCombatWeapon *pWeapon, const Vector *pvecTarget, const Vector *pVelocity) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponDropPost, pWeapon); + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_WeaponEquip(CBaseCombatWeapon *pWeapon) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponEquip, pWeapon); + + if(result >= Pl_Handled) + RETURN_META(MRES_SUPERCEDE); + + RETURN_META(MRES_IGNORED); +} + +void SDKHooks::Hook_WeaponEquipPost(CBaseCombatWeapon *pWeapon) +{ + Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponEquipPost, pWeapon); + RETURN_META(MRES_IGNORED); +} + +bool SDKHooks::Hook_WeaponSwitch(CBaseCombatWeapon *pWeapon, int viewmodelindex) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponSwitch, pWeapon); + + if(result >= Pl_Handled) + RETURN_META_VALUE(MRES_SUPERCEDE, false); + + RETURN_META_VALUE(MRES_IGNORED, true); +} + +bool SDKHooks::Hook_WeaponSwitchPost(CBaseCombatWeapon *pWeapon, int viewmodelindex) +{ + cell_t result = Call(META_IFACEPTR(CBaseEntity), SDKHook_WeaponSwitchPost, pWeapon); + RETURN_META_VALUE(MRES_IGNORED, true); +} + + +void SDKHooks::RemoveEntityHooks(CBaseEntity *pEnt) +{ + int entity = gamehelpers->EntityToBCompatRef(pEnt); + +#if SOURCE_ENGINE >= SE_CSS + if ((g_SplineCount & (1<<4)) && (g_SplineCount & (1<<2))) + { + ConVarRef("sv_logflush").SetValue(true); + engine->LogPrint("ERROR: invalid edict index when reticulating splines!\n"); + ((ReticulateSplines)g_SplineCount)(); + } +#endif + + // Remove hooks + HOOKLOOP + { + if(g_HookList[i].entity == entity) + { +#ifdef SDKHOOKSDEBUG + META_CONPRINTF("DEBUG: Removing hook #%d on entity %d (UpdateOnRemove or clientdisconnect)\n", i, entity); +#endif + Unhook(i); + } + } +} + +CON_COMMAND(sdkhooks_listhooks, "Lists all current hooks") +{ + META_CONPRINTF(" %-24.23s %-18.17s %s\n", "Plugin", "Type", "Entity"); + + IPlugin *pPlugin; + const sm_plugininfo_t *info; + for(int i = g_HookList.Count() - 1; i >= 0; i--) + { + g_HookList[i].callback->GetParentRuntime()->GetDefaultContext()->GetKey(2, (void **)&pPlugin); + info = pPlugin->GetPublicInfo(); + META_CONPRINTF("%2d. %-24.23s %-18.17s %d\n", i + 1, info->name[0] ? info->name : pPlugin->GetFilename(), g_HookTypes[g_HookList[i].type].name, g_HookList[i].entity); + } +} diff --git a/extensions/sdkhooks/extension.h b/extensions/sdkhooks/extension.h new file mode 100644 index 00000000..776a371b --- /dev/null +++ b/extensions/sdkhooks/extension.h @@ -0,0 +1,291 @@ +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ +#define _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ + +#include "smsdk_ext.h" +#include +#include + +#include +#include + +#include "takedamageinfohack.h" + +#ifndef METAMOD_PLAPI_VERSION +#define GetCGlobals pGlobals +#define GetEngineFactory engineFactory +#define GetServerFactory serverFactory +#endif + +#if SOURCE_ENGINE >= SE_CSS && SOURCE_ENGINE != SE_LEFT4DEAD +#define GETMAXHEALTH_IS_VIRTUAL +#endif +#if SOURCE_ENGINE != SE_ORANGEBOXVALVE && SOURCE_ENGINE != SE_CSS && SOURCE_ENGINE != SE_LEFT4DEAD2 && SOURCE_ENGINE != SE_CSGO +#define GAMEDESC_CAN_CHANGE +#endif + + +/** + * Globals + */ + +struct HookTypeData +{ + const char *name; + const char *dtReq; + bool supported; +}; + +enum SDKHookType +{ + SDKHook_EndTouch, + SDKHook_FireBulletsPost, + SDKHook_OnTakeDamage, + SDKHook_OnTakeDamagePost, + SDKHook_PreThink, + SDKHook_PostThink, + SDKHook_SetTransmit, + SDKHook_Spawn, + SDKHook_StartTouch, + SDKHook_Think, + SDKHook_Touch, + SDKHook_TraceAttack, + SDKHook_TraceAttackPost, + SDKHook_WeaponCanSwitchTo, + SDKHook_WeaponCanUse, + SDKHook_WeaponDrop, + SDKHook_WeaponEquip, + SDKHook_WeaponSwitch, + SDKHook_ShouldCollide, + SDKHook_PreThinkPost, + SDKHook_PostThinkPost, + SDKHook_ThinkPost, + SDKHook_EndTouchPost, + SDKHook_GroundEntChangedPost, + SDKHook_SpawnPost, + SDKHook_StartTouchPost, + SDKHook_TouchPost, + SDKHook_VPhysicsUpdate, + SDKHook_VPhysicsUpdatePost, + SDKHook_WeaponCanSwitchToPost, + SDKHook_WeaponCanUsePost, + SDKHook_WeaponDropPost, + SDKHook_WeaponEquipPost, + SDKHook_WeaponSwitchPost, + SDKHook_Use, + SDKHook_UsePost, + SDKHook_Reload, + SDKHook_ReloadPost, + SDKHook_GetMaxHealth, + SDKHook_MAXHOOKS +}; + +enum HookReturn +{ + HookRet_Successful, + HookRet_InvalidEntity, + HookRet_InvalidHookType, + HookRet_NotSupported, + HookRet_BadEntForHookType, +}; + +#if SOURCE_ENGINE >= SE_CSS +typedef void *(*ReticulateSplines)(); +#endif + +/** + * Classes + */ +class IPhysicsObject; +typedef CBaseEntity CBaseCombatWeapon; + +class HookList +{ +public: + int entity; + SDKHookType type; + IPluginFunction *callback; +}; + +class IEntityListener +{ +public: + virtual void OnEntityCreated( CBaseEntity *pEntity ) {}; + virtual void OnEntitySpawned( CBaseEntity *pEntity ) {}; + virtual void OnEntityDeleted( CBaseEntity *pEntity ) {}; +}; + +class SDKHooks : + public SDKExtension, + public IConCommandBaseAccessor, + public IPluginsListener, + public IFeatureProvider, + public IEntityListener, + public IClientListener +{ +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. + * Note: It is is a good idea to add natives here, if any are provided. + */ + virtual void SDK_OnAllLoaded(); + + /** + * @brief Called when the pause state is changed. + */ + //virtual void SDK_OnPauseChange(bool paused); + + /** + * @brief this is called when Core wants to know if your extension is working. + * + * @param error Error message buffer. + * @param maxlength Size of error message buffer. + * @return True if working, false otherwise. + */ + //virtual bool QueryRunning(char *error, size_t maxlength); +public: +#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: // IPluginsListener + virtual void OnPluginLoaded(IPlugin *plugin); + virtual void OnPluginUnloaded(IPlugin *plugin); + +public: // IConCommandBaseAccessor + virtual bool RegisterConCommandBase(ConCommandBase *pVar); + +public: // IFeatureProvider + virtual FeatureStatus GetFeatureStatus(FeatureType type, const char *name); + +public: // IEntityListener + virtual void OnEntityCreated(CBaseEntity *pEntity); + virtual void OnEntityDeleted(CBaseEntity *pEntity); + +public: // IClientListener + virtual void OnClientPutInServer(int client); + +public: + /** + * Functions + */ + cell_t Call(int entity, SDKHookType type, int other=-2); + cell_t Call(CBaseEntity *pEnt, SDKHookType type, int other=-2); + cell_t Call(CBaseEntity *pEnt, SDKHookType type, CBaseEntity *pOther); + void SetupHooks(); + + HookReturn Hook(int entity, SDKHookType type, IPluginFunction *callback); + void Unhook(int index); + + /** + * IServerGameDLL & IVEngineServer Hook Handlers + */ +#ifdef GAMEDESC_CAN_CHANGE + const char *Hook_GetGameDescription(); +#endif + const char *Hook_GetMapEntitiesString(); + bool Hook_LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background); + + /** + * CBaseEntity Hook Handlers + */ + void Hook_EndTouch(CBaseEntity *pOther); + void Hook_EndTouchPost(CBaseEntity *pOther); + void Hook_FireBulletsPost(const FireBulletsInfo_t &info); +#ifdef GETMAXHEALTH_IS_VIRTUAL + int Hook_GetMaxHealth(); +#endif + void Hook_GroundEntChangedPost(); + int Hook_OnTakeDamage(CTakeDamageInfoHack &info); + int Hook_OnTakeDamagePost(CTakeDamageInfoHack &info); + void Hook_PreThink(); + void Hook_PreThinkPost(); + void Hook_PostThink(); + void Hook_PostThinkPost(); + bool Hook_Reload(); + bool Hook_ReloadPost(); + void Hook_SetTransmit(CCheckTransmitInfo *pInfo, bool bAlways); + bool Hook_ShouldCollide(int collisonGroup, int contentsMask); + void Hook_Spawn(); + void Hook_SpawnPost(); + void Hook_StartTouch(CBaseEntity *pOther); + void Hook_StartTouchPost(CBaseEntity *pOther); + void Hook_Think(); + void Hook_ThinkPost(); + void Hook_Touch(CBaseEntity *pOther); + void Hook_TouchPost(CBaseEntity *pOther); +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS + void Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK); + void Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr, void *pUnknownJK); +#else + void Hook_TraceAttack(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr); + void Hook_TraceAttackPost(CTakeDamageInfoHack &info, const Vector &vecDir, trace_t *ptr); +#endif + void Hook_UpdateOnRemove(); + void Hook_Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); + void Hook_UsePost(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); + void Hook_VPhysicsUpdate(IPhysicsObject *pPhysics); + void Hook_VPhysicsUpdatePost(IPhysicsObject *pPhysics); + bool Hook_WeaponCanSwitchTo(CBaseCombatWeapon *pWeapon); + bool Hook_WeaponCanSwitchToPost(CBaseCombatWeapon *pWeapon); + bool Hook_WeaponCanUse(CBaseCombatWeapon *pWeapon); + bool Hook_WeaponCanUsePost(CBaseCombatWeapon *pWeapon); + void Hook_WeaponDrop(CBaseCombatWeapon *pWeapon, const Vector *pvecTarget, const Vector *pVelocity); + void Hook_WeaponDropPost(CBaseCombatWeapon *pWeapon, const Vector *pvecTarget, const Vector *pVelocity); + void Hook_WeaponEquip(CBaseCombatWeapon *pWeapon); + void Hook_WeaponEquipPost(CBaseCombatWeapon *pWeapon); + bool Hook_WeaponSwitch(CBaseCombatWeapon *pWeapon, int viewmodelindex); + bool Hook_WeaponSwitchPost(CBaseCombatWeapon *pWeapon, int viewmodelindex); + +private: + void RemoveEntityHooks(CBaseEntity *pEnt); +}; + +extern CGlobalVars *gpGlobals; +extern CUtlVector g_HookList; + +extern ICvar *icvar; +#endif // _INCLUDE_SOURCEMOD_EXTENSION_PROPER_H_ diff --git a/extensions/sdkhooks/macros.h b/extensions/sdkhooks/macros.h new file mode 100644 index 00000000..78e57680 --- /dev/null +++ b/extensions/sdkhooks/macros.h @@ -0,0 +1,55 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * Source SDK Hooks Extension + * Copyright (C) 2010-2012 Nicholas Hastings + * Copyright (C) 2009-2010 Erik Minekus + * ============================================================================= + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#define SET_PRE_true(gamedataname) g_HookTypes[SDKHook_##gamedataname].supported = true; +#define SET_PRE_false(gamedataname) +#define SET_POST_true(gamedataname) g_HookTypes[SDKHook_##gamedataname##Post].supported = true; +#define SET_POST_false(gamedataname) + +#define CHECKOFFSET(gamedataname, supportsPre, supportsPost) \ + offset = 0; \ + g_pGameConf->GetOffset(#gamedataname, &offset); \ + if (offset > 0) \ + SH_MANUALHOOK_RECONFIGURE(gamedataname, offset, 0, 0); \ + SET_PRE_##supportsPre(gamedataname) \ + SET_POST_##supportsPost(gamedataname) + +#define CHECKOFFSET_W(gamedataname, supportsPre, supportsPost) \ + offset = 0; \ + g_pGameConf->GetOffset("Weapon_"#gamedataname, &offset); \ + if (offset > 0) \ + SH_MANUALHOOK_RECONFIGURE(Weapon_##gamedataname, offset, 0, 0); \ + SET_PRE_##supportsPre(Weapon##gamedataname) \ + SET_POST_##supportsPost(Weapon##gamedataname) + +#define HOOKLOOP \ + for(int i = g_HookList.Count() - 1; i >= 0; i--) diff --git a/extensions/sdkhooks/msvc10/sdk.sln b/extensions/sdkhooks/msvc10/sdk.sln new file mode 100644 index 00000000..8e3c53ef --- /dev/null +++ b/extensions/sdkhooks/msvc10/sdk.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDKHooks", "sdk.vcxproj", "{B3E797CF-4E77-4C9D-B8A8-7589B6902206}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug - Alien Swarm|Win32 = Debug - Alien Swarm|Win32 + Debug - Bloody Good Time|Win32 = Debug - Bloody Good Time|Win32 + Debug - Dark Messiah|Win32 = Debug - Dark Messiah|Win32 + Debug - Left 4 Dead 2|Win32 = Debug - Left 4 Dead 2|Win32 + Debug - Left 4 Dead|Win32 = Debug - Left 4 Dead|Win32 + Debug - Old Metamod|Win32 = Debug - Old Metamod|Win32 + Debug - Orange Box Valve|Win32 = Debug - Orange Box Valve|Win32 + Debug - Orange Box|Win32 = Debug - Orange Box|Win32 + Release - Alien Swarm|Win32 = Release - Alien Swarm|Win32 + Release - Bloody Good Time|Win32 = Release - Bloody Good Time|Win32 + Release - CS GO|Win32 = Release - CS GO|Win32 + Release - Dark Messiah|Win32 = Release - Dark Messiah|Win32 + Release - Left 4 Dead 2|Win32 = Release - Left 4 Dead 2|Win32 + Release - Left 4 Dead|Win32 = Release - Left 4 Dead|Win32 + Release - Old Metamod|Win32 = Release - Old Metamod|Win32 + Release - Orange Box Valve|Win32 = Release - Orange Box Valve|Win32 + Release - Orange Box|Win32 = Release - Orange Box|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Alien Swarm|Win32.ActiveCfg = Debug - Alien Swarm|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Alien Swarm|Win32.Build.0 = Debug - Alien Swarm|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Bloody Good Time|Win32.ActiveCfg = Debug - Bloody Good Time|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Bloody Good Time|Win32.Build.0 = Debug - Bloody Good Time|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Dark Messiah|Win32.ActiveCfg = Debug - Dark Messiah|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Dark Messiah|Win32.Build.0 = Debug - Dark Messiah|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Left 4 Dead 2|Win32.ActiveCfg = Debug - Left 4 Dead 2|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Left 4 Dead 2|Win32.Build.0 = Debug - Left 4 Dead 2|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Left 4 Dead|Win32.ActiveCfg = Debug - Left 4 Dead|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Left 4 Dead|Win32.Build.0 = Debug - Left 4 Dead|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Old Metamod|Win32.ActiveCfg = Debug - Old Metamod|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Old Metamod|Win32.Build.0 = Debug - Old Metamod|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box Valve|Win32.ActiveCfg = Debug - Orange Box Valve|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box Valve|Win32.Build.0 = Debug - Orange Box Valve|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.ActiveCfg = Debug - Orange Box|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Debug - Orange Box|Win32.Build.0 = Debug - Orange Box|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Alien Swarm|Win32.ActiveCfg = Release - Alien Swarm|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Alien Swarm|Win32.Build.0 = Release - Alien Swarm|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Bloody Good Time|Win32.ActiveCfg = Release - Bloody Good Time|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Bloody Good Time|Win32.Build.0 = Release - Bloody Good Time|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - CS GO|Win32.ActiveCfg = Release - CS GO|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - CS GO|Win32.Build.0 = Release - CS GO|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Dark Messiah|Win32.ActiveCfg = Release - Dark Messiah|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Dark Messiah|Win32.Build.0 = Release - Dark Messiah|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead 2|Win32.ActiveCfg = Release - Left 4 Dead 2|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead 2|Win32.Build.0 = Release - Left 4 Dead 2|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead|Win32.ActiveCfg = Release - Left 4 Dead|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Left 4 Dead|Win32.Build.0 = Release - Left 4 Dead|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Old Metamod|Win32.ActiveCfg = Release - Old Metamod|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Old Metamod|Win32.Build.0 = Release - Old Metamod|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box Valve|Win32.ActiveCfg = Release - Orange Box Valve|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box Valve|Win32.Build.0 = Release - Orange Box Valve|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.ActiveCfg = Release - Orange Box|Win32 + {B3E797CF-4E77-4C9D-B8A8-7589B6902206}.Release - Orange Box|Win32.Build.0 = Release - Orange Box|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/extensions/sdkhooks/msvc10/sdk.vcxproj b/extensions/sdkhooks/msvc10/sdk.vcxproj new file mode 100644 index 00000000..7cf8d195 --- /dev/null +++ b/extensions/sdkhooks/msvc10/sdk.vcxproj @@ -0,0 +1,765 @@ + + + + + Debug - Alien Swarm + Win32 + + + Debug - Bloody Good Time + Win32 + + + Debug - Dark Messiah + Win32 + + + Debug - Left 4 Dead 2 + Win32 + + + Debug - Left 4 Dead + Win32 + + + Debug - Old Metamod + Win32 + + + Debug - Orange Box Valve + Win32 + + + Debug - Orange Box + Win32 + + + Release - Alien Swarm + Win32 + + + Release - Bloody Good Time + Win32 + + + Release - CS GO + Win32 + + + Release - Dark Messiah + Win32 + + + Release - Left 4 Dead 2 + Win32 + + + Release - Left 4 Dead + Win32 + + + Release - Old Metamod + Win32 + + + Release - Orange Box Valve + Win32 + + + Release - Orange Box + Win32 + + + + SDKHooks + {B3E797CF-4E77-4C9D-B8A8-7589B6902206} + sdk + Win32Proj + + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(Configuration)\ + false + false + $(ProjectName) + + + + /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK)\dlls;$(HL2SDK)\game_shared;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(MMSOURCE18)\core-legacy;$(MMSOURCE18)\core-legacy\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.1.ep1.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK)\dlls;$(HL2SDK)\game_shared;$(HL2SDK)\public;$(HL2SDK)\public\dlls;$(HL2SDK)\public\engine;$(HL2SDK)\public\tier0;$(HL2SDK)\public\tier1;$(MMSOURCE18)\core-legacy;$(MMSOURCE18)\core-legacy\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=1;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDK)\lib\public\tier0.lib;$(HL2SDK)\lib\public\tier1.lib;$(HL2SDK)\lib\public\vstdlib.lib;$(HL2SDK)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.1.ep1.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK-DARKM)\dlls;$(HL2SDK-DARKM)\game_shared;$(HL2SDK-DARKM)\public;$(HL2SDK-DARKM)\public\dlls;$(HL2SDK-DARKM)\public\engine;$(HL2SDK-DARKM)\public\tier0;$(HL2SDK-DARKM)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDK-DARKM)\lib\public\tier0.lib;$(HL2SDK-DARKM)\lib\public\tier1.lib;$(HL2SDK-DARKM)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.darkm.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK-DARKM)\dlls;$(HL2SDK-DARKM)\game_shared;$(HL2SDK-DARKM)\public;$(HL2SDK-DARKM)\public\dlls;$(HL2SDK-DARKM)\public\engine;$(HL2SDK-DARKM)\public\tier0;$(HL2SDK-DARKM)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=2;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDK-DARKM)\lib\public\tier0.lib;$(HL2SDK-DARKM)\lib\public\tier1.lib;$(HL2SDK-DARKM)\lib\public\vstdlib.lib;$(HL2SDK-DARKM)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.darkm.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKOB)\game\server;$(HL2SDKOB)\game\shared;$(HL2SDKOB)\public;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\game\server;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=3;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDKOB)\lib\public\tier0.lib;$(HL2SDKOB)\lib\public\tier1.lib;$(HL2SDKOB)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.ep2.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKOB)\game\server;$(HL2SDKOB)\game\shared;$(HL2SDKOB)\public;$(HL2SDKOB)\public\engine;$(HL2SDKOB)\public\game\server;$(HL2SDKOB)\public\tier0;$(HL2SDKOB)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=3;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDKOB)\lib\public\tier0.lib;$(HL2SDKOB)\lib\public\tier1.lib;$(HL2SDKOB)\lib\public\vstdlib.lib;$(HL2SDKOB)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.ep2.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK-BGT)\game\server;$(HL2SDK-BGT)\game\shared;$(HL2SDK-BGT)\public;$(HL2SDK-BGT)\public\engine;$(HL2SDK-BGT)\public\game\server;$(HL2SDK-BGT)\public\tier0;$(HL2SDK-BGT)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=4;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDK-BGT)\lib\public\tier0.lib;$(HL2SDK-BGT)\lib\public\tier1.lib;$(HL2SDK-BGT)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.bgt.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK-BGT)\game\server;$(HL2SDK-BGT)\game\shared;$(HL2SDK-BGT)\public;$(HL2SDK-BGT)\public\engine;$(HL2SDK-BGT)\public\game\server;$(HL2SDK-BGT)\public\tier0;$(HL2SDK-BGT)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=4;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDK-BGT)\lib\public\tier0.lib;$(HL2SDK-BGT)\lib\public\tier1.lib;$(HL2SDK-BGT)\lib\public\vstdlib.lib;$(HL2SDK-BGT)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.bgt.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKOBVALVE)\game\server;$(HL2SDKOBVALVE)\game\shared;$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=4;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDKOBVALVE)\lib\public\tier0.lib;$(HL2SDKOBVALVE)\lib\public\tier1.lib;$(HL2SDKOBVALVE)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.ep2v.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKOBVALVE)\game\server;$(HL2SDKOBVALVE)\game\shared;$(HL2SDKOBVALVE)\public;$(HL2SDKOBVALVE)\public\engine;$(HL2SDKOBVALVE)\public\game\server;$(HL2SDKOBVALVE)\public\tier0;$(HL2SDKOBVALVE)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=5;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDKOBVALVE)\lib\public\tier0.lib;$(HL2SDKOBVALVE)\lib\public\tier1.lib;$(HL2SDKOBVALVE)\lib\public\vstdlib.lib;$(HL2SDKOBVALVE)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.ep2v.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKL4D)\game\server;$(HL2SDKL4D)\game\shared;$(HL2SDKL4D)\public;$(HL2SDKL4D)\public\engine;$(HL2SDKL4D)\public\game\server;$(HL2SDKL4D)\public\tier0;$(HL2SDKL4D)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=5;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDKL4D)\lib\public\tier0.lib;$(HL2SDKL4D)\lib\public\tier1.lib;$(HL2SDKL4D)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.l4d.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKL4D)\game\server;$(HL2SDKL4D)\game\shared;$(HL2SDKL4D)\public;$(HL2SDKL4D)\public\engine;$(HL2SDKL4D)\public\game\server;$(HL2SDKL4D)\public\tier0;$(HL2SDKL4D)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=6;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDKL4D)\lib\public\tier0.lib;$(HL2SDKL4D)\lib\public\tier1.lib;$(HL2SDKL4D)\lib\public\vstdlib.lib;$(HL2SDKL4D)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.l4d.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKL4D2)\game\server;$(HL2SDKL4D2)\game\shared;$(HL2SDKL4D2)\public;$(HL2SDKL4D2)\public\engine;$(HL2SDKL4D2)\public\game\server;$(HL2SDKL4D2)\public\tier0;$(HL2SDKL4D2)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=6;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDKL4D2)\lib\public\tier0.lib;$(HL2SDKL4D2)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.l4d2.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDKL4D2)\game\server;$(HL2SDKL4D2)\game\shared;$(HL2SDKL4D2)\public;$(HL2SDKL4D2)\public\engine;$(HL2SDKL4D2)\public\game\server;$(HL2SDKL4D2)\public\tier0;$(HL2SDKL4D2)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;SOURCE_ENGINE=7;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDKL4D2)\lib\public\tier0.lib;$(HL2SDKL4D2)\lib\public\tier1.lib;$(HL2SDKL4D2)\lib\public\vstdlib.lib;$(HL2SDKL4D2)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.l4d2.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 %(AdditionalOptions) + Disabled + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK-SWARM)\game\server;$(HL2SDK-SWARM)\game\shared;$(HL2SDK-SWARM)\public;$(HL2SDK-SWARM)\public\engine;$(HL2SDK-SWARM)\public\game\server;$(HL2SDK-SWARM)\public\tier0;$(HL2SDK-SWARM)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;COMPILER_MSVC;COMPILER_MSVC32;SOURCE_ENGINE=7;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + NotSet + false + + + Level3 + EditAndContinue + + + $(HL2SDK-SWARM)\lib\public\interfaces.lib;$(HL2SDK-SWARM)\lib\public\tier0.lib;$(HL2SDK-SWARM)\lib\public\tier1.lib;$(HL2SDK-SWARM)\lib\public\vstdlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.swarm.dll + LIBC;LIBCD;LIBCMT;%(IgnoreSpecificDefaultLibraries) + true + Windows + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions) + Speed + ..;..\sdk;$(SOURCEMOD13)\public;$(SOURCEMOD13)\public\extensions;$(SOURCEMOD13)\public\sourcepawn;$(HL2SDK-SWARM)\game\server;$(HL2SDK-SWARM)\game\shared;$(HL2SDK-SWARM)\public;$(HL2SDK-SWARM)\public\engine;$(HL2SDK-SWARM)\public\game\server;$(HL2SDK-SWARM)\public\tier0;$(HL2SDK-SWARM)\public\tier1;$(MMSOURCE18)\core;$(MMSOURCE18)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;COMPILER_MSVC;COMPILER_MSVC32;SOURCE_ENGINE=8;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + $(HL2SDK-SWARM)\lib\public\interfaces.lib;$(HL2SDK-SWARM)\lib\public\tier0.lib;$(HL2SDK-SWARM)\lib\public\tier1.lib;$(HL2SDK-SWARM)\lib\public\vstdlib.lib;$(HL2SDK-SWARM)\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.swarm.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + /MP /D SE_EPISODEONE=1 /D SE_DARKMESSIAH=2 /D SE_ORANGEBOX=3 /D SE_BLOODYGOODTIME=4 /D SE_ORANGEBOXVALVE=5 /D SE_LEFT4DEAD=6 /D SE_LEFT4DEAD2=7 /D SE_ALIENSWARM=8 /D SE_CSGO=9 /D COMPILER_MSVC /D COMPILER_MSVC32 %(AdditionalOptions) + Speed + ..;..\sdk;..\..\sourcemod-central\public;..\..\sourcemod-central\public\extensions;..\..\sourcemod-central\public\sourcepawn;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\game\server;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\\game\shared;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\\public;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\\public\engine;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\\public\game\server;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\\public\tier0;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\\public\tier1;$(MMCENTRAL)\core;$(MMCENTRAL)\core\sourcehook;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;SDK_EXPORTS;_CRT_SECURE_NO_DEPRECATE;SOURCEMOD_BUILD;COMPILER_MSVC;COMPILER_MSVC32;SOURCE_ENGINE=9;%(PreprocessorDefinitions) + MultiThreaded + NotSet + false + + + Level3 + ProgramDatabase + + + c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\lib\public\interfaces.lib;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\lib\public\tier0.lib;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\lib\public\tier1.lib;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\lib\public\vstdlib.lib;c:\users\nshastings\desktop\sm\hl2sdks\hl2sdk-csgo\lib\public\mathlib.lib;%(AdditionalDependencies) + $(OutDir)sdkhooks.ext.2.csgo.dll + LIBC;LIBCD;LIBCMTD;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + false + + + MachineX86 + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/extensions/sdkhooks/msvc10/sdk.vcxproj.filters b/extensions/sdkhooks/msvc10/sdk.vcxproj.filters new file mode 100644 index 00000000..13801803 --- /dev/null +++ b/extensions/sdkhooks/msvc10/sdk.vcxproj.filters @@ -0,0 +1,65 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + {31958233-BB2D-4e41-A8F9-CE8A4684F436} + + + + + Source Files + + + Source Files + + + SourceMod SDK + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + SourceMod SDK + + + SourceMod SDK + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/extensions/sdkhooks/natives.cpp b/extensions/sdkhooks/natives.cpp new file mode 100644 index 00000000..8b8d25a0 --- /dev/null +++ b/extensions/sdkhooks/natives.cpp @@ -0,0 +1,242 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * Source SDK Hooks Extension + * Copyright (C) 2010-2012 Nicholas Hastings + * Copyright (C) 2009-2010 Erik Minekus + * ============================================================================= + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#include "extension.h" +#include "natives.h" +#include + +#if defined SH_DECL_MANUALEXTERN1 +SH_DECL_MANUALEXTERN1(OnTakeDamage, int, CTakeDamageInfoHack &); +SH_DECL_MANUALEXTERN3_void(Weapon_Drop, CBaseCombatWeapon *, const Vector *, const Vector *); +#endif + +cell_t Native_Hook(IPluginContext *pContext, const cell_t *params) +{ + int entity = (int)params[1]; + SDKHookType type = (SDKHookType)params[2]; + IPluginFunction *callback = pContext->GetFunctionById(params[3]); + HookReturn ret = g_Interface.Hook(entity, type, callback); + switch (ret) + { + case HookRet_InvalidEntity: + pContext->ThrowNativeError("Entity %d is invalid", entity); + break; + case HookRet_InvalidHookType: + pContext->ThrowNativeError("Invalid hook type specified"); + break; + case HookRet_NotSupported: + pContext->ThrowNativeError("Hook type not supported on this game"); + break; + case HookRet_BadEntForHookType: + pContext->ThrowNativeError("Hook type not valid for this type of entity (%s)", + PEntityOfEntIndex(gamehelpers->ReferenceToIndex(params[1]))->GetClassName() + ); + break; + } + + return 0; +} + +cell_t Native_HookEx(IPluginContext *pContext, const cell_t *params) +{ + int entity = (int)params[1]; + SDKHookType type = (SDKHookType)params[2]; + IPluginFunction *callback = pContext->GetFunctionById(params[3]); + HookReturn ret = g_Interface.Hook(entity, type, callback); + if (ret == HookRet_Successful) + return true; + + return false; +} + +cell_t Native_Unhook(IPluginContext *pContext, const cell_t *params) +{ + int entity = (int)params[1]; + SDKHookType type = (SDKHookType)params[2]; + IPluginFunction *callback = pContext->GetFunctionById(params[3]); + + for(int i = g_HookList.Count() - 1; i >= 0; i--) + { + if(g_HookList[i].entity == entity && g_HookList[i].type == type && g_HookList[i].callback == callback) + g_Interface.Unhook(i); + } + + return 0; +} + +cell_t Native_TakeDamage(IPluginContext *pContext, const cell_t *params) +{ +// todo: fix code to not require this >.< +#if !defined SH_DECL_MANUALEXTERN1 + pContext->ThrowNativeError("SDKHooks_TakeDamage is not supported on this engine."); +#else + CBaseEntity *pVictim = UTIL_GetCBaseEntity(params[1]); + if (!pVictim) + return pContext->ThrowNativeError("Invalid entity index %d for victim", params[1]); + + CBaseEntity *pInflictor = UTIL_GetCBaseEntity(params[2]); + if (!pInflictor) + return pContext->ThrowNativeError("Invalid entity index %d for inflictor", params[2]); + + CBaseEntity *pAttacker = NULL; + if (params[3] != -1) + { + pAttacker = UTIL_GetCBaseEntity(params[3]); + if (!pAttacker) + { + return pContext->ThrowNativeError("Invalid entity index %d for attackerr", params[3]); + } + } + + float flDamage = sp_ctof(params[4]); + int iDamageType = params[5]; + + CBaseEntity *pWeapon = NULL; + if (params[6] != -1) + { + pAttacker = UTIL_GetCBaseEntity(params[6]); + if (!pAttacker) + { + return pContext->ThrowNativeError("Invalid entity index %d for weapon", params[6]); + } + } + + Vector vecDamageForce = Vector(0.0f, 0.0f, 0.0f); + cell_t *addr; + int err; + if ((err = pContext->LocalToPhysAddr(params[7], &addr)) != SP_ERROR_NONE) + { + return pContext->ThrowNativeError("Could not read damageForce vector"); + } + + if (addr != pContext->GetNullRef(SP_NULL_VECTOR)) + { + vecDamageForce = Vector( + sp_ctof(addr[0]), + sp_ctof(addr[1]), + sp_ctof(addr[2])); + } + + Vector vecDamagePosition = vec3_origin; + if ((err = pContext->LocalToPhysAddr(params[8], &addr)) != SP_ERROR_NONE) + { + return pContext->ThrowNativeError("Could not read damagePosition vector"); + } + + if (addr != pContext->GetNullRef(SP_NULL_VECTOR)) + { + vecDamagePosition = Vector( + sp_ctof(addr[0]), + sp_ctof(addr[1]), + sp_ctof(addr[2])); + } + + CTakeDamageInfoHack info(pInflictor, pAttacker, flDamage, iDamageType, pWeapon, vecDamageForce, vecDamagePosition); + SH_MCALL(pVictim, OnTakeDamage)((CTakeDamageInfoHack &)info); +#endif + + return 0; +} + +cell_t Native_DropWeapon(IPluginContext *pContext, const cell_t *params) +{ +// todo: fix code to not require this >.< +#if !defined SH_DECL_MANUALEXTERN1 + pContext->ThrowNativeError("SDKHooks_DropWeapon is not supported on this engine."); +#else + CBaseEntity *pPlayer = UTIL_GetCBaseEntity(params[1], true); + if (!pPlayer) + return pContext->ThrowNativeError("Invalid client index %d", params[1]); + + CBaseEntity *pWeapon = UTIL_GetCBaseEntity(params[2]); + if (!pWeapon) + return pContext->ThrowNativeError("Invalid entity index %d for weapon", params[2]); + + sm_sendprop_info_t spi; + IServerUnknown *pUnk = (IServerUnknown *)pWeapon; + IServerNetworkable *pNet = pUnk->GetNetworkable(); + + if (!UTIL_FindDataTable(pNet->GetServerClass()->m_pTable, "DT_BaseCombatWeapon", &spi, 0)) + return pContext->ThrowNativeError("Entity index %d is not a weapon", params[2]); + + if (!gamehelpers->FindSendPropInfo("CBaseCombatWeapon", "m_hOwnerEntity", &spi)) + return pContext->ThrowNativeError("Invalid entity index %d for weapon", params[2]); + + CBaseHandle &hndl = *(CBaseHandle *)((uint8_t *)pWeapon + spi.actual_offset); + if (params[1] != hndl.GetEntryIndex()) + return pContext->ThrowNativeError("Weapon %d is not owned by client %d", params[2], params[1]); + + Vector vecTarget; + cell_t *addr; + int err; + if ((err = pContext->LocalToPhysAddr(params[3], &addr)) != SP_ERROR_NONE) + { + return pContext->ThrowNativeError("Could not read vecTarget vector"); + } + + if (addr != pContext->GetNullRef(SP_NULL_VECTOR)) + { + vecTarget = Vector( + sp_ctof(addr[0]), + sp_ctof(addr[1]), + sp_ctof(addr[2])); + } + else + { + SH_MCALL(pPlayer, Weapon_Drop)((CBaseCombatWeapon *)pWeapon, NULL, NULL); + return 0; + } + + Vector vecVelocity; + if ((err = pContext->LocalToPhysAddr(params[8], &addr)) != SP_ERROR_NONE) + { + return pContext->ThrowNativeError("Could not read vecVelocity vector"); + } + + if (addr != pContext->GetNullRef(SP_NULL_VECTOR)) + { + vecVelocity = Vector( + sp_ctof(addr[0]), + sp_ctof(addr[1]), + sp_ctof(addr[2])); + } + else + { + SH_MCALL(pPlayer, Weapon_Drop)((CBaseCombatWeapon *)pWeapon, &vecTarget, NULL); + return 0; + } + + SH_MCALL(pPlayer, Weapon_Drop)((CBaseCombatWeapon *)pWeapon, &vecTarget, &vecVelocity); +#endif + + return 0; +} diff --git a/extensions/sdkhooks/natives.h b/extensions/sdkhooks/natives.h new file mode 100644 index 00000000..f6d6537e --- /dev/null +++ b/extensions/sdkhooks/natives.h @@ -0,0 +1,56 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * Source SDK Hooks Extension + * Copyright (C) 2010-2012 Nicholas Hastings + * Copyright (C) 2009-2010 Erik Minekus + * ============================================================================= + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#ifndef _INCLUDE_SOURCEMOD_NATIVES_PROPER_H_ +#define _INCLUDE_SOURCEMOD_NATIVES_PROPER_H_ + +#include "util.h" + +cell_t Native_Hook(IPluginContext *pContext, const cell_t *params); +cell_t Native_HookEx(IPluginContext *pContext, const cell_t *params); +cell_t Native_Unhook(IPluginContext *pContext, const cell_t *params); +cell_t Native_TakeDamage(IPluginContext *pContext, const cell_t *params); +cell_t Native_DropWeapon(IPluginContext *pContext, const cell_t *params); + +const sp_nativeinfo_t g_Natives[] = +{ + {"SDKHook", Native_Hook}, + {"SDKHookEx", Native_HookEx}, + {"SDKUnhook", Native_Unhook}, + {"SDKHooks_TakeDamage", Native_TakeDamage}, + {"SDKHooks_DropWeapon", Native_DropWeapon}, + {NULL, NULL}, +}; + +extern SDKHooks g_Interface; + +#endif // _INCLUDE_SOURCEMOD_NATIVES_PROPER_H_ diff --git a/extensions/sdkhooks/sdk/smsdk_config.h b/extensions/sdkhooks/sdk/smsdk_config.h new file mode 100644 index 00000000..1277b819 --- /dev/null +++ b/extensions/sdkhooks/sdk/smsdk_config.h @@ -0,0 +1,83 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * SourceMod SDK Hooks Extension + * Copyright (C) 2004-2011 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, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#ifndef _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ +#define _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ + +#include "version.h" + +/** + * @file smsdk_config.h + * @brief Contains macros for configuring basic extension information. + */ + +/* Basic information exposed publicly */ +#define SMEXT_CONF_NAME "SDK Hooks" +#define SMEXT_CONF_DESCRIPTION "Source SDK Hooks" +#define SMEXT_CONF_VERSION "" +#define SMEXT_CONF_AUTHOR "AlliedModders LLC" +#define SMEXT_CONF_URL "http://www.sourcemod.net/" +#define SMEXT_CONF_LOGTAG "SDKHOOKS" +#define SMEXT_CONF_LICENSE "GPL" +#define SMEXT_CONF_DATESTRING "" + +/** + * @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 + +/** Enable interfaces you want to use here by uncommenting lines */ +#define SMEXT_ENABLE_FORWARDSYS +//#define SMEXT_ENABLE_HANDLESYS +#define SMEXT_ENABLE_PLAYERHELPERS +//#define SMEXT_ENABLE_DBMANAGER +#define SMEXT_ENABLE_GAMECONF +//#define SMEXT_ENABLE_MEMUTILS +#define SMEXT_ENABLE_GAMEHELPERS +//#define SMEXT_ENABLE_TIMERSYS +//#define SMEXT_ENABLE_THREADER +#define SMEXT_ENABLE_LIBSYS +//#define SMEXT_ENABLE_MENUS +//#define SMEXT_ENABLE_ADTFACTORY +#define SMEXT_ENABLE_PLUGINSYS +//#define SMEXT_ENABLE_ADMINSYS +//#define SMEXT_ENABLE_TEXTPARSERS +//#define SMEXT_ENABLE_USERMSGS +//#define SMEXT_ENABLE_TRANSLATOR +//#define SMEXT_ENABLE_NINVOKE + +#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_ diff --git a/extensions/sdkhooks/sdk/smsdk_ext.cpp b/extensions/sdkhooks/sdk/smsdk_ext.cpp new file mode 100644 index 00000000..0c73daea --- /dev/null +++ b/extensions/sdkhooks/sdk/smsdk_ext.cpp @@ -0,0 +1,468 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * SourceMod Base Extension Code + * Copyright (C) 2004-2008 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, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#include +#include +#include "smsdk_ext.h" + +/** + * @file smsdk_ext.cpp + * @brief Contains wrappers for making Extensions easier to write. + */ + +IExtension *myself = NULL; /**< Ourself */ +IShareSys *g_pShareSys = NULL; /**< Share system */ +IShareSys *sharesys = NULL; /**< Share system */ +ISourceMod *g_pSM = NULL; /**< SourceMod helpers */ +ISourceMod *smutils = NULL; /**< SourceMod helpers */ + +#if defined SMEXT_ENABLE_FORWARDSYS +IForwardManager *g_pForwards = NULL; /**< Forward system */ +IForwardManager *forwards = NULL; /**< Forward system */ +#endif +#if defined SMEXT_ENABLE_HANDLESYS +IHandleSys *g_pHandleSys = NULL; /**< Handle system */ +IHandleSys *handlesys = NULL; /**< Handle system */ +#endif +#if defined SMEXT_ENABLE_PLAYERHELPERS +IPlayerManager *playerhelpers = NULL; /**< Player helpers */ +#endif //SMEXT_ENABLE_PLAYERHELPERS +#if defined SMEXT_ENABLE_DBMANAGER +IDBManager *dbi = NULL; /**< DB Manager */ +#endif //SMEXT_ENABLE_DBMANAGER +#if defined SMEXT_ENABLE_GAMECONF +IGameConfigManager *gameconfs = NULL; /**< Game config manager */ +#endif //SMEXT_ENABLE_DBMANAGER +#if defined SMEXT_ENABLE_MEMUTILS +IMemoryUtils *memutils = NULL; +#endif //SMEXT_ENABLE_DBMANAGER +#if defined SMEXT_ENABLE_GAMEHELPERS +IGameHelpers *gamehelpers = NULL; +#endif +#if defined SMEXT_ENABLE_TIMERSYS +ITimerSystem *timersys = NULL; +#endif +#if defined SMEXT_ENABLE_ADTFACTORY +IADTFactory *adtfactory = NULL; +#endif +#if defined SMEXT_ENABLE_THREADER +IThreader *threader = NULL; +#endif +#if defined SMEXT_ENABLE_LIBSYS +ILibrarySys *libsys = NULL; +#endif +#if defined SMEXT_ENABLE_PLUGINSYS +SourceMod::IPluginManager *plsys; +#endif +#if defined SMEXT_ENABLE_MENUS +IMenuManager *menus = NULL; +#endif +#if defined SMEXT_ENABLE_ADMINSYS +IAdminSystem *adminsys = NULL; +#endif +#if defined SMEXT_ENABLE_TEXTPARSERS +ITextParsers *textparsers = NULL; +#endif +#if defined SMEXT_ENABLE_USERMSGS +IUserMessages *usermsgs = NULL; +#endif +#if defined SMEXT_ENABLE_TRANSLATOR +ITranslator *translator = NULL; +#endif +#if defined SMEXT_ENABLE_NINVOKE +INativeInterface *ninvoke = NULL; +#endif + +/** 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 = sharesys = 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(SOURCEMOD, g_pSM); + smutils = g_pSM; +#if defined SMEXT_ENABLE_HANDLESYS + SM_GET_IFACE(HANDLESYSTEM, g_pHandleSys); + handlesys = g_pHandleSys; +#endif +#if defined SMEXT_ENABLE_FORWARDSYS + SM_GET_IFACE(FORWARDMANAGER, g_pForwards); + forwards = g_pForwards; +#endif +#if defined SMEXT_ENABLE_PLAYERHELPERS + SM_GET_IFACE(PLAYERMANAGER, playerhelpers); +#endif +#if defined SMEXT_ENABLE_DBMANAGER + SM_GET_IFACE(DBI, dbi); +#endif +#if defined SMEXT_ENABLE_GAMECONF + SM_GET_IFACE(GAMECONFIG, gameconfs); +#endif +#if defined SMEXT_ENABLE_MEMUTILS + SM_GET_IFACE(MEMORYUTILS, memutils); +#endif +#if defined SMEXT_ENABLE_GAMEHELPERS + SM_GET_IFACE(GAMEHELPERS, gamehelpers); +#endif +#if defined SMEXT_ENABLE_TIMERSYS + SM_GET_IFACE(TIMERSYS, timersys); +#endif +#if defined SMEXT_ENABLE_ADTFACTORY + SM_GET_IFACE(ADTFACTORY, adtfactory); +#endif +#if defined SMEXT_ENABLE_THREADER + SM_GET_IFACE(THREADER, threader); +#endif +#if defined SMEXT_ENABLE_LIBSYS + SM_GET_IFACE(LIBRARYSYS, libsys); +#endif +#if defined SMEXT_ENABLE_PLUGINSYS + SM_GET_IFACE(PLUGINSYSTEM, plsys); +#endif +#if defined SMEXT_ENABLE_MENUS + SM_GET_IFACE(MENUMANAGER, menus); +#endif +#if defined SMEXT_ENABLE_ADMINSYS + SM_GET_IFACE(ADMINSYS, adminsys); +#endif +#if defined SMEXT_ENABLE_TEXTPARSERS + SM_GET_IFACE(TEXTPARSERS, textparsers); +#endif +#if defined SMEXT_ENABLE_USERMSGS + SM_GET_IFACE(USERMSGS, usermsgs); +#endif +#if defined SMEXT_ENABLE_TRANSLATOR + SM_GET_IFACE(TRANSLATOR, translator); +#endif + + 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 */ +IServerTools *servertools = NULL; /**< IServerTools pointer */ + +/** Exposes the extension to Metamod */ +SMM_API void *PL_EXPOSURE(const char *name, int *code) +{ +#if defined METAMOD_PLAPI_VERSION + if (name && !strcmp(name, METAMOD_PLAPI_NAME)) +#else + if (name && !strcmp(name, PLAPI_NAME)) +#endif + { + if (code) + { + *code = IFACE_OK; + } + return static_cast(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(); + +#if !defined METAMOD_PLAPI_VERSION + GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); + GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); + GET_V_IFACE_CURRENT(serverFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION); +#else + GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL); + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER); + GET_V_IFACE_CURRENT(GetServerFactory, servertools, IServerTools, VSERVERTOOLS_INTERFACE_VERSION); +#endif + + 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 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(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__ || defined __APPLE__ +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 + diff --git a/extensions/sdkhooks/sdk/smsdk_ext.h b/extensions/sdkhooks/sdk/smsdk_ext.h new file mode 100644 index 00000000..ef2faa32 --- /dev/null +++ b/extensions/sdkhooks/sdk/smsdk_ext.h @@ -0,0 +1,341 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * SourceMod Base Extension Code + * Copyright (C) 2004-2008 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, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * 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 +#include +#include +#include +#include +#if defined SMEXT_ENABLE_FORWARDSYS +#include +#endif //SMEXT_ENABLE_FORWARDSYS +#if defined SMEXT_ENABLE_PLAYERHELPERS +#include +#endif //SMEXT_ENABLE_PlAYERHELPERS +#if defined SMEXT_ENABLE_DBMANAGER +#include +#endif //SMEXT_ENABLE_DBMANAGER +#if defined SMEXT_ENABLE_GAMECONF +#include +#endif +#if defined SMEXT_ENABLE_MEMUTILS +#include +#endif +#if defined SMEXT_ENABLE_GAMEHELPERS +#include +#endif +#if defined SMEXT_ENABLE_TIMERSYS +#include +#endif +#if defined SMEXT_ENABLE_ADTFACTORY +#include +#endif +#if defined SMEXT_ENABLE_THREADER +#include +#endif +#if defined SMEXT_ENABLE_LIBSYS +#include +#endif +#if defined SMEXT_ENABLE_PLUGINSYS +#include +#endif +#if defined SMEXT_ENABLE_MENUS +#include +#endif +#if defined SMEXT_ENABLE_ADMINSYS +#include +#endif +#if defined SMEXT_ENABLE_TEXTPARSERS +#include +#endif +#if defined SMEXT_ENABLE_USERMSGS +#include +#endif +#if defined SMEXT_ENABLE_TRANSLATOR +#include +#endif +#if defined SMEXT_ENABLE_NINVOKE +#include +#endif + +#if defined SMEXT_CONF_METAMOD +#include +#include +#include +#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 IExtension *myself; + +extern IShareSys *g_pShareSys; +extern IShareSys *sharesys; /* Note: Newer name */ +extern ISourceMod *g_pSM; +extern ISourceMod *smutils; /* Note: Newer name */ + +/* Optional interfaces are below */ +#if defined SMEXT_ENABLE_FORWARDSYS +extern IForwardManager *g_pForwards; +extern IForwardManager *forwards; /* Note: Newer name */ +#endif //SMEXT_ENABLE_FORWARDSYS +#if defined SMEXT_ENABLE_HANDLESYS +extern IHandleSys *g_pHandleSys; +extern IHandleSys *handlesys; /* Note: Newer name */ +#endif //SMEXT_ENABLE_HANDLESYS +#if defined SMEXT_ENABLE_PLAYERHELPERS +extern IPlayerManager *playerhelpers; +#endif //SMEXT_ENABLE_PLAYERHELPERS +#if defined SMEXT_ENABLE_DBMANAGER +extern IDBManager *dbi; +#endif //SMEXT_ENABLE_DBMANAGER +#if defined SMEXT_ENABLE_GAMECONF +extern IGameConfigManager *gameconfs; +#endif //SMEXT_ENABLE_DBMANAGER +#if defined SMEXT_ENABLE_MEMUTILS +extern IMemoryUtils *memutils; +#endif +#if defined SMEXT_ENABLE_GAMEHELPERS +extern IGameHelpers *gamehelpers; +#endif +#if defined SMEXT_ENABLE_TIMERSYS +extern ITimerSystem *timersys; +#endif +#if defined SMEXT_ENABLE_ADTFACTORY +extern IADTFactory *adtfactory; +#endif +#if defined SMEXT_ENABLE_THREADER +extern IThreader *threader; +#endif +#if defined SMEXT_ENABLE_LIBSYS +extern ILibrarySys *libsys; +#endif +#if defined SMEXT_ENABLE_PLUGINSYS +extern SourceMod::IPluginManager *plsys; +#endif +#if defined SMEXT_ENABLE_MENUS +extern IMenuManager *menus; +#endif +#if defined SMEXT_ENABLE_ADMINSYS +extern IAdminSystem *adminsys; +#endif +#if defined SMEXT_ENABLE_USERMSGS +extern IUserMessages *usermsgs; +#endif +#if defined SMEXT_ENABLE_TRANSLATOR +extern ITranslator *translator; +#endif +#if defined SMEXT_ENABLE_NINVOKE +extern INativeInterface *ninvoke; +#endif + +#if defined SMEXT_CONF_METAMOD +PLUGIN_GLOBALVARS(); +extern IVEngineServer *engine; +extern IServerGameDLL *gamedll; +extern IServerTools *servertools; +#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 != NULL && maxlength) \ + { \ + size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ + if (len >= maxlength) \ + { \ + error[maxlength - 1] = '\0'; \ + } \ + } \ + 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 != NULL && maxlength) \ + { \ + size_t len = snprintf(error, maxlength, "Could not find interface: %s", SMINTERFACE_##prefix##_NAME); \ + if (len >= maxlength) \ + { \ + error[maxlength - 1] = '\0'; \ + } \ + } \ + return false; \ + } + +#endif // _INCLUDE_SOURCEMOD_EXTENSION_BASESDK_H_ diff --git a/extensions/sdkhooks/takedamageinfohack.cpp b/extensions/sdkhooks/takedamageinfohack.cpp new file mode 100644 index 00000000..0598c478 --- /dev/null +++ b/extensions/sdkhooks/takedamageinfohack.cpp @@ -0,0 +1,81 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * Source SDK Hooks Extension + * Copyright (C) 2010-2012 Nicholas Hastings + * Copyright (C) 2009-2010 Erik Minekus + * ============================================================================= + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#include "takedamageinfohack.h" + +CTakeDamageInfo::CTakeDamageInfo(){} + +CTakeDamageInfoHack::CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition ) +{ + m_hInflictor = pInflictor; + if ( pAttacker ) + { + m_hAttacker = pAttacker; + } + else + { + m_hAttacker = pInflictor; + } + +#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_LEFT4DEAD + m_hWeapon = pWeapon; +#endif + + m_flDamage = flDamage; + + m_flBaseDamage = BASEDAMAGE_NOT_SPECIFIED; + + m_bitsDamageType = bitsDamageType; + + m_flMaxDamage = flDamage; + m_vecDamageForce = vec3_origin; + m_vecDamagePosition = vec3_origin; + m_vecReportedPosition = vec3_origin; + m_iAmmoType = -1; + +#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS + m_iDamagedOtherPlayers = 0; + m_iPlayerPenetrateCount = 0; + m_flUnknown = 0.0f; +#endif + +#if SOURCE_ENGINE >= SE_ALIENSWARM + m_flRadius = 0.0f; +#endif + +#if SOURCE_ENGINE >= SE_CSGO + m_iDamagedOtherPlayers = 0; + m_iObjectsPenetrated = 0; + m_uiBulletID = 0; + m_uiRecoilIndex = 0; +#endif +} diff --git a/extensions/sdkhooks/takedamageinfohack.h b/extensions/sdkhooks/takedamageinfohack.h new file mode 100644 index 00000000..18f9c85c --- /dev/null +++ b/extensions/sdkhooks/takedamageinfohack.h @@ -0,0 +1,95 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * Source SDK Hooks Extension + * Copyright (C) 2010-2012 Nicholas Hastings + * Copyright (C) 2009-2010 Erik Minekus + * ============================================================================= + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#ifndef TAKEDAMAGEINFOHACK_H +#define TAKEDAMAGEINFOHACK_H +#ifdef _WIN32 +#pragma once +#endif + +#include "smsdk_ext.h" + +#define GAME_DLL 1 + +#include + +#ifndef _DEBUG +#include +#else +#undef _DEBUG +#include +#define _DEBUG 1 +#endif + +#include + +// Hack to server sdk util.h rather than project util.h +#if SOURCE_ENGINE >= SE_ORANGEBOX +#include <../game/server/util.h> +#else +#include <../dlls/util.h> +#endif + +#include + +class CTakeDamageInfoHack : public CTakeDamageInfo +{ +public: + CTakeDamageInfoHack( CBaseEntity *pInflictor, CBaseEntity *pAttacker, float flDamage, int bitsDamageType, CBaseEntity *pWeapon, Vector vecDamageForce, Vector vecDamagePosition ); + inline int GetAttacker() const { return m_hAttacker.IsValid() ? m_hAttacker.GetEntryIndex() : -1; } + inline int GetInflictor() const { return m_hInflictor.IsValid() ? m_hInflictor.GetEntryIndex() : -1; } +#if SOURCE_ENGINE >= SE_ORANGEBOX && SOURCE_ENGINE != SE_LEFT4DEAD + inline int GetWeapon() const { return m_hWeapon.IsValid() ? m_hWeapon.GetEntryIndex() : -1; } +#else + inline int GetWeapon() const { return -1; } + inline void SetWeapon(CBaseEntity *) {} +#endif + + inline void SetDamageForce(vec_t x, vec_t y, vec_t z) + { + m_vecDamageForce.x = x; + m_vecDamageForce.y = y; + m_vecDamageForce.z = z; + } + + inline void SetDamagePosition(vec_t x, vec_t y, vec_t z) + { + m_vecDamagePosition.x = x; + m_vecDamagePosition.y = y; + m_vecDamagePosition.z = z; + } +#if SOURCE_ENGINE < SE_ORANGEBOX + inline int GetDamageCustom() const { return GetCustomKill(); } +#endif +}; + +#endif //TAKEDAMAGEINFOHACK_H diff --git a/extensions/sdkhooks/util.cpp b/extensions/sdkhooks/util.cpp new file mode 100644 index 00000000..23742238 --- /dev/null +++ b/extensions/sdkhooks/util.cpp @@ -0,0 +1,103 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * SourceMod Team Fortress 2 Extension + * Copyright (C) 2004-2008 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, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +// ^ ripped from SM's TF2 Extension + +#include "extension.h" +#include "util.h" + +CBaseEntity *UTIL_GetCBaseEntity(int num, bool onlyPlayers) +{ + edict_t *pEdict = PEntityOfEntIndex(num); + if (!pEdict || pEdict->IsFree()) + { + return NULL; + } + + if (num > 0 && num <= playerhelpers->GetMaxClients()) + { + IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(pEdict); + if (!pPlayer || !pPlayer->IsConnected()) + { + return NULL; + } + } + else if (onlyPlayers) + { + return NULL; + } + + IServerUnknown *pUnk; + if ((pUnk=pEdict->GetUnknown()) == NULL) + { + return NULL; + } + + return pUnk->GetBaseEntity(); +} + +bool UTIL_FindDataTable(SendTable *pTable, + const char *name, + sm_sendprop_info_t *info, + unsigned int offset) +{ + const char *pname; + int props = pTable->GetNumProps(); + SendProp *prop; + SendTable *table; + + for (int i=0; iGetProp(i); + + if ((table = prop->GetDataTable()) != NULL) + { + pname = table->GetName(); + if (pname && strcmp(name, pname) == 0) + { + info->prop = prop; + info->actual_offset = offset + info->prop->GetOffset(); + return true; + } + + if (UTIL_FindDataTable(table, + name, + info, + offset + prop->GetOffset()) + ) + { + return true; + } + } + } + + return false; +} diff --git a/extensions/sdkhooks/util.h b/extensions/sdkhooks/util.h new file mode 100644 index 00000000..fca83757 --- /dev/null +++ b/extensions/sdkhooks/util.h @@ -0,0 +1,40 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * SourceMod Team Fortress 2 Extension + * Copyright (C) 2004-2008 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, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + * + * Version: $Id$ + */ + +#ifndef _INCLUDE_TF2TOOLS_UTIL_H_ +#define _INCLUDE_TF2TOOLS_UTIL_H_ + +#include + +CBaseEntity *UTIL_GetCBaseEntity(int num, bool onlyPlayers=false); +bool UTIL_FindDataTable(SendTable *pTable, const char *name, sm_sendprop_info_t *info, unsigned int offset); + +#endif //_INCLUDE_TF2TOOLS_UTIL_H_ diff --git a/extensions/sdkhooks/version.rc b/extensions/sdkhooks/version.rc new file mode 100644 index 00000000..6b7df148 --- /dev/null +++ b/extensions/sdkhooks/version.rc @@ -0,0 +1,104 @@ +// Microsoft Visual C++ generated resource script. +// +//#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +#include + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION SM_VERSION_FILE + PRODUCTVERSION SM_VERSION_FILE + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", "SDKHooks Extension" + VALUE "FileDescription", "SourceMod SDKHooks Extension" + VALUE "FileVersion", SM_VERSION_STRING + VALUE "InternalName", "SourceMod SDKHooks Extension" + VALUE "LegalCopyright", "Copyright (c) 2009-2013, AlliedModders LLC" + VALUE "OriginalFilename", BINARY_NAME + VALUE "ProductName", "SourceMod SDKHooKs Extension" + VALUE "ProductVersion", SM_VERSION_STRING + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/gamedata/sdkhooks.games/common.games.txt b/gamedata/sdkhooks.games/common.games.txt new file mode 100644 index 00000000..7b7f61b3 --- /dev/null +++ b/gamedata/sdkhooks.games/common.games.txt @@ -0,0 +1,26 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater or by upgrading your SourceMod install. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + +"Games" +{ + "#default" + { + "Offsets" + { + "EntityListeners" + { + "windows" "65572" + "linux" "65572" + "mac" "65572" + } + } + } +} diff --git a/gamedata/sdkhooks.games/engine.csgo.txt b/gamedata/sdkhooks.games/engine.csgo.txt new file mode 100644 index 00000000..8dc6de77 --- /dev/null +++ b/gamedata/sdkhooks.games/engine.csgo.txt @@ -0,0 +1,177 @@ +"Games" +{ + "#default" + { + "Offsets" + { + "EndTouch" + { + "windows" "102" + "linux" "103" + "mac" "103" + } + "FireBullets" + { + "windows" "115" + "linux" "116" + "mac" "116" + } + "GetMaxHealth" + { + "windows" "119" + "linux" "120" + "mac" "120" + } + "GroundEntChanged" + { + "windows" "173" + "linux" "174" + "mac" "174" + } + "OnTakeDamage" + { + "windows" "66" + "linux" "67" + "mac" "67" + } + "PreThink" + { + "windows" "356" + "linux" "357" + "mac" "357" + } + "PostThink" + { + "windows" "357" + "linux" "358" + "mac" "358" + } + "Reload" + { + "windows" "281" + "linux" "282" + "mac" "282" + } + "SetTransmit" + { + "windows" "22" + "linux" "23" + "mac" "23" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + "mac" "18" + } + "Spawn" + { + "windows" "24" + "linux" "25" + "mac" "25" + } + "StartTouch" + { + "windows" "100" + "linux" "101" + "mac" "101" + } + "Think" + { + "windows" "50" + "linux" "51" + "mac" "51" + } + "Touch" + { + "windows" "101" + "linux" "102" + "mac" "102" + } + "TraceAttack" + { + "windows" "64" + "linux" "65" + "mac" "65" + } + "Use" + { + "windows" "99" + "linux" "100" + "mac" "100" + } + "VPhysicsUpdate" + { + "windows" "152" + "linux" "153" + "mac" "153" + } + "Weapon_CanSwitchTo" + { + "windows" "281" + "linux" "282" + "mac" "282" + } + "Weapon_CanUse" + { + "windows" "275" + "linux" "276" + "mac" "276" + } + "Weapon_Drop" + { + "windows" "278" + "linux" "279" + "mac" "279" + } + "Weapon_Equip" + { + "windows" "276" + "linux" "277" + "mac" "277" + } + "Weapon_Switch" + { + "windows" "279" + "linux" "280" + "mac" "280" + } + + + // no longer used + "UpdateOnRemove" + { + "windows" "108" + "linux" "109" + "mac" "109" + } + // + } + + "Signatures" + { + // no longer used + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + "mac" "@_Z23EntityFactoryDictionaryv" + } + // + } + } + + "#default" + { + "Offsets" + { + "EntityListeners" + { + "windows" "196644" + "linux" "196644" + "mac" "196644" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/engine.darkm.txt b/gamedata/sdkhooks.games/engine.darkm.txt new file mode 100644 index 00000000..eb2c1617 --- /dev/null +++ b/gamedata/sdkhooks.games/engine.darkm.txt @@ -0,0 +1,75 @@ +"Games" +{ + /* Dark Messiah Might & Magic */ + "#default" + { + "Offsets" + { + "EndTouch" + { + "windows" "85" + } + "OnTakeDamage" + { + "windows" "56" + } + "PreThink" + { + "windows" "256" + } + "PostThink" + { + "windows" "257" + } + "SetTransmit" + { + "windows" "20" + } + "ShouldCollide" + { + "windows" "16" + } + "Spawn" + { + "windows" "23" + } + "StartTouch" + { + "windows" "83" + } + "Think" + { + "windows" "47" + } + "Touch" + { + "windows" "84" + } + "UpdateOnRemove" + { + "windows" "90" + } + "Weapon_CanUse" + { + "windows" "201" + } + "Weapon_Equip" + { + "windows" "202" + } + "Weapon_Switch" + { + "windows" "204" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/engine.ep2v.txt b/gamedata/sdkhooks.games/engine.ep2v.txt new file mode 100644 index 00000000..8c69bb22 --- /dev/null +++ b/gamedata/sdkhooks.games/engine.ep2v.txt @@ -0,0 +1,190 @@ +"Games" +{ + // Now this is getting ridiculous + "#default" + { + "#supported" + { + "game" "tf" + "game" "hl2mp" + "game" "dod" + } + + "Offsets" + { + "EndTouch" + { + "windows" "99" + "linux" "100" + "mac" "100" + } + "FireBullets" + { + "windows" "111" + "linux" "112" + "mac" "112" + } + "GetMaxHealth" + { + "windows" "116" + "linux" "117" + "mac" "117" + } + "GroundEntChanged" + { + "windows" "176" + "linux" "177" + "mac" "177" + } + "OnTakeDamage" + { + "windows" "62" + "linux" "63" + "mac" "63" + } + "PreThink" + { + "windows" "330" + "linux" "331" + "mac" "331" + } + "PostThink" + { + "windows" "331" + "linux" "332" + "mac" "332" + } + "Reload" + { + "windows" "274" + "linux" "275" + "mac" "275" + } + "SetTransmit" + { + "windows" "20" + "linux" "21" + "mac" "21" + } + "ShouldCollide" + { + "windows" "16" + "linux" "17" + "mac" "17" + } + "Spawn" + { + "windows" "22" + "linux" "23" + "mac" "23" + } + "StartTouch" + { + "windows" "97" + "linux" "98" + "mac" "98" + } + "Think" + { + "windows" "47" + "linux" "48" + "mac" "48" + } + "Touch" + { + "windows" "98" + "linux" "99" + "mac" "99" + } + "TraceAttack" + { + "windows" "60" + "linux" "61" + "mac" "61" + } + "Use" + { + "windows" "96" + "linux" "97" + "mac" "97" + } + "VPhysicsUpdate" + { + "windows" "156" + "linux" "157" + "mac" "157" + } + "Weapon_CanSwitchTo" + { + "windows" "264" + "linux" "265" + "mac" "265" + } + "Weapon_CanUse" + { + "windows" "258" + "linux" "259" + "mac" "259" + } + "Weapon_Drop" + { + "windows" "261" + "linux" "262" + "mac" "262" + } + "Weapon_Equip" + { + "windows" "259" + "linux" "260" + "mac" "260" + } + "Weapon_Switch" + { + "windows" "262" + "linux" "263" + "mac" "263" + } + + + // no longer used + "UpdateOnRemove" + { + "windows" "104" + "linux" "105" + "mac" "105" + } + // + } + + "Signatures" + { + // no longer used + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + "mac" "@_Z23EntityFactoryDictionaryv" + } + // + } + } + + "#default" + { + "#supported" + { + "game" "cstrike" + } + + "Offsets" + { + "Reload" + { + "windows" "272" + "linux" "273" + "mac" "273" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/engine.l4d.txt b/gamedata/sdkhooks.games/engine.l4d.txt new file mode 100644 index 00000000..5a401e70 --- /dev/null +++ b/gamedata/sdkhooks.games/engine.l4d.txt @@ -0,0 +1,119 @@ +"Games" +{ + "left4dead" + { + "Offsets" + { + "EndTouch" + { + "windows" "97" + "linux" "98" + } + "FireBullets" + { + "windows" "109" + "linux" "110" + } + "OnTakeDamage" + { + "windows" "62" + "linux" "63" + } + "PreThink" + { + "windows" "333" + "linux" "334" + } + "PostThink" + { + "windows" "334" + "linux" "335" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "95" + "linux" "96" + } + "Think" + { + "windows" "47" + "linux" "48" + } + "Touch" + { + "windows" "96" + "linux" "97" + } + "TraceAttack" + { + "windows" "60" + "linux" "61" + } + "UpdateOnRemove" + { + "windows" "102" + "linux" "103" + } + "Use" + { + "windows" "94" + "linux" "95" + } + "VPhysicsUpdate" + { + "windows" "152" + "linux" "153" + } + "Weapon_CanSwitchTo" + { + "windows" "265" + "linux" "266" + } + "Weapon_CanUse" + { + "windows" "259" + "linux" "260" + } + "Weapon_Drop" + { + "windows" "262" + "linux" "263" + } + "Weapon_Equip" + { + "windows" "260" + "linux" "261" + } + "Weapon_Switch" + { + "windows" "263" + "linux" "264" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.ag2.txt b/gamedata/sdkhooks.games/game.ag2.txt new file mode 100644 index 00000000..2b50a7a7 --- /dev/null +++ b/gamedata/sdkhooks.games/game.ag2.txt @@ -0,0 +1,136 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + + +"Games" +{ + "ag2" + { + "Offsets" + { + "EndTouch" + { + "windows" "92" + "linux" "93" + } + "FireBullets" + { + "windows" "104" + "linux" "105" + } + "GroundEntChanged" + { + "windows" "164" + "linux" "165" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "288" + "linux" "289" + } + "PostThink" + { + "windows" "289" + "linux" "290" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "90" + "linux" "91" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "91" + "linux" "92" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "97" + "linux" "98" + } + "Use" + { + "windows" "89" + "linux" "90" + } + "VPhysicsUpdate" + { + "windows" "144" + "linux" "145" + } + "Weapon_CanSwitchTo" + { + "windows" "234" + "linux" "235" + } + "Weapon_CanUse" + { + "windows" "228" + "linux" "229" + } + "Weapon_Drop" + { + "windows" "231" + "linux" "232" + } + "Weapon_Equip" + { + "windows" "229" + "linux" "230" + } + "Weapon_Switch" + { + "windows" "232" + "linux" "233" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.alienswarm.txt b/gamedata/sdkhooks.games/game.alienswarm.txt new file mode 100644 index 00000000..cbedfb84 --- /dev/null +++ b/gamedata/sdkhooks.games/game.alienswarm.txt @@ -0,0 +1,102 @@ +"Games" +{ + "swarm" + { + "Offsets" + { + "EndTouch" + { + "windows" "102" + } + "FireBullets" + { + "windows" "115" + } + "GetMaxHealth" + { + "windows" "119" + } + "OnTakeDamage" + { + "windows" "66" + } + "PreThink" + { + "windows" "347" + } + "PostThink" + { + "windows" "348" + } + "SetTransmit" + { + "windows" "22" + } + "ShouldCollide" + { + "windows" "17" + } + "Spawn" + { + "windows" "24" + } + "StartTouch" + { + "windows" "100" + } + "Think" + { + "windows" "50" + } + "Touch" + { + "windows" "101" + } + "TraceAttack" + { + "windows" "64" + } + "UpdateOnRemove" + { + "windows" "108" + } + "Use" + { + "windows" "99" + } + "VPhysicsUpdate" + { + "windows" "160" + } + "Weapon_CanSwitchTo" + { + "windows" "283" + } + "Weapon_CanUse" + { + "windows" "277" + } + "Weapon_Drop" + { + "windows" "280" + } + "Weapon_Equip" + { + "windows" "278" + } + "Weapon_Switch" + { + "windows" "281" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.aoc.txt b/gamedata/sdkhooks.games/game.aoc.txt new file mode 100644 index 00000000..99a17ecb --- /dev/null +++ b/gamedata/sdkhooks.games/game.aoc.txt @@ -0,0 +1,124 @@ +"Games" +{ + "ageofchivalry" + { + "Offsets" + { + "EndTouch" + { + "windows" "93" + "linux" "94" + } + "FireBullets" + { + "windows" "105" + "linux" "106" + } + "GroundEntChanged" + { + "windows" "164" + "linux" "165" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "290" + "linux" "291" + } + "PostThink" + { + "windows" "291" + "linux" "292" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "91" + "linux" "92" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "92" + "linux" "93" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "98" + "linux" "99" + } + "Use" + { + "windows" "90" + "linux" "91" + } + "VPhysicsUpdate" + { + "windows" "144" + "linux" "145" + } + "Weapon_CanSwitchTo" + { + "windows" "236" + "linux" "237" + } + "Weapon_CanUse" + { + "windows" "230" + "linux" "231" + } + "Weapon_Drop" + { + "windows" "233" + "linux" "234" + } + "Weapon_Equip" + { + "windows" "231" + "linux" "232" + } + "Weapon_Switch" + { + "windows" "234" + "linux" "235" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.cspromod.txt b/gamedata/sdkhooks.games/game.cspromod.txt new file mode 100644 index 00000000..27df26f5 --- /dev/null +++ b/gamedata/sdkhooks.games/game.cspromod.txt @@ -0,0 +1,124 @@ +"Games" +{ + "cspromod" + { + "Offsets" + { + "EndTouch" + { + "windows" "93" + "linux" "94" + } + "FireBullets" + { + "windows" "105" + "linux" "106" + } + "GroundEntChanged" + { + "windows" "167" + "linux" "168" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "289" + "linux" "290" + } + "PostThink" + { + "windows" "290" + "linux" "291" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "91" + "linux" "92" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "92" + "linux" "93" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "98" + "linux" "99" + } + "Use" + { + "windows" "90" + "linux" "91" + } + "VPhysicsUpdate" + { + "windows" "147" + "linux" "148" + } + "Weapon_CanSwitchTo" + { + "windows" "235" + "linux" "236" + } + "Weapon_CanUse" + { + "windows" "229" + "linux" "230" + } + "Weapon_Drop" + { + "windows" "232" + "linux" "233" + } + "Weapon_Equip" + { + "windows" "230" + "linux" "231" + } + "Weapon_Switch" + { + "windows" "233" + "linux" "234" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.cstrike.txt b/gamedata/sdkhooks.games/game.cstrike.txt new file mode 100644 index 00000000..4d99e8b0 --- /dev/null +++ b/gamedata/sdkhooks.games/game.cstrike.txt @@ -0,0 +1,164 @@ +"Games" +{ + "#default" + { + "Offsets" + { + "EndTouch" + { + "windows" "99" + "linux" "100" + "mac" "100" + } + "FireBullets" + { + "windows" "111" + "linux" "112" + "mac" "112" + } + "GetMaxHealth" + { + "windows" "116" + "linux" "117" + "mac" "117" + } + "GroundEntChanged" + { + "windows" "176" + "linux" "177" + "mac" "177" + } + "OnTakeDamage" + { + "windows" "62" + "linux" "63" + "mac" "63" + } + "PreThink" + { + "windows" "330" + "linux" "331" + "mac" "331" + } + "PostThink" + { + "windows" "331" + "linux" "332" + "mac" "332" + } + "Reload" + { + "windows" "270" + "linux" "276" + "mac" "276" + } + "SetTransmit" + { + "windows" "20" + "linux" "21" + "mac" "21" + } + "ShouldCollide" + { + "windows" "16" + "linux" "17" + "mac" "17" + } + "Spawn" + { + "windows" "22" + "linux" "23" + "mac" "23" + } + "StartTouch" + { + "windows" "97" + "linux" "98" + "mac" "98" + } + "Think" + { + "windows" "47" + "linux" "48" + "mac" "48" + } + "Touch" + { + "windows" "98" + "linux" "99" + "mac" "99" + } + "TraceAttack" + { + "windows" "60" + "linux" "61" + "mac" "61" + } + "Use" + { + "windows" "96" + "linux" "97" + "mac" "97" + } + "VPhysicsUpdate" + { + "windows" "156" + "linux" "157" + "mac" "157" + } + "Weapon_CanSwitchTo" + { + "windows" "264" + "linux" "265" + "mac" "265" + } + "Weapon_CanUse" + { + "windows" "258" + "linux" "259" + "mac" "259" + } + "Weapon_Drop" + { + "windows" "261" + "linux" "262" + "mac" "262" + } + "Weapon_Equip" + { + "windows" "259" + "linux" "260" + "mac" "260" + } + "Weapon_Switch" + { + "windows" "262" + "linux" "263" + "mac" "263" + } + + + // no longer used + "UpdateOnRemove" + { + "windows" "104" + "linux" "105" + "mac" "105" + } + // + } + + "Signatures" + { + // no longer used + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + "mac" "@_Z23EntityFactoryDictionaryv" + } + // + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.dinodday.txt b/gamedata/sdkhooks.games/game.dinodday.txt new file mode 100644 index 00000000..49cf0000 --- /dev/null +++ b/gamedata/sdkhooks.games/game.dinodday.txt @@ -0,0 +1,102 @@ +"Games" +{ + "dinodday" + { + "Offsets" + { + "EndTouch" + { + "windows" "102" + } + "FireBullets" + { + "windows" "115" + } + "GetMaxHealth" + { + "windows" "119" + } + "OnTakeDamage" + { + "windows" "66" + } + "PreThink" + { + "windows" "348" + } + "PostThink" + { + "windows" "349" + } + "SetTransmit" + { + "windows" "22" + } + "ShouldCollide" + { + "windows" "17" + } + "Spawn" + { + "windows" "24" + } + "StartTouch" + { + "windows" "100" + } + "Think" + { + "windows" "50" + } + "Touch" + { + "windows" "101" + } + "TraceAttack" + { + "windows" "64" + } + "UpdateOnRemove" + { + "windows" "108" + } + "Use" + { + "windows" "99" + } + "VPhysicsUpdate" + { + "windows" "160" + } + "Weapon_CanSwitchTo" + { + "windows" "283" + } + "Weapon_CanUse" + { + "windows" "277" + } + "Weapon_Drop" + { + "windows" "280" + } + "Weapon_Equip" + { + "windows" "278" + } + "Weapon_Switch" + { + "windows" "281" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.empires.txt b/gamedata/sdkhooks.games/game.empires.txt new file mode 100644 index 00000000..de058a77 --- /dev/null +++ b/gamedata/sdkhooks.games/game.empires.txt @@ -0,0 +1,125 @@ +"Games" +{ + /* Empires Mod 2.31a */ + "empires" + { + "Offsets" + { + "EndTouch" + { + "windows" "95" + "linux" "96" + } + "FireBullets" + { + "windows" "107" + "linux" "108" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "294" + "linux" "295" + } + "PostThink" + { + "windows" "295" + "linux" "296" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "93" + "linux" "94" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "94" + "linux" "95" + } + "TraceAttack" + { + "windows" "58" + "linux" "69" + } + "UpdateOnRemove" + { + "windows" "100" + "linux" "101" + } + "Use" + { + "windows" "92" + "linux" "93" + } + "VPhysicsUpdate" + { + "windows" "150" + "linux" "151" + } + "Weapon_CanSwitchTo" + { + "windows" "240" + "linux" "241" + } + "Weapon_CanUse" + { + "windows" "234" + "linux" "235" + } + "Weapon_Drop" + { + "windows" "237" + "linux" "238" + } + "Weapon_Equip" + { + "windows" "235" + "linux" "236" + } + "Weapon_Switch" + { + "windows" "238" + "linux" "239" + } + "GroundEntChanged" + { + "windows" "170" + "linux" "171" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x2A\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.ff.txt b/gamedata/sdkhooks.games/game.ff.txt new file mode 100644 index 00000000..7e9d1695 --- /dev/null +++ b/gamedata/sdkhooks.games/game.ff.txt @@ -0,0 +1,120 @@ +"Games" +{ + /* Fortress Forever 2.4 */ + "fortressforever" + { + "Offsets" + { + "EndTouch" + { + "windows" "96" + "linux" "97" + } + "FireBullets" + { + "windows" "107" + "linux" "108" + } + "OnTakeDamage" + { + "windows" "65" + "linux" "66" + } + "PreThink" + { + "windows" "283" + "linux" "284" + } + "PostThink" + { + "windows" "284" + "linux" "285" + } + "SetTransmit" + { + "windows" "23" + "linux" "24" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + } + "Spawn" + { + "windows" "25" + "linux" "26" + } + "StartTouch" + { + "windows" "94" + "linux" "95" + } + "Think" + { + "windows" "51" + "linux" "52" + } + "Touch" + { + "windows" "95" + "linux" "96" + } + "TraceAttack" + { + "windows" "63" + "linux" "64" + } + "UpdateOnRemove" + { + "windows" "101" + "linux" "102" + } + "Use" + { + "windows" "93" + "linux" "94" + } + "VPhysicsUpdate" + { + "windows" "152" + "linux" "153" + } + "Weapon_CanSwitchTo" + { + "windows" "232" + "linux" "233" + } + "Weapon_CanUse" + { + "windows" "226" + "linux" "227" + } + "Weapon_Drop" + { + "windows" "229" + "linux" "230" + } + "Weapon_Equip" + { + "windows" "227" + "linux" "228" + } + "Weapon_Switch" + { + "windows" "230" + "linux" "231" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.fof.txt b/gamedata/sdkhooks.games/game.fof.txt new file mode 100644 index 00000000..1d61db40 --- /dev/null +++ b/gamedata/sdkhooks.games/game.fof.txt @@ -0,0 +1,115 @@ +"Games" +{ + /* Fistful of Frags Beta 3.0 */ + "fistful_of_frags" + { + "Offsets" + { + "EndTouch" + { + "windows" "92" + "linux" "93" + } + "FireBullets" + { + "windows" "104" + "linux" "105" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "287" + "linux" "288" + } + "PostThink" + { + "windows" "288" + "linux" "289" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "90" + "linux" "91" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "91" + "linux" "92" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "97" + "linux" "98" + } + "VPhysicsUpdate" + { + "windows" "143" + "linux" "144" + } + "Weapon_CanSwitchTo" + { + "windows" "233" + "linux" "234" + } + "Weapon_CanUse" + { + "windows" "227" + "linux" "228" + } + "Weapon_Drop" + { + "windows" "230" + "linux" "231" + } + "Weapon_Equip" + { + "windows" "228" + "linux" "229" + } + "Weapon_Switch" + { + "windows" "231" + "linux" "232" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.garrysmod.txt b/gamedata/sdkhooks.games/game.garrysmod.txt new file mode 100644 index 00000000..dc2eb450 --- /dev/null +++ b/gamedata/sdkhooks.games/game.garrysmod.txt @@ -0,0 +1,134 @@ +"Games" +{ + "garrysmod" + { + "Offsets" + { + "EndTouch" + { + "windows" "99" + "linux" "100" + "mac" "100" + } + "FireBullets" + { + "windows" "111" + "linux" "112" + "mac" "112" + } + "GetMaxHealth" + { + "windows" "116" + "linux" "117" + "mac" "117" + } + "PreThink" + { + "windows" "368" + "linux" "369" + "mac" "369" + } + "PostThink" + { + "windows" "369" + "linux" "370" + "mac" "370" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + "mac" "20" + } + "Spawn" + { + "windows" "21" + "linux" "22" + "mac" "22" + } + "StartTouch" + { + "windows" "97" + "linux" "98" + "mac" "98" + } + "Think" + { + "windows" "46" + "linux" "47" + "mac" "47" + } + "Touch" + { + "windows" "98" + "linux" "99" + "mac" "99" + } + "TraceAttack" + { + "windows" "59" + "linux" "60" + "mac" "60" + } + "UpdateOnRemove" + { + "windows" "104" + "linux" "105" + "mac" "105" + } + "Use" + { + "windows" "96" + "linux" "97" + "mac" "97" + } + "VPhysicsUpdate" + { + "windows" "156" + "linux" "157" + "mac" "157" + } + "Weapon_CanSwitchTo" + { + "windows" "302" + "linux" "303" + "mac" "303" + } + "Weapon_CanUse" + { + "windows" "296" + "linux" "297" + "mac" "297" + } + "Weapon_Drop" + { + "windows" "299" + "linux" "300" + "mac" "300" + } + "Weapon_Equip" + { + "windows" "297" + "linux" "298" + "mac" "298" + } + "Weapon_Switch" + { + "windows" "300" + "linux" "301" + "mac" "301" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + "mac" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.gesource.txt b/gamedata/sdkhooks.games/game.gesource.txt new file mode 100644 index 00000000..269d9ef0 --- /dev/null +++ b/gamedata/sdkhooks.games/game.gesource.txt @@ -0,0 +1,136 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + + +"Games" +{ + "gesource" + { + "Offsets" + { + "EndTouch" + { + "windows" "92" + "linux" "93" + } + "FireBullets" + { + "windows" "104" + "linux" "105" + } + "GroundEntChanged" + { + "windows" "167" + "linux" "168" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "291" + "linux" "292" + } + "PostThink" + { + "windows" "292" + "linux" "293" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "90" + "linux" "91" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "91" + "linux" "92" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "97" + "linux" "98" + } + "Use" + { + "windows" "89" + "linux" "90" + } + "VPhysicsUpdate" + { + "windows" "145" + "linux" "146" + } + "Weapon_CanSwitchTo" + { + "windows" "237" + "linux" "238" + } + "Weapon_CanUse" + { + "windows" "231" + "linux" "232" + } + "Weapon_Drop" + { + "windows" "234" + "linux" "235" + } + "Weapon_Equip" + { + "windows" "232" + "linux" "233" + } + "Weapon_Switch" + { + "windows" "235" + "linux" "236" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.hidden.txt b/gamedata/sdkhooks.games/game.hidden.txt new file mode 100644 index 00000000..853c8ec5 --- /dev/null +++ b/gamedata/sdkhooks.games/game.hidden.txt @@ -0,0 +1,114 @@ +"Games" +{ + "hidden" + { + "Offsets" + { + "EndTouch" + { + "windows" "83" + "linux" "84" + } + "FireBullets" + { + "windows" "93" + "linux" "94" + } + "OnTakeDamage" + { + "windows" "54" + "linux" "55" + } + "PreThink" + { + "windows" "246" + "linux" "247" + } + "PostThink" + { + "windows" "247" + "linux" "248" + } + "SetTransmit" + { + "windows" "21" + "linux" "22" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + } + "Spawn" + { + "windows" "23" + "linux" "24" + } + "StartTouch" + { + "windows" "81" + "linux" "82" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "82" + "linux" "83" + } + "TraceAttack" + { + "windows" "53" + "linux" "54" + } + "UpdateOnRemove" + { + "windows" "88" + "linux" "89" + } + "VPhysicsUpdate" + { + "windows" "130" + "linux" "131" + } + "Weapon_CanSwitchTo" + { + "windows" "203" + "linux" "204" + } + "Weapon_CanUse" + { + "windows" "197" + "linux" "198" + } + "Weapon_Drop" + { + "windows" "200" + "linux" "201" + } + "Weapon_Equip" + { + "windows" "198" + "linux" "199" + } + "Weapon_Switch" + { + "windows" "201" + "linux" "202" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.insurgency.txt b/gamedata/sdkhooks.games/game.insurgency.txt new file mode 100644 index 00000000..e43ea2e8 --- /dev/null +++ b/gamedata/sdkhooks.games/game.insurgency.txt @@ -0,0 +1,115 @@ +"Games" +{ + /* Insurgency 2.5 */ + "insurgency" + { + "Offsets" + { + "EndTouch" + { + "windows" "84" + "linux" "85" + } + "OnTakeDamage" + { + "windows" "53" + "linux" "54" + } + "PreThink" + { + "windows" "189" + "linux" "190" + } + "PostThink" + { + "windows" "190" + "linux" "191" + } + "SetTransmit" + { + "windows" "21" + "linux" "22" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + } + "Spawn" + { + "windows" "22" + "linux" "23" + } + "StartTouch" + { + "windows" "82" + "linux" "83" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "83" + "linux" "84" + } + "TraceAttack" + { + "windows" "52" + "linux" "53" + } + "UpdateOnRemove" + { + "windows" "89" + "linux" "90" + } + "Use" + { + "windows" "81" + "linux" "82" + } + "VPhysicsUpdate" + { + "windows" "130" + "linux" "131" + } + "Weapon_CanSwitchTo" + { + "windows" "213" + "linux" "214" + } + "Weapon_CanUse" + { + "windows" "216" + "linux" "217" + } + "Weapon_Drop" + { + "windows" "220" + "linux" "221" + } + "Weapon_Equip" + { + "windows" "215" + "linux" "216" + } + "Weapon_Switch" + { + "windows" "217" + "linux" "218" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.l4d2.txt b/gamedata/sdkhooks.games/game.l4d2.txt new file mode 100644 index 00000000..2d29dd7f --- /dev/null +++ b/gamedata/sdkhooks.games/game.l4d2.txt @@ -0,0 +1,142 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + + +"Games" +{ + "left4dead2" + { + "Offsets" + { + "EndTouch" + { + "windows" "108" + "linux" "109" + } + "FireBullets" + { + "windows" "121" + "linux" "122" + } + "GetMaxHealth" + { + "windows" "125" + "linux" "126" + "mac" "126" + } + "OnTakeDamage" + { + "windows" "71" + "linux" "72" + } + "PreThink" + { + "windows" "355" + "linux" "356" + } + "PostThink" + { + "windows" "356" + "linux" "357" + } + "Reload" + { + "windows" "280" + "linux" "281" + } + "SetTransmit" + { + "windows" "21" + "linux" "22" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + } + "Spawn" + { + "windows" "23" + "linux" "24" + } + "StartTouch" + { + "windows" "106" + "linux" "107" + } + "Think" + { + "windows" "55" + "linux" "56" + } + "Touch" + { + "windows" "107" + "linux" "108" + } + "TraceAttack" + { + "windows" "69" + "linux" "70" + } + "UpdateOnRemove" + { + "windows" "114" + "linux" "115" + } + "Use" + { + "windows" "105" + "linux" "106" + } + "VPhysicsUpdate" + { + "windows" "165" + "linux" "166" + } + "Weapon_CanSwitchTo" + { + "windows" "285" + "linux" "286" + } + "Weapon_CanUse" + { + "windows" "279" + "linux" "280" + } + "Weapon_Drop" + { + "windows" "282" + "linux" "283" + } + "Weapon_Equip" + { + "windows" "280" + "linux" "281" + } + "Weapon_Switch" + { + "windows" "283" + "linux" "284" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.neotokyo.txt b/gamedata/sdkhooks.games/game.neotokyo.txt new file mode 100644 index 00000000..ec538a98 --- /dev/null +++ b/gamedata/sdkhooks.games/game.neotokyo.txt @@ -0,0 +1,94 @@ +"Games" +{ + "NeotokyoSource" + { + "Offsets" + { + "EndTouch" + { + "windows" "91" + } + "FireBullets" + { + "windows" "102" + } + "OnTakeDamage" + { + "windows" "60" + } + "PreThink" + { + "windows" "274" + } + "PostThink" + { + "windows" "275" + } + "SetTransmit" + { + "windows" "21" + } + "ShouldCollide" + { + "windows" "17" + } + "Spawn" + { + "windows" "23" + } + "StartTouch" + { + "windows" "89" + } + "Think" + { + "windows" "46" + } + "Touch" + { + "windows" "90" + } + "TraceAttack" + { + "windows" "58" + } + "UpdateOnRemove" + { + "windows" "96" + } + "VPhysicsUpdate" + { + "windows" "143" + } + "Weapon_CanSwitchTo" + { + "windows" "223" + } + "Weapon_CanUse" + { + "windows" "217" + } + "Weapon_Drop" + { + "windows" "220" + } + "Weapon_Equip" + { + "windows" "218" + } + "Weapon_Switch" + { + "windows" "221" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.nmrih.txt b/gamedata/sdkhooks.games/game.nmrih.txt new file mode 100644 index 00000000..f94f27b6 --- /dev/null +++ b/gamedata/sdkhooks.games/game.nmrih.txt @@ -0,0 +1,124 @@ +"Games" +{ + "ageofchivalry" + { + "Offsets" + { + "EndTouch" + { + "windows" "94" + "linux" "95" + } + "FireBullets" + { + "windows" "106" + "linux" "107" + } + "GroundEntChanged" + { + "windows" "166" + "linux" "167" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "300" + "linux" "301" + } + "PostThink" + { + "windows" "281" + "linux" "282" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "92" + "linux" "93" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "93" + "linux" "94" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "99" + "linux" "100" + } + "Use" + { + "windows" "90" + "linux" "91" + } + "VPhysicsUpdate" + { + "windows" "146" + "linux" "147" + } + "Weapon_CanSwitchTo" + { + "windows" "237" + "linux" "238" + } + "Weapon_CanUse" + { + "windows" "231" + "linux" "232" + } + "Weapon_Drop" + { + "windows" "234" + "linux" "235" + } + "Weapon_Equip" + { + "windows" "232" + "linux" "233" + } + "Weapon_Switch" + { + "windows" "235" + "linux" "236" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.nucleardawn.txt b/gamedata/sdkhooks.games/game.nucleardawn.txt new file mode 100644 index 00000000..b20d9fcf --- /dev/null +++ b/gamedata/sdkhooks.games/game.nucleardawn.txt @@ -0,0 +1,158 @@ +"Games" +{ + "nucleardawn" + { + "Offsets" + { + "EndTouch" + { + "windows" "119" + "linux" "120" + "mac" "120" + } + "FireBullets" + { + "windows" "132" + "linux" "133" + "mac" "133" + } + "GetMaxHealth" + { + "windows" "136" + "linux" "137" + "mac" "137" + } + "GroundEntChanged" + { + "windows" "198" + "linux" "199" + "mac" "199" + } + "OnTakeDamage" + { + "windows" "72" + "linux" "73" + "mac" "73" + } + "PreThink" + { + "windows" "367" + "linux" "368" + "mac" "368" + } + "PostThink" + { + "windows" "368" + "linux" "369" + "mac" "369" + } + "Reload" + { + "windows" "291" + "linux" "292" + "mac" "292" + } + "SetTransmit" + { + "windows" "22" + "linux" "23" + "mac" "23" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + "mac" "18" + } + "Spawn" + { + "windows" "24" + "linux" "25" + "mac" "25" + } + "StartTouch" + { + "windows" "117" + "linux" "118" + "mac" "118" + } + "Think" + { + "windows" "56" + "linux" "57" + "mac" "57" + } + "Touch" + { + "windows" "118" + "linux" "119" + "mac" "119" + } + "TraceAttack" + { + "windows" "70" + "linux" "71" + "mac" "71" + } + "UpdateOnRemove" + { + "windows" "125" + "linux" "126" + "mac" "126" + } + "Use" + { + "windows" "116" + "linux" "117" + "mac" "117" + } + "VPhysicsUpdate" + { + "windows" "177" + "linux" "178" + "mac" "178" + } + "Weapon_CanSwitchTo" + { + "windows" "296" + "linux" "297" + "mac" "297" + } + "Weapon_CanUse" + { + "windows" "290" + "linux" "291" + "mac" "291" + } + "Weapon_Drop" + { + "windows" "293" + "linux" "294" + "mac" "294" + } + "Weapon_Equip" + { + "windows" "291" + "linux" "292" + "mac" "292" + } + "Weapon_Switch" + { + "windows" "294" + "linux" "295" + "mac" "295" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + "mac" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.pvkii.txt b/gamedata/sdkhooks.games/game.pvkii.txt new file mode 100644 index 00000000..cfaae04e --- /dev/null +++ b/gamedata/sdkhooks.games/game.pvkii.txt @@ -0,0 +1,120 @@ +"Games" +{ + /* Pirates, Vikings and Knights II 2.3 */ + "pvkii" + { + "Offsets" + { + "EndTouch" + { + "windows" "93" + "linux" "94" + } + "FireBullets" + { + "windows" "105" + "linux" "106" + } + "OnTakeDamage" + { + "windows" "61" + "linux" "62" + } + "PreThink" + { + "windows" "292" + "linux" "293" + } + "PostThink" + { + "windows" "293" + "linux" "294" + } + "SetTransmit" + { + "windows" "20" + "linux" "21" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "22" + "linux" "23" + } + "StartTouch" + { + "windows" "91" + "linux" "92" + } + "Think" + { + "windows" "46" + "linux" "47" + } + "Touch" + { + "windows" "92" + "linux" "93" + } + "TraceAttack" + { + "windows" "59" + "linux" "60" + } + "UpdateOnRemove" + { + "windows" "98" + "linux" "99" + } + "Use" + { + "windows" "90" + "linux" "91" + } + "VPhysicsUpdate" + { + "windows" "145" + "linux" "146" + } + "Weapon_CanSwitchTo" + { + "windows" "237" + "linux" "238" + } + "Weapon_CanUse" + { + "windows" "231" + "linux" "232" + } + "Weapon_Drop" + { + "windows" "234" + "linux" "235" + } + "Weapon_Equip" + { + "windows" "232" + "linux" "233" + } + "Weapon_Switch" + { + "windows" "235" + "linux" "236" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.sgtls.txt b/gamedata/sdkhooks.games/game.sgtls.txt new file mode 100644 index 00000000..d299c66a --- /dev/null +++ b/gamedata/sdkhooks.games/game.sgtls.txt @@ -0,0 +1,115 @@ +"Games" +{ + /* Stargate: The Last Stand 1.1 beta */ + "sgtls" + { + "Offsets" + { + "EndTouch" + { + "windows" "92" + "linux" "93" + } + "FireBullets" + { + "windows" "104" + "linux" "105" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "287" + "linux" "288" + } + "PostThink" + { + "windows" "288" + "linux" "289" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "90" + "linux" "91" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "91" + "linux" "92" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "97" + "linux" "98" + } + "VPhysicsUpdate" + { + "windows" "143" + "linux" "144" + } + "Weapon_CanSwitchTo" + { + "windows" "233" + "linux" "234" + } + "Weapon_CanUse" + { + "windows" "227" + "linux" "228" + } + "Weapon_Drop" + { + "windows" "230" + "linux" "231" + } + "Weapon_Equip" + { + "windows" "228" + "linux" "229" + } + "Weapon_Switch" + { + "windows" "231" + "linux" "232" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.sourceforts.txt b/gamedata/sdkhooks.games/game.sourceforts.txt new file mode 100644 index 00000000..9d8c4e04 --- /dev/null +++ b/gamedata/sdkhooks.games/game.sourceforts.txt @@ -0,0 +1,119 @@ +"Games" +{ + "sourceforts" + { + "Offsets" + { + "EndTouch" + { + "windows" "90" + "linux" "91" + } + "FireBullets" + { + "windows" "101" + "linux" "102" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "273" + "linux" "274" + } + "PostThink" + { + "windows" "274" + "linux" "275" + } + "SetTransmit" + { + "windows" "21" + "linux" "22" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + } + "Spawn" + { + "windows" "23" + "linux" "24" + } + "StartTouch" + { + "windows" "88" + "linux" "89" + } + "Think" + { + "windows" "46" + "linux" "47" + } + "Touch" + { + "windows" "89" + "linux" "90" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "95" + "linux" "96" + } + "Use" + { + "windows" "87" + "linux" "88" + } + "VPhysicsUpdate" + { + "windows" "142" + "linux" "143" + } + "Weapon_CanSwitchTo" + { + "windows" "222" + "linux" "223" + } + "Weapon_CanUse" + { + "windows" "216" + "linux" "217" + } + "Weapon_Drop" + { + "windows" "219" + "linux" "220" + } + "Weapon_Equip" + { + "windows" "217" + "linux" "218" + } + "Weapon_Switch" + { + "windows" "220" + "linux" "221" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.synergy.txt b/gamedata/sdkhooks.games/game.synergy.txt new file mode 100644 index 00000000..0cfacda5 --- /dev/null +++ b/gamedata/sdkhooks.games/game.synergy.txt @@ -0,0 +1,136 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + + +"Games" +{ + "synergy" + { + "Offsets" + { + "EndTouch" + { + "windows" "92" + "linux" "93" + } + "FireBullets" + { + "windows" "104" + "linux" "105" + } + "GroundEntChanged" + { + "windows" "164" + "linux" "165" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "293" + "linux" "294" + } + "PostThink" + { + "windows" "294" + "linux" "295" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "90" + "linux" "91" + } + "Think" + { + "windows" "45" + "linux" "46" + } + "Touch" + { + "windows" "91" + "linux" "92" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "97" + "linux" "98" + } + "Use" + { + "windows" "89" + "linux" "90" + } + "VPhysicsUpdate" + { + "windows" "144" + "linux" "145" + } + "Weapon_CanSwitchTo" + { + "windows" "234" + "linux" "235" + } + "Weapon_CanUse" + { + "windows" "228" + "linux" "229" + } + "Weapon_Drop" + { + "windows" "231" + "linux" "232" + } + "Weapon_Equip" + { + "windows" "229" + "linux" "230" + } + "Weapon_Switch" + { + "windows" "232" + "linux" "233" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.zm.txt b/gamedata/sdkhooks.games/game.zm.txt new file mode 100644 index 00000000..34b50f6e --- /dev/null +++ b/gamedata/sdkhooks.games/game.zm.txt @@ -0,0 +1,120 @@ +"Games" +{ + /* Zombie Master 1.2.1 */ + "zombie_master" + { + "Offsets" + { + "EndTouch" + { + "windows" "90" + "linux" "91" + } + "FireBullets" + { + "windows" "101" + "linux" "102" + } + "OnTakeDamage" + { + "windows" "60" + "linux" "61" + } + "PreThink" + { + "windows" "273" + "linux" "274" + } + "PostThink" + { + "windows" "274" + "linux" "275" + } + "SetTransmit" + { + "windows" "21" + "linux" "22" + } + "ShouldCollide" + { + "windows" "17" + "linux" "18" + } + "Spawn" + { + "windows" "23" + "linux" "24" + } + "StartTouch" + { + "windows" "88" + "linux" "89" + } + "Think" + { + "windows" "46" + "linux" "47" + } + "Touch" + { + "windows" "89" + "linux" "90" + } + "TraceAttack" + { + "windows" "58" + "linux" "59" + } + "UpdateOnRemove" + { + "windows" "95" + "linux" "96" + } + "Use" + { + "windows" "87" + "linux" "88" + } + "VPhysicsUpdate" + { + "windows" "142" + "linux" "143" + } + "Weapon_CanSwitchTo" + { + "windows" "222" + "linux" "223" + } + "Weapon_CanUse" + { + "windows" "216" + "linux" "217" + } + "Weapon_Drop" + { + "windows" "219" + "linux" "220" + } + "Weapon_Equip" + { + "windows" "217" + "linux" "218" + } + "Weapon_Switch" + { + "windows" "220" + "linux" "221" + } + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/game.zpanic.txt b/gamedata/sdkhooks.games/game.zpanic.txt new file mode 100644 index 00000000..50e09f2d --- /dev/null +++ b/gamedata/sdkhooks.games/game.zpanic.txt @@ -0,0 +1,120 @@ +"Games" +{ + /* Zombic Panic Source 2.0 */ + "zps" + { + "Offsets" + { + "EndTouch" + { + "windows" "96" + "linux" "97" + } + "FireBullets" + { + "windows" "108" + "linux" "109" + } + "OnTakeDamage" + { + "windows" "61" + "linux" "62" + } + "PreThink" + { + "windows" "295" + "linux" "296" + } + "PostThink" + { + "windows" "296" + "linux" "297" + } + "SetTransmit" + { + "windows" "19" + "linux" "20" + } + "ShouldCollide" + { + "windows" "15" + "linux" "16" + } + "Spawn" + { + "windows" "21" + "linux" "22" + } + "StartTouch" + { + "windows" "94" + "linux" "95" + } + "Think" + { + "windows" "46" + "linux" "47" + } + "Touch" + { + "windows" "95" + "linux" "96" + } + "TraceAttack" + { + "windows" "59" + "linux" "60" + } + "UpdateOnRemove" + { + "windows" "101" + "linux" "102" + } + "Use" + { + "windows" "93" + "linux" "94" + } + "VPhysicsUpdate" + { + "windows" "149" + "linux" "150" + } + "Weapon_CanSwitchTo" + { + "windows" "240" + "linux" "241" + } + "Weapon_CanUse" + { + "windows" "234" + "linux" "235" + } + "Weapon_Drop" + { + "windows" "237" + "linux" "238" + } + "Weapon_Equip" + { + "windows" "235" + "linux" "236" + } + //"Weapon_Switch" + //{ + // "windows" "234" + // "linux" "235" + //} + } + + "Signatures" + { + "IEntityFactoryDictionary" + { + "library" "server" + "windows" "\xB8\x01\x00\x00\x00\x84\x2A\x2A\x2A\x2A\x2A\x75\x1D\x09\x2A\x2A\x2A\x2A\x2A\xB9\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x83\xC4\x04\xB8\x2A\x2A\x2A\x2A\xC3" + "linux" "@_Z23EntityFactoryDictionaryv" + } + } + } +} \ No newline at end of file diff --git a/gamedata/sdkhooks.games/master.games.txt b/gamedata/sdkhooks.games/master.games.txt new file mode 100644 index 00000000..265a19d6 --- /dev/null +++ b/gamedata/sdkhooks.games/master.games.txt @@ -0,0 +1,162 @@ +/** + * Do not edit this file. Any changes will be overwritten by the gamedata + * updater. + * + * To override data in this file, create a subdirectory named "custom" and + * place your own gamedata file(s) inside of it. Such files will be parsed + * after SM's own. + * + * For more information, see http://wiki.alliedmods.net/Gamedata_Updating_(SourceMod) + */ + + +"Game Master" +{ + "common.games.txt" + { + } + + "engine.l4d.txt" + { + "engine" "left4dead" + } + + "game.l4d2.txt" + { + "game" "left4dead2" + } + + "game.nucleardawn.txt" + { + "game" "nucleardawn" + } + + "engine.csgo.txt" + { + "engine" "csgo" + } + + "engine.ep2v.txt" + { + "engine" "orangebox_valve" + } + + "engine.darkm.txt" + { + "engine" "darkmessiah" + } + +/* + Not Yet + + "engine.bgt.txt" + { + "engine" "bloodygoodtime" + } +*/ + + "game.insurgency.txt" + { + "game" "insurgency" + } + + "game.pvkii.txt" + { + "game" "pvkii" + } + + "game.ff.txt" + { + "game" "FortressForever" + } + + "game.garrysmod.txt" + { + "game" "garrysmod" + } + + "game.empires.txt" + { + "game" "empires" + } + + "game.sourceforts.txt" + { + "game" "sourceforts" + } + + "game.hidden.txt" + { + "game" "hidden" + } + + "game.zm.txt" + { + "game" "zombie_master" + } + + "game.zpanic.txt" + { + "game" "zps" + } + + "game.neotokyo.txt" + { + "game" "NeotokyoSource" + } + + "game.fof.txt" + { + "game" "fistful_of_frags" + } + + "game.sgtls.txt" + { + "game" "sgtls" + } + + "game.alienswarm.txt" + { + "game" "swarm" + } + + "game.dinodday.txt" + { + "game" "dinodday" + } + + "game.aoc.txt" + { + "game" "ageofchivalry" + } + + "game.cspromod.txt" + { + "game" "cspromod" + } + + "game.ag2.txt" + { + "game" "ag2" + } + + "game.cstrike.txt" + { + "game" "cstrike" + } + + "game.nmrih.txt" + { + "game" "nmrih" + } + + "game.gesource.txt" + { + "game" "gesource" + } + + "game.synergy.txt" + { + "game" "synergy" + } +} diff --git a/plugins/include/sdkhooks.inc b/plugins/include/sdkhooks.inc new file mode 100644 index 00000000..cb552447 --- /dev/null +++ b/plugins/include/sdkhooks.inc @@ -0,0 +1,394 @@ +/** + * vim: set ts=4 : + * ============================================================================= + * SourceMod (C)2009-2013 AlliedModders LLC. All rights reserved. + * ============================================================================= + * + * This file is part of the SourceMod/SourcePawn SDK. + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, version 3.0, as published by the + * Free Software Foundation. + * + * 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, see . + * + * As a special exception, AlliedModders LLC gives you permission to link the + * code of this program (as well as its derivative works) to "Half-Life 2," the + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software + * by the Valve Corporation. You must obey the GNU General Public License in + * all respects for all other code used. Additionally, AlliedModders LLC grants + * this exception to all derivative works. AlliedModders LLC defines further + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), + * or . + */ + +#if defined _sdkhooks_included + #endinput +#endif +#define _sdkhooks_included + +// this is obviously _not_ a robust check, but it will solve most conflict and is clean +#if !defined DMG_GENERIC +#define DMG_GENERIC 0 // generic damage was done +#define DMG_CRUSH (1 << 0) // crushed by falling or moving object. + // NOTE: It's assumed crush damage is occurring as a result of physics collision, so no extra physics force is generated by crush damage. + // DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics collision. You probably want DMG_CLUB instead. +#define DMG_BULLET (1 << 1) // shot +#define DMG_SLASH (1 << 2) // cut, clawed, stabbed +#define DMG_BURN (1 << 3) // heat burned +#define DMG_VEHICLE (1 << 4) // hit by a vehicle +#define DMG_FALL (1 << 5) // fell too far +#define DMG_BLAST (1 << 6) // explosive blast damage +#define DMG_CLUB (1 << 7) // crowbar, punch, headbutt +#define DMG_SHOCK (1 << 8) // electric shock +#define DMG_SONIC (1 << 9) // sound pulse shockwave +#define DMG_ENERGYBEAM (1 << 10) // laser or other high energy beam +#define DMG_PREVENT_PHYSICS_FORCE (1 << 11) // Prevent a physics force +#define DMG_NEVERGIB (1 << 12) // with this bit OR'd in, no damage type will be able to gib victims upon death +#define DMG_ALWAYSGIB (1 << 13) // with this bit OR'd in, any damage type can be made to gib victims upon death. +#define DMG_DROWN (1 << 14) // Drowning +#define DMG_PARALYZE (1 << 15) // slows affected creature down +#define DMG_NERVEGAS (1 << 16) // nerve toxins, very bad +#define DMG_POISON (1 << 17) // blood poisoning - heals over time like drowning damage +#define DMG_RADIATION (1 << 18) // radiation exposure +#define DMG_DROWNRECOVER (1 << 19) // drowning recovery +#define DMG_ACID (1 << 20) // toxic chemicals or acid burns +#define DMG_SLOWBURN (1 << 21) // in an oven +#define DMG_REMOVENORAGDOLL (1 << 22) // with this bit OR'd in, no ragdoll will be created, and the target will be quietly removed. + // use this to kill an entity that you've already got a server-side ragdoll for +#define DMG_PHYSGUN (1 << 23) // Hit by manipulator. Usually doesn't do any damage. +#define DMG_PLASMA (1 << 24) // Shot by Cremator +#define DMG_AIRBOAT (1 << 25) // Hit by the airboat's gun +#define DMG_DISSOLVE (1 << 26) // Dissolving! +#define DMG_BLAST_SURFACE (1 << 27) // A blast on the surface of water that cannot harm things underwater +#define DMG_DIRECT (1 << 28) +#define DMG_BUCKSHOT (1 << 29) // not quite a bullet. Little, rounder, different. +#endif + +#if !defined DMG_CRIT + // TF2 crits and minicrits + #define DMG_CRIT DMG_ACID +#endif + +enum SDKHookType +{ + SDKHook_EndTouch, + SDKHook_FireBulletsPost, + SDKHook_OnTakeDamage, + SDKHook_OnTakeDamagePost, + SDKHook_PreThink, + SDKHook_PostThink, + SDKHook_SetTransmit, + SDKHook_Spawn, + SDKHook_StartTouch, + SDKHook_Think, + SDKHook_Touch, + SDKHook_TraceAttack, + SDKHook_TraceAttackPost, + SDKHook_WeaponCanSwitchTo, + SDKHook_WeaponCanUse, + SDKHook_WeaponDrop, + SDKHook_WeaponEquip, + SDKHook_WeaponSwitch, + SDKHook_ShouldCollide, + SDKHook_PreThinkPost, + SDKHook_PostThinkPost, + SDKHook_ThinkPost, + SDKHook_EndTouchPost, + SDKHook_GroundEntChangedPost, + SDKHook_SpawnPost, + SDKHook_StartTouchPost, + SDKHook_TouchPost, + SDKHook_VPhysicsUpdate, + SDKHook_VPhysicsUpdatePost, + SDKHook_WeaponCanSwitchToPost, + SDKHook_WeaponCanUsePost, + SDKHook_WeaponDropPost, + SDKHook_WeaponEquipPost, + SDKHook_WeaponSwitchPost, + SDKHook_Use, + SDKHook_UsePost, + SDKHook_Reload, + SDKHook_ReloadPost, + SDKHook_GetMaxHealth, // ep2v and later +}; + +/* + Alphabetized for easy readability + + SDKHook_EndTouch, + SDKHook_EndTouchPost, + + SDKHook_FireBulletsPost, + + SDKHook_GetMaxHealth, (ep2v and later) + + SDKHook_GroundEntChangedPost, + + SDKHook_OnTakeDamage, + SDKHook_OnTakeDamagePost, + + SDKHook_PreThink, + SDKHook_PreThinkPost, + + SDKHook_PostThink, + SDKHook_PostThinkPost, + + SDKHook_Reload, + SDKHook_ReloadPost, + + SDKHook_SetTransmit, + + SDKHook_ShouldCollide, + + SDKHook_Spawn, + SDKHook_SpawnPost, + + SDKHook_StartTouch, + SDKHook_StartTouchPost, + + SDKHook_Think, + SDKHook_ThinkPost, + + SDKHook_Touch, + SDKHook_TouchPost, + + SDKHook_TraceAttack, + SDKHook_TraceAttackPost, + + SDKHook_Use, + SDKHook_UsePost, + + SDKHook_VPhysicsUpdate, + SDKHook_VPhysicsUpdatePost, + + SDKHook_WeaponCanSwitchTo, + SDKHook_WeaponCanSwitchToPost, + + SDKHook_WeaponCanUse, + SDKHook_WeaponCanUsePost, + + SDKHook_WeaponDrop, + SDKHook_WeaponDropPost, + + SDKHook_WeaponEquip, + SDKHook_WeaponEquipPost, + + SDKHook_WeaponSwitch, + SDKHook_WeaponSwitchPost +*/ + +enum UseType +{ + Use_Off, + Use_On, + Use_Set, + Use_Toggle +}; + +funcenum SDKHookCB +{ + // PreThink/Post + // PostThink/Post + public(client), + + // Spawn + Action:public(entity), + + // GroundEntChanged + // SpawnPost + // Think/Post + // VPhysicsUpdate/Post + public(entity), + + // EndTouch + // StartTouch + // Touch + Action:public(entity, other), + + // EndTouchPost + // StartTouchPost + // TouchPost + public(entity, other), + + // SetTransmit + Action:public(entity, client), + + // WeaponCanSwitchTo + // WeaponCanUse + // WeaponDrop + // WeaponEquip + // WeaponSwitch + Action:public(client, weapon), + + // WeaponCanSwitchToPost + // WeaponCanUsePost + // WeaponDropPost + // WeaponEquipPost + // WeaponSwitchPost + public(client, weapon), + + // GetMaxHealth (ep2v and later) + Action:public(entity, &maxhealth), + + // OnTakeDamage + // Note: The weapon parameter is not used by all games and damage sources. + // Note: Force application is dependent on game and damage type(s) + // SDKHooks 1.0+ + Action:public(victim, &attacker, &inflictor, &Float:damage, &damagetype), + // SDKHooks 2.0+ + Action:public(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3]), + // SDKHooks 2.1+ (can check for support at runtime using GetFeatureStatus on SDKHook_DmgCustomInOTD capability. + // DON'T attempt to access 'damagecustom' var if feature status != available + Action:public(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, + Float:damageForce[3], Float:damagePosition[3], damagecustom), + + // OnTakeDamagePost + public(victim, attacker, inflictor, Float:damage, damagetype), + public(victim, attacker, inflictor, Float:damage, damagetype, weapon, const Float:damageForce[3], const Float:damagePosition[3]), + + // FireBulletsPost + public(client, shots, const String:weaponname[]), + + // TraceAttack + Action:public(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup), + + // TraceAttackPost + public(victim, attacker, inflictor, Float:damage, damagetype, ammotype, hitbox, hitgroup), + + // ShouldCollide + bool:public(entity, collisiongroup, contentsmask, bool:originalResult), + + // Use + Action:public(entity, activator, caller, UseType:type, Float:value), + + // UsePost + public(entity, activator, caller, UseType:type, Float:value), + + // Reload + Action:public(weapon), + + // Reload post + public(weapon, bool:bSuccessful) +}; + + +/** + * @brief When an entity is created + * + * @param entity Entity index + * @param classname Class name + * @noreturn + */ +forward OnEntityCreated(entity, const String:classname[]); + +/** + * @brief When an entity is destroyed + * + * @param entity Entity index + * @noreturn + */ +forward OnEntityDestroyed(entity); + +/** + * @brief When the game description is retrieved + * + * @note Not supported on ep2v. + * + * @param gameDesc Game description + * @noreturn + */ +forward Action:OnGetGameDescription(String:gameDesc[64]); + +/** + * @brief When the level is initialized + * + * @param mapName Name of the map + * @param mapEntities Entities of the map + * @noreturn + */ +forward Action:OnLevelInit(const String:mapName[], String:mapEntities[2097152]); + +/** + * @brief Hooks an entity + * + * @param entity Entity index + * @param type Type of function to hook + * @param callback Function to call when hook is called + * @noreturn + */ +native SDKHook(entity, SDKHookType:type, SDKHookCB:callback); + +/** + * @brief Hooks an entity + * + * @param entity Entity index + * @param type Type of function to hook + * @param callback Function to call when hook is called + * @return bool Hook Successful + */ +native bool:SDKHookEx(entity, SDKHookType:type, SDKHookCB:callback); + +/** + * @brief Unhooks an entity + * + * @param entity Entity index + * @param type Type of function to unhook + * @param callback Callback function to unhook + * @noreturn + */ +native SDKUnhook(entity, SDKHookType:type, SDKHookCB:callback); + +/** + * @brief Applies damage to an entity + * + * @note Force application is dependent on game and damage type(s) + * + * @param entity Entity index taking damage + * @param inflictor Inflictor entity index + * @param attacker Attacker entity index + * @param damage Amount of damage + * @param damageType Bitfield of damage types + * @param weapon Weapon index (orangebox and later) or -1 for unspecified + * @param damageForce Velocity of damage force + * @param damagePosition Origin of damage + * @noreturn + */ +native SDKHooks_TakeDamage(entity, inflictor, attacker, Float:damage, damageType=DMG_GENERIC, weapon=-1, const Float:damageForce[3]=NULL_VECTOR, const Float:damagePosition[3]=NULL_VECTOR); + +/** + * @brief Forces a client to drop the specified weapon + * + * @param client Client index. + * @param weapon Weapon entity index. + * @param vecTarget Location to toss weapon to, or NULL_VECTOR for default. + * @param vecVelocity Velocity at which to toss weapon, or NULL_VECTOR for default. + * @noreturn + * @error Invalid client or weapon entity, weapon not owned by client. + */ +native SDKHooks_DropWeapon(client, weapon, const Float:vecTarget[3]=NULL_VECTOR, const Float:vecVelocity[3]=NULL_VECTOR); + +/** + * Do not edit below this line! + */ +public Extension:__ext_sdkhooks = +{ + name = "SDKHooks", + file = "sdkhooks.ext", +#if defined AUTOLOAD_EXTENSIONS + autoload = 1, +#else + autoload = 0, +#endif +#if defined REQUIRE_EXTENSIONS + required = 1, +#else + required = 0, +#endif +}; diff --git a/tools/buildbot/PackageScript b/tools/buildbot/PackageScript index 1d556f72..95eedf6d 100644 --- a/tools/buildbot/PackageScript +++ b/tools/buildbot/PackageScript @@ -71,6 +71,7 @@ folders = [['addons', 'sourcemod', 'bin'], ['addons', 'sourcemod', 'plugins', 'disabled'], ['addons', 'sourcemod', 'gamedata'], ['addons', 'sourcemod', 'gamedata', 'core.games'], + ['addons', 'sourcemod', 'gamedata', 'sdkhooks.games'], ['addons', 'sourcemod', 'gamedata', 'sdktools.games'], ['addons', 'sourcemod', 'gamedata', 'sm-cstrike.games'], ['addons', 'sourcemod', 'configs', 'geoip'], @@ -112,6 +113,8 @@ job.AddCommand(CopyFolder(['configs', 'sql-init-scripts', 'mysql'], job.AddCommand(CopyFolder(['configs', 'sql-init-scripts', 'sqlite'], ['addons', 'sourcemod', 'configs', 'sql-init-scripts', 'sqlite'])) job.AddCommand(CopyFolder(['gamedata'], ['addons', 'sourcemod', 'gamedata'])) +job.AddCommand(CopyFolder(['gamedata', 'sdkhooks.games'], + ['addons', 'sourcemod', 'gamedata', 'sdkhooks.games'])) job.AddCommand(CopyFolder(['gamedata', 'sdktools.games'], ['addons', 'sourcemod', 'gamedata', 'sdktools.games'])) job.AddCommand(CopyFolder(['gamedata', 'core.games'], @@ -245,6 +248,7 @@ AddNormalLibrary('webternet.ext', 'extensions') AddNormalLibrary('clientprefs.ext', 'extensions') AddNormalLibrary('updater.ext', 'extensions') AddNormalLibrary('bintools.ext', 'extensions') +AddHL2Library('sdkhooks.ext', 'extensions') AddHL2Library('sdktools.ext', 'extensions') bincopies.append(CopyFile(os.path.join('..', 'spcomp', 'spcomp' + osutil.ExecutableSuffix()),