1.1 --- a/plugins/include/sdktools.inc Fri Jul 11 06:51:21 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,212 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
1.8 - * =============================================================================
1.9 - *
1.10 - * This file is part of the SourceMod/SourcePawn SDK.
1.11 - *
1.12 - * This program is free software; you can redistribute it and/or modify it under
1.13 - * the terms of the GNU General Public License, version 3.0, as published by the
1.14 - * Free Software Foundation.
1.15 - *
1.16 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.17 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.18 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.19 - * details.
1.20 - *
1.21 - * You should have received a copy of the GNU General Public License along with
1.22 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.23 - *
1.24 - * As a special exception, AlliedModders LLC gives you permission to link the
1.25 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.26 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.27 - * by the Valve Corporation. You must obey the GNU General Public License in
1.28 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.29 - * this exception to all derivative works. AlliedModders LLC defines further
1.30 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.31 - * or <http://www.sourcemod.net/license.php>.
1.32 - *
1.33 - * Version: $Id$
1.34 - */
1.35 -
1.36 -#if defined _sdktools_included
1.37 - #endinput
1.38 -#endif
1.39 -#define _sdktools_included
1.40 -
1.41 -#include <core>
1.42 -#include <sdktools_engine>
1.43 -#include <sdktools_functions>
1.44 -#if !defined SDKTOOLS_DISABLE_SOUNDAPI
1.45 -#include <sdktools_sound>
1.46 -#endif
1.47 -#include <sdktools_stringtables>
1.48 -#include <sdktools_trace>
1.49 -#include <sdktools_tempents>
1.50 -#include <sdktools_tempents_stocks>
1.51 -#include <sdktools_voice>
1.52 -#include <sdktools_entinput>
1.53 -#include <sdktools_entoutput>
1.54 -
1.55 -enum SDKCallType
1.56 -{
1.57 - SDKCall_Static, /**< Static call */
1.58 - SDKCall_Entity, /**< CBaseEntity call */
1.59 - SDKCall_Player, /**< CBasePlayer call */
1.60 - SDKCall_GameRules, /**< CGameRules call */
1.61 - SDKCall_EntityList, /**< CGlobalEntityList call */
1.62 -};
1.63 -
1.64 -enum SDKLibrary
1.65 -{
1.66 - SDKLibrary_Server, /**< server.dll/server_i486.so */
1.67 - SDKLibrary_Engine, /**< engine.dll/engine_*.so */
1.68 -};
1.69 -
1.70 -enum SDKFuncConfSource
1.71 -{
1.72 - SDKConf_Virtual = 0, /**< Read a virtual index from the Offsets section */
1.73 - SDKConf_Signature = 1, /**< Read a signature from the Signatures section */
1.74 -};
1.75 -
1.76 -enum SDKType
1.77 -{
1.78 - SDKType_CBaseEntity, /**< CBaseEntity (always as pointer) */
1.79 - SDKType_CBasePlayer, /**< CBasePlayer (always as pointer) */
1.80 - SDKType_Vector, /**< Vector (pointer, byval, or byref) */
1.81 - SDKType_QAngle, /**< QAngles (pointer, byval, or byref) */
1.82 - SDKType_PlainOldData, /**< Integer/generic data <=32bit (any) */
1.83 - SDKType_Float, /**< Float (any) */
1.84 - SDKType_Edict, /**< edict_t (always as pointer) */
1.85 - SDKType_String, /**< NULL-terminated string (always as pointer) */
1.86 - SDKType_Bool, /**< Boolean (any) */
1.87 -};
1.88 -
1.89 -enum SDKPassMethod
1.90 -{
1.91 - SDKPass_Pointer, /**< Pass as a pointer */
1.92 - SDKPass_Plain, /**< Pass as plain data */
1.93 - SDKPass_ByValue, /**< Pass an object by value */
1.94 - SDKPass_ByRef, /**< Pass an object by reference */
1.95 -};
1.96 -
1.97 -#define VDECODE_FLAG_ALLOWNULL (1<<0) /**< Allow NULL for pointers */
1.98 -#define VDECODE_FLAG_ALLOWNOTINGAME (1<<1) /**< Allow players not in game */
1.99 -#define VDECODE_FLAG_ALLOWWORLD (1<<2) /**< Allow World entity */
1.100 -#define VDECODE_FLAG_BYREF (1<<3) /**< Floats/ints by reference */
1.101 -
1.102 -#define VENCODE_FLAG_COPYBACK (1<<0) /**< Copy back data once done */
1.103 -
1.104 -/**
1.105 - * Starts the preparation of an SDK call.
1.106 - *
1.107 - * @param type Type of function call this will be.
1.108 - * @noreturn
1.109 - */
1.110 -native StartPrepSDKCall(SDKCallType:type);
1.111 -
1.112 -/**
1.113 - * Sets the virtual index of the SDK call if it is virtual.
1.114 - *
1.115 - * @param vtblidx Virtual table index.
1.116 - * @noreturn
1.117 - */
1.118 -native PrepSDKCall_SetVirtual(vtblidx);
1.119 -
1.120 -/**
1.121 - * Finds an address in a library and sets it as the address to use for the SDK call.
1.122 - *
1.123 - * @param lib Library to use.
1.124 - * @param signature Binary data to search for in the library. If it starts with '@',
1.125 - * the bytes parameter is ignored and the signature is interpreted
1.126 - * as a symbol lookup in the library.
1.127 - * @param bytes Number of bytes in the binary search string.
1.128 - * @return True on success, false if nothing was found.
1.129 - */
1.130 -native bool:PrepSDKCall_SetSignature(SDKLibrary:lib, const String:signature[], bytes);
1.131 -
1.132 -/**
1.133 - * Finds an address or virtual function index in a GameConfig file and sets it as
1.134 - * the calling information for the SDK call.
1.135 - *
1.136 - * @param gameconf GameConfig Handle, or INVALID_HANDLE to use sdktools.games.txt.
1.137 - * @param source Whether to look in Offsets or Signatures.
1.138 - * @param name Name of the property to find.
1.139 - * @return True on success, false if nothing was found.
1.140 - */
1.141 -native bool:PrepSDKCall_SetFromConf(Handle:gameconf, SDKFuncConfSource:source, const String:name[]);
1.142 -
1.143 -/**
1.144 - * Sets the return information of an SDK call. Do not call this if there is no return data.
1.145 - * This must be called if there is a return value (i.e. it is not necessarily safe to ignore
1.146 - * the data).
1.147 - *
1.148 - * @param type Data type to convert to/from.
1.149 - * @param pass How the data is passed in C++.
1.150 - * @param decflags Flags on decoding from the plugin to C++.
1.151 - * @param encflags Flags on encoding from C++ to the plugin.
1.152 - * @noreturn
1.153 - */
1.154 -native PrepSDKCall_SetReturnInfo(SDKType:type, SDKPassMethod:pass, decflags=0, encflags=0);
1.155 -
1.156 -/**
1.157 - * Adds a parameter to the calling convention. This should be called in normal ascending order.
1.158 - *
1.159 - * @param type Data type to convert to/from.
1.160 - * @param pass How the data is passed in C++.
1.161 - * @param decflags Flags on decoding from the plugin to C++.
1.162 - * @param encflags Flags on encoding from C++ to the plugin.
1.163 - * @noreturn
1.164 - */
1.165 -native PrepSDKCall_AddParameter(SDKType:type, SDKPassMethod:pass, decflags=0, encflags=0);
1.166 -
1.167 -/**
1.168 - * Finalizes an SDK call preparation and returns the resultant Handle.
1.169 - *
1.170 - * @return A new SDKCall Handle on success, or INVALID_HANDLE on failure.
1.171 - */
1.172 -native Handle:EndPrepSDKCall();
1.173 -
1.174 -/**
1.175 - * Calls an SDK function with the given parameters.
1.176 - *
1.177 - * If the call type is Entity or Player, the index MUST ALWAYS be the FIRST parameter passed.
1.178 - * If the call type is GameRules, then nothing special needs to be passed.
1.179 - * If the return value is a Vector or QAngles, the SECOND parameter must be a Float[3].
1.180 - * If the return value is a string, the THIRD parameter must be a String buffer, and the
1.181 - * FOURTH parameter must be the maximum length.
1.182 - * All parameters must be passed after the above is followed. Failure to follow these
1.183 - * rules will result in crashes or wildly unexpected behavior!
1.184 - *
1.185 - * If the return value is a float or integer, the return value will be this value.
1.186 - * If the return value is a CBaseEntity, CBasePlayer, or edict, the return value will
1.187 - * always be the entity index, or -1 for NULL.
1.188 - *
1.189 - * @param call SDKCall Handle.
1.190 - * @param ... Call Parameters.
1.191 - * @return Simple return value, if any.
1.192 - * @error Invalid Handle or internal decoding error.
1.193 - */
1.194 -native any:SDKCall(Handle:call, any:...);
1.195 -
1.196 -#include <sdktools_stocks>
1.197 -
1.198 -/**
1.199 - * Do not edit below this line!
1.200 - */
1.201 -public Extension:__ext_sdktools =
1.202 -{
1.203 - name = "SDKTools",
1.204 - file = "sdktools.ext",
1.205 -#if defined AUTOLOAD_EXTENSIONS
1.206 - autoload = 1,
1.207 -#else
1.208 - autoload = 0,
1.209 -#endif
1.210 -#if defined REQUIRE_EXTENSIONS
1.211 - required = 1,
1.212 -#else
1.213 - required = 0,
1.214 -#endif
1.215 -};