Raised This Month: $305 Target: $400
 76%   Almost there!

[SOLVED]Detour ShouldHitEntity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 09-19-2016 , 19:43   [SOLVED]Detour ShouldHitEntity
Reply With Quote #1

Hello. I want detour CTraceFilterSimple::ShouldHitEntity, so i found part of code in collisionhook extension thread, made by God-Tony. I want to know 1 thing - how next code is look like?I need to know how look like
g_iPassEntOffs and g_iCollisionOffs in code. I know, its offsets of contentmask and collisiongroup, but i want to know how declare it (or it just integer?).
Thanks in advance.

PHP Code:
DETOUR_DECL_MEMBER2(ShouldHitEntityboolIHandleEntity *, pHandleEntityintcontentsMask)
{
    
IHandleEntity *m_pPassEnt = *(IHandleEntity **)((intptr_t)this g_iPassEntOffs);
    
int m_collisionGroup = *(int *)((intptr_t)this g_iCollisionOffs);

    
cell_t result DETOUR_MEMBER_CALL(ShouldHitEntity)(pHandleEntitycontentsMask);

    if (!
pHandleEntity || !m_pPassEnt || pHandleEntity == m_pPassEnt)
        return (
result != 0);

    
cell_t touchEnt gamehelpers->EntityToBCompatRef((CBaseEntity *)pHandleEntity);
    
cell_t passEnt gamehelpers->EntityToBCompatRef((CBaseEntity *)m_pPassEnt);

    
g_pOnShouldCollide->PushCell(touchEnt);
    
g_pOnShouldCollide->PushCell(passEnt);
    
g_pOnShouldCollide->PushCell(m_collisionGroup);
    
g_pOnShouldCollide->PushCell(contentsMask);
    
g_pOnShouldCollide->PushCellByRef(&result);
    
g_pOnShouldCollide->Execute(NULL);

    return (
result != 0);

Need to use GETGAMEDATAOFFSET.

Last edited by keygens; 09-19-2016 at 20:16.
keygens is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 09-24-2016 , 10:04   Re: [SOLVED]Detour ShouldHitEntity
Reply With Quote #2

I would have replied here earlier if this wasn't marked as "solved". Anyway in response to your PM:
Quote:
Originally Posted by keygens
Hello. Trying to declare your code for collisionhook.But i want to know, what is g_iPassEntOffs? As i know g_iCollisionOffs is m_CollisionGroup, correct? But what is g_iPassEntOffs? Thanks for your possible answer.
It's referring to these member vars: https://mxr.alliedmods.net/hl2sdk-sd...l_shared.h#128

The offsets are probably still 4 and 8 bytes for every game.
__________________
GoD-Tony is offline
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 09-24-2016 , 22:03   Re: [SOLVED]Detour ShouldHitEntity
Reply With Quote #3

Quote:
Originally Posted by GoD-Tony View Post
I would have replied here earlier if this wasn't marked as "solved". Anyway in response to your PM:
It's referring to these member vars: https://mxr.alliedmods.net/hl2sdk-sd...l_shared.h#128

The offsets are probably still 4 and 8 bytes for every game.
Thank you!
keygens is offline
Komodo3000
Junior Member
Join Date: Sep 2017
Old 09-22-2017 , 12:16   Re: [SOLVED]Detour ShouldHitEntity
Reply With Quote #4

Hello, I'm trying to get this code to run, but I have the same problem keygens had/described in the first post. I get that the the vars g_iPassEntOffs and g_iCollisionOffs refer to m_pPassEnt & m_collisionGroup as described by GoD-Tony but don't know how to declare the vars in a different file so that they contain the correct data. Could someone please explain how I accomplish that?

Thanks in advance!
Komodo3000 is offline
keygens
Senior Member
Join Date: Mar 2010
Location: Somewhere
Old 12-19-2017 , 11:29   Re: [SOLVED]Detour ShouldHitEntity
Reply With Quote #5

Quote:
Originally Posted by Komodo3000 View Post
Hello, I'm trying to get this code to run, but I have the same problem keygens had/described in the first post. I get that the the vars g_iPassEntOffs and g_iCollisionOffs refer to m_pPassEnt & m_collisionGroup as described by GoD-Tony but don't know how to declare the vars in a different file so that they contain the correct data. Could someone please explain how I accomplish that?

Thanks in advance!

Something like this:

PHP Code:
const int  g_iPassEntOffs 4;
const 
int g_iCollisionOffs 8

Last edited by keygens; 12-19-2017 at 11:30.
keygens 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 00:46.


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