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

CollisionHook


Post New Thread Reply   
 
Thread Tools Display Modes
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 11-24-2019 , 06:01   Re: CollisionHook
Reply With Quote #101

How can I call pre-hooks or pre-detour please?
__________________
HarryPotter is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 11-24-2019 , 13:21   Re: CollisionHook
Reply With Quote #102

Okay, I have tried loading this extension for Windows (the one from Spirit's GitHub repo) with the new signature provided in the previous page. It gets loaded but the moment a map is fully loaded, the server crashes. I haven't tried with the one from here but I doubt it will produce a different result.

Last edited by cravenge; 11-24-2019 at 13:22.
cravenge is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 11-24-2019 , 17:00   Re: CollisionHook
Reply With Quote #103

This is my understanding from what I read of Peace-Maker's reply. You are to store the entity data in pre hook phase as opposed to using DHookGetParam in post hook.

I don't have a windows server running, so this is an untested version, but it should work.

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <dhooks>

// Global Variables to store parameters.
int g_iEntityOne;
int g_iEntityTwo;

public 
OnPluginStart()
{
    
// Setup gamedata file
    
GameData hData = new GameData("l4dcollisionhook");

    
Handle hDetour DHookCreateFromConf(hData"PassEntityFilter");
    if( !
hDetour 
        
SetFailState("Failed to find \"PassEntityFilter\" offset.");
    
delete hData;

    
// Setup pre hook to grab parameters
    
if( !DHookEnableDetour(hDetourfalsedetour_pre) ) 
        
SetFailState("Failed to detour \"PassEntityFilter\". pre");
    
    
// Setup post hook
    
if( !DHookEnableDetour(hDetourtruedetour_post) ) 
        
SetFailState("Failed to detour \"PassEntityFilter\". post");
}

public 
MRESReturn detour_pre(Handle hReturnHandle hParams)
{
    
// Store prehook parameters into global variables
    
g_iEntityOne    =    DHookGetParam(hParams1);
    
g_iEntityTwo    =    DHookGetParam(hParams2);
    
    
PrintToServer("Entity 1 %i Entity 2 %i"DHookGetParam(hParams1), DHookGetParam(hParams2));
    return 
MRES_Ignored;


public 
MRESReturn detour_post(Handle hReturnHandle hParams)
{
    
PrintToServer("Entity 1 %i Entity 2 %i"g_iEntityOneg_iEntityTwo);
    return 
MRES_Ignored;

__________________
Spirit_12 is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 11-25-2019 , 05:51   Re: CollisionHook
Reply With Quote #104

Quote:
Originally Posted by Spirit_12 View Post
This is my understanding from what I read of Peace-Maker's reply. You are to store the entity data in pre hook phase as opposed to using DHookGetParam in post hook.

I don't have a windows server running, so this is an untested version, but it should work.
still crash after few seconds I join the server.

I try to check if a parameter is NULL using the DHookIsNullParam in pre-hook and post-hook, it works without any errors
but still cause windows server crash, I guess windows is pretty complicated
PHP Code:
 if(DHookIsNullParam(hParams1) || DHookIsNullParam(hParams2)) return MRES_Ignored
__________________

Last edited by HarryPotter; 11-25-2019 at 05:52.
HarryPotter is offline
BHaType
Great Tester of Whatever
Join Date: Jun 2018
Old 11-25-2019 , 06:20   Re: CollisionHook
Reply With Quote #105

Try this gamedata

PHP Code:
"Games"
{
    
"left4dead2"
    
{
        
"Functions"
        
{
            
"PassEntityFilter"
            
{
                
"signature"        "PassEntityFilter"
                "callconv"        "cdecl"
                "return"        "bool"
                "this"            "ignore"
                "arguments"
                
{
                    
"a1"
                    
{
                        
"type"    "cbaseentity"
                    
}
                    
"a2"
                    
{
                        
"type"    "cbaseentity"
                    
}
                }
            }
        }
        
"Signatures"
        
{
            
"PassEntityFilter"
            
{
                
"library" "server"
                "windows"        "\x55\x8B\xEC\x57\x8B\x7D\x0C\x85\xFF\x75"
            
}
        }
    }


If this doesn't help then change the
Code:
"callconv"        "cdecl"
to this
Code:
"callconv"        "thiscall"
__________________
cry

Last edited by BHaType; 11-25-2019 at 16:50.
BHaType is offline
Send a message via AIM to BHaType
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 11-26-2019 , 07:35   Re: CollisionHook
Reply With Quote #106

Quote:
Originally Posted by BHaType View Post
Try this gamedata

PHP Code:
[DHOOKSFATALFailed to find return address of original function. Check the arguments and return type of your detour setup
__________________
HarryPotter is offline
Nerus
Senior Member
Join Date: Aug 2010
Location: Poland
Old 12-28-2019 , 11:31   Re: CollisionHook
Reply With Quote #107

This works for me on Windows and Linux in CSS
PHP Code:
"Games"
{
    
"#default"
    
{
        
"Signatures"
        
{
            
"PassServerEntityFilter"
            
{
                
"library"    "server"
                
                "windows"    "\x55\x8B\xEC\x56\x8B\x2A\x2A\x85\x2A\x75\x2A\xB0\x2A\x5E"
                "linux"        "@_Z22PassServerEntityFilterPK13IHandleEntityS1_"
            
}
        }
    }


Last edited by Nerus; 12-28-2019 at 11:31.
Nerus is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-13-2020 , 17:19   Re: CollisionHook
Reply With Quote #108

L 06/14/2020 - 00:19:05: [SM] Unable to load extension "collisionhook.ext": The specified procedure could not be found.

windows ?

using: https://bitbucket.org/VoiDeD/collisionhook/downloads/ 0.2.zip
Attached Thumbnails
Click image for larger version

Name:	oof.PNG
Views:	121
Size:	11.8 KB
ID:	182006   Click image for larger version

Name:	aa.PNG
Views:	110
Size:	21.9 KB
ID:	182007  

Last edited by Kellan123; 06-13-2020 at 17:25.
Kellan123 is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 06-13-2020 , 19:51   Re: CollisionHook
Reply With Quote #109

Quote:
Originally Posted by Kellan123 View Post
L 06/14/2020 - 00:19:05: [SM] Unable to load extension "collisionhook.ext": The specified procedure could not be found.

windows ?

using: https://bitbucket.org/VoiDeD/collisionhook/downloads/ 0.2.zip
You are running the version from 2013, therefore it seems like a linking issue. What game are you running?
__________________
Spirit_12 is offline
Kellan123
AlliedModders Donor
Join Date: Aug 2012
Old 06-14-2020 , 01:24   Re: CollisionHook
Reply With Quote #110

Quote:
Originally Posted by Spirit_12 View Post
You are running the version from 2013, therefore it seems like a linking issue. What game are you running?
CS GO

Peace-Maker one is crashing when i join the server.

Last edited by Kellan123; 06-15-2020 at 11:48.
Kellan123 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 07:06.


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