voided / CollisionHook

10 stars 4 forks source link

TF2 update #10

Closed bottiger1 closed 3 weeks ago

bottiger1 commented 5 months ago

The new update changed the calling convention.

The signature for linux is now this

_Z22PassServerEntityFilterPK13IHandleEntityS1_.part.0

use this for the hook

CDetour* PassServerEntityFilterFuncDetour;
__attribute__((regparm(2))) bool (*PassServerEntityFilterFunc_Actual)(const IHandleEntity*, const IHandleEntity*);
__attribute__((regparm(2))) bool PassServerEntityFilterFunc(const IHandleEntity* pTouch, const IHandleEntity* pPass)
voided commented 5 months ago

@bottiger1 by chance do you know if windows is affected by calling conv changes?

bottiger1 commented 5 months ago

I don't know sorry, I've been too busy trying to fix other crashes with this update.

gaejuck commented 4 months ago

I want to use this extension in linux, when will this issue be solved?

bottiger1 commented 4 months ago

@gaejuck you can edit the source yourself and gamedata. if you don't know how to compile then you can use the one I made.

collisionhook.ext.2.tf2.so.zip

I am too busy to make a pull request out of this as I have a lot of extensions to port to 64 bit and it doesn't look like anyone else seems to be worried that 32bit servers might be removed suddenly.

voided commented 4 months ago

People are definitely worried. There's an entire discord with tf2 server reps and community modders that are trying to coordinate the 64bit work.

It's just a manpower problem - more work exists than people able to do it.

Personally, I've resigned to shutting down my servers when 64bit hits, unless I miraculously find free time.

bottiger1 commented 4 months ago

Well I am looking at this https://forums.alliedmods.net/forumdisplay.php?f=134 and it seems like nobody has mentioned or updated their extensions for 64bit.

It also seems like the vast majority of extensions just work without any changes. I was able to port a few of them like pointdetour in 5 minutes. So I feel like if people were worried then I'd have seen more progress on these things by now.

I understand that some will take a lot more work to fix like dhooks but it doesn't seem to be the majority.

fearts commented 4 months ago

@bottiger1

Most people have moved to the SM Discord to discuss issue they are having. You will notice the forums are highly inactive and rarely get responded to. People know this and it's just easier to talk on the SM Discord were people are active and interacting with each other.

If you have fixes for any extensions it would be very kind of you if you did post them so people can be ready once 32bit support gets dropped. People have been working on 64bit stuff (like Dhooks) but from my understanding there is some fixes needed on Sourcemods end before the ball can get rolling on updating everything.

There are not as many people working on Sourcemod as there have been in the past, so anything you can contribute to the public is highly valueable to everyone. I understand you are busy with your own servers so if you ever have time that would be greatly appreciated. Thanks.

bottiger1 commented 4 months ago

@fearts

Thanks for the notice but I won't be joining the sourcemod discord if I can help it.

Not only is it risky to put all your content into a privately owned company that has been known for false bans, but it really doesn't make sense to me for people to have to use Discord search to find random attachments. This seems like a giant step backwards from an actual forum or github.

I left sourcemod IRC over 10 years ago for a reason. It was an unmoderated hotbed of competing communities talking trash and spreading lies about us, and it still seems like it is the case nowadays as people have told me recently. I'd rather not ruin my mood exposing myself to that daily.

And to add insult to injury, apparently the owner of the discord is 404usernotfound who has been slandering us everywhere since I banned him for 1 day for saying n-word 14 years ago.

I will release my ports when I have time, but I need to ensure that our servers don't get downed for days when 32bit servers are randomly removed, so this means no time to create github forks for each extension, copying existing files to another location, and back and then submitting a pull request. I also don't want to be responsible for updating these extensions for windows as it is a giant hassle to find window sigs.

voided commented 4 months ago

I'll happily accept a git patch for CH if there's anything floating around.

I just don't have anything setup for reverse engineering or running linux srcds.

bottiger1 commented 4 months ago

don't use the last 2 posted if you saw it

diff --git a/sourcemod/gamedata/collisionhook.txt b/sourcemod/gamedata/collisionhook.txt
index 96af269..5ae8020 100644
--- a/sourcemod/gamedata/collisionhook.txt
+++ b/sourcemod/gamedata/collisionhook.txt
@@ -12,7 +12,8 @@
                        "PassServerEntityFilter"
                        {
                                "windows"       "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x75\x2A\xB0\x2A\x5F\xC3\x56"
-                               "linux"         "@_Z22PassServerEntityFilterPK13IHandleEntityS1_"
+                               "linux"         "@_Z22PassServerEntityFilterPK13IHandleEntityS1_.part.0"
+                               "linux64"       "@_Z22PassServerEntityFilterPK13IHandleEntityS1_.part.0"
                        }
                }
        }
diff --git a/src/extension.cpp b/src/extension.cpp
index bc64a3e..c4b1ea4 100644
--- a/src/extension.cpp
+++ b/src/extension.cpp
@@ -39,8 +39,13 @@ IForward *g_pPassFwd = NULL;

 int gSetCollisionSolverHookId, gShouldCollideHookId;

-
+#if defined(__linux__) && defined(__i386__)
+CDetour* PassServerEntityFilterFuncDetour;
+__attribute__((regparm(2))) bool (*PassServerEntityFilterFunc_Actual)(const IHandleEntity*, const IHandleEntity*);
+__attribute__((regparm(2))) bool PassServerEntityFilterFunc(const IHandleEntity* pTouch, const IHandleEntity* pPass)
+#else
 DETOUR_DECL_STATIC2( PassServerEntityFilterFunc, bool, const IHandleEntity *, pTouch, const IHandleEntity *, pPass )
+#endif
 {
        if ( g_pPassFwd->GetFunctionCount() == 0 )
                return DETOUR_STATIC_CALL( PassServerEntityFilterFunc )( pTouch, pPass );
voided commented 4 months ago

Thanks a bunch!

CI artifacts are available here if someone wants to give it a shot: https://github.com/voided/CollisionHook/actions/runs/8961351966

If someone (cc @gaejuck?) can confirm these bins work I'll do a formal release with this fix.

geominorai commented 4 months ago

CI artifacts are available here if someone wants to give it a shot: https://github.com/voided/CollisionHook/actions/runs/8961351966

This build instantly crashes on server startup for me on TF2 Linux 32-bit.

gaejuck commented 4 months ago

I'm sorry for the late response.

@gaejuck you can edit the source yourself and gamedata. if you don't know how to compile then you can use the one I made.

collisionhook.ext.2.tf2.so.zip

I am too busy to make a pull request out of this as I have a lot of extensions to port to 64 bit and it doesn't look like anyone else seems to be worried that 32bit servers might be removed suddenly.

I'm using the @bottiger1's extension posted, and it's working well on my server right now. Thank you for everyone's dedication!

geominorai commented 4 months ago

CI artifacts are available here if someone wants to give it a shot: https://github.com/voided/CollisionHook/actions/runs/8961351966

This build instantly crashes on server startup for me on TF2 Linux 32-bit.

The crashes turned out to be the fault of the Accelerator crash uploader extension (latest build 2.5.0-git138-cd575aa-linux). Adding this to /addons/sourcemod/configs/core.cfg stopped the crashes and I was able to load the new CollisionHook CI build, which seems to work fine again:

/**
 * Controls which binaries will be eligible to be processed for symbols and uploaded.
 * Only modules loaded by the server at the time of the crash can be considered.
 *
 * 0 = Disabled: No binaries will be processed or uploaded.
 * 1 = System Only: Only binaries outside of the game directory (where the srcds binary is).
 * 2 = System + Game: Loaded modules outside of the addons/ directory.
 * 3 = System + Game + Addons: All loaded modules.
*/
"MinidumpSymbolUpload"  "2"
ghost commented 4 months ago

https://forums.alliedmods.net/showpost.php?p=2796045&postcount=149

voided commented 3 weeks ago

Closing this out since the issue appears to be accelerator related rather than CH. The newest v1.3.0 release contains this Linux fix provided by bottiger.