DBG: added documentation for plugin_loader.cpp
This commit is contained in:
parent
387815d1a4
commit
58973dd2a1
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
@file math.cpp
|
||||
|
||||
@brief Implements the mathematics class.
|
||||
@brief Implements various functionalities that have to do with handling expression text.
|
||||
*/
|
||||
|
||||
#include "math.h"
|
||||
|
|
@ -302,7 +302,7 @@ static void fillpair(EXPRESSION* expstruct, int pos, int layer)
|
|||
\param [in,out] expstruct The expression structure. Cannot be null.
|
||||
\param [in,out] expression The expression text to parse. Cannot be null.
|
||||
\param endlayer The layer to stop on. This variable is used for the recursion termination condition.
|
||||
\return The position in the \pexpression mathpairs ended in.
|
||||
\return The position in the \p expression mathpairs ended in.
|
||||
*/
|
||||
static int matchpairs(EXPRESSION* expstruct, char* expression, int endlayer = 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
@file plugin_loader.cpp
|
||||
|
||||
@brief Implements the plugin loader class.
|
||||
@brief Implements the plugin loader.
|
||||
*/
|
||||
|
||||
#include "plugin_loader.h"
|
||||
|
|
@ -10,13 +10,35 @@
|
|||
#include "memory.h"
|
||||
#include "x64_dbg.h"
|
||||
|
||||
|
||||
/**
|
||||
\brief List of plugins.
|
||||
*/
|
||||
static std::vector<PLUG_DATA> pluginList;
|
||||
|
||||
/**
|
||||
\brief The current plugin handle.
|
||||
*/
|
||||
static int curPluginHandle = 0;
|
||||
|
||||
/**
|
||||
\brief List of plugin callbacks.
|
||||
*/
|
||||
static std::vector<PLUG_CALLBACK> pluginCallbackList;
|
||||
|
||||
/**
|
||||
\brief List of plugin commands.
|
||||
*/
|
||||
static std::vector<PLUG_COMMAND> pluginCommandList;
|
||||
|
||||
/**
|
||||
\brief List of plugin menus.
|
||||
*/
|
||||
static std::vector<PLUG_MENU> pluginMenuList;
|
||||
|
||||
/**
|
||||
\brief Loads plugins from a specified directory.
|
||||
\param pluginDir The directory to load plugins from.
|
||||
*/
|
||||
void pluginload(const char* pluginDir)
|
||||
{
|
||||
//load new plugins
|
||||
|
|
@ -195,6 +217,10 @@ void pluginload(const char* pluginDir)
|
|||
SetCurrentDirectoryW(currentDir);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Unregister all plugin commands.
|
||||
\param pluginHandle Handle of the plugin to remove the commands from.
|
||||
*/
|
||||
static void plugincmdunregisterall(int pluginHandle)
|
||||
{
|
||||
int listsize = (int)pluginCommandList.size();
|
||||
|
|
@ -208,6 +234,9 @@ static void plugincmdunregisterall(int pluginHandle)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Unloads all plugins.
|
||||
*/
|
||||
void pluginunload()
|
||||
{
|
||||
int pluginCount = (int)pluginList.size();
|
||||
|
|
@ -225,6 +254,12 @@ void pluginunload()
|
|||
GuiMenuClear(GUI_PLUGIN_MENU); //clear the plugin menu
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Register a plugin callback.
|
||||
\param pluginHandle Handle of the plugin to register a callback for.
|
||||
\param cbType The type of the callback to register.
|
||||
\param cbPlugin The actual callback function.
|
||||
*/
|
||||
void pluginregistercallback(int pluginHandle, CBTYPE cbType, CBPLUGIN cbPlugin)
|
||||
{
|
||||
pluginunregistercallback(pluginHandle, cbType); //remove previous callback
|
||||
|
|
@ -235,6 +270,11 @@ void pluginregistercallback(int pluginHandle, CBTYPE cbType, CBPLUGIN cbPlugin)
|
|||
pluginCallbackList.push_back(cbStruct);
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Unregister all plugin callbacks of a certain type.
|
||||
\param pluginHandle Handle of the plugin to unregister a callback from.
|
||||
\param cbType The type of the callback to unregister.
|
||||
*/
|
||||
bool pluginunregistercallback(int pluginHandle, CBTYPE cbType)
|
||||
{
|
||||
int pluginCallbackCount = (int)pluginCallbackList.size();
|
||||
|
|
@ -249,6 +289,11 @@ bool pluginunregistercallback(int pluginHandle, CBTYPE cbType)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Call all registered callbacks of a certain type.
|
||||
\param cbType The type of callbacks to call.
|
||||
\param [in,out] callbackInfo Information describing the callback. See plugin documentation for more information on this.
|
||||
*/
|
||||
void plugincbcall(CBTYPE cbType, void* callbackInfo)
|
||||
{
|
||||
int pluginCallbackCount = (int)pluginCallbackList.size();
|
||||
|
|
@ -263,6 +308,14 @@ void plugincbcall(CBTYPE cbType, void* callbackInfo)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Register a plugin command.
|
||||
\param pluginHandle Handle of the plugin to register a command for.
|
||||
\param command The command text to register. This text cannot contain the '\1' character. This text is not case sensitive.
|
||||
\param cbCommand The command callback.
|
||||
\param debugonly true if the command can only be called during debugging.
|
||||
\return true if it the registration succeeded, false otherwise.
|
||||
*/
|
||||
bool plugincmdregister(int pluginHandle, const char* command, CBPLUGINCOMMAND cbCommand, bool debugonly)
|
||||
{
|
||||
if(!command or strlen(command) >= deflen or strstr(command, "\1"))
|
||||
|
|
@ -277,6 +330,12 @@ bool plugincmdregister(int pluginHandle, const char* command, CBPLUGINCOMMAND cb
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Unregister a plugin command.
|
||||
\param pluginHandle Handle of the plugin to unregister the command from.
|
||||
\param command The command text to unregister. This text is not case sensitive.
|
||||
\return true if the command was found and removed, false otherwise.
|
||||
*/
|
||||
bool plugincmdunregister(int pluginHandle, const char* command)
|
||||
{
|
||||
if(!command or strlen(command) >= deflen or strstr(command, "\1"))
|
||||
|
|
@ -296,6 +355,12 @@ bool plugincmdunregister(int pluginHandle, const char* command)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Add a new plugin (sub)menu.
|
||||
\param hMenu The menu handle to add the (sub)menu to.
|
||||
\param title The title of the (sub)menu.
|
||||
\return The handle of the new (sub)menu.
|
||||
*/
|
||||
int pluginmenuadd(int hMenu, const char* title)
|
||||
{
|
||||
if(!title or !strlen(title))
|
||||
|
|
@ -320,6 +385,13 @@ int pluginmenuadd(int hMenu, const char* title)
|
|||
return hMenuNew;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Add a plugin menu entry to a menu.
|
||||
\param hMenu The menu to add the entry to.
|
||||
\param hEntry The handle you like to have the entry. This should be a unique value in the scope of the plugin that registered the \p hMenu.
|
||||
\param title The menu entry title.
|
||||
\return true if the \p hEntry was unique and the entry was successfully added, false otherwise.
|
||||
*/
|
||||
bool pluginmenuaddentry(int hMenu, int hEntry, const char* title)
|
||||
{
|
||||
if(!title or !strlen(title) or hEntry == -1)
|
||||
|
|
@ -351,6 +423,11 @@ bool pluginmenuaddentry(int hMenu, int hEntry, const char* title)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Add a menu separator to a menu.
|
||||
\param hMenu The menu to add the separator to.
|
||||
\return true if it succeeds, false otherwise.
|
||||
*/
|
||||
bool pluginmenuaddseparator(int hMenu)
|
||||
{
|
||||
bool bFound = false;
|
||||
|
|
@ -368,6 +445,11 @@ bool pluginmenuaddseparator(int hMenu)
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Clears a plugin menu.
|
||||
\param hMenu The menu to clear.
|
||||
\return true if it succeeds, false otherwise.
|
||||
*/
|
||||
bool pluginmenuclear(int hMenu)
|
||||
{
|
||||
bool bFound = false;
|
||||
|
|
@ -385,6 +467,10 @@ bool pluginmenuclear(int hMenu)
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Call the registered CB_MENUENTRY callbacks for a menu entry.
|
||||
\param hEntry The menu entry that triggered the event.
|
||||
*/
|
||||
void pluginmenucall(int hEntry)
|
||||
{
|
||||
if(hEntry == -1)
|
||||
|
|
@ -410,6 +496,12 @@ void pluginmenucall(int hEntry)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Calls the registered CB_WINEVENT callbacks.
|
||||
\param [in,out] message the message that triggered the event. Cannot be null.
|
||||
\param [out] result The result value. Cannot be null.
|
||||
\return The value the plugin told it to return. See plugin documentation for more information.
|
||||
*/
|
||||
bool pluginwinevent(MSG* message, long* result)
|
||||
{
|
||||
PLUG_CB_WINEVENT winevent;
|
||||
|
|
@ -420,6 +512,11 @@ bool pluginwinevent(MSG* message, long* result)
|
|||
return winevent.retval;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Calls the registered CB_WINEVENTGLOBAL callbacks.
|
||||
\param [in,out] message the message that triggered the event. Cannot be null.
|
||||
\return The value the plugin told it to return. See plugin documentation for more information.
|
||||
*/
|
||||
bool pluginwineventglobal(MSG* message)
|
||||
{
|
||||
PLUG_CB_WINEVENTGLOBAL winevent;
|
||||
|
|
|
|||
Loading…
Reference in New Issue