06.01.2010, 21:54
Quote:
Originally Posted by Y_Leѕѕ
Getting the addresses is quite slow, as is figuring out the parameters as it requires looking into the EXE file and figuring out how bits work (I did used to be on the team, so do have a slight advantage in that I used to have source code access so know how certain parts are done, but they do change).
Getting the addresses of PAWN natives is easy - I've got code to do that for me. Getting the addresses you actually need is harder as the PAWN natives read in the parameters, convert them to a regular format then pass them to other functions. Also, the PAWN invoke plugin doesn't actually go through PAWN for most calls, it just needs the AMX to exist to load all the function addresses which can then be looked up dynamically. This stage can be improved somewhat to remove the AMX and speed up the lookups (either create a static list with my code or embed the code into the plugin and rebuild the list every time the server starts), which may be a compromise between the two current methods. |
My own custom wrapper gets and stores all those addresses when it starts as I thought at that time amx_FindNative would probably use a linear search through the table with natives the AMX holds which is very slow and you don't want to be doing that each time you want to call a native.
Those addresses still point to functions with the prototype:
Код:
static cell AMX_NATIVE_CALL Func(AMX*, cell*); int (*func)(AMX*, cell*); //Is how my wrapper stores them
As far as I know the only way to completely bypass the AMX is when you have the prototypes and addresses for all the native functions, not the ones with the above prototype but the ones they call internally.