Raised This Month: $1944 Target: $400
 486% 

DHooks (Dynamic Hooks - Dev Preview)


Post New Thread Reply   
 
Thread Tools Display Modes
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 05-13-2015 , 17:30   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #281

Quote:
Originally Posted by Neuro Toxin View Post
Spoiler
I cant get DHookGetReturn to give me an entity index for GiveNamedItem's return type.

If I create a hook with the return type of ReturnType_Int it get this:
Code:
----------==========> MRESReturn:OnGiveNamedItem(client=3, entity=164975072)
----------==========> MRESReturn:OnGiveNamedItem(client=3, entity=177344800)
----------==========> MRESReturn:OnGiveNamedItem(client=3, entity=177231552)
----------==========> MRESReturn:OnGiveNamedItem(client=3, entity=164039216)
Which looks like a pointer to me. So I naturally try ReturnType_CBaseEntity which crashes the server

I think the return type is CBaseEntity*. Is there anyway way for me to convert this into a entity index?
There is a bug in DHooks2, I will fix it soon. It appears I did some bad copy pasting from the param logic and this totally broke returns of pointers
Dr!fter is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-13-2015 , 17:45   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #282

Yay!

I have to mention where due.

This extension is really useful. Love your work guys.
__________________
Neuro Toxin is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-14-2015 , 10:25   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #283

Quote:
Originally Posted by psychonic View Post
It's in sourcepawn/include now, instead of public/sourcepawn/ or wherever it was.
Actually, there are a number of other build problem building on SM 1.8.

The first four can just be tossed into the existing AMBuildScript. Specifically:

Code:
      os.path.join(self.sm_root, 'sourcepawn', 'include'),
      os.path.join(self.sm_root, 'sourcepawn', 'vm'),
      os.path.join(self.sm_root, 'sourcepawn', 'vm', 'x86'),
      os.path.join(self.sm_root, 'public', 'amtl', 'include'),
in the builder.compiler.cxxincludes array.

The last problem I see may not be compatible. DHooks has the path to assembler-x86.cpp hard-coded into the AMBuildScript (well... using os.path.join, but close enough):

Code:
program.sources += [os.path.join(DHooks.sm_root, 'public', 'jit', 'x86', "assembler-x86.cpp"),]
This file moved in SM 1.8:

Code:
program.sources += [os.path.join(DHooks.sm_root, 'sourcepawn', 'vm', 'x86', "assembler-x86.cpp"),]
Is it possible to detect if a file exists and/or what SM version we're compiling against inside AMBuild?

Edit: Herpa-Derp... of course you can. AMBuildScript is just a Python script after all. os.path.isfile should work for this.

Incidentally, I've attached the working AMBuildScript for DHooks2 and SM 1.8.
Attached Files
File Type: zip AMBuildScript.zip (2.3 KB, 50 views)
__________________
Am I back? Well, we'll see.

Last edited by Powerlord; 05-14-2015 at 11:48.
Powerlord is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 05-14-2015 , 12:21   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #284

I fixed the problem with returns that were pointers. I hopefully didnt break anything else, the code for handling returns needs to be rewritten at some point as it is quiet ugly (Ill probably get around to it soon). I tested changing returns of ints, floats, bools, and pointers and they all appear to be working correctly so hopefully the ones I didnt test also work. I also updated the test plugin so it no longer spews things about keywords (this, interface).

The code i used to test.

PHP Code:
new Handle:hGiveNamedItem;
public 
OnPluginStart()
{
    
int offset 445;
    
    
hGiveNamedItem DHookCreate(offsetHookType_EntityReturnType_CBaseEntityThisPointer_CBaseEntityOnGiveNamedItem);
    
DHookAddParam(hGiveNamedItemHookParamType_CharPtr);
    
DHookAddParam(hGiveNamedItemHookParamType_Int);
    
DHookAddParam(hGiveNamedItemHookParamType_Unknown);
    
DHookAddParam(hGiveNamedItemHookParamType_Bool);
}
public 
void OnClientPutInServer(client)
{
    if (
IsFakeClient(client))
        return;
    
    
DHookEntity(hGiveNamedItemtrueclient);
}

public 
MRESReturn OnGiveNamedItem(pThisHandle hReturnHandle hParams)
{   
    
PrintToConsole(pThis"----------==========> MRESReturn:OnGiveNamedItem(client=%d, entity=%d)"pThisDHookGetReturn(hReturn));
    return 
MRES_Ignored;

You can grab the latest snapshot on the link in the first post.

Last edited by Dr!fter; 05-14-2015 at 12:23.
Dr!fter is offline
Electr000999
Senior Member
Join Date: Aug 2011
Location: Russia, Perm
Old 05-14-2015 , 13:13   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #285

anyone can help with this?
issue only on linux..
Electr000999 is offline
Send a message via Skype™ to Electr000999
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-14-2015 , 14:41   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #286

Here's a new AMBuilldScript file that compiles on both SM 1.7 and SM 1.8.

I should do a pull request on this, but I haven't had a chance.

Edit: Filed a pull request.
Attached Files
File Type: zip AMBuildScript.zip (2.4 KB, 42 views)
__________________
Am I back? Well, we'll see.

Last edited by Powerlord; 05-14-2015 at 15:26.
Powerlord is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-14-2015 , 17:22   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #287

Quote:
Originally Posted by Dr!fter View Post
I fixed the problem with returns that were pointers. I hopefully didnt break anything else, the code for handling returns needs to be rewritten at some point as it is quiet ugly (Ill probably get around to it soon). I tested changing returns of ints, floats, bools, and pointers and they all appear to be working correctly so hopefully the ones I didnt test also work. I also updated the test plugin so it no longer spews things about keywords (this, interface).

The code i used to test.

PHP Code:
new Handle:hGiveNamedItem;
public 
OnPluginStart()
{
    
int offset 445;
    
    
hGiveNamedItem DHookCreate(offsetHookType_EntityReturnType_CBaseEntityThisPointer_CBaseEntityOnGiveNamedItem);
    
DHookAddParam(hGiveNamedItemHookParamType_CharPtr);
    
DHookAddParam(hGiveNamedItemHookParamType_Int);
    
DHookAddParam(hGiveNamedItemHookParamType_Unknown);
    
DHookAddParam(hGiveNamedItemHookParamType_Bool);
}
public 
void OnClientPutInServer(client)
{
    if (
IsFakeClient(client))
        return;
    
    
DHookEntity(hGiveNamedItemtrueclient);
}

public 
MRESReturn OnGiveNamedItem(pThisHandle hReturnHandle hParams)
{   
    
PrintToConsole(pThis"----------==========> MRESReturn:OnGiveNamedItem(client=%d, entity=%d)"pThisDHookGetReturn(hReturn));
    return 
MRES_Ignored;

You can grab the latest snapshot on the link in the first post.
Thanks Dr!fter

Just left for work. I'll test it tonight
__________________
Neuro Toxin is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-15-2015 , 20:04   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #288

Works perfect now.

Thanks Dr!fter!
__________________
Neuro Toxin is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 05-16-2015 , 09:57   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #289

Updated to version 2.0.2. In my attempt to fix pointer returns i created a memory leak, it is now fixed in the latest build.
Dr!fter is offline
Apina
AlliedModders Donor
Join Date: May 2013
Old 05-20-2015 , 16:15   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #290

[12] <FAILED> file "dhooks.ext.so": Extension version is too new to load (8, max is 7)

Using in CSS, sourcemod 1.6.4 and using latest version css server

Tryed out 2.0.0 version to 2.0.2 version dhooks same problem.

Last edited by Apina; 05-20-2015 at 16:54.
Apina 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 13:36.


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