diff options
author | 2025-04-16 02:13:01 +0100 | |
---|---|---|
committer | 2025-04-16 21:31:20 +0100 | |
commit | 4fddfa831d2a33ab3eee7ceb5f181c82d5aa78d2 (patch) | |
tree | f62a0fc1a0b3d7ffcd7967b98885453636309686 /src/l4daddon.c | |
parent | 5c805aac744df43dd96f70bc7e39337d9c3a966a (diff) | |
download | sst-4fddfa831d2a33ab3eee7ceb5f181c82d5aa78d2.tar.gz sst-4fddfa831d2a33ab3eee7ceb5f181c82d5aa78d2.zip |
Rework API for inline hooking
This both simplifies and complicates things, but probably hopefully
maybe simplifies things overall. Certainly in cases like the L4D1 demo
thing where there's 3 inline hooks at once, it seems simpler to be able
to batch the fallible stuff to avoid rollbacks. In cases where you only
need one hook, it's a bit more verbose, but what can you do.
Thanks bill for discussing this with me pretty exhaustively and giving a
lot of good input.
I think both of us still kind of hate it actually.
Diffstat (limited to 'src/l4daddon.c')
-rw-r--r-- | src/l4daddon.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/l4daddon.c b/src/l4daddon.c index 0609459..8e61e05 100644 --- a/src/l4daddon.c +++ b/src/l4daddon.c @@ -241,12 +241,11 @@ INIT { return FEAT_INCOMPAT; } try_fix_broken_addon_check(); - orig_FS_MAFAS = (FS_MAFAS_func)hook_inline((void *)orig_FS_MAFAS, - (void *)&hook_FS_MAFAS); - if_cold (!orig_FS_MAFAS) { - errmsg_errorsys("couldn't hook FileSystem_ManageAddonsForActiveSession"); - return FEAT_FAIL; - } + struct hook_inline_featsetup_ret h = hook_inline_featsetup( + (void *)orig_FS_MAFAS, (void **)&orig_FS_MAFAS, + "FileSystem_ManageAddonsForActiveSession"); + if_cold (h.err) return h.err; + hook_inline_commit(h.prologue, (void *)&hook_FS_MAFAS); return FEAT_OK; } |