WPADStatus
Syntax
#include <revolution/wpad.h>
#include <revolution/wpadBalance.h>
#include <revolution/wpadGuitar.h>
#include <revolution/wpadTrain.h>
#define WPAD_DPD_MAX_OBJECTS 4
#define WPAD_PRESS_UNITS 4
// for Core or BalanceBoard
#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, Guitar, Train, etc
#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 DPDObject
{
s16 x;
s16 y;
u16 size;
u8 traceId;
} DPDObject;
typedef struct WPADStatus
{
u16 button;
s16 accX;
s16 accY;
s16 accZ;
DPDObject obj[WPAD_DPD_MAX_OBJECTS];
u8 dev;
s8 err;
} WPADStatus;
typedef struct WPADFSStatus
{
u16 button;
s16 accX;
s16 accY;
s16 accZ;
DPDObject obj[WPAD_DPD_MAX_OBJECTS];
u8 dev;
s8 err;
s16 fsAccX;
s16 fsAccY;
s16 fsAccZ;
s8 fsStickX;
s8 fsStickY;
} WPADFSStatus;
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 DPDObjEx
{
s16 range_x1;
s16 range_y1;
s16 range_x2;
s16 range_y2;
u16 pixel;
s8 radius;
} DPDObjEx;
typedef struct WPADStatusEx
{
u16 button;
s16 accX;
s16 accY;
s16 accZ;
DPDObject obj[WPAD_DPD_MAX_OBJECTS];
u8 dev;
s8 err;
DPDObjEx exp[WPAD_DPD_MAX_OBJECTS];
} WPADStatusEx;
typedef struct WPADTRStatus
{
u16 button;
s16 accX;
s16 accY;
s16 accZ;
DPDObject obj[WPAD_DPD_MAX_OBJECTS];
u8 dev;
s8 err;
u16 trButton;
u8 mascon;
u8 brake;
} WPADTRStatus;
typedef struct WPADBLStatus
{
u16 button;
s16 accX;
s16 accY;
s16 accZ;
DPDObject obj[WPAD_DPD_MAX_OBJECTS];
u8 dev;
s8 err;
u16 press[WPAD_PRESS_UNITS];
s8 temp;
u8 battery;
} WPADBLStatus;
Elements
Common Elements
| button |
When a button is pressed, the corresponding bit (WPAD_BUTTON_*) is set to 1. |
| accX |
Output of the Motion Sensor's x-component. The resolution is 1024. A value of 0 corresponds to weightlessness (0G). (Outputs in the range of -512 <= accX < 512.) |
| accY |
Output of the Motion Sensor's y-component. The resolution is the same as for accX. |
| accZ |
Output of the 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. |
WPADFSStatus Element
| fsAccX |
Output of the Nunchuk's motion sensor's x-component. Resolution is 1024. A value of 0 corresponds to weightlessness, or 0G (values are output in the range -512 <= fsAccX < 512). |
| fsAccY |
Output of the Nunchuk's motion sensor's y-component. Resolution is the same as for fsAccX. |
| fsAccZ |
Output of the Nunchuk's motion sensor's z-component. Resolution is the same as for fsAccX. |
| fsStickX |
Translation data for the x-axis of the analog stick on the Nunchuk is received. The resolution is 256 (values are output in the range -128 <= fsStickX < 128). |
| fsStickY |
Translation data for the y-axis of the analog stick on the Nunchuk is received. The resolution is the same as for fsStickX. |
WPADCLStatus Element
| clButton |
When a Classic Controller, Master Controller, or Guitar 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's L Stick and the Guitar Controller's Control Stick.(-512 <= (Values are output in the range -512 <= clLStickX < 512.) |
| clLStickY |
Movement data given in terms of the y-axis for the Classic Controller's L Stick and the Guitar Controller's Control 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.(-512 <= (Values are output in the range -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 for the Classic Controller's L Button and the Master Controller's Brake. (Values are output in the range 0 <= clTriggerL < 256.) |
| clTriggerR |
Movement data for the Classic Controller's R Button, the Master Controller's Master Control, and the Guitar Controller's Whammy Bar. The value range is the same as for clTriggerL. |
WPADStatusEx Element
| exp[].range_x1 |
The top-right coordinate (x-axis) of the rectangle enclosing the object obtained by the pointer. Resolution is 1024. |
| exp[].range_y1 |
The top-right coordinate (y-axis) of the rectangle enclosing the object obtained by the pointer. Resolution is 768. |
| exp[].range_x2 |
The bottom-left coordinate (x-axis) of the rectangle enclosing the object obtained by the pointer. Resolution is 1024. |
| exp[].range_y2 |
The bottom-left coordinate (y-axis) of the rectangle enclosing the object obtained by the pointer. Resolution is 768. |
| exp[].pixel |
The number of pixels for the object obtained by the pointer. Resolution is 128*96. |
| exp[].radius |
The radius of the object obtained by the pointer. Values are calculated based on the size and are output in the range 0 <= exp[].radius <= 15. |
WPADTRStatus Element
| trButton |
When a Master Controller button is pressed, the corresponding bit (WPAD_CL_BUTTON_*) is set to 1. |
| mascon |
Returns the value of the Master Controller's Master Control. (Values are output in the range 0 <= mascon < 256.) |
| brake |
Returns the value of the Master Controller's Brake. The value range is the same as for mascon. |
WPADBLStatus Element
| press |
The value of the sensors in the four corners of the Wii Balance Board. |
| temp |
The temperature on the surface of the Wii Balance Board. |
| battery |
The remaining battery life for the Wii Balance Board. |
Description
Each structure shows the state of the Wii Remote, external extension controller, and Wii Balance Board, respectively.
The maximum number of Wii Remotes that can connect is defined as the macro constant below.
| WPAD_MAX_CONTROLLERS |
The maximum number of Wii Remotes that can connect. |
Button inputs are defined with the following macro constants.
The Wii Remote is equipped with +Control Pad, A, B, 1, 2, -, +, and HOME digital buttons.
| 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_A |
The A Button on the Wii Remote is being pressed. |
| WPAD_BUTTON_B |
The B Button on the Wii Remote is being pressed. |
| WPAD_BUTTON_1 |
The 1 Button on the Wii Remote is being pressed. |
| WPAD_BUTTON_2 |
The 2 Button on the Wii Remote is being pressed. |
| WPAD_BUTTON_MINUS |
The - Button on the Wii Remote is being pressed. |
| WPAD_BUTTON_PLUS |
The + Button on the Wii Remote is being pressed. |
| WPAD_BUTTON_HOME |
HOME on the Wii Remote is being pressed. |
The Nunchuk has the Z and C Buttons.
| WPAD_BUTTON_Z |
The Z Button on the Nunchuk is being pressed. |
| WPAD_BUTTON_C |
The C Button on the Nunchuk is being pressed. |
The Classic Controller has the +Control Pad and the A, B, X, Y, -/SELECT, +/START, HOME, L, R, and Z buttons. The button status for the Wii Remote and the Classic Controller can be obtained independently.
| 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_A |
The A Button on the Classic Controller is being pressed. |
| WPAD_CL_BUTTON_B |
The B Button on the Classic Controller is being pressed. |
| WPAD_CL_BUTTON_Y |
The Y Button on the Classic Controller is being pressed. |
| WPAD_CL_BUTTON_X |
The X Button on the Classic Controller is being pressed. |
| WPAD_CL_TRIGGER_L |
The L Button on the Classic Controller is being pressed. |
| WPAD_CL_TRIGGER_R |
The R Button on the Classic Controller is being pressed. |
| WPAD_CL_TRIGGER_ZL |
The ZL Button on the Classic Controller is being pressed. |
| WPAD_CL_TRIGGER_ZR |
The ZR Button on the Classic Controller is being pressed. |
| WPAD_CL_BUTTON_MINUS |
The -/SELECT Button on the Classic Controller is being pressed. |
| WPAD_CL_BUTTON_PLUS |
The +/START Button on the Classic Controller is being pressed. |
| WPAD_CL_BUTTON_HOME |
HOME on the Classic Controller is being pressed. |
The Master Controller has the +Control Pad and the A, B, C, D, SELECT, and START buttons. Each button is treated as a corresponding button on the Classic Controller.
| WPAD_CL_BUTTON_UP |
+Control Pad UP on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_DOWN |
+Control Pad DOWN on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_LEFT |
+Control Pad LEFT on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_RIGHT |
+Control Pad RIGHT on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_A |
The C Button on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_B |
The B Button on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_Y |
The A Button on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_X |
The D Button on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_MINUS |
The SELECT Button on the Master Controller is being pressed. |
| WPAD_CL_BUTTON_PLUS |
The START Button on the Master Controller is being pressed. |
The Guitar Controller has five fret buttons, UP and DOWN on the strum bar, a foot pedal, and the SELECT and START buttons. Each button is treated as a corresponding button on the Classic Controller.
| WPAD_CL_BUTTON_UP |
The strum bar on the Guitar Controller is being raised up. |
| WPAD_CL_BUTTON_DOWN |
The strum bar on the Guitar Controller is being pushed down. |
| WPAD_CL_BUTTON_A |
The green fret button on the Guitar Controller is being pressed. |
| WPAD_CL_BUTTON_B |
The red fret button on the Guitar Controller is being pressed. |
| WPAD_CL_BUTTON_Y |
The blue fret button on the Guitar Controller is being pressed. |
| WPAD_CL_BUTTON_X |
The yellow fret button on the Guitar Controller is being pressed. |
| WPAD_CL_TRIGGER_ZL |
The orange fret button on the Guitar Controller is being pressed. |
| WPAD_CL_TRIGGER_ZR |
The foot pedal on the Guitar Controller is being pressed. |
| WPAD_CL_BUTTON_MINUS |
The SELECT Button on the Guitar Controller is being pressed. |
| WPAD_CL_BUTTON_PLUS |
The START Button on the Guitar Controller is being pressed. |
The Wii Balance Board has only a Power Button, which is treated as the A Button on the Wii Remote.
| WPAD_BUTTON_A |
The Wii Balance Board's Power Button is being pressed. |
The pointer specifications are defined by the following macro constants.
| WPAD_DPD_MAX_OBJECTS |
The maximum number of objects that the pointer can detect simultaneously. |
| WPAD_DPD_ANGLE |
The pointer view angle (in degrees). |
| WPAD_DPD_IMG_RESO_WX |
Pointer resolution along the x-axis. |
| WPAD_DPD_IMG_RESO_WY |
Pointer resolution along the y-axis. |
Object data items are stored in the obj array 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.
The motion sensor specifications are defined by the macro constant below.
| WPAD_ACC_RESO |
The motion sensor's resolution. |
Controller types are defined with the following macro constants.
| WPAD_DEV_NOT_FOUND |
Nothing is connected to the specified channel. |
| WPAD_DEV_CORE |
Wii Remote. |
| WPAD_DEV_FREESTYLE |
Nunchuk Style. |
| WPAD_DEV_CLASSIC |
Classic Style. |
| WPAD_DEV_TRAIN |
Wii Remote + Master Controller. |
| WPAD_DEV_GUITAR |
Wii Remote + Guitar Controller. |
| WPAD_DEV_BALANCE_CHECKER |
Wii Balance Board. |
| WPAD_DEV_FUTURE |
A device that will be supported in the future. The device is legitimate, but this External Extension Controller cannot be used with this title. It can be operated as a Wii Remote. |
| WPAD_DEV_NOT_SUPPORTED |
A device that cannot be used. This type is selected when an illegal device is plugged in or device recognition fails due to a poor connection with the external extension controller. It can be operated as a Wii Remote. |
| WPAD_DEV_UNKNOWN |
Unknown device. This type is selected during the period between insertion of an External Extension Controller and completion of the recognition process. It can be operated as a Wii Remote. |
Error statuses are defined with the following macro constants.
| WPAD_ERR_NONE |
A Wii Remote or Wii Balance Board is connected. Each structure contains valid data. |
| WPAD_ERR_NO_CONTROLLER |
A Wii Remote or Wii Balance Board is not connected. Each structure does not contain valid data (members other than err are undefined). |
| WPAD_ERR_TRANSFER |
Indicates a problem occurred during communications. Each structure does not contain valid data (members other than err are undefined). |
| WPAD_ERR_INVALID |
The data format of data received from the Wii Remote or Wii Balance Board differs from that set by the WPADSetDataFormat function.(Structure members other than err are undefined.) |
| WPAD_ERR_CORRUPTED |
The data in the External Extension Controller is corrupted. The structure members of the External Extension Controller are undefined. |
See Also
None.
Revision History
2008/04/16 Integrated descriptions for external extension controller structures. Deleted WPAD_ERR_BUSY from the error status.
2008/03/17 Revised the description of WPAD_DEV_NOT_SUPPORTED.
2006/09/22 Added WPAD_ERR_CORRUPTED.
2006/08/15 Changed the description of WPAD_ERR_INVALID.
2006/06/19 Added define, renamed the external extension controller, renamed buttons, and revised the WPAD_DEV_DOLPHIN explanation.
2005/10/27 Changed the acceleration resolution from 2,048 to 1,024. Changed the interface from EXI to SI.
2005/09/27 Changed the name to DPD. Deleted the note regarding the DPDObject member variables size and traceID. Changed the DPD description.
2005/08/30 Modified the description of button placement and added a note that the member variable of the DPDObject structure will change.
2005/08/01 Initial version.
CONFIDENTIAL