Raised This Month: $51 Target: $400
 12% 

SDKCall for non standart conv function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gubka
Veteran Member
Join Date: Jan 2012
Location: Russia
Old 02-28-2023 , 12:14   SDKCall for non standart conv function
Reply With Quote #1

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
__________________

Last edited by gubka; 02-28-2023 at 19:21.
gubka is offline
Send a message via ICQ to gubka
donrevan
AlliedModders Donor
Join Date: Jul 2010
Old 03-04-2023 , 18:28   Re: SDKCall for non standart conv function
Reply With Quote #2

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.
donrevan is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:19.


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