Add HookPluginUnload() and UnhookPluginUnload() functions

This commit is contained in:
Vladimir
2021-05-24 14:30:16 -07:00
committed by David Anderson
parent e6129ab2d9
commit c874703136
5 changed files with 152 additions and 0 deletions
+27
View File
@@ -84,6 +84,13 @@ enum APLRes
APLRes_SilentFailure /**< Plugin shouldn't load but do so silently */
};
/**
* Called when a plugin unloaded.
*
* @param plugin Plugin Handle who unloaded.
*/
typedef PluginUnloaded = function void (Handle plugin);
methodmap GameData < Handle
{
// Loads a game config file.
@@ -319,6 +326,26 @@ native bool GetPluginInfo(Handle plugin, PluginInfo info, char[] buffer, int max
*/
native Handle FindPluginByNumber(int order_num);
/**
* Creates a hook for when a plugin unloaded.
*
* @param plugin Plugin Handle to hook.
* @param callback An PluginUnloaded function pointer.
*
* @return True on success, false otherwise.
*/
native bool HookPluginUnload(Handle plugin, PluginUnloaded callback);
/**
* Removes a hook for when a plugin unloaded.
*
* @param plugin Plugin Handle to hook.
* @param callback An PluginUnloaded function pointer.
*
* @return True on success, false otherwise.
*/
native bool UnhookPluginUnload(Handle plugin, PluginUnloaded callback);
/**
* Causes the plugin to enter a failed state. An error will be thrown and
* the plugin will be paused until it is unloaded or reloaded.