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

CollisionHook


Post New Thread Reply   
 
Thread Tools Display Modes
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 06-15-2020 , 00:29   Re: CollisionHook
Reply With Quote #111

Quote:
Originally Posted by Kellan123 View Post
CS GO

Peace-Maker one is crashing when i join the server.
You gotta ask someone to recompile the the extension for the game and then recheck the signature.
__________________
Spirit_12 is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-15-2020 , 10:26   Re: CollisionHook
Reply With Quote #112

Have you tried this updated version?
https://forums.alliedmods.net/showth...34#post2592634
__________________
Peace-Maker is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-15-2020 , 11:44   Re: CollisionHook
Reply With Quote #113

Quote:
Originally Posted by Peace-Maker View Post
Have you tried this updated version?
https://forums.alliedmods.net/showth...34#post2592634
Thank you, this one works good (CS GO Only) ;O
Attached Files
File Type: zip CollisionHook 0.2 Extension [Windows].zip (183.1 KB, 368 views)
File Type: zip CollisionHook 0.2 Extension [Linux].zip (85.4 KB, 410 views)

Last edited by Kellan123; 08-21-2020 at 13:34. Reason: FULL Update (NEW SYNTAX + BOOL FIX)
Kellan123 is offline
vikingo12
Member
Join Date: Nov 2018
Old 02-14-2021 , 11:58   Re: CollisionHook
Reply With Quote #114

Anybody got working version of collisionhook for windows [l4d2]?

Last edited by vikingo12; 02-14-2021 at 11:59.
vikingo12 is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 02-14-2021 , 19:50   Re: CollisionHook
Reply With Quote #115

Quote:
Originally Posted by vikingo12 View Post
Anybody got working version of collisionhook for windows [l4d2]?
Game?
__________________
Spirit_12 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-15-2021 , 03:35   Re: CollisionHook
Reply With Quote #116

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.
cravenge is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 02-15-2021 , 17:05   Re: CollisionHook
Reply With Quote #117

Quote:
Originally Posted by cravenge View Post
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(hDetourtruedetour) ) 
        
SetFailState("Failed to detour \"PassEntityFilter\".");
    
delete hData;
    
    
g_CHPassEntity CreateGlobalForward("CH_PassFilter"ET_EventParam_CellParam_Cell Param_CellByRef);
}


public 
MRESReturn detour(Handle hReturnHandle hParams)
{
    if(!
DHookIsNullParam(hParams1) && !DHookIsNullParam(hParams2))
    {
        
int iEntity1    DHookGetParam(hParams1);
        
int iEntity2    DHookGetParam(hParams2);
        
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(hReturnfuncresult);
                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_"
            
}
        }
    }

Attached Files
File Type: txt CollisionHook.txt (573 Bytes, 103 views)
File Type: sp Get Plugin or Get Source (CollisionHook.sp - 135 views - 1.5 KB)
__________________
Spirit_12 is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-16-2021 , 05:33   Re: CollisionHook
Reply With Quote #118

What's the string to search for in order to find this function? The reason why I'm asking this is cuz I want to get its base address instead since I'm using BHaType's hooking via script manager method.
cravenge is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 02-16-2021 , 09:30   Re: CollisionHook
Reply With Quote #119

Quote:
Originally Posted by cravenge View Post
What's the string to search for in order to find this function? The reason why I'm asking this is cuz I want to get its base address instead since I'm using BHaType's hooking via script manager method.
You can find it by searching "RagdollImpact" which will lead you to the "CBaseEntity::FireBullets" function. That function contains other strings you can reference but the "RagdollImpact" is the one closest to the function we'll need. A little below that string, you'll see a function called "Pickup_ForcePlayerToDropThisObject" (the function we need) which will only have two references. The second one will be the function "CTraceFilterMelee::ShouldHitEntity". When you look inside that function, you will see that it calls "PassServerEntityFilter" in the Linux binaries. In the Windows binaries, it'll be the 2nd subroutine that you'll see in an "if" statement.

Linux:
PHP Code:
v3 0;
  if ( (
unsigned __int8)StandardFilterRules(a2a3) )
  {
    if ( 
PassServerEntityFilter(a2, *((const IHandleEntity **)this 1))
      && !(*(
unsigned __int8 (__cdecl **)(intIHandleEntity *))(*(_DWORD *)staticpropmgr 8))(staticpropmgra2) )
    { 
Windows:
PHP Code:
if ( !(unsigned __int8)sub_1020B800(a2a3)
    || !(
unsigned __int8)sub_1020B760(a2, *(_DWORD *)(this 4)) 
I ran makesig.idc on "sub_1020B760" and got the same signature (minus the last wildcarded byte) as Spirit_12:
PHP Code:
Signature for sub_1020B760:
55 8B EC 57 8B 7D 0C 85 FF 75 
\
x55\x8B\xEC\x57\x8B\x7D\x0C\x85\xFF\x75\x2A 
__________________

Last edited by Psyk0tik; 02-16-2021 at 09:32.
Psyk0tik is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 02-16-2021 , 09:39   Re: CollisionHook
Reply With Quote #120

Quote:
Originally Posted by Crasher_3637 View Post
You can find it by searching "RagdollImpact" which will lead you to the "CBaseEntity::FireBullets" function. That function contains other strings you can reference but the "RagdollImpact" is the one closest to the function we'll need. A little below that string, you'll see a function called "Pickup_ForcePlayerToDropThisObject" (the function we need) which will only have two references. The second one will be the function "CTraceFilterMelee::ShouldHitEntity". When you look inside that function, you will see that it calls "PassServerEntityFilter" in the Linux binaries. In the Windows binaries, it'll be the 2nd subroutine that you'll see in an "if" statement.

Linux:
PHP Code:
v3 0;
  if ( (
unsigned __int8)StandardFilterRules(a2a3) )
  {
    if ( 
PassServerEntityFilter(a2, *((const IHandleEntity **)this 1))
      && !(*(
unsigned __int8 (__cdecl **)(intIHandleEntity *))(*(_DWORD *)staticpropmgr 8))(staticpropmgra2) )
    { 
Windows:
PHP Code:
if ( !(unsigned __int8)sub_1020B800(a2a3)
    || !(
unsigned __int8)sub_1020B760(a2, *(_DWORD *)(this 4)) 
I ran makesig.idc on "sub_1020B760" and got the same signature (minus the last wildcarded byte) as Spirit_12:
PHP Code:
Signature for sub_1020B760:
55 8B EC 57 8B 7D 0C 85 FF 75 
\
x55\x8B\xEC\x57\x8B\x7D\x0C\x85\xFF\x75\x2A 
This really helped me a lot. Thanks! By the way, how did you compare the functions? I'm using IDA and I couldn't see any feature that provided that.
cravenge is offline
Reply


Thread Tools
Display Modes

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


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