1.1 --- a/plugins/include/sourcemod.inc Mon Jan 11 20:09:34 2010 -0800
1.2 +++ b/plugins/include/sourcemod.inc Mon Jan 11 22:46:44 2010 -0800
1.3 @@ -386,6 +386,16 @@
1.4 */
1.5 native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[], maxlen);
1.6
1.7 +/*
1.8 + * Finds an address calculation in a GameConfig file,
1.9 + * performs LoadFromAddress on it as appropriate, then returns the final address.
1.10 + *
1.11 + * @param gameconf GameConfig Handle, or INVALID_HANDLE to use sdktools.games.txt.
1.12 + * @param name Name of the property to find.
1.13 + * @return An address calculated on success, or 0 on failure.
1.14 + */
1.15 +native Address:GameConfGetAddress(Handle:gameconf, const String:name[]);
1.16 +
1.17 /**
1.18 * Returns the operating system's "tick count," which is a number of
1.19 * milliseconds since the operating system loaded. This can be used
1.20 @@ -630,6 +640,41 @@
1.21 native RequireFeature(FeatureType:type, const String:name[],
1.22 const String:fmt[]="", any:...);
1.23
1.24 +/**
1.25 + * Represents how many bytes we can read from an address with one load
1.26 + */
1.27 +enum NumberType
1.28 +{
1.29 + NumberType_Int8,
1.30 + NumberType_Int16,
1.31 + NumberType_Int32
1.32 +};
1.33 +
1.34 +enum Address
1.35 +{
1.36 + Address_Null = 0, //a typical invalid result when an address lookup fails
1.37 + Address_MinimumValid = 0x10000 //addresses below this value are considered invalid to use for Load/Store
1.38 +};
1.39 +
1.40 +/**
1.41 + * Load up to 4 bytes from a memory address.
1.42 + *
1.43 + * @param addr Address to a memory location.
1.44 + * @param size How many bytes should be read.
1.45 + * @return The value that is stored at that address.
1.46 + */
1.47 +native LoadFromAddress(Address:addr, NumberType:size);
1.48 +
1.49 +/**
1.50 + * Store up to 4 bytes to a memory address.
1.51 + *
1.52 + * @param addr Address to a memory location.
1.53 + * @param data Value to store at the address.
1.54 + * @param size How many bytes should be written.
1.55 + * @noreturn
1.56 + */
1.57 +native StoreToAddress(Address:addr, data, NumberType:size);
1.58 +
1.59 #include <helpers>
1.60 #include <entity>
1.61 #include <entity_prop_stocks>