From ce19586646a5c7456403bb52f6bda544eb5142e1 Mon Sep 17 00:00:00 2001 From: Ayuto22 Date: Sun, 28 Jan 2018 16:34:17 +0100 Subject: [PATCH] Moved _libs to python/_libs/spe Removed revision number --- .gitignore | 8 + _libs/{ => python/spe}/__init__.py | 1182 ++++++++--------- _libs/{ => python/spe}/games/__init__.py | 8 +- _libs/{ => python/spe}/games/cstrike.py | 234 ++-- _libs/{ => python/spe}/games/hl2mp.py | 56 +- _libs/{ => python/spe}/games/l4d.py | 74 +- _libs/{ => python/spe}/games/left4dead.py | 74 +- _libs/{ => python/spe}/games/shared.py | 480 +++---- .../spe}/ini/engines/shared.ep1.ini | 86 +- .../spe}/ini/engines/shared.ep2.ini | 0 .../spe}/ini/engines/shared.l4d.ini | 2 +- .../spe}/ini/engines/shared.l4d2.ini | 2 +- _libs/{ => python/spe}/ini/games/cstrike.ini | 156 +-- .../{ => python/spe}/ini/games/left4dead.ini | 30 +- .../{ => python/spe}/ini/games/left4dead2.ini | 2 +- _libs/{ => python/spe}/ini/games/tf.ini | 2 +- _libs/{ => python/spe}/types/shared.ini | 16 +- src/spe_main.cpp | 6 +- src/spe_main.h | 4 +- src/svn_build.h | 32 - src/svn_build.tmpl | 32 - 21 files changed, 1213 insertions(+), 1273 deletions(-) create mode 100644 .gitignore rename _libs/{ => python/spe}/__init__.py (96%) rename _libs/{ => python/spe}/games/__init__.py (88%) rename _libs/{ => python/spe}/games/cstrike.py (96%) rename _libs/{ => python/spe}/games/hl2mp.py (96%) rename _libs/{ => python/spe}/games/l4d.py (96%) rename _libs/{ => python/spe}/games/left4dead.py (96%) rename _libs/{ => python/spe}/games/shared.py (97%) rename _libs/{ => python/spe}/ini/engines/shared.ep1.ini (96%) rename _libs/{ => python/spe}/ini/engines/shared.ep2.ini (100%) rename _libs/{ => python/spe}/ini/engines/shared.l4d.ini (96%) rename _libs/{ => python/spe}/ini/engines/shared.l4d2.ini (96%) rename _libs/{ => python/spe}/ini/games/cstrike.ini (96%) rename _libs/{ => python/spe}/ini/games/left4dead.ini (96%) rename _libs/{ => python/spe}/ini/games/left4dead2.ini (96%) rename _libs/{ => python/spe}/ini/games/tf.ini (96%) rename _libs/{ => python/spe}/types/shared.ini (97%) delete mode 100644 src/svn_build.h delete mode 100644 src/svn_build.tmpl diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b40ad61 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +src/Release* +src/SPE-2008.opensdf +src/SPE-2008.sdf +src/Binaries/* +src/libvstdlib_srv.so +src/libpython2.5.so.1.0 +src/libtier0_srv.so +src/SPE-2008.suo \ No newline at end of file diff --git a/_libs/__init__.py b/_libs/python/spe/__init__.py similarity index 96% rename from _libs/__init__.py rename to _libs/python/spe/__init__.py index 4ab858a..a116600 100644 --- a/_libs/__init__.py +++ b/_libs/python/spe/__init__.py @@ -1,592 +1,590 @@ -""" -$Rev$ -$LastChangedDate$ -""" - -# ============================================================================= -# Source-Python Extensions Library: -# Base Library -# ============================================================================= - -# ============================================================================= -# Imports -# ============================================================================= - -# Python Imports -import os -import binascii -import ctypes -from configobj import ConfigObj -from os import name as platform - -# Eventscripts Imports -import es - -# SPE Imports -from spe_C import * - -# ============================================================================= -# Versioning -# ============================================================================= -__revision__ = '$Rev$' -__version__ = '1.6.1 r' -es.ServerVar( - 'spe_version', __version__ + __revision__.strip('$Rev: ')).makepublic() - - -# ============================================================================= -# Exceptions -# ============================================================================= -class InvalidFunctionNameException(Exception): - pass - - -class FunctionAddressNotValid(Exception): - pass - - -class ConventionError(Exception): - pass - - -class MismatchedTypesAndNames(Exception): - pass - - -class UndefinedTypeError(Exception): - pass - - -class UnsupportedOperation(Exception): - pass - - -# ============================================================================= -# Enums -# ============================================================================= -class Conventions: - ''' - This class defines constants which denote various x86 - calling conventions. NOTE: Using the wrong calling convention will - cause crashing! - ''' - CDECL, THISCALL, STDCALL = range(3) - - -class HookAction: - ''' - This class defines various constants for hook actions. A hook - action is basically what you want to do after your callback is - executed. - - Continue - Call original function like normal. - Modified - Call original function with modified parameters. - Override - Block original function and use custom return value. - Error - Internal use only. - ''' - Continue, Modified, Override = range(3) - Error = -1 - - -class HookType: - ''' - This class defines the two hook types supported by SPE. - PRE - Call your callback before the original function. - POST - Call your callback after the original function. - ''' - Pre, Post = range(2) - - -# ============================================================================= -# >> Classes -# ============================================================================= -class SPEObject(object): - - def __init__(self, name, basePtr, varPositions): - ''' - This is the SPEObject constructor. DO NOT try to instantiate one of - these directly. SPE will automatically parse and add attributes to this - class for use with your datatype. Use spe.makeObject instead. - ''' - #self.base = basePtr - #self.name = name - #self.varlist = {} - self.__dict__['base'] = basePtr - self.__dict__['name'] = name - self.__dict__['varlist'] = {} - - # Temporary base pointer - tmpBase = basePtr - - # Iterate over every member variable. - for var in varPositions['typeinfo']: - # If it is a native type... - if var['type'] in ['i', 'f', 'b', 'p']: - self.varlist[var['name']] = { - 'addr': tmpBase, 'type': var['type']} - tmpBase += 4 - - # Char is special case because it is 1 byte. - elif var['type'] in ['c']: - self.varlist[var['name']] = { - 'addr': tmpBase, 'type': var['type']} - tmpBase += 1 - - # Found a non-native type. - else: - # Is the type in the list? - if var['type'] in gSPE.Types: - # Non-native type. Create the object. This basically - # recurses until we hit basetypes. - obj = makeObject(var['type'], tmpBase) - - # Store the object. - self.varlist[var['name']] = obj - - # Now Increment the base pointer. - tmpBase += obj.size - - # Yay, done parsing the object. We need to set the size. - self.__dict__['size'] = varPositions['size'] - - def __getattr__(self, name): - ''' - We need to override this so that we can use spe.getLocVal - in order to grab variable information. - ''' - - # Find the object in our variable list. - if name in self.varlist: - # Get the value. - val = self.varlist[name] - - # If it's an integer, this means we're at an offset. We need to - # Ask SPE to get this information for us. - if type(val).__name__ == 'dict': - return getLocVal(val['type'], val['addr']) - - # This means it was an SPEObject. Return that instead. - return val - - return object.__getattribute__(self, name) - - def __setattr__(self, name, value): - ''' - We override this in order to set values at locations. - ''' - - # Does the object exist in our variable list? - if name in self.varlist: - # Get the value. - val = self.varlist[name] - - # If it's a dict, this means we are at a base type. We can - # set basetypes using atomic operations. - if type(val).__name__ == 'dict': - setLocVal(val['type'], val['addr'], value) - - else: - # Setting whole SPE objects is not supported yet. - raise UnsupportedOperation('SPE currently does not ' - 'support setting SPEObject instances.') - - -# ============================================================================= -# >> Signature Class -# ============================================================================= -class Signature(object): - ''' - This is the primary class for calling Signature-based functions. - Requirements for this class are: - * Identifier (identifier): - - The actual "Windows Signature" or "Linux Symbol". - - "Windows Signatures" must be previously formatted - with "backslash x" instead of spaces. - * Parameter Format (param_format): - - The type of each argument, and the return type: - p = Pointer - i = Integer - f = Float - B = Boolean - d = Double - L = Long - S = String - * Convention (convention): - - thiscall - Used when calling funtions from (within a C++ class) - - cdecl - Used when calling functions that are global - (not part of a C++ class) - - fastcall - (Reserved) - ''' - def __init__(self, identifier, param_format, convention): - # IDENTIFIER (Windows Signature or Linux Symbol) - self.identifier = str(identifier) - - # FUNCTION (memory address) - if platform == 'nt': - self.function = findFunction( - self.identifier, len(self.identifier.decode('string_escape'))) - else: - self.function = findSymbol(self.identifier) - - # PARAMETER FORMAT - self.param_format = str(param_format) - - # CONVENTION TYPE - if convention not in ['thiscall', 'cdecl', 'fastcall']: - raise ConventionError('"' + str(convention) + '" is not a valid' - ' convention: "thiscall", "cdecl", or "fastcall" only.') - - self.convention = str(convention) - - def call(self, args=()): - # Weird, but this is still required on Linux to prevent crashes - tuple(args) - - # Set the calling convention - setCallingConvention(self.convention) - - # Call the function and return the results - return callFunction(self.function, self.param_format, args) - - -# ============================================================================= -# >> SPE Manager class -# ============================================================================= -class CSPEManager(object): - ''' - This class is the main SPE module manager. - Do not access any methods from this class directly. - Instead, use the exported functions down below. - ''' - def __init__(self): - # Setup the game name - self.game_name = str( - os.path.split(str(es.ServerVar('eventscripts_gamedir')))[1]) - - # Setup signature dictionary - self.Signatures = {} - - # Setup type dictionary. - self.Types = {} - - # Initialize SPE - self.initializeSPE() - - def initializeSPE(self): - ''' - Parses shared and game-specific signatures from the ini files. - Loads up the game specific module so it can be used by SPE. - ''' - # Setup signatures - self.parseINI('_libs/python/spe/ini/' - 'engines/shared.' + str(es.ServerVar('spe_engine') + '.ini')) - self.parseINI('_libs/python/spe/ini/games/' + self.game_name + '.ini') - - # Setup types. - self.parseTypesINI('_libs/python/spe/types/shared.ini') - - # Load the shared and game module - self.loadModule('spe.games.shared') - self.loadModule('spe.games.' + self.game_name) - - def parseTypesINI(self, path): - ''' - Parses signatures from an INI file. - ''' - gamedir = es.ServerVar('eventscripts_gamedir') - - # Create an INI object! - INI = ConfigObj(str(gamedir) + '/addons/eventscripts/' + str(path)) - - # Loop through each section in the INI - for section in INI: - - # Time for the hard shit. Get the shortname of the type. - shortname = INI[section]['shortname'] - - # Skip this type if we already have it. - if shortname in self.Types: - continue - - # Get the type and name string. - types = INI[section]['types'] - names = INI[section]['names'] - - # Split them into lists. - types = types.split(',') - names = names.split(',') - - # Make sure the lengths match up (need a name for every var). - if len(types) != len(names): - raise MismatchedTypesAndNames( - 'The name string and type string don\'t line up!') - - # Construct the variables for the type. - self.Types[shortname] = {'typeinfo': [], 'size': 0} - - # Keeps track of the current variable offset. - curOffset = 0 - - # Iterate over all of the types. - for name, type in zip(names, types): - - # Construct a dict for each variable in the object. - typedict = {'name': name, 'type': type, 'offset': curOffset} - - # We need to figure out the offset of each variable. - # If the current variable is a native type, - # we can do this immediately. - # If it isn't, we need to search the dictionary. - if type in ['i', 'p', 'f', 'd']: - # Next free offset is 4 bytes away. - curOffset += 4 - - elif type in ['c']: - # Next offset is 1 byte away. - curOffset += 1 - - # If we are here, it means that the type is a non-native type. - # Does it exist in the dictionary? - else: - if type in self.Types: - # Calculate the next free offset. - curOffset += self.Types[type]['size'] - else: - # This means we have an undefined type. - raise UndefinedTypeError('Type of name "' + str(type) + - '" not found in dictionary! Did you define it?') - - # Now push the constructed dict into the list. - self.Types[shortname]['typeinfo'].append(typedict) - - # Store the size too. - self.Types[shortname]['size'] = curOffset - - def parseINI(self, path): - ''' - Parses signatures from an INI file. - ''' - gamedir = es.ServerVar('eventscripts_gamedir') - - # Create an INI object! - INI = ConfigObj(str(gamedir) + '/addons/eventscripts/' + str(path)) - - # Loop through each section in the INI - for section in INI: - - # Skip this signature if we already have it. - if INI[section]['shortname'] in self.Signatures: - continue - - # Check to see if the OS is Windows - if platform == 'nt': - # If the signature contains spaces, - # convert the signature to proper readable form - if ' ' in INI[section]['sig']: - sig = binascii.unhexlify( - ''.join(INI[section]['sig'].split())) - # If there are no spaces, read the signature as-is - else: - sig = INI[section]['sig'] - - # Add the signature to the gSignatureDictionary as - # a Signature() instance via the INI's "shortname" - self.Signatures[INI[section]['shortname']] = Signature( - sig, INI[section]['param'], INI[section]['convention']) - - # If the OS is UNIX, add the symbol to the gSignatureDictionary - # as a Signature() instance via the INI's "shortname" - else: - self.Signatures[INI[section]['shortname']] = Signature( - INI[section]['symbol'], INI[section]['param'], - INI[section]['convention']) - - def moduleExists(self, module_name): - ''' - Tests to see if a particular module can be imported. - ''' - try: - mod = __import__(module_name) - except ImportError: - return False - else: - return True - - def loadModule(self, module_name): - ''' - - Written by XE_ManUp! - - - ** THIS FUNCTION IS HIGHLY UNPYTHONIC ** - - This basically takes all of the methods and class instances - within the module of module_name and adds them to SPE. - This way, you can call functions within that module - directly from SPE. Example: spe.(args). - ''' - import inspect - - if self.moduleExists(module_name): - mod = __import__(module_name, globals(), locals(), ['']) - for item in mod.__dict__: - if (callable(mod.__dict__[item]) - or inspect.isclass(mod.__dict__[item])): - globals()[item] = mod.__dict__[item] - elif type(mod.__dict__[item]).__name__ in mod.__dict__: - if inspect.isclass( - mod.__dict__[type(mod.__dict__[item]).__name__]): - globals()[item] = mod.__dict__[item] - - def call(self, name, *args): - ''' - Calls a function that is already in the global signature - dictionary. These functions must be present within either - the shared.ini or the mod specific ini file. The name - parameter corresponds to the shortname of the function - in the ini file. - ''' - - # If the function name is not found - if not name in self.Signatures: - - # Raise an exception - raise InvalidFunctionNameException( - 'Could not find ' + str(name) + ' in the dictionary!') - - # Otherwise, call the function using the Signature() instance - # contained within the self.Signatures via the function name - return self.Signatures[name].call(args) - - def detourFunction(self, functionName, hooktype, callback): - # Is the function in the list? - if not functionName in self.Signatures: - - # Raise an exception - raise InvalidFunctionNameException( - 'Could not find ' + str(functionName) + ' in the dictionary!') - - # Get the signature object. - sigObj = self.Signatures[functionName] - - # Determine the calling convention. - convIdx = ['cdecl', 'thiscall', 'stdcall'].index(sigObj.convention) - - # Make sure the function address is valid. - if sigObj.function == None: - raise FunctionAddressNotValid(functionName + "\'s address is not valid!") - - # Hook the function - hookFunction(sigObj.function, sigObj.param_format, convIdx, int(hooktype), callback) - - def undetourFunction(self, functionName, hooktype, callback): - # Is the function in the list? - if not functionName in self.Signatures: - - # Raise an exception - raise InvalidFunctionNameException( - 'Could not find ' + str(functionName) + ' in the dictionary!') - - # Get the signature object. - sigObj = self.Signatures[functionName] - - # Determine the calling convention. - convIdx = ['cdecl', 'thiscall', 'stdcall'].index(sigObj.convention) - - # Make sure the function address is valid. - if sigObj.function == None: - raise FunctionAddressNotValid(functionName + "\'s address is not valid!") - - # Unhook the function - unHookFunction(sigObj.function, int(hooktype), callback) - - def makeObject(self, objectName, baseAddress): - # Do we have the requested object in our list? - if objectName in self.Types: - return SPEObject(objectName, baseAddress, self.Types[objectName]) - else: - raise UndefinedTypeError( - 'Type ' + str(objectName) + ' not registered with SPE!') - -gSPE = CSPEManager() - - -# ============================================================================= -# >> Exported functions -# ============================================================================= -def parseINI(path): - ''' - This function parses signatures from an INI file. - Path represents the path to the INI file, with the - base being cstrike/addons/eventscripts/. You must - put in the .ini extension manually into the path. - It is not done for you. - ''' - gSPE.parseINI(path) - - -def parseTypesINI(path): - ''' - This function parses custom type definitions from an ini - of your choosing. You can then pass the shortname of a - custom type in the ini to spe.makeObject and it will - return a class instance comprised of the symbolic names - of all variables in the declared type. - ''' - gSPE.parseTypesINI(path) - - -def call(name, *args): - ''' - Calls a sigscanned function based upon its shortname - in the INI file. args of course are the arguments to - said function. - ''' - return gSPE.call(name, *args) - - -def getPointer(signature, offset): - ''' - This function is very low level. It allows one to rip - out C++ class instances directly from memory which are - not normally accessible by server plugins. The signature - parameter (which requires that the signature that is - passed in uses hex escape characters) is the signature - of the function that the instance is referenced in. The - offset parameter is the number of bytes away from the - beginning of the signature that the instance itself - is referenced at (the beginning of the address bytes - of the instance). - - IF YOU DO NOT KNOW WHAT YOU ARE DOING, DON'T USE THIS! - ''' - - # Find the function - pFunc = findFunction(signature, len(signature.decode('string_escape'))) - - # Rip the pointer - return (pFunc + offset) - - -def detourFunction(functionName, type, callback): - ''' - This function will hook a function as defined by a signature, - and redirect its execution to your own python callback. - NOTE: You must have loaded the signature via spe.parseINI! - ''' - gSPE.detourFunction(functionName, type, callback) - - -def undetourFunction(functionName, type, callback): - ''' - This function will remove a python callback from a detour. - ''' - gSPE.undetourFunction(functionName, type, callback) - - -def makeObject(objectName, baseAddress): - ''' - Returns a special python wrapper around a C++ object instance. - ''' - return gSPE.makeObject(objectName, baseAddress) +""" +$Rev$ +$LastChangedDate$ +""" + +# ============================================================================= +# Source-Python Extensions Library: +# Base Library +# ============================================================================= + +# ============================================================================= +# Imports +# ============================================================================= + +# Python Imports +import os +import binascii +import ctypes +from configobj import ConfigObj +from os import name as platform + +# Eventscripts Imports +import es + +# SPE Imports +from spe_C import * + +# ============================================================================= +# Versioning +# ============================================================================= +__version__ = '1.6.2' +es.ServerVar('spe_version', __version__).makepublic() + + +# ============================================================================= +# Exceptions +# ============================================================================= +class InvalidFunctionNameException(Exception): + pass + + +class FunctionAddressNotValid(Exception): + pass + + +class ConventionError(Exception): + pass + + +class MismatchedTypesAndNames(Exception): + pass + + +class UndefinedTypeError(Exception): + pass + + +class UnsupportedOperation(Exception): + pass + + +# ============================================================================= +# Enums +# ============================================================================= +class Conventions: + ''' + This class defines constants which denote various x86 + calling conventions. NOTE: Using the wrong calling convention will + cause crashing! + ''' + CDECL, THISCALL, STDCALL = range(3) + + +class HookAction: + ''' + This class defines various constants for hook actions. A hook + action is basically what you want to do after your callback is + executed. + + Continue - Call original function like normal. + Modified - Call original function with modified parameters. + Override - Block original function and use custom return value. + Error - Internal use only. + ''' + Continue, Modified, Override = range(3) + Error = -1 + + +class HookType: + ''' + This class defines the two hook types supported by SPE. + PRE - Call your callback before the original function. + POST - Call your callback after the original function. + ''' + Pre, Post = range(2) + + +# ============================================================================= +# >> Classes +# ============================================================================= +class SPEObject(object): + + def __init__(self, name, basePtr, varPositions): + ''' + This is the SPEObject constructor. DO NOT try to instantiate one of + these directly. SPE will automatically parse and add attributes to this + class for use with your datatype. Use spe.makeObject instead. + ''' + #self.base = basePtr + #self.name = name + #self.varlist = {} + self.__dict__['base'] = basePtr + self.__dict__['name'] = name + self.__dict__['varlist'] = {} + + # Temporary base pointer + tmpBase = basePtr + + # Iterate over every member variable. + for var in varPositions['typeinfo']: + # If it is a native type... + if var['type'] in ['i', 'f', 'b', 'p']: + self.varlist[var['name']] = { + 'addr': tmpBase, 'type': var['type']} + tmpBase += 4 + + # Char is special case because it is 1 byte. + elif var['type'] in ['c']: + self.varlist[var['name']] = { + 'addr': tmpBase, 'type': var['type']} + tmpBase += 1 + + # Found a non-native type. + else: + # Is the type in the list? + if var['type'] in gSPE.Types: + # Non-native type. Create the object. This basically + # recurses until we hit basetypes. + obj = makeObject(var['type'], tmpBase) + + # Store the object. + self.varlist[var['name']] = obj + + # Now Increment the base pointer. + tmpBase += obj.size + + # Yay, done parsing the object. We need to set the size. + self.__dict__['size'] = varPositions['size'] + + def __getattr__(self, name): + ''' + We need to override this so that we can use spe.getLocVal + in order to grab variable information. + ''' + + # Find the object in our variable list. + if name in self.varlist: + # Get the value. + val = self.varlist[name] + + # If it's an integer, this means we're at an offset. We need to + # Ask SPE to get this information for us. + if type(val).__name__ == 'dict': + return getLocVal(val['type'], val['addr']) + + # This means it was an SPEObject. Return that instead. + return val + + return object.__getattribute__(self, name) + + def __setattr__(self, name, value): + ''' + We override this in order to set values at locations. + ''' + + # Does the object exist in our variable list? + if name in self.varlist: + # Get the value. + val = self.varlist[name] + + # If it's a dict, this means we are at a base type. We can + # set basetypes using atomic operations. + if type(val).__name__ == 'dict': + setLocVal(val['type'], val['addr'], value) + + else: + # Setting whole SPE objects is not supported yet. + raise UnsupportedOperation('SPE currently does not ' + 'support setting SPEObject instances.') + + +# ============================================================================= +# >> Signature Class +# ============================================================================= +class Signature(object): + ''' + This is the primary class for calling Signature-based functions. + Requirements for this class are: + * Identifier (identifier): + - The actual "Windows Signature" or "Linux Symbol". + - "Windows Signatures" must be previously formatted + with "backslash x" instead of spaces. + * Parameter Format (param_format): + - The type of each argument, and the return type: + p = Pointer + i = Integer + f = Float + B = Boolean + d = Double + L = Long + S = String + * Convention (convention): + - thiscall + Used when calling funtions from (within a C++ class) + - cdecl + Used when calling functions that are global + (not part of a C++ class) + - fastcall + (Reserved) + ''' + def __init__(self, identifier, param_format, convention): + # IDENTIFIER (Windows Signature or Linux Symbol) + self.identifier = str(identifier) + + # FUNCTION (memory address) + if platform == 'nt': + self.function = findFunction( + self.identifier, len(self.identifier.decode('string_escape'))) + else: + self.function = findSymbol(self.identifier) + + # PARAMETER FORMAT + self.param_format = str(param_format) + + # CONVENTION TYPE + if convention not in ['thiscall', 'cdecl', 'fastcall']: + raise ConventionError('"' + str(convention) + '" is not a valid' + ' convention: "thiscall", "cdecl", or "fastcall" only.') + + self.convention = str(convention) + + def call(self, args=()): + # Weird, but this is still required on Linux to prevent crashes + tuple(args) + + # Set the calling convention + setCallingConvention(self.convention) + + # Call the function and return the results + return callFunction(self.function, self.param_format, args) + + +# ============================================================================= +# >> SPE Manager class +# ============================================================================= +class CSPEManager(object): + ''' + This class is the main SPE module manager. + Do not access any methods from this class directly. + Instead, use the exported functions down below. + ''' + def __init__(self): + # Setup the game name + self.game_name = str( + os.path.split(str(es.ServerVar('eventscripts_gamedir')))[1]) + + # Setup signature dictionary + self.Signatures = {} + + # Setup type dictionary. + self.Types = {} + + # Initialize SPE + self.initializeSPE() + + def initializeSPE(self): + ''' + Parses shared and game-specific signatures from the ini files. + Loads up the game specific module so it can be used by SPE. + ''' + # Setup signatures + self.parseINI('_libs/python/spe/ini/' + 'engines/shared.' + str(es.ServerVar('spe_engine') + '.ini')) + self.parseINI('_libs/python/spe/ini/games/' + self.game_name + '.ini') + + # Setup types. + self.parseTypesINI('_libs/python/spe/types/shared.ini') + + # Load the shared and game module + self.loadModule('spe.games.shared') + self.loadModule('spe.games.' + self.game_name) + + def parseTypesINI(self, path): + ''' + Parses signatures from an INI file. + ''' + gamedir = es.ServerVar('eventscripts_gamedir') + + # Create an INI object! + INI = ConfigObj(str(gamedir) + '/addons/eventscripts/' + str(path)) + + # Loop through each section in the INI + for section in INI: + + # Time for the hard shit. Get the shortname of the type. + shortname = INI[section]['shortname'] + + # Skip this type if we already have it. + if shortname in self.Types: + continue + + # Get the type and name string. + types = INI[section]['types'] + names = INI[section]['names'] + + # Split them into lists. + types = types.split(',') + names = names.split(',') + + # Make sure the lengths match up (need a name for every var). + if len(types) != len(names): + raise MismatchedTypesAndNames( + 'The name string and type string don\'t line up!') + + # Construct the variables for the type. + self.Types[shortname] = {'typeinfo': [], 'size': 0} + + # Keeps track of the current variable offset. + curOffset = 0 + + # Iterate over all of the types. + for name, type in zip(names, types): + + # Construct a dict for each variable in the object. + typedict = {'name': name, 'type': type, 'offset': curOffset} + + # We need to figure out the offset of each variable. + # If the current variable is a native type, + # we can do this immediately. + # If it isn't, we need to search the dictionary. + if type in ['i', 'p', 'f', 'd']: + # Next free offset is 4 bytes away. + curOffset += 4 + + elif type in ['c']: + # Next offset is 1 byte away. + curOffset += 1 + + # If we are here, it means that the type is a non-native type. + # Does it exist in the dictionary? + else: + if type in self.Types: + # Calculate the next free offset. + curOffset += self.Types[type]['size'] + else: + # This means we have an undefined type. + raise UndefinedTypeError('Type of name "' + str(type) + + '" not found in dictionary! Did you define it?') + + # Now push the constructed dict into the list. + self.Types[shortname]['typeinfo'].append(typedict) + + # Store the size too. + self.Types[shortname]['size'] = curOffset + + def parseINI(self, path): + ''' + Parses signatures from an INI file. + ''' + gamedir = es.ServerVar('eventscripts_gamedir') + + # Create an INI object! + INI = ConfigObj(str(gamedir) + '/addons/eventscripts/' + str(path)) + + # Loop through each section in the INI + for section in INI: + + # Skip this signature if we already have it. + if INI[section]['shortname'] in self.Signatures: + continue + + # Check to see if the OS is Windows + if platform == 'nt': + # If the signature contains spaces, + # convert the signature to proper readable form + if ' ' in INI[section]['sig']: + sig = binascii.unhexlify( + ''.join(INI[section]['sig'].split())) + # If there are no spaces, read the signature as-is + else: + sig = INI[section]['sig'] + + # Add the signature to the gSignatureDictionary as + # a Signature() instance via the INI's "shortname" + self.Signatures[INI[section]['shortname']] = Signature( + sig, INI[section]['param'], INI[section]['convention']) + + # If the OS is UNIX, add the symbol to the gSignatureDictionary + # as a Signature() instance via the INI's "shortname" + else: + self.Signatures[INI[section]['shortname']] = Signature( + INI[section]['symbol'], INI[section]['param'], + INI[section]['convention']) + + def moduleExists(self, module_name): + ''' + Tests to see if a particular module can be imported. + ''' + try: + mod = __import__(module_name) + except ImportError: + return False + else: + return True + + def loadModule(self, module_name): + ''' + - Written by XE_ManUp! - + + ** THIS FUNCTION IS HIGHLY UNPYTHONIC ** + + This basically takes all of the methods and class instances + within the module of module_name and adds them to SPE. + This way, you can call functions within that module + directly from SPE. Example: spe.(args). + ''' + import inspect + + if self.moduleExists(module_name): + mod = __import__(module_name, globals(), locals(), ['']) + for item in mod.__dict__: + if (callable(mod.__dict__[item]) + or inspect.isclass(mod.__dict__[item])): + globals()[item] = mod.__dict__[item] + elif type(mod.__dict__[item]).__name__ in mod.__dict__: + if inspect.isclass( + mod.__dict__[type(mod.__dict__[item]).__name__]): + globals()[item] = mod.__dict__[item] + + def call(self, name, *args): + ''' + Calls a function that is already in the global signature + dictionary. These functions must be present within either + the shared.ini or the mod specific ini file. The name + parameter corresponds to the shortname of the function + in the ini file. + ''' + + # If the function name is not found + if not name in self.Signatures: + + # Raise an exception + raise InvalidFunctionNameException( + 'Could not find ' + str(name) + ' in the dictionary!') + + # Otherwise, call the function using the Signature() instance + # contained within the self.Signatures via the function name + return self.Signatures[name].call(args) + + def detourFunction(self, functionName, hooktype, callback): + # Is the function in the list? + if not functionName in self.Signatures: + + # Raise an exception + raise InvalidFunctionNameException( + 'Could not find ' + str(functionName) + ' in the dictionary!') + + # Get the signature object. + sigObj = self.Signatures[functionName] + + # Determine the calling convention. + convIdx = ['cdecl', 'thiscall', 'stdcall'].index(sigObj.convention) + + # Make sure the function address is valid. + if sigObj.function == None: + raise FunctionAddressNotValid(functionName + "\'s address is not valid!") + + # Hook the function + hookFunction(sigObj.function, sigObj.param_format, convIdx, int(hooktype), callback) + + def undetourFunction(self, functionName, hooktype, callback): + # Is the function in the list? + if not functionName in self.Signatures: + + # Raise an exception + raise InvalidFunctionNameException( + 'Could not find ' + str(functionName) + ' in the dictionary!') + + # Get the signature object. + sigObj = self.Signatures[functionName] + + # Determine the calling convention. + convIdx = ['cdecl', 'thiscall', 'stdcall'].index(sigObj.convention) + + # Make sure the function address is valid. + if sigObj.function == None: + raise FunctionAddressNotValid(functionName + "\'s address is not valid!") + + # Unhook the function + unHookFunction(sigObj.function, int(hooktype), callback) + + def makeObject(self, objectName, baseAddress): + # Do we have the requested object in our list? + if objectName in self.Types: + return SPEObject(objectName, baseAddress, self.Types[objectName]) + else: + raise UndefinedTypeError( + 'Type ' + str(objectName) + ' not registered with SPE!') + +gSPE = CSPEManager() + + +# ============================================================================= +# >> Exported functions +# ============================================================================= +def parseINI(path): + ''' + This function parses signatures from an INI file. + Path represents the path to the INI file, with the + base being cstrike/addons/eventscripts/. You must + put in the .ini extension manually into the path. + It is not done for you. + ''' + gSPE.parseINI(path) + + +def parseTypesINI(path): + ''' + This function parses custom type definitions from an ini + of your choosing. You can then pass the shortname of a + custom type in the ini to spe.makeObject and it will + return a class instance comprised of the symbolic names + of all variables in the declared type. + ''' + gSPE.parseTypesINI(path) + + +def call(name, *args): + ''' + Calls a sigscanned function based upon its shortname + in the INI file. args of course are the arguments to + said function. + ''' + return gSPE.call(name, *args) + + +def getPointer(signature, offset): + ''' + This function is very low level. It allows one to rip + out C++ class instances directly from memory which are + not normally accessible by server plugins. The signature + parameter (which requires that the signature that is + passed in uses hex escape characters) is the signature + of the function that the instance is referenced in. The + offset parameter is the number of bytes away from the + beginning of the signature that the instance itself + is referenced at (the beginning of the address bytes + of the instance). + + IF YOU DO NOT KNOW WHAT YOU ARE DOING, DON'T USE THIS! + ''' + + # Find the function + pFunc = findFunction(signature, len(signature.decode('string_escape'))) + + # Rip the pointer + return (pFunc + offset) + + +def detourFunction(functionName, type, callback): + ''' + This function will hook a function as defined by a signature, + and redirect its execution to your own python callback. + NOTE: You must have loaded the signature via spe.parseINI! + ''' + gSPE.detourFunction(functionName, type, callback) + + +def undetourFunction(functionName, type, callback): + ''' + This function will remove a python callback from a detour. + ''' + gSPE.undetourFunction(functionName, type, callback) + + +def makeObject(objectName, baseAddress): + ''' + Returns a special python wrapper around a C++ object instance. + ''' + return gSPE.makeObject(objectName, baseAddress) diff --git a/_libs/games/__init__.py b/_libs/python/spe/games/__init__.py similarity index 88% rename from _libs/games/__init__.py rename to _libs/python/spe/games/__init__.py index da01ebf..00e31a4 100644 --- a/_libs/games/__init__.py +++ b/_libs/python/spe/games/__init__.py @@ -1,4 +1,4 @@ -""" -$Rev$ -$LastChangedDate$ -""" +""" +$Rev$ +$LastChangedDate$ +""" diff --git a/_libs/games/cstrike.py b/_libs/python/spe/games/cstrike.py similarity index 96% rename from _libs/games/cstrike.py rename to _libs/python/spe/games/cstrike.py index 71a3011..9d99c65 100644 --- a/_libs/games/cstrike.py +++ b/_libs/python/spe/games/cstrike.py @@ -1,117 +1,117 @@ -""" -$Rev$ -$LastChangedDate$ -""" - -# ============================================================================= -# Source-Python Extensions Library: -# Counter-Strike Source Library -# ============================================================================= - -# ============================================================================= -# Imports -# ============================================================================= - -# SPE imports -import spe - -# ============================================================================= -# Exported Functions -# ============================================================================= - - -# ============================================================================= -# Respawns a player -# ============================================================================= -def respawn(userid): - # Get the player instance - pPlayer = spe.getPlayer(int(userid)) - - # Make sure the player instance is valid - if not pPlayer: - # Return False since the player instance was not valid - return False - - # Respawn the player - spe.call("Respawn", pPlayer) - - return True - - -# ============================================================================= -# Switches a player's team without killing them. -# ============================================================================= -def switchTeam(userid, team_index): - # Get the player instance - pPlayer = spe.getPlayer(int(userid)) - - # Is the player instance valid? - if not pPlayer: - # Return False since the player instance was not valid - return False - - # Switch their team - spe.call("ChangeTeam", pPlayer, int(team_index)) - - return True - - -# ============================================================================= -# Returns an instance to a player's active weapon -# (the weapon they are currently holding). -# ============================================================================= -def getActiveWeapon(userid): - # Get the player instance - pPlayer = spe.getPlayer(int(userid)) - - # Is the player instance valid? - if not pPlayer: - # Return None since the player instance was not valid - return None - - # Call and return player's active weapon - return spe.call("GetActiveWeapon", pPlayer) - - -# ============================================================================= -# Gives a player a named item. -# ============================================================================= -def giveNamedItem(userid, item_name): - # Get the player instance - pPlayer = spe.getPlayer(int(userid)) - - # Is the player instance valid? - if not pPlayer: - # Return None since the player instance was not valid - return None - - # Give the player the item - return spe.call('GiveNamedItem', pPlayer, str(item_name), 0) - - -# ============================================================================= -# If the player owns the weapon_instance entity, it forces them to drop it. -# ============================================================================= -def dropWeapon(userid, weapon_name, throwWeapon=True): - # Get the player instance - pPlayer = spe.getPlayer(int(userid)) - - # Is the player instance valid? - if not pPlayer: - # Return False since the player instance was not valid - return False - - # Get the weapon instance - weapon_instance = spe.ownsWeapon(userid, weapon_name) - - # Is the weapon instance valid? - if not weapon_instance: - # Return False since the weapon instance was not valid - return False - - # Throw the weapon? - if throwWeapon: - return spe.call('DropWeapon', pPlayer, weapon_instance, 0, 1) - - # Otherwise, don't. - return spe.call('DropWeapon', pPlayer, weapon_instance, 0, 0) +""" +$Rev$ +$LastChangedDate$ +""" + +# ============================================================================= +# Source-Python Extensions Library: +# Counter-Strike Source Library +# ============================================================================= + +# ============================================================================= +# Imports +# ============================================================================= + +# SPE imports +import spe + +# ============================================================================= +# Exported Functions +# ============================================================================= + + +# ============================================================================= +# Respawns a player +# ============================================================================= +def respawn(userid): + # Get the player instance + pPlayer = spe.getPlayer(int(userid)) + + # Make sure the player instance is valid + if not pPlayer: + # Return False since the player instance was not valid + return False + + # Respawn the player + spe.call("Respawn", pPlayer) + + return True + + +# ============================================================================= +# Switches a player's team without killing them. +# ============================================================================= +def switchTeam(userid, team_index): + # Get the player instance + pPlayer = spe.getPlayer(int(userid)) + + # Is the player instance valid? + if not pPlayer: + # Return False since the player instance was not valid + return False + + # Switch their team + spe.call("ChangeTeam", pPlayer, int(team_index)) + + return True + + +# ============================================================================= +# Returns an instance to a player's active weapon +# (the weapon they are currently holding). +# ============================================================================= +def getActiveWeapon(userid): + # Get the player instance + pPlayer = spe.getPlayer(int(userid)) + + # Is the player instance valid? + if not pPlayer: + # Return None since the player instance was not valid + return None + + # Call and return player's active weapon + return spe.call("GetActiveWeapon", pPlayer) + + +# ============================================================================= +# Gives a player a named item. +# ============================================================================= +def giveNamedItem(userid, item_name): + # Get the player instance + pPlayer = spe.getPlayer(int(userid)) + + # Is the player instance valid? + if not pPlayer: + # Return None since the player instance was not valid + return None + + # Give the player the item + return spe.call('GiveNamedItem', pPlayer, str(item_name), 0) + + +# ============================================================================= +# If the player owns the weapon_instance entity, it forces them to drop it. +# ============================================================================= +def dropWeapon(userid, weapon_name, throwWeapon=True): + # Get the player instance + pPlayer = spe.getPlayer(int(userid)) + + # Is the player instance valid? + if not pPlayer: + # Return False since the player instance was not valid + return False + + # Get the weapon instance + weapon_instance = spe.ownsWeapon(userid, weapon_name) + + # Is the weapon instance valid? + if not weapon_instance: + # Return False since the weapon instance was not valid + return False + + # Throw the weapon? + if throwWeapon: + return spe.call('DropWeapon', pPlayer, weapon_instance, 0, 1) + + # Otherwise, don't. + return spe.call('DropWeapon', pPlayer, weapon_instance, 0, 0) diff --git a/_libs/games/hl2mp.py b/_libs/python/spe/games/hl2mp.py similarity index 96% rename from _libs/games/hl2mp.py rename to _libs/python/spe/games/hl2mp.py index 25e1245..584eded 100644 --- a/_libs/games/hl2mp.py +++ b/_libs/python/spe/games/hl2mp.py @@ -1,28 +1,28 @@ -""" -$Rev$ -$LastChangedDate$ -""" - -# ============================================================================= -# Source-Python Extensions Library: -# Half-Life 2 Deathmatch Library -# ============================================================================= - -'''NOTE: Use the shared library instead of this for now.''' - -# ============================================================================= -# Imports -# ============================================================================= - -# SPE Imports -import spe - -# ============================================================================= -# Globals -# ============================================================================= -# ... - -# ============================================================================= -# Functions -# ============================================================================= -# ... +""" +$Rev$ +$LastChangedDate$ +""" + +# ============================================================================= +# Source-Python Extensions Library: +# Half-Life 2 Deathmatch Library +# ============================================================================= + +'''NOTE: Use the shared library instead of this for now.''' + +# ============================================================================= +# Imports +# ============================================================================= + +# SPE Imports +import spe + +# ============================================================================= +# Globals +# ============================================================================= +# ... + +# ============================================================================= +# Functions +# ============================================================================= +# ... diff --git a/_libs/games/l4d.py b/_libs/python/spe/games/l4d.py similarity index 96% rename from _libs/games/l4d.py rename to _libs/python/spe/games/l4d.py index a427c00..4acda18 100644 --- a/_libs/games/l4d.py +++ b/_libs/python/spe/games/l4d.py @@ -1,37 +1,37 @@ -""" -$Rev$ -$LastChangedDate$ -""" - -# ============================================================================= -# Source-Python Extensions Library: -# Left 4 Dead Library -# ============================================================================= - -# ============================================================================= -# Imports -# ============================================================================= - -# Python imports -from os import name as platform - -# Eventscripts imports -import es - -# SPE imports -import spe - - -# ============================================================================= -# Exported Functions -# ============================================================================= -def createEntity(entity_name): - """ - Left4Dead's CreateEntityByName function has an extra parameter. - I set this to true. - - This function returns a pointer to the entity you just created. - It returns None if the entity could not be created. - """ - - return spe.call("CreateEntity", entity_name, -1, 1) +""" +$Rev$ +$LastChangedDate$ +""" + +# ============================================================================= +# Source-Python Extensions Library: +# Left 4 Dead Library +# ============================================================================= + +# ============================================================================= +# Imports +# ============================================================================= + +# Python imports +from os import name as platform + +# Eventscripts imports +import es + +# SPE imports +import spe + + +# ============================================================================= +# Exported Functions +# ============================================================================= +def createEntity(entity_name): + """ + Left4Dead's CreateEntityByName function has an extra parameter. + I set this to true. + + This function returns a pointer to the entity you just created. + It returns None if the entity could not be created. + """ + + return spe.call("CreateEntity", entity_name, -1, 1) diff --git a/_libs/games/left4dead.py b/_libs/python/spe/games/left4dead.py similarity index 96% rename from _libs/games/left4dead.py rename to _libs/python/spe/games/left4dead.py index a427c00..4acda18 100644 --- a/_libs/games/left4dead.py +++ b/_libs/python/spe/games/left4dead.py @@ -1,37 +1,37 @@ -""" -$Rev$ -$LastChangedDate$ -""" - -# ============================================================================= -# Source-Python Extensions Library: -# Left 4 Dead Library -# ============================================================================= - -# ============================================================================= -# Imports -# ============================================================================= - -# Python imports -from os import name as platform - -# Eventscripts imports -import es - -# SPE imports -import spe - - -# ============================================================================= -# Exported Functions -# ============================================================================= -def createEntity(entity_name): - """ - Left4Dead's CreateEntityByName function has an extra parameter. - I set this to true. - - This function returns a pointer to the entity you just created. - It returns None if the entity could not be created. - """ - - return spe.call("CreateEntity", entity_name, -1, 1) +""" +$Rev$ +$LastChangedDate$ +""" + +# ============================================================================= +# Source-Python Extensions Library: +# Left 4 Dead Library +# ============================================================================= + +# ============================================================================= +# Imports +# ============================================================================= + +# Python imports +from os import name as platform + +# Eventscripts imports +import es + +# SPE imports +import spe + + +# ============================================================================= +# Exported Functions +# ============================================================================= +def createEntity(entity_name): + """ + Left4Dead's CreateEntityByName function has an extra parameter. + I set this to true. + + This function returns a pointer to the entity you just created. + It returns None if the entity could not be created. + """ + + return spe.call("CreateEntity", entity_name, -1, 1) diff --git a/_libs/games/shared.py b/_libs/python/spe/games/shared.py similarity index 97% rename from _libs/games/shared.py rename to _libs/python/spe/games/shared.py index 5bae46d..fb4cb10 100644 --- a/_libs/games/shared.py +++ b/_libs/python/spe/games/shared.py @@ -1,240 +1,240 @@ -""" -$Rev$ -$LastChangedDate$ -""" - -# ============================================================================= -# Source-Python Extensions Library: -# Global Library -# ============================================================================= - -# ============================================================================= -# Imports -# ============================================================================= -import spe - - -# ============================================================================= -# Creates an entity by name, and returns an instance to it. -# ============================================================================= -def createEntity(entity_name): - # Call the function - # Last parameter must be -1. - return spe.call("CreateEntity", entity_name, -1) - - -# ============================================================================= -# Returns an entity instance by its index. -# ============================================================================= -def getEntityOfIndex(entity_index): - # Call and return - return spe.call("EntityByIndex", int(entity_index)) - - -# ============================================================================= -# Courtesy of Einlanzers and XE_Manup: -# Returns the index of an entity. None means no entity exists at this index. -# ============================================================================= -def getIndexOfEntity(entity_instance): - return spe.getEntityIndex(entity_instance) - - -# ============================================================================= -# Returns the instance of a player's weapon of type weapon_name. -# Returns None if player doesn't own that particular weapon. -# ============================================================================= -def ownsWeapon(userid, weapon_name): - # Get player instance - pPlayer = spe.getPlayer(int(userid)) - - if not pPlayer: - return None - - # Call function and return weapon instance - return spe.call("OwnsWeapon", pPlayer, weapon_name, 0) - - -# ============================================================================= -# Returns a weapon instance from a player's slot. -# ============================================================================= -def getWeaponFromSlot(userid, weapon_slot): - # Get player instance - pPlayer = spe.getPlayer(int(userid)) - - if not pPlayer: - return None - - # Call function and return player weapon instance - return spe.call("GetWeapon", pPlayer, int(weapon_slot)) - - -# ============================================================================= -# Removes an entity by it's index. -# ============================================================================= -def removeEntityByIndex(entity_index): - # Get entity instance - pEntity = spe.getEntityOfIndex(int(entity_index)) - - # Make sure it's valid - if not pEntity: - # Return false if the entity was None. - return False - - # Remove it! - spe.call("Remove", pEntity) - - return True - - -# ============================================================================= -# Removes an entity by its instance -# ============================================================================= -def removeEntityByInstance(entity_instance): - # Make sure it's valid - if not entity_instance: - # Return false if the entity was None. - return False - - # Remove it! - spe.call("Remove", entity_instance) - - return True - - -# ============================================================================= -# Sets an entity's string keyvalue. -# ============================================================================= -def setStringKeyvalue(entity_index, keyvalue_name, new_value): - # Get entity instance - pEntity = spe.getEntityOfIndex(int(entity_index)) - - # Make sure the entity is valid - if not pEntity: - # Return False if the entity was None. - return False - - # Set the keyvalue - spe.call("setkv_string", pEntity, keyvalue_name, new_value) - - return True - - -# ============================================================================= -# Retrieve the index of a player's weapon -# ============================================================================= -def getWeaponIndex(userid, weapon_name): - # Retrieve the weapon pointer - weapon = spe.ownsWeapon(userid, weapon_name) - - # Make sure the weapon pointer is valid - if not weapon: - # Return None if the weapon pointer is not valid - return None - - # Return the index of the weapon - return spe.getEntityIndex(weapon) - - -# ============================================================================= -# Retrieve a list of weapon names that the player has in their inventory -# ============================================================================= -def getWeaponNameList(userid): - # Make sure the player is valid - if not spe.getPlayer(int(userid)): - # Return None due to the invalid player instance - return None - - # Set up the list - weapon_names = [] - - # Loop through the maximum range of 48 weapons - for i in range(0, 48): - - # Retrieve the weapon instance/pointer - wPointer = spe.getWeaponFromSlot(userid, i) - - # Make sure the weapon instance/pointer is valid - if wPointer: - - # Append the weapon name to the list - weapon_names.append(spe.getEntityClassName(wPointer)) - - # Return the populated list - return weapon_names - - -# ============================================================================= -# Retrieve a list of weapon instances that the player has in their inventory -# ============================================================================= -def getWeaponInstanceList(userid): - # Make sure the player is valid - if not spe.getPlayer(int(userid)): - # Return None due to the invalid player instance - return None - - # Set up the list - weapon_pointers = [] - - # Loop through the maximum range of 48 weapons - for i in range(0, 48): - - # Retrieve the weapon instance/pointer - wPointer = spe.getWeaponFromSlot(userid, i) - - # Make sure the weapon instance/pointer is valid - if wPointer: - - # Append the valid instance/pointer to the list - weapon_pointers.append(wPointer) - - # Return the populated list - return weapon_pointers - - -# ============================================================================= -# Retrieve a list of weapon indexes that the player has in their inventory -# ============================================================================= -def getWeaponIndexList(userid): - # Make sure the player is valid - if not spe.getPlayer(int(userid)): - # Return None due to the invalid player instance - return None - - # Return a list of weapon indexes - return [spe.getEntityIndex(i) for i in spe.getWeaponInstanceList(userid)] - - -# ============================================================================= -# Retrieve a dictionary of weapons in the player's inventory where the key is -# the weapon_name which contains an additional dictionary with the keys of -# "instance" (stores the pointer foe the weapon) and "slot" (stores the slot -# that the weapon can be found in while using getWeaponFromSlot(), or as an -# index to the lists: getWeaponNameList(), getWeaponInstanceList(), or -# getWeaponIndexList(). -# ============================================================================= -def getWeaponDict(userid): - # Make sure the player is valid - if not spe.getPlayer(int(userid)): - # Return None due to the invalid player instance - return None - - # Set up the list - weapons = {} - - # Loop through the maximum range of 48 weapons - for i in range(0, 48): - - # Retrieve the weapon instance/pointer - wPointer = spe.getWeaponFromSlot(userid, i) - - # Make sure the weapon instance/pointer is valid - if wPointer: - - # Create the valid key:value pair - weapons[spe.getEntityClassName(wPointer)] = { - "instance": wPointer, - "slot": i, - "index": spe.getEntityIndex(wPointer)} - - # Return the populated dictionary - return weapons +""" +$Rev$ +$LastChangedDate$ +""" + +# ============================================================================= +# Source-Python Extensions Library: +# Global Library +# ============================================================================= + +# ============================================================================= +# Imports +# ============================================================================= +import spe + + +# ============================================================================= +# Creates an entity by name, and returns an instance to it. +# ============================================================================= +def createEntity(entity_name): + # Call the function + # Last parameter must be -1. + return spe.call("CreateEntity", entity_name, -1) + + +# ============================================================================= +# Returns an entity instance by its index. +# ============================================================================= +def getEntityOfIndex(entity_index): + # Call and return + return spe.call("EntityByIndex", int(entity_index)) + + +# ============================================================================= +# Courtesy of Einlanzers and XE_Manup: +# Returns the index of an entity. None means no entity exists at this index. +# ============================================================================= +def getIndexOfEntity(entity_instance): + return spe.getEntityIndex(entity_instance) + + +# ============================================================================= +# Returns the instance of a player's weapon of type weapon_name. +# Returns None if player doesn't own that particular weapon. +# ============================================================================= +def ownsWeapon(userid, weapon_name): + # Get player instance + pPlayer = spe.getPlayer(int(userid)) + + if not pPlayer: + return None + + # Call function and return weapon instance + return spe.call("OwnsWeapon", pPlayer, weapon_name, 0) + + +# ============================================================================= +# Returns a weapon instance from a player's slot. +# ============================================================================= +def getWeaponFromSlot(userid, weapon_slot): + # Get player instance + pPlayer = spe.getPlayer(int(userid)) + + if not pPlayer: + return None + + # Call function and return player weapon instance + return spe.call("GetWeapon", pPlayer, int(weapon_slot)) + + +# ============================================================================= +# Removes an entity by it's index. +# ============================================================================= +def removeEntityByIndex(entity_index): + # Get entity instance + pEntity = spe.getEntityOfIndex(int(entity_index)) + + # Make sure it's valid + if not pEntity: + # Return false if the entity was None. + return False + + # Remove it! + spe.call("Remove", pEntity) + + return True + + +# ============================================================================= +# Removes an entity by its instance +# ============================================================================= +def removeEntityByInstance(entity_instance): + # Make sure it's valid + if not entity_instance: + # Return false if the entity was None. + return False + + # Remove it! + spe.call("Remove", entity_instance) + + return True + + +# ============================================================================= +# Sets an entity's string keyvalue. +# ============================================================================= +def setStringKeyvalue(entity_index, keyvalue_name, new_value): + # Get entity instance + pEntity = spe.getEntityOfIndex(int(entity_index)) + + # Make sure the entity is valid + if not pEntity: + # Return False if the entity was None. + return False + + # Set the keyvalue + spe.call("setkv_string", pEntity, keyvalue_name, new_value) + + return True + + +# ============================================================================= +# Retrieve the index of a player's weapon +# ============================================================================= +def getWeaponIndex(userid, weapon_name): + # Retrieve the weapon pointer + weapon = spe.ownsWeapon(userid, weapon_name) + + # Make sure the weapon pointer is valid + if not weapon: + # Return None if the weapon pointer is not valid + return None + + # Return the index of the weapon + return spe.getEntityIndex(weapon) + + +# ============================================================================= +# Retrieve a list of weapon names that the player has in their inventory +# ============================================================================= +def getWeaponNameList(userid): + # Make sure the player is valid + if not spe.getPlayer(int(userid)): + # Return None due to the invalid player instance + return None + + # Set up the list + weapon_names = [] + + # Loop through the maximum range of 48 weapons + for i in range(0, 48): + + # Retrieve the weapon instance/pointer + wPointer = spe.getWeaponFromSlot(userid, i) + + # Make sure the weapon instance/pointer is valid + if wPointer: + + # Append the weapon name to the list + weapon_names.append(spe.getEntityClassName(wPointer)) + + # Return the populated list + return weapon_names + + +# ============================================================================= +# Retrieve a list of weapon instances that the player has in their inventory +# ============================================================================= +def getWeaponInstanceList(userid): + # Make sure the player is valid + if not spe.getPlayer(int(userid)): + # Return None due to the invalid player instance + return None + + # Set up the list + weapon_pointers = [] + + # Loop through the maximum range of 48 weapons + for i in range(0, 48): + + # Retrieve the weapon instance/pointer + wPointer = spe.getWeaponFromSlot(userid, i) + + # Make sure the weapon instance/pointer is valid + if wPointer: + + # Append the valid instance/pointer to the list + weapon_pointers.append(wPointer) + + # Return the populated list + return weapon_pointers + + +# ============================================================================= +# Retrieve a list of weapon indexes that the player has in their inventory +# ============================================================================= +def getWeaponIndexList(userid): + # Make sure the player is valid + if not spe.getPlayer(int(userid)): + # Return None due to the invalid player instance + return None + + # Return a list of weapon indexes + return [spe.getEntityIndex(i) for i in spe.getWeaponInstanceList(userid)] + + +# ============================================================================= +# Retrieve a dictionary of weapons in the player's inventory where the key is +# the weapon_name which contains an additional dictionary with the keys of +# "instance" (stores the pointer foe the weapon) and "slot" (stores the slot +# that the weapon can be found in while using getWeaponFromSlot(), or as an +# index to the lists: getWeaponNameList(), getWeaponInstanceList(), or +# getWeaponIndexList(). +# ============================================================================= +def getWeaponDict(userid): + # Make sure the player is valid + if not spe.getPlayer(int(userid)): + # Return None due to the invalid player instance + return None + + # Set up the list + weapons = {} + + # Loop through the maximum range of 48 weapons + for i in range(0, 48): + + # Retrieve the weapon instance/pointer + wPointer = spe.getWeaponFromSlot(userid, i) + + # Make sure the weapon instance/pointer is valid + if wPointer: + + # Create the valid key:value pair + weapons[spe.getEntityClassName(wPointer)] = { + "instance": wPointer, + "slot": i, + "index": spe.getEntityIndex(wPointer)} + + # Return the populated dictionary + return weapons diff --git a/_libs/ini/engines/shared.ep1.ini b/_libs/python/spe/ini/engines/shared.ep1.ini similarity index 96% rename from _libs/ini/engines/shared.ep1.ini rename to _libs/python/spe/ini/engines/shared.ep1.ini index 4abe61d..be7766b 100644 --- a/_libs/ini/engines/shared.ep1.ini +++ b/_libs/python/spe/ini/engines/shared.ep1.ini @@ -1,44 +1,44 @@ -# $Rev$ -# $LastChangedDate$ - -[CreateEntityByName] -shortname = "CreateEntity" -sig = " 56 8B 74 24 0C 83 FE FF 57 8B 7C 24 0C 74 25 8B 0D 2A 2A 2A 2A 8B 01 56 FF 50 54 85 C0" -symbol = "_Z18CreateEntityByNamePKci" -param = "Si)p" -convention = "cdecl" - -[UTIL_EntityByIndex] -shortname = "EntityByIndex" -sig = " 8B 2A 2A 2A 56 33 F6 85 C0 7E 2C 8B 2A 2A 2A 2A 2A 8B 11 50 2A 2A 2A 85 C0 74 1C 8B 08 D1 E9 F6 C1 01" -symbol = "_Z18UTIL_EntityByIndexi" -param = "i)p" -convention = "cdecl" - -[UTIL_Remove] -shortname = "Remove" -sig = " 8B 44 24 04 85 C0 74 0E 05 48 01 00 00 89 44 24 04 E9 7A FF FF FF C3" -symbol = "_Z11UTIL_RemoveP11CBaseEntity" -param = "p)v" -convention = "cdecl" - -[CBaseCombatCharacter::GetWeapon] -shortname = "GetWeapon" -sig = " 8B 2A 2A 2A 8B 2A 2A 2A 2A 2A 2A 83 2A 2A 74 22 8B 2A 2A 2A 2A 2A 8B C8" -symbol = "_ZNK20CBaseCombatCharacter9GetWeaponEi" -param = "pi)p" -convention = "thiscall" - -[CBaseCombatCharacter::Weapon_OwnsThisType] -shortname = "OwnsWeapon" -sig = " 53 8B 2A 2A 2A 55 56 8B E9 57 33 FF 2A 2A 2A 2A 2A 2A 8B 0E" -symbol = "_ZNK20CBaseCombatCharacter19Weapon_OwnsThisTypeEPKci" -param = "pSi)p" -convention = "thiscall" - -[CBaseEntity::Keyvalues_String] -shortname = "setkv_string" -sig = " 2A 2A 2A 55 2A 2A 2A 2A 57 2A 2A 55 8B F9 2A 2A 2A 2A 2A 83 C4 08" -symbol = "_ZN11CBaseEntity8KeyValueEPKcS1_" -param = "pSS)v" +# $Rev$ +# $LastChangedDate$ + +[CreateEntityByName] +shortname = "CreateEntity" +sig = " 56 8B 74 24 0C 83 FE FF 57 8B 7C 24 0C 74 25 8B 0D 2A 2A 2A 2A 8B 01 56 FF 50 54 85 C0" +symbol = "_Z18CreateEntityByNamePKci" +param = "Si)p" +convention = "cdecl" + +[UTIL_EntityByIndex] +shortname = "EntityByIndex" +sig = " 8B 2A 2A 2A 56 33 F6 85 C0 7E 2C 8B 2A 2A 2A 2A 2A 8B 11 50 2A 2A 2A 85 C0 74 1C 8B 08 D1 E9 F6 C1 01" +symbol = "_Z18UTIL_EntityByIndexi" +param = "i)p" +convention = "cdecl" + +[UTIL_Remove] +shortname = "Remove" +sig = " 8B 44 24 04 85 C0 74 0E 05 48 01 00 00 89 44 24 04 E9 7A FF FF FF C3" +symbol = "_Z11UTIL_RemoveP11CBaseEntity" +param = "p)v" +convention = "cdecl" + +[CBaseCombatCharacter::GetWeapon] +shortname = "GetWeapon" +sig = " 8B 2A 2A 2A 8B 2A 2A 2A 2A 2A 2A 83 2A 2A 74 22 8B 2A 2A 2A 2A 2A 8B C8" +symbol = "_ZNK20CBaseCombatCharacter9GetWeaponEi" +param = "pi)p" +convention = "thiscall" + +[CBaseCombatCharacter::Weapon_OwnsThisType] +shortname = "OwnsWeapon" +sig = " 53 8B 2A 2A 2A 55 56 8B E9 57 33 FF 2A 2A 2A 2A 2A 2A 8B 0E" +symbol = "_ZNK20CBaseCombatCharacter19Weapon_OwnsThisTypeEPKci" +param = "pSi)p" +convention = "thiscall" + +[CBaseEntity::Keyvalues_String] +shortname = "setkv_string" +sig = " 2A 2A 2A 55 2A 2A 2A 2A 57 2A 2A 55 8B F9 2A 2A 2A 2A 2A 83 C4 08" +symbol = "_ZN11CBaseEntity8KeyValueEPKcS1_" +param = "pSS)v" convention = "thiscall" \ No newline at end of file diff --git a/_libs/ini/engines/shared.ep2.ini b/_libs/python/spe/ini/engines/shared.ep2.ini similarity index 100% rename from _libs/ini/engines/shared.ep2.ini rename to _libs/python/spe/ini/engines/shared.ep2.ini diff --git a/_libs/ini/engines/shared.l4d.ini b/_libs/python/spe/ini/engines/shared.l4d.ini similarity index 96% rename from _libs/ini/engines/shared.l4d.ini rename to _libs/python/spe/ini/engines/shared.l4d.ini index 55f1a9f..6d2f38d 100644 --- a/_libs/ini/engines/shared.l4d.ini +++ b/_libs/python/spe/ini/engines/shared.l4d.ini @@ -1,2 +1,2 @@ -# $Rev$ +# $Rev$ # $LastChangedDate$ \ No newline at end of file diff --git a/_libs/ini/engines/shared.l4d2.ini b/_libs/python/spe/ini/engines/shared.l4d2.ini similarity index 96% rename from _libs/ini/engines/shared.l4d2.ini rename to _libs/python/spe/ini/engines/shared.l4d2.ini index 55f1a9f..6d2f38d 100644 --- a/_libs/ini/engines/shared.l4d2.ini +++ b/_libs/python/spe/ini/engines/shared.l4d2.ini @@ -1,2 +1,2 @@ -# $Rev$ +# $Rev$ # $LastChangedDate$ \ No newline at end of file diff --git a/_libs/ini/games/cstrike.ini b/_libs/python/spe/ini/games/cstrike.ini similarity index 96% rename from _libs/ini/games/cstrike.ini rename to _libs/python/spe/ini/games/cstrike.ini index d0fc276..4c00562 100644 --- a/_libs/ini/games/cstrike.ini +++ b/_libs/python/spe/ini/games/cstrike.ini @@ -1,79 +1,79 @@ -# $Rev$ -# $LastChangedDate$ - -[CCSPlayer::RoundRespawn] -shortname = "Respawn" -sig = " 55 8B EC 51 89 2A 2A 8B 2A 2A 8B 10 8B" -symbol = "_ZN9CCSPlayer12RoundRespawnEv" -param = "p)v" -convention = "thiscall" - -[CCSPlayer::SwitchTeam] -shortname = "ChangeTeam" -sig = " 55 8B EC 83 EC 7C 89 4D FC" -symbol = "_ZN9CCSPlayer10SwitchTeamEi" -param = "pi)v" -convention = "thiscall" - -[CCSPlayer::GetActiveWeapon] -shortname = "GetActiveWeapon" -sig = " 55 8B EC 51 89 4D FC 6A 00 68 2A 2A 2A 2A 68 2A 2A 2A 2A 8B 4D FC E8 2A 2A 2A 2A 6A 00" -symbol = "_ZNK9CCSPlayer17GetActiveCSWeaponEv" -param = "p)p" -convention = "thiscall" - -[CCSPlayer::GiveNamedItem] -shortname = "GiveNamedItem" -sig = " 55 8B EC 83 EC 14 89 4D F8" -symbol = "_ZN9CCSPlayer13GiveNamedItemEPKci" -param = "pSi)p" -convention = "thiscall" - -[CCSPlayer::CSWeaponDrop] -shortname = "DropWeapon" -sig = " 55 8B EC 81 EC 84 01 00 00 89 4D FC" -symbol = "_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb" -param = "ppii)i" -convention = "thiscall" - -[CBaseCombatCharacter::OnTakeDamage] -shortname = "OnTakeDamage" -sig = " 55 8B EC 83 EC 0C 57 8B F9 80 BF E9 00 00 00 00" -symbol = "_ZN20CBaseCombatCharacter12OnTakeDamageERK15CTakeDamageInfo" -param = "pp)i" -convention = "thiscall" - -[CCSGameRules::TerminateRound] -shortname = "TerminateRound" -sig = " 55 8B EC 83 EC 28 8B 45 0C" -symbol = "_ZN12CCSGameRules14TerminateRoundEfi" -param = "pfi)v" -convention = "thiscall" - -[CCSPlayer::BumpWeapon] -shortname = "BumpWeapon" -sig = " 55 8B EC 83 EC 38 89 4D F4" -symbol = "_ZN9CCSPlayer10BumpWeaponEP17CBaseCombatWeapon" -param = "pp)i" -convention = "thiscall" - -[ClientCommand] -shortname = "ClientCommand" -sig = " 55 8B EC 53 8B 5D 0C 57 BF 2A 2A 2A 2A 83" -symbol = "_Z13ClientCommandP11CBasePlayerRK8CCommand" -param = "pp)v" -convention = "cdecl" - -[FindPickerEntity] -"shortname" = "FindPickerEntity" -"sig" = " 55 8B EC 83 EC 18 53 56 8B 35 2A 2A 2A 2A 8B" -"symbol" = "_Z16FindPickerEntityP11CBasePlayer" -"param" = "p)p" -"convention" = "cdecl" - -[CCSPlayer::AddAccount] -shortname = "AddAccount" -sig = " 55 8B EC 83 EC 20 89 4D FC 8D 45 08" -symbol = "_ZN9CCSPlayer10AddAccountEibbPKc" -param = "pib)v" +# $Rev$ +# $LastChangedDate$ + +[CCSPlayer::RoundRespawn] +shortname = "Respawn" +sig = " 55 8B EC 51 89 2A 2A 8B 2A 2A 8B 10 8B" +symbol = "_ZN9CCSPlayer12RoundRespawnEv" +param = "p)v" +convention = "thiscall" + +[CCSPlayer::SwitchTeam] +shortname = "ChangeTeam" +sig = " 55 8B EC 83 EC 7C 89 4D FC" +symbol = "_ZN9CCSPlayer10SwitchTeamEi" +param = "pi)v" +convention = "thiscall" + +[CCSPlayer::GetActiveWeapon] +shortname = "GetActiveWeapon" +sig = " 55 8B EC 51 89 4D FC 6A 00 68 2A 2A 2A 2A 68 2A 2A 2A 2A 8B 4D FC E8 2A 2A 2A 2A 6A 00" +symbol = "_ZNK9CCSPlayer17GetActiveCSWeaponEv" +param = "p)p" +convention = "thiscall" + +[CCSPlayer::GiveNamedItem] +shortname = "GiveNamedItem" +sig = " 55 8B EC 83 EC 14 89 4D F8" +symbol = "_ZN9CCSPlayer13GiveNamedItemEPKci" +param = "pSi)p" +convention = "thiscall" + +[CCSPlayer::CSWeaponDrop] +shortname = "DropWeapon" +sig = " 55 8B EC 81 EC 84 01 00 00 89 4D FC" +symbol = "_ZN9CCSPlayer12CSWeaponDropEP17CBaseCombatWeaponbb" +param = "ppii)i" +convention = "thiscall" + +[CBaseCombatCharacter::OnTakeDamage] +shortname = "OnTakeDamage" +sig = " 55 8B EC 83 EC 0C 57 8B F9 80 BF E9 00 00 00 00" +symbol = "_ZN20CBaseCombatCharacter12OnTakeDamageERK15CTakeDamageInfo" +param = "pp)i" +convention = "thiscall" + +[CCSGameRules::TerminateRound] +shortname = "TerminateRound" +sig = " 55 8B EC 83 EC 28 8B 45 0C" +symbol = "_ZN12CCSGameRules14TerminateRoundEfi" +param = "pfi)v" +convention = "thiscall" + +[CCSPlayer::BumpWeapon] +shortname = "BumpWeapon" +sig = " 55 8B EC 83 EC 38 89 4D F4" +symbol = "_ZN9CCSPlayer10BumpWeaponEP17CBaseCombatWeapon" +param = "pp)i" +convention = "thiscall" + +[ClientCommand] +shortname = "ClientCommand" +sig = " 55 8B EC 53 8B 5D 0C 57 BF 2A 2A 2A 2A 83" +symbol = "_Z13ClientCommandP11CBasePlayerRK8CCommand" +param = "pp)v" +convention = "cdecl" + +[FindPickerEntity] +"shortname" = "FindPickerEntity" +"sig" = " 55 8B EC 83 EC 18 53 56 8B 35 2A 2A 2A 2A 8B" +"symbol" = "_Z16FindPickerEntityP11CBasePlayer" +"param" = "p)p" +"convention" = "cdecl" + +[CCSPlayer::AddAccount] +shortname = "AddAccount" +sig = " 55 8B EC 83 EC 20 89 4D FC 8D 45 08" +symbol = "_ZN9CCSPlayer10AddAccountEibbPKc" +param = "pib)v" convention = "thiscall" \ No newline at end of file diff --git a/_libs/ini/games/left4dead.ini b/_libs/python/spe/ini/games/left4dead.ini similarity index 96% rename from _libs/ini/games/left4dead.ini rename to _libs/python/spe/ini/games/left4dead.ini index 6c7c400..83afba3 100644 --- a/_libs/ini/games/left4dead.ini +++ b/_libs/python/spe/ini/games/left4dead.ini @@ -1,16 +1,16 @@ -# $Rev$ -# $LastChangedDate$ - -[CreateEntityByName] -shortname = "CreateEntity" -sig = " 56 8B 74 24 0C 83 FE FF 57 8B 7C 24 0C 74 27 8B 0D 2A 2A 2A 2A 8B 01 8B 50 54 56 FF D2" -symbol = "_Z18CreateEntityByNamePKci" -param = "Sii)p" -convention = "cdecl" - -[Reset] -shortname = "Reset" -sig = " 51 D9 2A 2A 2A 2A 2A 53 33 DB 56 8B F1 57 8D 2A 2A 2A 2A 2A 88 2A 2A 2A 2A 2A 88 2A 2A 2A 2A 2A 88" -symbol = "_ZN8Director5ResetEv" -param = "p)v" +# $Rev$ +# $LastChangedDate$ + +[CreateEntityByName] +shortname = "CreateEntity" +sig = " 56 8B 74 24 0C 83 FE FF 57 8B 7C 24 0C 74 27 8B 0D 2A 2A 2A 2A 8B 01 8B 50 54 56 FF D2" +symbol = "_Z18CreateEntityByNamePKci" +param = "Sii)p" +convention = "cdecl" + +[Reset] +shortname = "Reset" +sig = " 51 D9 2A 2A 2A 2A 2A 53 33 DB 56 8B F1 57 8D 2A 2A 2A 2A 2A 88 2A 2A 2A 2A 2A 88 2A 2A 2A 2A 2A 88" +symbol = "_ZN8Director5ResetEv" +param = "p)v" convention = "thiscall" \ No newline at end of file diff --git a/_libs/ini/games/left4dead2.ini b/_libs/python/spe/ini/games/left4dead2.ini similarity index 96% rename from _libs/ini/games/left4dead2.ini rename to _libs/python/spe/ini/games/left4dead2.ini index 55f1a9f..6d2f38d 100644 --- a/_libs/ini/games/left4dead2.ini +++ b/_libs/python/spe/ini/games/left4dead2.ini @@ -1,2 +1,2 @@ -# $Rev$ +# $Rev$ # $LastChangedDate$ \ No newline at end of file diff --git a/_libs/ini/games/tf.ini b/_libs/python/spe/ini/games/tf.ini similarity index 96% rename from _libs/ini/games/tf.ini rename to _libs/python/spe/ini/games/tf.ini index 55f1a9f..6d2f38d 100644 --- a/_libs/ini/games/tf.ini +++ b/_libs/python/spe/ini/games/tf.ini @@ -1,2 +1,2 @@ -# $Rev$ +# $Rev$ # $LastChangedDate$ \ No newline at end of file diff --git a/_libs/types/shared.ini b/_libs/python/spe/types/shared.ini similarity index 97% rename from _libs/types/shared.ini rename to _libs/python/spe/types/shared.ini index 4136b58..267bb84 100644 --- a/_libs/types/shared.ini +++ b/_libs/python/spe/types/shared.ini @@ -1,9 +1,9 @@ -[Vector] -shortname = "Vector" -types = "f,f,f" -names = "x,y,z" - -[TakeDamageInfo] -shortname = "CTakeDamageInfo" -types = "Vector,Vector,Vector,i,i,i,f,f,f,i,i,i,i" +[Vector] +shortname = "Vector" +types = "f,f,f" +names = "x,y,z" + +[TakeDamageInfo] +shortname = "CTakeDamageInfo" +types = "Vector,Vector,Vector,i,i,i,f,f,f,i,i,i,i" names = "vecDamageForce,vecDamagePosition,vecReportedPosition,hInflictor,hAttacker,hWeapon,flDamage,flMaxDamage,flBaseDamage,bitsDamageType,iDamageCustom,iDamageStats,iAmmoType" \ No newline at end of file diff --git a/src/spe_main.cpp b/src/spe_main.cpp index 9247da8..ea74b4f 100644 --- a/src/spe_main.cpp +++ b/src/spe_main.cpp @@ -29,8 +29,7 @@ //================================================================================= #include "spe_main.h" #include "spe_globals.h" -#include "spe_python.h" -#include "svn_build.h" +#include "spe_python.h" #include "playerinfomanager.h" @@ -188,8 +187,7 @@ const char *CSPE_Plugin::GetPluginDescription( void ) return (PLUGIN_NAME ", " PLUGIN_DATE ", " PLUGIN_AUTHOR ", " - PLUGIN_VERSION ", r" - SVN_WC_REVISION); + PLUGIN_VERSION ); } //================================================================================= diff --git a/src/spe_main.h b/src/spe_main.h index 17f9d30..c9158d8 100644 --- a/src/spe_main.h +++ b/src/spe_main.h @@ -38,10 +38,10 @@ #define PLUGIN_AUTHOR "your-name-here" /* YOUR PLUGIN VERSION HERE */ -#define PLUGIN_VERSION "1.6.1" +#define PLUGIN_VERSION "1.6.2" /* YOUR PLUGIN DATE HERE */ -#define PLUGIN_DATE "2009 - 2013" +#define PLUGIN_DATE "2009 - 2018" //================================================================================= // Includes diff --git a/src/svn_build.h b/src/svn_build.h deleted file mode 100644 index 908d61b..0000000 --- a/src/svn_build.h +++ /dev/null @@ -1,32 +0,0 @@ -/** -* ============================================================================= -* Source Python Extensions -* Copyright (C) 2009-2010 Deniz "your-name-here" Sezen. 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, I (Deniz Sezen) give you permission to link the -* code of this program (as well as its derivative works) to "Half-Life 2," the -* "Source Engine," 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, I (Deniz Sezen) grants -* this exception to all derivative works. -*/ -#ifndef SVN_BUILD_H -#define SVN_BUILD_H - -#define SVN_WC_REVISION "147" -#define SVN_WC_DATE "2010/09/19 09:32:41" - -#endif \ No newline at end of file diff --git a/src/svn_build.tmpl b/src/svn_build.tmpl deleted file mode 100644 index cef9c24..0000000 --- a/src/svn_build.tmpl +++ /dev/null @@ -1,32 +0,0 @@ -/** -* ============================================================================= -* Source Python Extensions -* Copyright (C) 2009-2010 Deniz "your-name-here" Sezen. 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, I (Deniz Sezen) give you permission to link the -* code of this program (as well as its derivative works) to "Half-Life 2," the -* "Source Engine," 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, I (Deniz Sezen) grants -* this exception to all derivative works. -*/ -#ifndef SVN_BUILD_H -#define SVN_BUILD_H - -#define SVN_WC_REVISION "$WCREV$" -#define SVN_WC_DATE "$WCDATE$" - -#endif