AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   SDKCall for non standart conv function (https://forums.alliedmods.net/showthread.php?t=342006)

gubka 02-28-2023 12:14

SDKCall for non standart conv function
 
Hello everyone, I have already published on the forum ways to call functions with __fastcall & __vectorcall conv or how to call functions where registers such as xmm are used to pass some parameters with SDKCall. I wanted to share a more elegant way in which Malloc is used to allocate memory for a function once. In this example, I fixed the call to the FX_FireBullets function that has __fastcall conv on the Windows. In addition, I include example of SDKCall for CGlobalEntityList::FindEntityInSphere which not have CGlobalEntityList as first parameter and float radius is passed in xmm3 register in CS:GO windows

Example:
Spoiler


Gamedata:
Spoiler

donrevan 03-04-2023 18:28

Re: SDKCall for non standart conv function
 
Nice, it's really cool to do stuff like this just using SourcePawn.

I'm surprised memory allocated via g_pMemAlloc->Alloc() has RWX permissions.


All times are GMT -4. The time now is 05:32.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.