Raised This Month: $12 Target: $400
 3% 

Sourcehook problem on linux


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AnAkIn
Junior Member
Join Date: Jan 2007
Old 01-09-2009 , 12:28   Sourcehook problem on linux
Reply With Quote #1

Hi,

We have a plugin which tries to modifies the TF2 soldier self damage using sourcehook.

It works by modifying a cvar which is the coefficient of the soldier self damage. This plugin works fine on Windows, no problem at all. But when we are trying on Linux, it doesn't work at all, the cvar just has no effect.

Here is the part of code in our plugin for this feature (it's not the only thing in the plugin):
http://nocclan.free.fr/soldierselfdamage.txt

We tried 2 others hooking methods, normal hook and manual hook with offset. Both worked on Windows but not on Linux.

NOTE: This is not a MM Source plugin. It's just a normal TF2 plugin with sourcehook included.

Thanks in advance.

AnAkIn
EDIT: There is also a linux server which keeps crashing when someone connects, at the end of the loading bar. The guy can't put -debug because he's renting the server, and we didn't find anyone else with the crashing problems. We know it's the soldier self damage code because removing it make it not crash.

Last edited by AnAkIn; 01-10-2009 at 11:10.
AnAkIn is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 01-09-2009 , 15:35   Re: Sourcehook problem on linux
Reply With Quote #2

Are you using the standard takedamage code from the SDK? TF2 has made some changes to the CTakeDamageInfo class and some of the member variables don't "line up" anymore and the compiler ends up pointing to the wrong location in memory.

If that's the actual problem, I'm surprised it worked on one OS and not the other though.
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
AnAkIn
Junior Member
Join Date: Jan 2007
Old 01-09-2009 , 15:45   Re: Sourcehook problem on linux
Reply With Quote #3

Someone told me to do this change in takedamageinfo.h:

Find:

Code:
    EHANDLE            m_hAttacker;
Add after:
Code:
    int             m_iDummy;
That's what I did and it still not work on linux.


Is there anything else to modify?
AnAkIn is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 01-09-2009 , 16:02   Re: Sourcehook problem on linux
Reply With Quote #4

That should do it.

The other thing I see is that you're not using a manual hook. The virtual function table is probably not the same as what's in the SDK. You should use a manual hook using the correct vtable offset (I think this list is current.) Make sure to add 1 to that offset on Linux.

The Dukehacks extension does something similar with TraceAttack so you could look at that source code for an example (TraceAttack isn't called on some explosion weapons, but the concept is the same). The TakeDamage detour is called on all weapons and it works on Linux and Windows. It's a little more complicated to implement though.

Not sure if the vtable hook not being manual is the problem or not, but it will most likely become a problem with a future update if it's not.
__________________
"Good grammar is essential, Robin."
- Batman

Last edited by L. Duke; 01-09-2009 at 16:06.
L. Duke is offline
AnAkIn
Junior Member
Join Date: Jan 2007
Old 01-09-2009 , 16:17   Re: Sourcehook problem on linux
Reply With Quote #5

We already tried the manual hook with vtable offset, and it also only worked on Windows (we did add 1 for the offset on linux).


EDIT: There is also a linux server which keeps crashing when someone connects, at the end of the loading bar. The guy can't put -debug because he's renting the server, and we didn't find anyone else with the crashing problems. We know it's the soldier self damage code because removing it make it not crash.

Last edited by AnAkIn; 01-10-2009 at 11:10.
AnAkIn is offline
AnAkIn
Junior Member
Join Date: Jan 2007
Old 01-12-2009 , 14:15   Re: Sourcehook problem on linux
Reply With Quote #6

Manual hook here:

http://nocclan.free.fr/soldierselfdamage2.txt

Still not work on Linux.
AnAkIn is offline
AnAkIn
Junior Member
Join Date: Jan 2007
Old 01-23-2009 , 13:16   Re: Sourcehook problem on linux
Reply With Quote #7

We tried adding 2 other features to the plugin which work with SourceHook, and again, both work under Windows and not under Linux? oO

There seem to be a problem with SourceHook and Linux :s

Last edited by AnAkIn; 01-23-2009 at 13:22.
AnAkIn is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 01-23-2009 , 15:23   Re: Sourcehook problem on linux
Reply With Quote #8

I fired up a server with GDB, and OnTakeDamage is definitely being called when the soldier damages himself (twice actually for some reason).

The code you pasted on #sourcemod looks fine. Not sure what could be wrong. I assume WIN32 isn't defined in your linux compile?
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
AnAkIn
Junior Member
Join Date: Jan 2007
Old 01-25-2009 , 13:29   Re: Sourcehook problem on linux
Reply With Quote #9

Ok we finally fixed it, it was a problem in the makefile.
AnAkIn is offline
Drunken F00l
Member
Join Date: May 2007
Old 02-16-2009 , 05:09   Re: Sourcehook problem on linux
Reply With Quote #10

Hey, could you please post your makefile problem and solution? I think I have a similar issue in my plugin.

The hooks work in Windows but are never called in Linux.
Drunken F00l is offline
Reply



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 08:40.


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