- A few style improvements
- Add & correct some documentation
- Change AddHook signature to not allow DVP as an option (for now!)
- Fix cstdio not being pulled in on linux (bleh)
- Add some more static_asserts to make errors easier to interpret (yay)
This is a large refactor that splits our mega-template into a few smaller ones. First off, the PLUGIN_GLOBALVARS() helpers were put in the SourceHook namespace.
- HookHandlerImpl: Responsible for the lowered delegates (post-vafmt), can be used independently of other templates added here. Relies on parent HookManager class to handle the unlowered original invocation logic. (As a template parameter)
- HookCoreImpl: Adds a public interface & glue layer beterrn managers and HookHandlerImpl
- HookImpl: non-varardic hook manager
- FmtHookImpl: format-string hook manager
FmtHookImpl was tested by hooking IVEngineServer::ClientCommand.
This allows us to specify the SH pointer and the Plugin ID pointer in the template, so when the plugin uses Hook<> it doesn't have to touch g_PLID or g_SHPtr.
Also added a little struct that wraps ISourceHook->xHookById methods.
Introduces one massive template for generating SourceHook managers.
The goal is for this to simplify the definition of SourceHooks long-term by replacing macros with templates.
This introduces some new templates for metaprogramming, but they're hidden away in the SourceHook::metaprogramming namespace.
Tested on Windows 32 bit and Linux 32 bit TF2.
* Fix detection of Blade Symphony on Windows x64
Port finding the module base address on x64 builds from SourceMod.
Fix a bunch of truncation warnings on x64 while at it too.
* Fix mm_TrimComments stripping last char before comment
```c
char test[] = "hi this is a a test!// comment";
mm_TrimComments(test);
puts(test); // prints "hi this is a test" without the !
```
* Fix unsigned comparison warnings
* Fix truncation warnings in SourceHook::String
* Fix unsigned comparison warnings
clang does have some nice analysis.