#include <revolution/wpad.h>
#define WPAD_DPD_MAX_OBJECTS 4
#define WPAD_BUTTON_LEFT 0x0001
#define WPAD_BUTTON_RIGHT 0x0002
#define WPAD_BUTTON_DOWN 0x0004
#define WPAD_BUTTON_UP 0x0008
#define WPAD_BUTTON_PLUS 0x0010
#define WPAD_BUTTON_2 0x0100
#define WPAD_BUTTON_1 0x0200
#define WPAD_BUTTON_B 0x0400
#define WPAD_BUTTON_A 0x0800
#define WPAD_BUTTON_MINUS 0x1000
#define WPAD_BUTTON_HOME 0x8000
// for FreeStyle
#define WPAD_BUTTON_Z 0x2000
#define WPAD_BUTTON_C 0x4000
// for ClassicStyle
#define WPAD_CL_BUTTON_UP 0x0001
#define WPAD_CL_BUTTON_LEFT 0x0002
#define WPAD_CL_TRIGGER_ZR 0x0004
#define WPAD_CL_BUTTON_X 0x0008
#define WPAD_CL_BUTTON_A 0x0010
#define WPAD_CL_BUTTON_Y 0x0020
#define WPAD_CL_BUTTON_B 0x0040
#define WPAD_CL_TRIGGER_ZL 0x0080
#define WPAD_CL_RESERVED 0x0100
#define WPAD_CL_TRIGGER_R 0x0200
#define WPAD_CL_BUTTON_PLUS 0x0400
#define WPAD_CL_BUTTON_HOME 0x0800
#define WPAD_CL_BUTTON_MINUS 0x1000
#define WPAD_CL_TRIGGER_L 0x2000
#define WPAD_CL_BUTTON_DOWN 0x4000
#define WPAD_CL_BUTTON_RIGHT 0x8000
// for compatibility
#define WPAD_BUTTON_SELECT WPAD_BUTTON_MINUS
#define WPAD_BUTTON_START WPAD_BUTTON_PLUS
#define WPAD_BUTTON_SMALL_B WPAD_BUTTON_2
#define WPAD_BUTTON_SMALL_A WPAD_BUTTON_1
#define WPAD_BUTTON_Z1 WPAD_BUTTON_Z
#define WPAD_BUTTON_Z2 WPAD_BUTTON_C
typedef struct WPADCLStatus
{
u16 button;
s16 accX;
s16 accY;
s16 accZ;
DPDObject obj[WPAD_DPD_MAX_OBJECTS];
u8 dev;
s8 err;
u16 clButton;
s16 clLStickX;
s16 clLStickY;
s16 clRStickX;
s16 clRStickY;
u8 clTriggerL;
u8 clTriggerR;
} WPADCLStatus;
typedef struct DPDObject
{
s16 x;
s16 y;
u16 size;
u8 traceId;
} DPDObject;
button |
When a Wii Remote button is pressed, the corresponding bit (WPAD_BUTTON_*) is set to 1. |
accX |
Output of the Wii Remote's motion sensor's x-component. The resolution is 1024. A value of 0 corresponds to 0G (outputs in the range of -512 <= accX < 512). |
accY |
Output of the Wii Remote's motion sensor's y-component. The resolution is the same as for accX. |
accZ |
Output of the Wii Remote's motion sensor's z-component. The resolution is the same as for accX. |
obj[].x |
The x-coordinate of the center of mass for the object obtained with the pointer. The resolution is 1024. |
obj[].y |
The y-coordinate of the center of mass for the object obtained with the pointer. The resolution is 768. |
obj[].size |
The size of the object obtained with the pointer. The resolution is 128*96. |
obj[].traceId |
The trace ID of the object obtained with the pointer. |
dev |
The controller type. |
err |
The controller error status. |
clButton |
When a Classic Controller button is pressed, the corresponding bit (WPAD_CL_BUTTON_*) is set to 1. |
clLStickX |
Movement data given in terms of the x-axis for the Classic Controller L Stick. (Values are output in the range -512 <= clLStickX < 512.) |
clLStickY |
Movement data given in terms of the y-axis for the Classic Controller L Stick. The value range is the same as for clLStickX. |
clRStickX |
Movement data given in terms of the x-axis for the Classic Controller R Stick. (Values are output in the -512 <= clRStickX < 512.) |
clRStickY |
Movement data given in terms of the y-axis for the Classic Controller R Stick. The value range is the same as for clRStickX. |
clTriggerL |
Movement data given in terms of the L Button of the Classic Controller. (Values are output in the range 0 <= clTriggerL < 256.) |
clTriggerR |
Movement data given in terms of the R Button of the Classic Controller. The value range is as for clTriggerL. |
The WPADCLStatus structure represents the status of the Classic Style.
The maximum number of Wii Remotes that can connect is defined as the macro constant below.
WPAD_MAX_CONTROLLERSThe maximum number of Wii Remotes that can connect.
Button inputs are defined with the following macro constants. The Wii Remote has +Control Pad, A Button, B Button, 1 Button, 2 Button, - Button, + Button, and HOME; the Classic Controller has +Control Pad, A Button, B Button, X Button, Y Button, -/SELECT Button, +/START Button, HOME, L Button, R Button, and Z Button. The button status for the Wii Remote and the Classic Controller can be obtained independently.
WPAD_BUTTON_UP+Control Pad UP on the Wii Remote is being pressed. WPAD_BUTTON_DOWN+Control Pad DOWN on the Wii Remote is being pressed. WPAD_BUTTON_LEFT+Control Pad LEFT on the Wii Remote is being pressed. WPAD_BUTTON_RIGHT+Control Pad RIGHT on the Wii Remote is being pressed. WPAD_BUTTON_AThe A Button on the Wii Remote is being pressed. WPAD_BUTTON_BThe B Button on the Wii Remote is being pressed. WPAD_BUTTON_1The 1 Button on the Wii Remote is being pressed. WPAD_BUTTON_2The 2 Button on the Wii Remote is being pressed. WPAD_BUTTON_MINUSThe - Button on the Wii Remote is being pressed. WPAD_BUTTON_PLUSThe + Button on the Wii Remote is being pressed. WPAD_BUTTON_HOMEHOME on the Wii Remote is being pressed.
WPAD_CL_BUTTON_UP+Control Pad UP on the Classic Controller is being pressed. WPAD_CL_BUTTON_DOWN+Control Pad DOWN on the Classic Controller is being pressed. WPAD_CL_BUTTON_LEFT+Control Pad LEFT on the Classic Controller is being pressed. WPAD_CL_BUTTON_RIGHT+Control Pad RIGHT on the Classic Controller is being pressed. WPAD_CL_BUTTON_AThe A Button on the Classic Controller is being pressed. WPAD_CL_BUTTON_BThe B Button on the Classic Controller is being pressed. WPAD_CL_BUTTON_YThe Y Button on the Classic Controller is being pressed. WPAD_CL_BUTTON_XThe X Button on the Classic Controller is being pressed. WPAD_CL_TRIGGER_LThe L Button on the Classic Controller is being pressed. WPAD_CL_TRIGGER_RThe R Button on the Classic Controller is being pressed. WPAD_CL_TRIGGER_ZLThe ZL Button on the Classic Controller is being pressed. WPAD_CL_TRIGGER_ZRThe ZR Button on the Classic Controller is being pressed. WPAD_CL_BUTTON_MINUSThe -/SELECT Button on the Classic Controller is being pressed. WPAD_CL_BUTTON_PLUSThe +/START Button on the Classic Controller is being pressed. WPAD_CL_BUTTON_HOMEHOME on the Classic Controller is being pressed.
The pointer specifications are defined by the following macro constants.
WPAD_DPD_MAX_OBJECTSThe maximum number of objects that the pointer can detect simultaneously. WPAD_DPD_ANGLEThe pointer view angle (in degrees). WPAD_DPD_IMG_RESO_WXPointer resolution along the x-axis. WPAD_DPD_IMG_RESO_WYPointer resolution along the y-axis. Object data items are stored in the
objarray in the order in which they are detected by the pointer. The pointer scans the image captured by the sensor internally from top left to bottom right and outputs object data in the order detected. At the same time, trace IDs are assigned in the order in which the objects are detected.The trace IDs help to judge whether previously obtained data is the same as the currently obtained data. Consider a case where objects A (trace ID=0) and B (trace ID=1) are detected as A and B, respectively, by the previous scan, and then they are detected as B and A, respectively, after the pointer is moved. The output order for the current scan is the reverse of the previous one. However, the trace IDs are in the order of B (using the previously assigned trace ID of 1) and A (using the previously assigned trace ID of 0), and the fact that the data is the same is preserved.
Controller types are defined with the following macro constants.
WPAD_DEV_NOT_FOUNDNothing is connected to the specified channel. WPAD_DEV_COREWii Remote. WPAD_DEV_FREESTYLENunchuk Style. WPAD_DEV_CLASSICClassic Style.
WPAD_DEV_FUTUREA device that will be supported in the future. The device is legitimate, but this External Extension Controller cannot be used with this title. It may be operated as a Wii Remote.
WPAD_DEV_NOT_SUPPORTEDA device that cannot be used. This type is selected when device recognition fails or an illegal device is plugged in. It may be operated as a Wii Remote.
WPAD_DEV_UNKNOWNUnknown device. This type is selected during the period between insertion of an External Extension Controller and completion of the recognition process. It may be operated as a Wii Remote.
Error statuses are defined with the following macro constants.
WPAD_ERR_NONEIndicates the Wii Remote is connected. The WPADCLStatusstructure maintains valid data.WPAD_ERR_BUSYThis is the ACK control command sent to the Wii Remote. Only Wii Remote button information is valid for the WPADCLStatusstructure.WPAD_ERR_INVALIDThe data format of data received from the Wii Remote differs from that set by the WPADSetDataFormatfunction. (Structure members other thanerrare undefined.)WPAD_ERR_CORRUPTEDThe data in the External Extension Controller is corrupted. The structure members of the External Extension Controller are undefined.
2007/12/10 Revised the description of WPAD_ERR_BUSY, and deleted WPAD_ERR_NO_CONTROLLER and WPAD_ERR_TRANSFER.
2007/12/27 Corrected mistaken range for the stick value.
2006/09/22 Added WPAD_ERR_CORRUPTED.
2006/08/15 Changed the description of WPAD_ERR_INVALID.
2006/06/19 Initial version
CONFIDENTIAL