Thread: CollisionHook
View Single Post
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 09-16-2021 , 21:50   Re: CollisionHook
Reply With Quote #135

Quote:
Originally Posted by Forgetest View Post
Thanks for your information, but nonetheless it's still crashing on Windows in my attempts.

Current setup (works on Linux L4D1):
...

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:
...

Several crash IDs:
...
The function seems to be setup differently on Windows for both games. I can't say anything definite yet since I'm looking more into this, but so far, it seems that the function may not be "detour-able" on Windows because of its non-standard calling convention.

I haven't tested Linux but the following setup should work fine on both games without needing any extra params. You'll still need to convert the IHandleEntities though.
PHP Code:
"PassServerEntityFilter"
{
    
"signature"    "PassServerEntityFilter"
    "callconv"    "cdecl"
    "return"    "bool"
    "this"        "ignore"
    "arguments"
    
{
        
"entity1"
        
{
            
"type"        "int"
        
}
        
"entity2"
        
{
            
"type"        "int"
        
}
    }

Quote:
Originally Posted by cravenge View Post
Maybe the fault lies within DHooks and how it replaces the first six bytes of the function during the detouring process.
The first few bytes are just relocated since all DHooks does is replace them with a jump instruction to use its function instead. Those bytes only matter when DHooks accesses them (i.e. creating a detour to send a forward to all plugins detouring the function, restoring the original bytes when no plugin is detouring the function anymore, etc.).
__________________
Psyk0tik is offline