.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > SDK Programming discussions > Half-Life 2 SDK
Half-Life 2 SDK For developments focused around the Half-Life 2 engine Half-Life 2

Reply
 
Thread Tools
Hooking into HL2 DLL ?
Old
  (#1)
stefanhendriks
RealBot Author
 
stefanhendriks's Avatar
 
Status: Offline
Posts: 3,088
Join Date: Nov 2003
Location: Netherlands
Default Hooking into HL2 DLL ? - 12-01-2005

I got to this link via the hlcoding mailing list,

http://www.sourcemod.net/forums/viewtopic.php?t=441

i don't understand it yet. But basicly its telling how to HOOK (aka HL1 style!?) into HL2 and such... if possible, this could be more interesting...


Author of RealBot, "Arrakis" and "Dune 2 - The Maker" | co-Founder of Bots-United | Fundynamic | Blog | E-Mail me
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#2)
Cpl. Shrike
ShrikeBot Coder/Moderator
 
Cpl. Shrike's Avatar
 
Status: Offline
Posts: 550
Join Date: Mar 2004
Location: The Netherlands
Default Re: Hooking into HL2 DLL ? - 12-01-2005

Reading..... brain hurts o_O
Keeps reading
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#3)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Hooking into HL2 DLL ? - 12-01-2005

that guy had a clever idea. However, if I understand well, as soon as the interface changes a bit, he's left to rearrange all his function pointers in the vtable. I'm not sure it's very practical. It doesn't seem to bother the AMX guys though, as they are used to get/set info where they shouldn't, such as in HL1 edict's private data...



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#4)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: Hooking into HL2 DLL ? - 12-01-2005

You could probably code it so that if there is a new interface, it bypasses the hook.


sfx1999.postcount++
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#5)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Hooking into HL2 DLL ? - 13-01-2005

huh?
what would be the point ?



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#6)
sfx1999
Member
 
sfx1999's Avatar
 
Status: Offline
Posts: 534
Join Date: Jan 2004
Location: Pittsburgh, PA, USA
Default Re: Hooking into HL2 DLL ? - 13-01-2005

Well, you can hook whatever functions you need, and have the ones you don't bypass it. You can also make it so that if new functions come around, they could also bypass it.


sfx1999.postcount++
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Hooking into HL2 DLL ? - 13-01-2005

No, you don't get it. The order in which the functions are may be arranged everytime a new interface version is defined. Contrarily to HL1. That's the purpose of this "interface factory" to ensure consistency between DLLs using different versions of the interface. Unless he cares about the version of the interface he hooks onto (but I don't see him doing that), he'll be in big trouble at any minor revision of the interface.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#8)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Hooking into HL2 DLL ? - 17-01-2005

i thought about an easier way using the plugin interface. Technically if we chain the plugin, Is it not possible too dump any information between the server -> plugin interface like weapon bit id`s (really needed at the moment).


Dubb`s Coding Cave WiP - YeGods - Free Image hosting
4u-servers.co.uk : YeGods Gin Palace II - Refloated - 195.20.108.30:27025
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#9)
botman
Super Moderator
 
Status: Offline
Posts: 280
Join Date: Jan 2004
Location: Plano, TX
Default Re: Hooking into HL2 DLL ? - 17-01-2005

What do you mean by "chain the plugin"?

Plugins in Half-Life2 are implemented similar to the way they are in Metamod. The plugin does not sit between the engine and the game DLL.

In Half-Life2, the engine can call plugin functions when (after) game DLL functions are called. It's more of a branch off from the main engine/gameDLL connection than it is a connection between them.

For example, the engine calls the game DLL GameFrame() function, then when the game DLL returns back to the engine, the engine calls it for plugin A, then plugin B, then plugin C, like this...

engine->GameDLL::GameFrame()
<- GameDLL::GameFrame() returns back to the engine
engine->PluginA::GameFrame()
<- PluginA::GameFrame() returns back to then engine
engine->PluginB::GameFrame()
<- PluginB::GameFrame() returns back to the engine

...it's NOT like this...

engine->PluginA::GameFrame()->PluginB::GameFrame()->GameDLL::GameFrame()

..that would be more like the way the HPB bot hooks the game DLL. The Half-Life2 plugin system does not work that way.

botman
  
Reply With Quote
Re: Hooking into HL2 DLL ?
Old
  (#10)
dub
Member
 
dub's Avatar
 
Status: Offline
Posts: 89
Join Date: Aug 2004
Location: UK
Default Re: Hooking into HL2 DLL ? - 17-01-2005

botman what i mean is engine call`s the hook plugin, then hook plugin calls the real plugin.
Have a hook dll that sit`s in between dumping various information on engine functions passed to the real plugin.

edit
found an intresting hooking library for injecting your own code into a remote process windows only here


Dubb`s Coding Cave WiP - YeGods - Free Image hosting
4u-servers.co.uk : YeGods Gin Palace II - Refloated - 195.20.108.30:27025

Last edited by dub; 17-01-2005 at 01:58.. Reason: intresting hook library
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com