(c) 2022 YSI contibutors, licensed under MPL 1.1
This can be used for a range of things, including automatic callback hooking and testing.
AMX_TABLE_PUBLICS = 0
AMX_TABLE_NATIVES = 1
AMX_TABLE_LIBRARIES = 2
AMX_TABLE_PUBVARS = 3
AMX_TABLE_TAGS = 4
AMX_Deref(addr)
Name | Info |
---|---|
addr |
A DAT pointer. |
An array whose data is at addr
. Converts a pointer to a pawn usable array.
3 cells
AMX_DoNothing()
A dummy function used to get the address of.
1 cells
AMX_DumpHeader()
Print all the names of all the public functions from the AMX header. There is now a more complete version of this function in amx_assembly called PrintAmxHeader
.
41 cells
AMX_GetBaseCount(table, &base, &count)
Name | Info |
---|---|
table |
E_AMX_TABLE The table in the header (publics, tags, etc). |
base |
& Return for the start pointer. |
count |
& Return for the count. |
Get information about one of the tables in the AMX header. These are lists of address/name pairs. The address is one cell long, and points to where in code/data/vm the corresponding symbol is located. The name is defsize - cellbytes
long, which may not be exactly one cell (all of y_amx assumes that this value is known at compile-time, but amx_assembly more correctly reads it from the header), and points to the start of the name as a C string in the AMX header's nametable. This function just gets where in memory (relative to DAT) the table starts, and how many items there are in the table.
AMX_HEADER_LIBRARIES
AMX_HEADER_NAMETABLE
AMX_HEADER_NATIVES
AMX_HEADER_PUBLICS
AMX_HEADER_PUBVARS
AMX_HEADER_TAGS
AMX_TABLE_LIBRARIES
AMX_TABLE_NATIVES
AMX_TABLE_PUBLICS
AMX_TABLE_PUBVARS
AMX_TABLE_TAGS
__defsize_cells
1 cells
AMX_GetCount(table)
Name | Info |
---|---|
table |
E_AMX_TABLE Which table to get the size of. |
The number of entries in this table.
6 cells
AMX_GetEntryBinary(table, idx, &buffer, pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
[] An optional name to look for. |
exact |
bool When true find the pattern exactly, otherwise just include it. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find one matching the given name pattern, or just the next one when no pattern is given. Loop over all public functions with:
new idx = 0, buffer;
while ((idx = AMX_GetPublicEntry(idx, buffer)))
{
}
The entry is a pointer in to the table itself, i.e. address/name pair relative to DAT
. You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicEntry
AMX_GetPubVarEntry
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that.
AMX_BASE_ADDRESS
AMX_GetBaseCount
AMX_Read
AMX_ReadPackedString
Cell_ReverseBytes
FIXES_strcmp
FIXES_strfind
FUNCTION_LENGTH
__defsize_cells
cellbits
cellbytes
cellmax
45 cells
AMX_GetEntryFromNativeIndex(index)
Name | Info |
---|---|
index |
The position in the native functions table. |
A pointer to this table entry.
1 cells
AMX_GetEntryFromPublicIndex(index)
Name | Info |
---|---|
index |
The position in the public functions table. |
A pointer to this table entry.
1 cells
AMX_GetEntryLinear(table, idx, &buffer, pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
[] An optional name to look for. |
exact |
bool When true find the pattern exactly, otherwise just include it. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find one matching the given name pattern, or just the next one when no pattern is given. Loop over all libraries with:
new idx = 0, buffer;
while ((idx = AMX_GetLibraryEntry(idx, buffer)))
{
}
The entry is a pointer in to the table itself, i.e. address/name pair relative to DAT
. You should not use this function directly, but one of the macro wrappers defined for unsorted tables:
AMX_GetNativeEntry
AMX_GetLibraryEntry
AMX_GetTagEntry
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
AMX_BASE_ADDRESS
AMX_GetBaseCount
AMX_Read
AMX_ReadPackedString
FIXES_strcmp
FIXES_strfind
FUNCTION_LENGTH
__defsize_cells
cellbytes
43 cells
AMX_GetEntryPointer(tableEntry)
Name | Info |
---|---|
tableEntry |
The table entry in the AMX header to use. |
The data pointer in this table (the first cell in the struct).
1 cells
AMX_GetEntryPrefixBinary(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
A prefix to look for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find one whose name starts with the given prefix. Prefixes are four bytes built from the first four characters in a name. Prefixes are used extensively for looping over special function types as they require no string decoding and so can be compared very quickly. The _A
macro can be used to convert four characters in to the special format used by pattern
(which is really just the C string as a 32-bit number).
y_hooks uses this function to find all of its special hook functions, which start with the magic four character sequence "@yH_"
(both a prefix for this function, and a public function declaration as it starts with @
), like so:
new idx = 0, buffer;
while ((idx = AMX_GetPublicEntryPrefix(idx, buffer, _A<@yH_>)))
{
}
The entry is a pointer in to the table itself, i.e. address/name pair relative to DAT
. You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicEntryPrefix
AMX_GetPubVarEntryPrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that.
Prefixes are widely used in YSI as the names are sorted and so can be binary searched, the entries point to the start of the names, and once a prefix is passed there can be no more later (thanks to sorting). Thus binary prefix searches are extremely efficient.
11 cells
AMX_GetEntryPrefixLinear(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
A prefix to look for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find one whose name starts with the given prefix. Prefixes are four bytes built from the first four characters in a name. Prefixes are used extensively for looping over special function types as they require no string decoding and so can be compared very quickly. The _A
macro can be used to convert four characters in to the special format used by pattern
(which is really just the C string as a 32-bit number).
All the special Func:
tags which encode parameter types could be looped over like so:
new idx = 0, buffer;
while ((idx = AMX_GetTagEntryPrefix(idx, buffer, _A<F@_@>)))
{
}
The entry is a pointer in to the table itself, i.e. address/name pair relative to DAT
. You should not use this function directly, but one of the macro wrappers defined for unsorted tables:
AMX_GetNativeEntryPrefix
AMX_GetLibraryEntryPrefix
AMX_GetTagEntryPrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
10 cells
AMX_GetEntrySuffix(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through any table to look for names ending with the given four byte suffix. These suffixes are defined in the same way as the prefixes used by AMX_GetPublicEntryPrefix
et. al, but the scanning is much harder because the full names must all be read. Unlike prefix scanning, suffix scanning is very inefficient. Returns the table entry.
10 cells
AMX_GetFirstNativeString()
The address in the nametable of the first string name referenced by this table. Same as AMX_GetFirstString
, but specialised for natives as their pointers may be clobbered in some VM versions.
AMX_BASE_ADDRESS
AMX_GetBaseCount
AMX_GetEntryFromPublicIndex
AMX_ReadLength
AMX_TABLE_PUBLICS
cellbytes
8 cells
AMX_GetFirstString(table)
Name | Info |
---|---|
table |
E_AMX_TABLE Which header table to report on. |
The address in the nametable of the first string name referenced by this table. Should be called via the table-specific wrappers:
AMX_GetFirstPublicString
AMX_GetFirstLibraryString
AMX_GetFirstPubVarString
AMX_GetFirstTagString
1 cells
AMX_GetGlobal()
The address of the AMX in the server.
4 cells
AMX_GetGlobalAddress(...)
Name | Info |
---|---|
... |
The passed address, in the server not the AMX.
2 cells
AMX_GetLengthFromEntry(tableEntry)
Name | Info |
---|---|
tableEntry |
The AMX header table entry to use. |
The length of the name of this entry.
4 cells
AMX_GetLibraryStringSpace()
The number of bytes used by all library names in the nametable.
4 cells
AMX_GetNameBinary(table, idx, buffer[], pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed sring. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find one whose name contains the given pattern, or all of them when there is no pattern. Loop over all the defined player callbacks like so:
new idx = 0, buffer[FUNCTION_LENGTH];
while ((idx = AMX_GetPublicName(idx, buffer, "OnPlayer", false)))
{
}
You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicNamePrefix
AMX_GetPubVarNamePrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that.
9 cells
AMX_GetNameLinear(table, idx, buffer[], pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed sring. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find one whose name contains the given pattern, or all of them when there is no pattern. Loop over all the defined player callbacks like so:
new idx = 0, buffer[FUNCTION_LENGTH];
while ((idx = AMX_GetPublicName(idx, buffer, "OnPlayer", false)))
{
}
You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetNativeNameLinear
AMX_GetLibraryNameLinear
AMX_GetTagNameLinear
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
9 cells
AMX_GetNamePrefixBinary(table, idx, buffer[], pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed string. |
pattern |
A prefix to scan for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find the next entry matching the given prefix, and returns the full name of the entry. You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicNamePrefix
AMX_GetPubVarNamePrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that.
8 cells
AMX_GetNamePrefixLinear(table, idx, buffer[], pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed string. |
pattern |
A prefix to scan for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find the next entry matching the given prefix, and returns the full name of the entry. You should not use this function directly, but one of the macro wrappers defined for unsorted tables:
AMX_GetNativeNamePrefix
AMX_GetLibraryNamePrefix
AMX_GetTagNamePrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
8 cells
AMX_GetNameSuffix(table, idx, buffer[], pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed sring. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through any table to look for names ending with the given four byte suffix. These suffixes are defined in the same way as the prefixes used by AMX_GetPublicEntryPrefix
et. al, but the scanning is much harder because the full names must all be read. Unlike prefix scanning, suffix scanning is very inefficient. Returns the full name.
8 cells
AMX_GetNativeIndexFromEntry(tableEntry)
Name | Info |
---|---|
tableEntry |
The AMX header native function entry to use. |
The index (i.e the position in the table) of this native function entry.
1 cells
AMX_GetNativeStringSpace()
The number of bytes used by all native function names in the nametable.
4 cells
AMX_GetPointerBinary(table, idx, &buffer, pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The pointer return value. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find one whose name includes or exactly matches the given pattern. The return value is the pointer from in the entry, not the entry itself, nor the data the pointer references (e.g. a funcion). You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicPointer
AMX_GetPubVarPointer
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
9 cells
AMX_GetPointerLinear(table, idx, &buffer, pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The pointer return value. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find one whose name includes or exactly matches the given pattern. The return value is the pointer from in the entry, not the entry itself, nor the data the pointer references (e.g. a funcion). You should not use this function directly, but one of the macro wrappers defined for unsorted tables:
AMX_GetNativePointer
AMX_GetLibraryPointer
AMX_GetTagPointer
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
9 cells
AMX_GetPointerPrefixBinary(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The pointer return value. |
pattern |
A prefix to scan for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find the next entry matching the given prefix, and returns a pointer to the data. You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicPointerPrefix
AMX_GetPubVarPointerPrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that.
8 cells
AMX_GetPointerPrefixLinear(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The pointer return value. |
pattern |
A prefix to scan for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find the next entry matching the given prefix, and returns a pointer to the data. You should not use this function directly, but one of the macro wrappers defined for unsorted tables:
AMX_GetNativePointerPrefix
AMX_GetLibraryPointerPrefix
AMX_GetTagPointerPrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
8 cells
AMX_GetPointerSuffix(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The data pointer return value. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through any table to look for names ending with the given four byte suffix. These suffixes are defined in the same way as the prefixes used by AMX_GetPublicEntryPrefix
et. al, but the scanning is much harder because the full names must all be read. Unlike prefix scanning, suffix scanning is very inefficient. Returns the data pointer.
8 cells
AMX_GetPubVarStringSpace()
The number of bytes used by all public variable names in the nametable.
4 cells
AMX_GetPublicIndexFromEntry(tableEntry)
Name | Info |
---|---|
tableEntry |
The AMX header public function entry to use. |
The index (i.e the position in the table) of this public function entry.
The value returned corresponds to the return value of funcidx
.
1 cells
AMX_GetPublicStringSpace()
The number of bytes used by all public function names in the nametable.
4 cells
AMX_GetPubvarCount()
The number of entries in this table.
4 cells
AMX_GetPubvarEntry(idx, &buffer, pattern[], exact)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
[] An optional name to look for. |
exact |
bool When true find the pattern exactly, otherwise just include it. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the public variables table to find one matching the given name pattern, or just the next one when no pattern is given. Loop over all public variables with:
new idx = 0, buffer;
while ((idx = AMX_GetPubvarEntry(idx, buffer)))
{
}
The entry is a pointer in to the table itself, i.e. address/name pair relative to DAT
.
8 cells
AMX_GetPubvarEntryPrefix(idx, &buffer, pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
A prefix to look for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the public variables table to find one whose name starts with the given prefix. Prefixes are four bytes built from the first four characters in a name. Prefixes are used extensively for looping over special function types as they require no string decoding and so can be compared very quickly. The _A
macro can be used to convert four characters in to the special format used by pattern
(which is really just the C string as a 32-bit number).
To loop over all public variables that start with "var_"
:
new idx = 0, buffer;
while ((idx = AMX_GetPubvarEntryPrefix(idx, buffer, _A<var_>)))
{
}
The entry is a pointer in to the table itself, i.e. address/name pair relative to DAT
.
7 cells
AMX_GetPubvarEntrySuffix(idx, &buffer, pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The return value, with a pointer to a table entry. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetEntrySuffix.
7 cells
AMX_GetPubvarName(idx, buffer[], pattern[], exact)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed sring. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetNameBinary.
8 cells
AMX_GetPubvarNamePrefix(idx, buffer[], pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed string. |
pattern |
A prefix to scan for. |
table |
Which sorted table to scan through. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetNamePrefixBinary
7 cells
AMX_GetPubvarNameSuffix(idx, buffer[], pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
[32] The name return value, as a packed sring. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetNameSuffix.
7 cells
AMX_GetPubvarPointer(idx, &buffer, pattern[], exact)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The pointer return value. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
table |
Which unsorted table to scan through. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetPointerBinary
.
8 cells
AMX_GetPubvarPointerPrefix(idx, &buffer, pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The pointer return value. |
pattern |
A prefix to scan for. |
table |
Which unsorted table to scan through. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetPointerPrefixBinary
7 cells
AMX_GetPubvarPointerSuffix(idx, &buffer, pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The data pointer return value. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetPointerSuffix.
7 cells
AMX_GetPubvarValue(idx, &buffer, pattern[], exact)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
table |
Which sorted table to scan through. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetValueBinary
.
8 cells
AMX_GetPubvarValuePrefix(idx, &buffer, pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
A prefix to scan for. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetValuePrefixBinary
.
7 cells
AMX_GetPubvarValueSuffix(idx, &buffer, pattern)
Name | Info |
---|---|
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
See AMX_GetNameSuffix.
7 cells
AMX_GetRelativeAddress(...)
Name | Info |
---|---|
... |
The passed address in the AMX.
2 cells
AMX_GetStringFromEntry(tableEntry, str[], size)
Name | Info |
---|---|
tableEntry |
The header entry that has a name pointer. |
str |
[] The destination array. |
size |
The size of the destination array. |
Copies a C string in AMX memory out to a packed string. The pointer does not point straight to the string, but instead points to a header entry, i.e. part of a table with a data pointer and a name pointer. This thus abstracts the weirdness of the size of the name pointer, which may not be a whole cell. There is no unpacked equivalent.
6 cells
AMX_GetTagByValue(tag, name[], len)
Name | Info |
---|---|
tag |
The tag value to look up (e.g. from tagof ). |
name |
[] The destination for the name. |
len |
The destination size. |
Get the original string (code) name of a tag from its ID.
AMX_BASE_ADDRESS
AMX_GetEntryLinear
AMX_Read
AMX_ReadPackedString
AMX_TABLE_TAGS
cellbytes
strunpack
11 cells
AMX_GetTagStringSpace()
The number of bytes used by all tag names in the nametable.
4 cells
AMX_GetValueBinary(table, idx, &buffer, pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find one whose name includes or exactly matches the given pattern. The return value is the data pointed to by the entry. You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicValue
AMX_GetPubVarValue
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that.
9 cells
AMX_GetValueLinear(table, idx, &buffer, pattern[], exact)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
[] A prefix to look for. |
exact |
bool True to match the pattern exactly, false for contains. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find one whose name includes or exactly matches the given pattern. The return value is the data pointed to by the entry. You should not use this function directly, but one of the macro wrappers defined for unsorted tables:
AMX_GetNativeValue
AMX_GetLibraryValue
AMX_GetTagValue
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
9 cells
AMX_GetValuePrefixBinary(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which sorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
A prefix to scan for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given sorted table to find the next entry matching the given prefix, and returns the data pointed to by that entry. You should not use this function directly, but one of the macro wrappers defined for sorted tables:
AMX_GetPublicValuePrefix
AMX_GetPubVarValuePrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that.
8 cells
AMX_GetValuePrefixLinear(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which unsorted table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
A prefix to scan for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through the given unsorted table to find the next entry matching the given prefix, and returns the data pointed to by that entry. You should not use this function directly, but one of the macro wrappers defined for unsorted tables:
AMX_GetNativeValuePrefix
AMX_GetLibraryValuePrefix
AMX_GetTagValuePrefix
Note that amx_assembly now sorts the library and tag headers, so those could be binary searched, but this library cannot rely on that. Also note that the native name searches may not currently work correctly in all VM versions due to data clobbering.
8 cells
AMX_GetValueSuffix(table, idx, &buffer, pattern)
Name | Info |
---|---|
table |
E_AMX_TABLE Which table to scan through. |
idx |
When iterating, the offset to start at. |
buffer |
& The data return value. |
pattern |
A suffix to look for. |
The next index (idx
) to continue scanning from, or 0
.
This scans through any table to look for names ending with the given four byte suffix. These suffixes are defined in the same way as the prefixes used by AMX_GetPublicEntryPrefix
et. al, but the scanning is much harder because the full names must all be read. Unlike prefix scanning, suffix scanning is very inefficient. Returns data from the data pointer.
8 cells
AMX_Read(addr)
Name | Info |
---|---|
addr |
Where to read the data from (relative to DAT). |
The data at this address.
Read some data from any arbitrary location in the AMX, bypassing the DAT-only restriction.
1 cells
AMX_ReadArray(addr, dest[], len)
Name | Info |
---|---|
addr |
Data source address. |
dest |
[] Where to copy the data to. |
len |
Amount of data to copy. |
Read data out of a memory location, which may be outside the bounds of DAT.
1 cells
AMX_ReadLength(addr)
Name | Info |
---|---|
addr |
Pointer to a C string. |
The length of the string.
Operates on C strings, as found in the header, not pawn packed strings, which have their bytes reversed in a cell.
6 cells
AMX_ReadPackedString(addr, str[], len)
Name | Info |
---|---|
addr |
Where in DAT to read the string from. |
str |
[] The destination array. |
len |
The size of the destination array. |
Copies a C string in AMX memory out to a packed string. Mainly used to read function names from the header, as they are not in pawn order. Uses a clever trick to detect NULL
in four bytes at once.
6 cells
AMX_ReadString(addr, str[], len)
Name | Info |
---|---|
addr |
Where in DAT to read the string from. |
str |
[] The destination array. |
len |
The size of the destination array. |
Copies a C string in AMX memory out to a packed string. Mainly used to read function names from the header, as they are not in pawn order. Uses a clever trick to detect NULL
in four bytes at once. Deprecated name.
6 cells
AMX_ReadUnpackedString(addr, str[], len)
Name | Info |
---|---|
addr |
Where in DAT to read the string from. |
str |
[] The destination array. |
len |
The size of the destination array. |
Copies a C string in AMX memory out to an unpacked string. Mainly used to read function names from the header, as they are not in pawn order.
3 cells
AMX_Ref(&addr)
Name | Info |
---|---|
addr |
& A variable that you want to get the address of. |
The address of the given parameter.
This is the old function version in case the compiler being used doesn't have inline assembly.
1 cells
AMX_TraceCode(pattern[], &addrRet, &dataRet, size)
Name | Info |
---|---|
pattern |
[] The pattern to scan for in code. |
addrRet |
& The return for the address. |
dataRet |
& The return for the parameter. |
size |
The size of the pattern. |
An extremely poor-mans version of codescan. Just takes a pure array of opcodes and searches for it in memory. No data wildcards, no stack tracing, no opcode value lookup, etc. Returns the next cell after the end of a found pattern as if it were an opcode parameter.
6 cells
AMX_TraceMemory(pattern[], &addrRet, &dataRet, size)
Name | Info |
---|---|
pattern |
[] The pattern to scan for in data. |
addrRet |
& The return for the address. |
dataRet |
& The return for the parameter. |
size |
The size of the pattern. |
Search for the given pattern in the data segment. Return the address of the match and the data immediately following the match.
6 cells
AMX_Write(addr, value)
Name | Info |
---|---|
addr |
Where to write the data (relative to DAT). |
value |
What to write. |
Writes some data to any arbitrary location in the AMX, bypassing the DAT-only restriction. This is the old function version in case the compiler being used doesn't have inline assembly.
1 cells
AMX_WriteArray(addr, src[], len)
Name | Info |
---|---|
addr |
Where to copy the data to. |
src |
[] Data source. |
len |
Amount of data to copy. |
Write data to a memory location, which may be outside the bounds of DAT.
1 cells
AMX_WritePackedString(addr, str[])
Name | Info |
---|---|
addr |
Where in DAT to write the string to. |
str |
[] The packed string to write. |
Copies a packed string in to AMX memory, as a C string. Mainly used to write function names in to the header, as they are not in pawn order.
8 cells
AMX_WriteUnpackedString(addr, str[])
Name | Info |
---|---|
addr |
Where in DAT to write the string to. |
str |
[] The unpacked string to write. |
Copies an unpacked string in to AMX memory, as a C string. Mainly used to write function names in to the header, as they are not in pawn order.
8 cells