diff options
author | 2025-06-17 20:18:48 +0100 | |
---|---|---|
committer | 2025-06-21 14:50:00 +0100 | |
commit | ac7e7d0f21978afc70fe3ef76db69d575742b974 (patch) | |
tree | 6fd25c7ded6cfeba7c55b1c26abc82a28878a14e /src/sst.c | |
parent | 1f2d9ce197eafd16803de087cc5b6f8b8f4345a6 (diff) | |
download | sst-ac7e7d0f21978afc70fe3ef76db69d575742b974.tar.gz sst-ac7e7d0f21978afc70fe3ef76db69d575742b974.zip |
Separate our command callbacks from Source's
This improves the ergonomics of a few different things, and sets us up
somewhat for the fact OE had a different interface for commands too
(it was v1 only and had a separate API call for getting the args).
Diffstat (limited to 'src/sst.c')
-rw-r--r-- | src/sst.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -419,7 +419,7 @@ DEF_EVENT(PluginLoaded) DEF_EVENT(PluginUnloaded) static struct con_cmd *cmd_plugin_load, *cmd_plugin_unload; -static con_cmdcb orig_plugin_load_cb, orig_plugin_unload_cb; +static con_cmdcbv2 orig_plugin_load_cb, orig_plugin_unload_cb; static int ownidx; // XXX: super hacky way of getting this to do_unload() @@ -518,11 +518,11 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) { if (!deferinit()) { do_featureinit(); fixes_apply(); } if_hot (pluginhandler) { cmd_plugin_load = con_findcmd("plugin_load"); - orig_plugin_load_cb = cmd_plugin_load->cb; - cmd_plugin_load->cb = &hook_plugin_load_cb; + orig_plugin_load_cb = cmd_plugin_load->cb_v2; + cmd_plugin_load->cb_v2 = &hook_plugin_load_cb; cmd_plugin_unload = con_findcmd("plugin_unload"); - orig_plugin_unload_cb = cmd_plugin_unload->cb; - cmd_plugin_unload->cb = &hook_plugin_unload_cb; + orig_plugin_unload_cb = cmd_plugin_unload->cb_v2; + cmd_plugin_unload->cb_v2 = &hook_plugin_unload_cb; } return true; } @@ -530,8 +530,8 @@ static bool do_load(ifacefactory enginef, ifacefactory serverf) { static void do_unload() { // slow path: reloading shouldn't happen all the time, prioritise fast exit if_cold (sst_userunloaded) { // note: if we're here, pluginhandler is set - cmd_plugin_load->cb = orig_plugin_load_cb; - cmd_plugin_unload->cb = orig_plugin_unload_cb; + cmd_plugin_load->cb_v2 = orig_plugin_load_cb; + cmd_plugin_unload->cb_v2 = orig_plugin_unload_cb; #ifdef _WIN32 // this bit is only relevant in builds that predate linux support struct CPlugin **plugins = pluginhandler->plugins.m.mem; // see comment in CPlugin struct. setting this to the real handle right |