Skip to content

Legacy: PmCreateCallback routine

Archie_UwU edited this page Nov 19, 2023 · 2 revisions

You are reading the documentation of YYToolkit Legacy (v2.x.x) - for documentation on current-gen YYTK, see the Homepage.


Registers and creates a callback routine for a plugin.

Syntax

YYTKStatus PmCreateCallback(
    PluginAttributes_t* pObjectAttributes,
    CallbackAttributes_t* &outAttributes,
    FNEventHandler pfnCallback,
    EventType Flags,
    void* OptionalArgument
);

Parameters

pObjectAttributes

Attributes of the owner plugin object. Plugins should use PmGetPluginAttributes to get an opaque pointer to the structure.

outAttributes

A reference to a CallbackAttributes_t pointer. Plugins should keep this pointer for use in a PmRemoveCallback call.

pfnCallback

The function associated with the callback. It gets called by the YYTK Core.

EventType

Events under which the callback should be run. These values may be OR'd via the bitwise | operator, to register it for more than one event type.

The callback can then get the actual type by interrogating the passed-in YYTKEventBase structure.

If the passed in value is NULL, the callback is not called, but the function returns a valid CallbackAttributes_t pointer which still has to be unregistered.

OptionalArgument

The argument always passed to the registered callback function.

The meaning of this value is entirely plugin-dependant.

Return Value

The function returns YYTK_OK on success. If or more arguments are invalid, the function returns YYTK_INVALIDARG.

Remarks

It is entirely possible for two distinct calls to PmCreateCallback to register the same function.

If this happens, plugins must unregister both CallbackAttributes structs by calling PmRemoveCallback.

Quick Access

Documentation

Writeups

Clone this wiki locally