Added a new ValveCallType that allows for arbitrary |this| parameters, as well as associated features in gamedata and for reading/writing memory (bug 3520, r=dvander, sr=fyren).

This commit is contained in:
Downtown1
2010-01-11 22:46:44 -08:00
parent ead6ca73e5
commit 18865c44c8
9 changed files with 330 additions and 2 deletions
+1
View File
@@ -57,6 +57,7 @@ enum SDKCallType
SDKCall_Player, /**< CBasePlayer call */
SDKCall_GameRules, /**< CGameRules call */
SDKCall_EntityList, /**< CGlobalEntityList call */
SDKCall_Raw, /**< Raw Address call */
};
enum SDKLibrary
+45
View File
@@ -386,6 +386,16 @@ native GameConfGetOffset(Handle:gc, const String:key[]);
*/
native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[], maxlen);
/*
* Finds an address calculation in a GameConfig file,
* performs LoadFromAddress on it as appropriate, then returns the final address.
*
* @param gameconf GameConfig Handle, or INVALID_HANDLE to use sdktools.games.txt.
* @param name Name of the property to find.
* @return An address calculated on success, or 0 on failure.
*/
native Address:GameConfGetAddress(Handle:gameconf, const String:name[]);
/**
* Returns the operating system's "tick count," which is a number of
* milliseconds since the operating system loaded. This can be used
@@ -630,6 +640,41 @@ native FeatureStatus:GetFeatureStatus(FeatureType:type, const String:name[]);
native RequireFeature(FeatureType:type, const String:name[],
const String:fmt[]="", any:...);
/**
* Represents how many bytes we can read from an address with one load
*/
enum NumberType
{
NumberType_Int8,
NumberType_Int16,
NumberType_Int32
};
enum Address
{
Address_Null = 0, //a typical invalid result when an address lookup fails
Address_MinimumValid = 0x10000 //addresses below this value are considered invalid to use for Load/Store
};
/**
* Load up to 4 bytes from a memory address.
*
* @param addr Address to a memory location.
* @param size How many bytes should be read.
* @return The value that is stored at that address.
*/
native LoadFromAddress(Address:addr, NumberType:size);
/**
* Store up to 4 bytes to a memory address.
*
* @param addr Address to a memory location.
* @param data Value to store at the address.
* @param size How many bytes should be written.
* @noreturn
*/
native StoreToAddress(Address:addr, data, NumberType:size);
#include <helpers>
#include <entity>
#include <entity_prop_stocks>