metamod-source icon indicating copy to clipboard operation
metamod-source copied to clipboard

SourceHook detour support (or some new subsystem)

Open Vauff opened this issue 9 months ago • 2 comments

This idea has already been thrown around on Discord recently, but decided why not put an issue up for tracking on GitHub as well.

Unlike Source 1 games where a lot of modifications are unified under SourceMod (plugins, but also extensions), CS2 Source 2 plugins are much more of a wild west with many Metamod plugins being available instead. Not just individual plugins (CS2Fixes, CS2KZ, rampbug fix, S2ZE plugins, Pisex plugins), but also competing modding platforms (CounterStrikeSharp, Swiftly, Plugify, any future Source2Mod attempt).

As development continues to grow, so does detour conflicts between many of them, as they all need to include their own detour system that isn't compatible with any other plugins that detour the same functions. The sanest solution to this is probably expanding Metamod's virtual hook management to detours as well.

This seems to be in line with Metamod's vision:

  1. If separate plugins use their own hooking mechanisms, conflicts will arise. The centralized SourceHook environment solves that by providing a unified gateway.

Vauff avatar Mar 07 '25 07:03 Vauff

If review SourceHook (rewriting to templates and other stuff), should also optimize it, because SetupHook has a very slowly/outdated single-linked list method. And compatibility with other hooks that do tableswap or vfunciton replacement, you have to make hacks to work with shooks

Wend4r avatar Mar 07 '25 14:03 Wend4r

And compatibility with other hooks that do tableswap or vfunciton replacement, you have to make hacks to work with shooks

For virtual hooking you shouldn't be using anything else than sourcehook. That's the purpose of metamod/sourcehook, you're not supposed to do virtual hooking yourself with another library.

because SetupHook has a very slowly/outdated single-linked list method

Agreed, it is an issue.

Kenzzer avatar Mar 07 '25 15:03 Kenzzer