Quote:
Originally Posted by cravenge
BHaType posted a newer way of recreating this extension for L4D2 in the form of a plugin. The only problem is you have to find the latest offset of the PassServerEntityFilter function in the binary to make it work post-TLS.
|
Just to add to what cravenge is talking about. I went ahead with BhaType's idea and created this plugin with a forward.
Just grab the right signature for your game and it should work fine. Windows is not tested at all, so you are on your own.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <dhooks>
Handle g_CHPassEntity;
public Plugin myinfo =
{
name = "CollisionHook Dhooks",
author = "$atanic $pirit, BHaType",
description = "Hook on entity collision",
version = "1.0",
url = ""
}
public OnPluginStart()
{
GameData hData = new GameData("CollisionHook");
Handle hDetour = DHookCreateFromConf(hData, "PassEntityFilter");
if( !hDetour )
SetFailState("Failed to find \"PassEntityFilter\" offset.");
if( !DHookEnableDetour(hDetour, true, detour) )
SetFailState("Failed to detour \"PassEntityFilter\".");
delete hData;
g_CHPassEntity = CreateGlobalForward("CH_PassFilter", ET_Event, Param_Cell, Param_Cell , Param_CellByRef);
}
public MRESReturn detour(Handle hReturn, Handle hParams)
{
if(!DHookIsNullParam(hParams, 1) && !DHookIsNullParam(hParams, 2))
{
int iEntity1 = DHookGetParam(hParams, 1);
int iEntity2 = DHookGetParam(hParams, 2);
int funcresult = DHookGetReturn(hReturn);
if(g_CHPassEntity)
{
Action result = Plugin_Continue;
/* Start function call */
Call_StartForward(g_CHPassEntity);
/* Push parameters one at a time */
Call_PushCell(iEntity1);
Call_PushCell(iEntity2);
Call_PushCellRef(funcresult);
/* Finish the call, get the result */
Call_Finish(result);
if (result == Plugin_Handled)
{
DHookSetReturn(hReturn, funcresult);
return MRES_Supercede;
}
}
}
//PrintToChatAll("Entity 1 %i Entity 2 %i", iEntity1, iEntity2);
return MRES_Ignored;
}
GameData
PHP Code:
"Games"
{
"left4dead2"
{
"Functions"
{
"PassEntityFilter"
{
"signature" "PassEntityFilter"
"callconv" "cdecl"
"return" "int"
"this" "ignore"
"arguments"
{
"a1"
{
"type" "cbaseentity"
}
"a2"
{
"type" "cbaseentity"
}
}
}
}
"Signatures"
{
"PassEntityFilter"
{
"library" "server"
"windows" "\x55\x8B\xEC\x57\x8B\x7D\x0C\x85\xFF\x75"
"linux" "@_Z22PassServerEntityFilterPK13IHandleEntityS1_"
}
}
}
}