WPADSetExtensionCallback

C Specification

#include <revolution/wpad.h>

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

#define WPAD_DEV_CORE                 0
#define WPAD_DEV_FREESTYLE            1
#define WPAD_DEV_CLASSIC              2
#define WPAD_DEV_FUTURE             251
#define WPAD_DEV_NOT_SUPPORTED      252
#define WPAD_DEV_NOT_FOUND          253
#define WPAD_DEV_UNKNOWN            255

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

WPADExtensionCallback WPADSetExtensionCallback( s32 chan, WPADExtensionCallback callback );

Arguments

chan One of the WPAD_CHANn values.
callback The callback function that notifies of an event when an External Extension 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 Extension Controller is inserted, this callback is called twice. This is because it takes some time to recognize the device type of the inserted External Extension Controller. When an External Extension 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. If the Controller is disconnected during the recognition process, then WPAD_DEV_NOT_FOUND gets passed.

When the External Extension 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.

See Also

WPAD Functions

Revision History

2006/10/05 Added mention that the callback function is cleared when a controller is connected.
2006/09/06 Added description of the case where WPAD_DEV_NOT_FOUND is passed.
2006/08/15 Deleted mention that the callback function is cleared when external extension controller is connected/disconnected.
2006/06/19 Initial version.


CONFIDENTIAL