Raised This Month: $ Target: $400
 0% 

Planned SourceHook changes


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
mooman2
Member
Join Date: Apr 2007
Old 05-31-2007 , 10:27   Re: Planned SourceHook changes
Reply With Quote #14

Quote:
Originally Posted by PM View Post
Whoa, that doesn't sound healhty.
I'll try to reproduce your situation here, so I'll have to ask some questions in order to get a precise picture of what is going on

Are you running only this plugin? Or also other plugins (which hook the function in question?)

Does your plugin use deprecated callclasses (SH_GET_CALLCLASS and stuff)? And then SH_CALL on them crashes? Do you do this when there is a hook on the function? Also, is the plugin which causes the callclass-related crashes compiled against 1.5 or 1.4 headers? Thanks
EDIT: Does it crash if you have a plugin running which "uses 1.4 methods to hook DispatchEffect"? Was that plugin compiled against the 1.4 SDK? Or was it recompiled? (it is important that not-recompiled plugins don't crash) Or does it only crash if you have BOTH your new plugin and an old plugin running?

It could be possible that I've made some error when writing those source backwards compat quirks.... I'm not sure yet, I'll have to test it.

However it worries me that you can't get VP hooks working :-O
There are two kinds of VP hooks:

normal VP hooks expect a pointer to an already existing instance (internally, they add the thispointeroffset and vtable offset to the this pointer, then dereference this computer "vtable pointer pointer" and use that as a direct VP hook. the thispointeroffset and vtable offset are either given manually (manual hook) or are discovered automatically from a member function pointer (non-manual hook) ).

direct VP hooks expect a pointer to the vtable. They only do vtable[vtblidx] in order to refer to the virtual function pointer then. This means that vtblidx is not the offset from the vtable beginning, but the offset / sizeof(void*), but you probably know that anyway.

/* It is important that the function/"method" you want to hook is called through this vtable (ie. it is possible that you hook a function in one vtable; but a derived class has its own vtable and thus when someone calls baseClassPointer->Function() and baseClassPointer is in fact a pointer to a derived class which overrides one or more functions from the base class (and it doesn't matter if the function is the function you are hooking or not) your hook will not be called). But you are probably doing that correctly as BaseZombie doesn't appear to be the lowest base class having a virtual BecomeRagdoll member. */ (EDIT2: I took a look at the SDK and found out that what I wrote here was unimportant for this discussion)

The source-level backwards compatibility callclasses are only template hacks so that old plugins compile without changing code; basically SH_GET_CALLCLASS stores the this pointer in some fake callclass instance and then SH_CALL extracts it again. So it should be the same as calling SH_CALL with the this pointer directly unless I've made some fault on the way.

Sorry for my confusion, it's early in the morning ;)
I am currently running BAT, one other plugin compiled for 1.4, and this plugin.

This is the only plugin that hooks this stuff.

Yeah, my plugin uses SH_GET_CALLCLASS, but that doesn't make it crash- it's when SH_CALL's first parameter is that callclass. To fix it I changed it to the actual interface.

Yes, I do this inside a hook.

I compiled this against 1.5 headers.

Quote:
EDIT: Does it crash if you have a plugin running which "uses 1.4 methods to hook DispatchEffect"? Was that plugin compiled against the 1.4 SDK? Or was it recompiled? (it is important that not-recompiled plugins don't crash) Or does it only crash if you have BOTH your new plugin and an old plugin running?
I can't remember exactly, but I have old versions compiled against 1.4 which do the same thing and I'll see if they crash on 1.5.

What do you suggest I do to try and fix it?

Last edited by mooman2; 05-31-2007 at 22:27.
mooman2 is offline
 



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:19.


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