Skip to content
This repository was archived by the owner on Dec 26, 2025. It is now read-only.

Next: CreateCallback

Archie_UwU edited this page Nov 19, 2023 · 6 revisions

Defines a callback function for intercepting game events.

Syntax

AurieStatus CreateCallback(
    [in] AurieModule*  Module,
    [in] EventTriggers Trigger,
    [in] PVOID         Routine,
    [in] int32_t       Priority
);

Parameters

Module

A pointer to the module that is registering this callback. If a valid module is not supplied, the tool may fail to automatically unregister the callback when the module that registered the callback unloads. In such cases, the module that registered the callback must manually call RemoveCallback before it is unloaded by the Framework. If a valid module is specified, the tool automatically unregisters all callbacks for the given module when it unloads. Callers should, unless needed, specify g_ArSelfModule.

Trigger

The specific event to listen for. Values here must not be bitwise-ORed together, as the system is not meant to handle one function being registered for multiple triggers. The trigger type specified here dictates the parameters passed into the function pointed-to by the Routine argument.

Routine

A pointer to a function responsible for handling the callback. The prototype for this function must be as follows:

void ExampleFunction(
    IN FunctionWrapper<...>& FunctionContext // alternatively FWType& FunctionContext
);

The templated parameters provided to FunctionWrapper are dependant upon the Trigger parameter passed into the function. Predefined types exist for the callbacks handled by the tool, and are prefixed with FW. For more information on how to use FunctionWrappers correctly, visit the FunctionWrapper wiki page.

Event Trigger FWType
EVENT_OBJECT_CALL FWCodeEvent
EVENT_FRAME FWFrame
EVENT_RESIZE FWResize
EVENT_SCRIPT_CALL FWScriptEvent
EVENT_WNDPROC FwWndProc

Priority

The order in which callbacks are called by the tool is determined based off their priority. Callbacks are called from highest-priority to lowest-priority, with the default priority being 0. Unless specifically needed, callers should pass 0 for this parameter.

Return Value

The function returns AURIE_SUCCESS on success, otherwise returns a matching error code. If the routine is already registered for the given module, the function returns AURIE_OBJECT_ALREADY_EXISTS.

Quick Access

Documentation

Writeups

Clone this wiki locally