Thread: CollisionHook
View Single Post
Forgetest
Member
Join Date: Aug 2020
Old 09-15-2021 , 01:23   Re: CollisionHook
Reply With Quote #133

Quote:
Originally Posted by Psyk0tik View Post
Your setup is wrong. You need to understand that not every entity handle pointer passed to the two params will be a CBaseEntity pointer. You'll have to figure out a way to check if they are static props or not. When one of the params is a static prop, you'll want to return early to avoid crashes. You'll also want to change the param types from "cbaseentity" to "int" so DHooks doesn't convert them to entity indexes, which is also why you're getting crashes.
Thanks for your information, but nonetheless it's still crashing on Windows in my attempts.

Current setup (works on Linux L4D1):
Code:
"Games"
{
    "left4dead"
    {
        "Functions"
        {
            "PassEntityFilter"
            {
                "signature"			"PassEntityFilter"
                "callconv"			"cdecl"
                "return"			"bool"
                "this"				"ignore"
                "arguments"
                {
                    "a1"
                    {
                        "type"		"int"
                    }
                    "a2"
                    {
                        "type"		"int"
                    }
                }
            }
        }
        "Signatures"
        {
            "PassEntityFilter"
            {
                "library"		"server"
                "linux"			"@_Z22PassServerEntityFilterPK13IHandleEntityS1_"
                "windows"		"\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x75\x2A\xB0\x2A\x5F\xC3\x56"
				/* ? ? ? ? ? ? ? 75 ? B0 ? 5F C3 56 */
            }
	}
    }
}
Tried a few possible setups before I gave up on this, which includes adding an argument whilist setting "a1" to be passed in "ebx".
Given it's always a crash regardless of what's in the detour callback (empty callback included), I started to dig out a few hints from crash logs, until I met with multiple ones labelled unique signature crash.

Plugin setup:
PHP Code:
public void OnPluginStart()
{
    
Handle hData LoadGameConfigFile("CollisionHook");
    
    
Handle hDetour DHookCreateFromConf(hData"PassEntityFilter");
    if (!
hDetour
        
SetFailState("Failed to find \"PassEntityFilter\" offset.");
        
    if (!
DHookEnableDetour(hDetourfalsePassEntityFilter)) // tried both pre and post hook
        
SetFailState("Failed to detour \"PassEntityFilter\".");

    
delete hData;
}

public 
MRESReturn PassEntityFilter(Handle hReturnHandle hParams)
{
    return 
MRES_Ignored;

Several crash IDs:
Code:
XCOI-K4MM-OETP
YKWD-K76T-OXYS
A2Y6-CIZK-VEW4

Last edited by Forgetest; 09-15-2021 at 01:23.
Forgetest is offline