some questions ( CString, CVector, Ham )
1# I have to use CString.h or string.h
2# I have to use CVector.h or vector.h 3# How work Ham with Metamod. Because I see that RegisterHam work diferent than Fakemeta or Engine. Metamod dont exec func in Ham ( Well the function like Player Pre Think ). Plis, sorry my english. |
Re: some questions ( CString, CVector, Ham )
about 1#,2#, if you want your plugins compiled only in windows, you can use stl, if you want them to be compiled in both win and linux, use the library amxx supplied.
about #3, you mean why ham don't hook engine or dll function? |
Re: some questions ( CString, CVector, Ham )
Quote:
Quote:
PHP Code:
How Ham Hook HL or Metamod events? Else: I have to use define of ARRAYSIZE of winnt or eiface? |
Re: some questions ( CString, CVector, Ham )
Hamsandwish hooks the virtual functions(vfuncs) of a class, to explain clearly, I'll give an example.
Here is the Class Hierachy: Code:
CBaseEntity Here is part of vfuncs from CBasePlayer class Code:
0 CBasePlayer::Spawn(void) Code:
RegisterHam(Ham_TakeDamage, "player", "my_hook_func", 0 or 1) //pre or post Virtual table(vtbl) stores in each object of a class, it stores the virtual function's address(pointer). When an obj call its virtual function, it will look up the vtbl to find its real address in memory. Code:
CBasePlayer *pPlayer; Ham does the followings to hook CBasePlayer::TakeDamage function: (1)spawn a "player" entity (2)get its vtbl address (3)get its vtbl index from hamdata(actually this have been done when ham init) (4)get the vfunc address (5)generate a trampoline function (6)changed the original vfunc address in vtbl to the trampoline function address(hooking started) about the trampoline function, it looks like this: Code:
Tramp() =================== if you want to use ARRAYSIZE, use the hlsdk version |
Re: some questions ( CString, CVector, Ham )
@jim: I can use Trampoline.h from Ham, Or I have to make a new?
Is you have time, only show how to hook Ham_Spawn, Example. Only the code, without explain. I was traing but sometimes work and others no. :D Thanks!!! |
Re: some questions ( CString, CVector, Ham )
Code:
#include "amxxmodule.h" in windows this calc is Code:
mov eax, [ecx + 4]; get this->pev |
Re: some questions ( CString, CVector, Ham )
Wow Jim, Work perfect. Also the edict_t :D
Now I am Traing to Transport Trampoline from Ham to my Module. First Test Work :D |
Re: some questions ( CString, CVector, Ham )
Quote:
|
Re: some questions ( CString, CVector, Ham )
if you know how a struct store in memory, you will know the asm part above
Code:
0 string_t classname; so this->pev->pContainingEntity, you will get the entity itself from its class object. |
Re: some questions ( CString, CVector, Ham )
Quote:
http://en.wikipedia.org/wiki/Standard_Template_Library http://en.wikipedia.org/wiki/C%2B%2B_Standard_Library http://en.wikipedia.org/wiki/Core_language Also, files with extension ".h" are deprecated, use files without ".h" (read links): #include <string> #include <vector> |
All times are GMT -4. The time now is 15:06. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.