Plugins are used by wminput to implement functionality using data that is too complex to calculate in the configuration files, such as pointer tracking or gesture recognition. This is done by providing "virtual" buttons and axes that can be mapped by wminput in the same manner as real buttons and axes.
A plugin must implement the following functions, and return valid data from each of them.
All necessary definitions are provided in cwiid/wminput/wmplugin.h. See cwiid/common/includes/plugin.mak for compilation details.
struct wmplugin_info *wmplugin_info()
int wmplugin_init(int id, wiimote_t *wiimote)
struct wmplugin_data *wmplugin_exec(int mesg_count, union wiimote_mesg *mesg)
Typedefs are provided for each of the three API calls. I recommend prototyping each function using the typedef, and defining the function using the actual return type and named parameters. This guarantees agreement between the expected and implemented functions, as a mismatch will cause a compiler error.
Declare all non-public functions and variables with the static keyword, as the dynamic loader can and will use dynamic symbol resolution to find any symbols not declared static, resulting in identically named functions or variables in other plugins being called/used rather than the intended object.