If you're going to do this, you won't just be able to cut-and-paste this functionality into each MFD....
You'd need a separate DLL (HUDHook.DLL or something like that) that each of the prospective HUD Hookers would link to and call the one hooking function from that to make sure that there is only one hook object instantiated and only one hooking performed. You'd then include the HUDHook.DLL with every release that used it (though that's not a problem really).
Well, that's exactly what I meant when I spoke of a "Standard Hijacking API". Indeed, a DLL, much like OrbiterSound, that does the dirty job and provides a clean interface to the interested developers.
If you're going down the route of one separate library hooking DLL then you'll want to make the exported functions simple and not change. You'll also want to future-proof it, so while you're at it, you may as well add the functionality to hook *any* of the virtual methods of VESSEL2.
I think I didn't explain that properly -- the proposal is already to hook the entire interface, not a single method. Internally the DLL shall hijack every single method of VESSEL2 interface
for the given instance. The developer should implement the method he wants to hook, which will override the default from VHL::hook_class and call the VHL::add_hook(), that adds the developers hook to the internal list of hooks for that particular vessel instance.
All hooks shall be managed by the implementation, so a particular developer shall not be needing to worry about eg. calling other hooks.
Face: I think I caused a great deal of confusion with that hook_class.
The idea is that this hook_class is an
interface between the developer and the VHL API DLL. It's more like an event subscription. That is, by overriding these functions in a hook_class-derived class the developer can respond to various callbacks. The VHL API DLL shall internall maintain the list of pointers to these interfaces, but those are not interfaces to the original vessel instance.
There shall be only one "Master Hook" for each instance, hidden inside the VHL API DLL. When clbkXXX() is intercepted, that "Master Hook" shall notify its subscribers by calling their appropriate handlers through supplied ( through add_hook() ) interface pointers.
This way a particular developer won't have to worry about chaining the call to other hooks -- the implementation shall manage that. I don't think that emptying the internal subscriber list should be allowed, as this will simply screw up the other addons.
That magic cookie is just a way to unsubscribe from a particular vessel instance. No big deal though.