WPADSetExtensionCallback

C Specification

#include <revolution/wpad.h>

#define WPAD_CHAN0               0
#define WPAD_CHAN1               1
#define WPAD_CHAN2               2
#define WPAD_CHAN3               3


typedef void (* WPADExtensionCallback )( s32 chan, s32 result );

WPADExtensionCallback WPADSetExtensionCallback( s32 chan, WPADExtensionCallback callback );

Arguments

chan One of WPAD_CHANn values.
callback The callback function that notifies of an event when an external controller is inserted or removed.

Return Values

Pointer to the most recently registered callback function.

Description

Registers the callback function that notifies events when an external extension controller is inserted into or removed from a Wii Remote at the specified channel. If NULL is specified, no notifications are made until reset.

The device type is passed to the callback function's result argument.

When an external controller is inserted, this callback is called twice. This is because it takes some time to recognize the device type of the inserted external controller. When an external controller is inserted, it is not immediately recognized and WPAD_DEV_UNKNOWN is returned with the callback. Once the device type is known, the callback is called again with the device type.

When the external controller is removed, this callback is called once and returned with WPAD_DEV_CORE.

Be aware that callback functions registered by using this function will be cleared in the following circumstances.

In addition, the callback functions are not cleared when a controller is connected, so they can be registered in advance.

See Also

WPAD Functions

Revision History

08/15/2006 Removed statement that the callback is cleared when an external controller is plugged into or unplugged from the console.
06/19/2006 Initial version.


CONFIDENTIAL