View Single Post
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 09-13-2012 , 12:11   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #60

Its possible. Its a little more complicated, but here is some code (untested).

Gamedata
Code:
"Games"
{
	"cstrike"
	{
		"Keys"
		{
			"ServerGameDLL"	"ServerGameDLL009"
		}
		"Offsets"
		{
			"BotHibernate"
			{
				"windows"	"38"
				"linux"		"38"
			}
		}
		"Signatures"
		{
			"CreateInterface"
			{
				"library"		"server"
				"windows"		"\x55\x8B\xEC\x56\x8B\x35\x2A\x2A\x2A\x2A\x57\x85\xF6\x74\x2A\x8B\x2A\x2A\x8B\x2A\x2A\x8B\xCF"
				"linux"			"@CreateInterface"
			}
		}
	}
}
Note the CreateInterface Sig also works in CS:GO

Part of the plugin
PHP Code:
public OnPluginStart()
{
    new 
Handle:gameconf LoadGameConfigFile("gamedata.games");
    if(
gameconf == INVALID_HANDLE)
    {
        
SetFailState("Failed to find gamedata.games.txt gamedata");
    }
    new 
offset GameConfGetOffset(gameconf"BotHibernate");
    if(
offset == -1)
    {
        
SetFailState("Failed to find offset for BotHibernate");
        
CloseHandle(gameconf);
    }
    
StartPrepSDKCall(SDKCall_Static);
    if(!
PrepSDKCall_SetFromConf(gameconfSDKConf_Signature"CreateInterface"))
    {
        
SetFailState("Failed to get CreateInterface");
        
CloseHandle(gameconf);
    }
    
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_PointerVDECODE_FLAG_ALLOWNULL);
    
PrepSDKCall_SetReturnInfo(SDKType_PlainOldDataSDKPass_Plain);
    
    new 
String:interface[64];
    if(!
GameConfGetKeyValue(gameconf"ServerGameDLL", interface, sizeof(interface)))
    {
        
SetFailState("Failed to get servergamedll interface name");
        
CloseHandle(gameconf);
    }
    
    new 
Handle:temp EndPrepSDKCall();
    new 
Address:addr SDKCall(temp, interface, 0);
    
    
CloseHandle(gameconf);
    
CloseHandle(temp);
    
    if(!
addr)
    {
        
SetFailState("Failed to get servergamedll ptr");
    }
    
//SETUP THE HOOK STUFF HERE (PARAMS, RETURNS ETC)
    
DHookRaw(myhandlefalseaddr);

Here is an example, The gamedata is wrong for css it should be the same as csgo's due to the last update, but should give you a good idea of how it works. Also note, that it gets the function from the engine since the interface is in the engine. In your case the interface is in server.

http://dl.dropbox.com/u/72634408/nav_fix.sp
http://dl.dropbox.com/u/72634408/navfix.games.txt
Dr!fter is offline