WPADStatus

Syntax

#include <revolution/wpad.h>
#include <revolution/wpadBalance.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
#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

#define WPAD_MPLS_STAT_PLSVLD   0x80
#define WPAD_MPLS_STAT_EXTVLD   0x40
#define WPAD_MPLS_STAT_YAWSEL   0x08
#define WPAD_MPLS_STAT_PITSEL   0x04
#define WPAD_MPLS_STAT_ROLSEL   0x02
#define WPAD_MPLS_STAT_ATTACH   0x01

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 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;

typedef struct WPADMPStatus
{
    u16       button;
    s16       accX;
    s16       accY;
    s16       accZ;
    DPDObject obj[WPAD_DPD_MAX_OBJECTS];

    u8        dev;
    s8        err;

    union
    {
        // for Nunchuk
        struct 
        {
            s16 fsAccX;
            s16 fsAccY;
            s16 fsAccZ;
            s8  fsStickX;
            s8  fsStickY;
        } fs;
        
        // for Classic
        struct
        {
            u16 clButton; 
            s16 clLStickX;
            s16 clLStickY;
            s16 clRStickX;
            s16 clRStickY;
            u8  clTriggerL;
            u8  clTriggerR;
        } cl;
    } ext;

    u8        stat;                         
    u8        reserved;
    
    s16       pitch;                        
    s16       yaw;
    s16       roll;

} WPADMPStatus;

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 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.(-512 <= (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.(-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 given in terms of the L Button of the Classic Controller.(0 <= (Values are output in the range 0 <= clTriggerL < 256.) Zero is always returned, effective from SDK 3.3.
clTriggerR Movement data given in terms of the R Button of the Classic Controller. The value range is the same as for clTriggerL. Zero is always returned, effective from SDK 3.3.

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.

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.

WPADMPStatus Elements

ext.fs.fsAccX Output of the Nunchuk motion sensor's X-component when using Nunchuk/MotionPlus Style. Resolution is 1024. A value of 0 corresponds to weightlessness, or 0 G (values are output in the range -512 <= fsAccX < 512).
ext.fs.fsAccY Output of the Nunchuk motion sensor's Y-component when using Nunchuk/MotionPlus Style. Resolution is the same as for fsAccX.
ext.fs.fsAccZ Output of the Nunchuk motion sensor's Z-component when using Nunchuk/MotionPlus Style. Resolution is the same as for fsAccX.
ext.fs.fsStickX Movement data given in terms of the X-axis for the Nunchuk Control Stick when using Nunchuk/MotionPlus Style. The resolution is 256 (values are output in the range -128 <= fsStickX < 128).
ext.fs.fsStickY Movement data given in terms of the Y-axis of the Nunchuk Control Stick when using Nunchuk/MotionPlus Style. The resolution is the same as for fsStickX.
ext.cl.clButton When a Classic Controller button is pressed when using Classic/MotionPlus Style, the corresponding bit (WPAD_CL_BUTTON_*) is set to 1.
ext.cl.clLStickX Movement data about the X-axis of the Classic Controller's analog L Stick when using Classic/MotionPlus Style.(-512 <= (Values are output in the range -512 <= clLStickX < 512.)
ext.cl.clLStickY Movement data about the Y-axis of the Classic Controller's analog L Stick when using Classic/MotionPlus Style. The value range is the same as for clLStickX.
ext.cl.clRStickX Movement data about the X-axis of the Classic Controller's R Stick when using Classic/MotionPlus style.(-512 <= (Values are output in the range -512 <= clRStickX < 512.)
ext.cl.clRStickY Movement data about the Y-axis of the Classic Controller's R Stick when using Classic/MotionPlus style. The value range is the same as for clRStickX.
ext.cl.clTriggerL Movement data about the L Button of the Classic Controller when using Classic/MotionPlus Style.(0 <= (Values are output in the range 0 <= clTriggerL < 256.) Zero is always returned, effective from SDK 3.3.
ext.cl.clTriggerR Movement data about the R Button of the Classic Controller when using Classic/MotionPlus Style. The value range is the same as for clTriggerL. Zero is always returned, effective from SDK 3.3.
stat Status of the Wii MotionPlus.
reserved Not used.
pitch Wii MotionPlus output around the pitch axis. Resolution is 16368. This value will approach zero when the Wii Remote rotates in the negative direction, and 16384 when it rotates in the positive direction.
yaw Wii MotionPlus output around the yaw axis. Resolution is the same as for pitch.
roll Wii MotionPlus output in the roll direction. Resolution is the same as for pitch.

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 macro constants shown below.

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, MINUS, PLUS, HOME, L, R, ZL, and ZR 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 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. If the WPADTrn library is not linked, the device is recognized as WPAD_DEV_FUTURE.
WPAD_DEV_GUITAR Wii Remote + Guitar Controller. If the WPADGtr library is not linked, the device is recognized as WPAD_DEV_FUTURE.
WPAD_DEV_DRUM Wii Remote + Drum Controller. If the WPADDrm library is not linked, the device is recognized as WPAD_DEV_FUTURE.
WPAD_DEV_TAIKO Wii Remote + Taiko Drum Controller. If the WPADTko library is not linked, the device is recognized as WPAD_DEV_FUTURE.
WPAD_DEV_BALANCE_CHECKER Wii Balance Board. If the WUD library is not linked, a Wii Balance Board is not connected.
WPAD_DEV_MPLS MotionPlus Style.
WPAD_DEV_MPLS_FREESTYLE Nunchuk/MotionPlus Style.
WPAD_DEV_MPLS_CLASSIC Classic/MotionPlus Style. Not supported by Wii MotionPlus PP2.
WPAD_DEV_MPLS_FUTURE Status when a device other than a Nunchuk or Classic Controller has been plugged into the Wii MotionPlus while it is operating in extension mode. Not supported by Wii MotionPlus PP2.
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 Data with the specified data format was received.
WPAD_ERR_NO_CONTROLLER Data has never been received.
WPAD_ERR_INVALID The format of incoming data is different from the format specified for the WPAD library. Values other than err and dev are undefined.
(In this case, the Wii Remote and external extension controller data is invalid.)
WPAD_ERR_CORRUPTED An external extension controller, such as the Nunchuk or Classic Controller, is partially inserted into the Wii Remote. Data for the external extension controller is corrupted. (However, Wii Remote data is not corrupted.)
The Wii MotionPlus status bits contain information pertaining to: 1) the type of conversion value used for each axis (the low-velocity range conversion value or the overall range conversion value); 2) whether an external extension controller is plugged into the Wii MotionPlus, and; 3) whether the data for the Wii MotionPlus or external extension controller is corrupt. Check the information set in each bit by performing a logical AND comparison with the following macros.
WPAD_MPLS_STAT_PITSEL If this value for the pitch axis is zero, pitch uses the overall conversion value. If nonzero, pitch uses the low-velocity range conversion value.
WPAD_MPLS_STAT_YAWSEL If this value for the yaw axis is zero, yaw uses the overall conversion value. If nonzero, yaw uses the low-velocity range conversion value.
WPAD_MPLS_STAT_ROLSEL If this value for the roll axis is zero, roll uses the overall conversion value. If nonzero, roll uses the low-velocity range conversion value.
WPAD_MPLS_STAT_ATTACH If the value is zero, nothing is plugged into the Wii MotionPlus. If nonzero, something is plugged into the Wii MotionPlus.
WPAD_MPLS_STAT_PLSVLD If this value is zero, the Wii MotionPlus data is corrupt. If nonzero, the data is normal.
WPAD_MPLS_STAT_EXTVLD If this value is zero, the external extension controller data is corrupt. If nonzero, the data is normal.

See Also

None.

Revision History

2009/06/23 Revised the explanations of clTriggerL, clTriggerR for WPADCLStatus, WPADMPStatus. Deleted information for some specialty controllers.
2008/12/26 Added WPAD_DEV_TAIKO.
2008/12/19 Added WPAD_DEV_DRUM.
2008/12/02 Revised the description of error status.
2008/11/26 Revised the description of controller types.
2008/09/30 Added the WPADMPStatus structure.
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