1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="Microsoft FrontPage 5.0"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css"> 8<title>WPADStatusEx</title> 9</head> 10 11<body> 12 13<h1>WPADStatusEx</h1> 14 15 16<H2>C Specification</H2> 17<DL> 18 <DD> 19<PRE><CODE>#include <revolution/wpad.h></CODE></PRE> 20 <DD> 21 <PRE><CODE> 22#define WPAD_DPD_MAX_OBJECTS 4 23 24#define WPAD_BUTTON_LEFT 0x0001 25#define WPAD_BUTTON_RIGHT 0x0002 26#define WPAD_BUTTON_DOWN 0x0004 27#define WPAD_BUTTON_UP 0x0008 28#define WPAD_BUTTON_PLUS 0x0010 29#define WPAD_BUTTON_2 0x0100 30#define WPAD_BUTTON_1 0x0200 31#define WPAD_BUTTON_B 0x0400 32#define WPAD_BUTTON_A 0x0800 33#define WPAD_BUTTON_MINUS 0x1000 34#define WPAD_BUTTON_HOME 0x8000 35 36// for FreeStyle 37#define WPAD_BUTTON_Z 0x2000 38#define WPAD_BUTTON_C 0x4000 39 40// for ClassicStyle 41#define WPAD_CL_BUTTON_UP 0x0001 42#define WPAD_CL_BUTTON_LEFT 0x0002 43#define WPAD_CL_TRIGGER_ZR 0x0004 44#define WPAD_CL_BUTTON_X 0x0008 45#define WPAD_CL_BUTTON_A 0x0010 46#define WPAD_CL_BUTTON_Y 0x0020 47#define WPAD_CL_BUTTON_B 0x0040 48#define WPAD_CL_TRIGGER_ZL 0x0080 49#define WPAD_CL_RESERVED 0x0100 50#define WPAD_CL_TRIGGER_R 0x0200 51#define WPAD_CL_BUTTON_PLUS 0x0400 52#define WPAD_CL_BUTTON_HOME 0x0800 53#define WPAD_CL_BUTTON_MINUS 0x1000 54#define WPAD_CL_TRIGGER_L 0x2000 55#define WPAD_CL_BUTTON_DOWN 0x4000 56#define WPAD_CL_BUTTON_RIGHT 0x8000 57 58// for compatibility 59#define WPAD_BUTTON_SELECT WPAD_BUTTON_MINUS 60#define WPAD_BUTTON_START WPAD_BUTTON_PLUS 61#define WPAD_BUTTON_SMALL_B WPAD_BUTTON_2 62#define WPAD_BUTTON_SMALL_A WPAD_BUTTON_1 63#define WPAD_BUTTON_Z1 WPAD_BUTTON_Z 64#define WPAD_BUTTON_Z2 WPAD_BUTTON_C 65 66 67typedef struct WPADStatusEx 68{ 69u16 button; 70s16 accX; 71s16 accY; 72s16 accZ; 73DPDObject obj[WPAD_DPD_MAX_OBJECTS]; 74u8 dev; 75s8 err; 76DPDObjEx exp[WPAD_DPD_MAX_OBJECTS]; 77} WPADStatusEx; 78 79typedef struct DPDObject 80{ 81s16 x; 82s16 y; 83u16 size; 84u8 traceId; 85} DPDObject; 86 87typedef struct DPDObjEx 88{ 89s16 range_x1; 90s16 range_y1; 91s16 range_x2; 92s16 range_y2; 93u16 pixel; 94s8 radius; 95} DPDObjEx; 96 97</CODE></PRE> 98</DL> 99<H2>Elements</H2> 100<TABLE border="1" cellpadding="3" cellspacing="0.1"> 101 <TBODY> 102 <tr> 103<TD><code><b><i>button</i></b></code></TD> 104<TD>When a button is pressed, the corresponding bit (<code>WPAD_BUTTON_*</code>) is set to 1.</TD> 105 </tr> 106 <tr> 107<TD><code><b><i>accX</i></b></code></TD> 108<TD>Output of the motion sensor's x-component. The resolution is 1024. A value of 0 corresponds to 0G (outputs in the range of -512 <= <code><b><i>accX</i></b></code> < 512).</TD> 109 </tr> 110 <tr> 111<TD><code><b><i>accY</i></b></code></TD> 112<TD>Output of the motion sensor's y-component. The resolution is the same as for <code><b><i>accX</i></b></code>.</TD> 113 </tr> 114 <tr> 115<TD><code><b><i>accZ</i></b></code></TD> 116<TD>Output of the motion sensor's z-component. The resolution is the same as for <code><b><i>accX</i></b></code>.</TD> 117 </tr> 118 <tr> 119<TD><code><b><i>obj[].x</i></b></code></TD> 120<TD>The x-coordinate of the center of mass for the object obtained with the pointer. The resolution is 1024.</TD> 121 </tr> 122 <tr> 123<TD><code><b><i>obj[].y</i></b></code></TD> 124<TD>The y-coordinate of the center of mass for the object obtained with the pointer. The resolution is 768.</TD> 125 </tr> 126 <tr> 127<TD><code><b><i>obj[].size</i></b></code></TD> 128<TD>The size of the object obtained with the pointer. The resolution is 128*96.</TD> 129 </tr> 130 <tr> 131<TD><code><b><i>obj[].traceId</i></b></code></TD> 132<TD>The trace ID of the object obtained with the pointer.</TD> 133 </tr> 134 <tr> 135<TD><code><b><i>dev</i></b></code></TD> 136<TD>The controller type.</TD> 137 </tr> 138 <TR> 139<TD width="120" valign="top"><CODE><b><i>err</i></b></CODE></TD> 140<TD width="520">The controller error status. 141 </TD> 142 </TR> 143 <tr> 144<TD><code><b><i>exp[].range_x1</i></b></code></TD> 145<TD>The top-right coordinate (for the X axis) of the rectangle enclosing the object gotten by the pointer. The resolution is 1024.</TD> 146 </tr> 147 <tr> 148<TD><code><b><i>exp[].range_y1</i></b></code></TD> 149<TD>The top-right coordinate (for the Y axis) of the rectangle enclosing the object gotten by the pointer. The resolution is 768.</TD> 150 </tr> 151 <tr> 152<TD><code><b><i>exp[].range_x2</i></b></code></TD> 153<TD>The bottom-left coordinate (for the X axis) of the rectangle enclosing the object gotten by the pointer. The resolution is 1024.</TD> 154 </tr> 155 <tr> 156<TD><code><b><i>exp[].range_y2</i></b></code></TD> 157<TD>The bottom-left coordinate (for the Y axis) of the rectangle enclosing the object gotten by the pointer. The resolution is 768.</TD> 158 </tr> 159 <tr> 160<TD><code><b><i>exp[].pixel</i></b></code></TD> 161<TD>The number of pixels for the object gotten by the pointer. The resolution is 128*96.</TD> 162 </tr> 163 <tr> 164<TD><code><b><i>exp[].radius</i></b></code></TD> 165<TD>The radius of the object gotten by the pointer. Values are calculated based on the size and are output in the range 0 <= exp[].radius <= 15.</TD> 166 </tr> 167 </TBODY> 168</TABLE> 169 170 171 172<h2>Description</h2> 173<p> 174The WPADStatus structure represents the status of the Wii Remote. 175<ul> 176<li>Number of Standard Controllers</li> 177</ul> 178<blockquote> 179The maximum number of Wii Remotes that can connect is defined as a macro constant. 180<table border="1"> 181<TR> 182<TD width="150"><CODE>WPAD_MAX_CONTROLLERS</CODE></TD> 183<TD>The maximum number of Wii Remotes that can connect.</TD> 184</TR> 185</table> 186</blockquote> 187 188<ul> 189<li>Button Input</li> 190</ul> 191<blockquote> 192Button inputs are defined with the following macro constants. The Wii Remote is equipped with + Control Pad, A, B, 1, 2, MINUS, PLUS, and HOME digital buttons. 193<table border="1"> 194<TR> 195<TD width="150"><CODE>WPAD_BUTTON_UP</CODE></TD> 196<TD>+Control Pad UP is being pressed.</TD> 197</TR> 198<TR> 199<TD width="150"><CODE>WPAD_BUTTON_DOWN</CODE></TD> 200<TD>+Control Pad DOWN is being pressed.</TD> 201</TR> 202<TR> 203<TD width="150"><CODE>WPAD_BUTTON_LEFT</CODE></TD> 204<TD>+Control Pad LEFT is being pressed.</TD> 205</TR> 206<TR> 207<TD width="150"><CODE>WPAD_BUTTON_RIGHT</CODE></TD> 208<TD>+Control Pad RIGHT is being pressed.</TD> 209</TR> 210<TR> 211<TD width="150"><CODE>WPAD_BUTTON_A</CODE></TD> 212<TD>The A Button is being pressed.</TD> 213</TR> 214<TR> 215<TD width="150"><CODE>WPAD_BUTTON_B</CODE></TD> 216<TD>The B Button is being pressed.</TD> 217</TR> 218<TR> 219<TD width="150"><CODE>WPAD_BUTTON_1</CODE></TD> 220<TD>The 1 Button is being pressed.</TD> 221</TR> 222<TR> 223<TD width="150"><CODE>WPAD_BUTTON_2</CODE></TD> 224<TD>The 2 Button is being pressed.</TD> 225</TR> 226<TR> 227<TD width="150"><CODE>WPAD_BUTTON_MINUS</CODE></TD> 228<TD>The MINUS button is being pressed.</TD> 229</TR> 230<TR> 231<TD width="150"><CODE>WPAD_BUTTON_PLUS</CODE></TD> 232<TD>The PLUS button is being pressed.</TD> 233</TR> 234<TR> 235<TD width="150"><CODE>WPAD_BUTTON_HOME</CODE></TD> 236<TD>HOME is being pressed.</TD> 237</TR> 238</table> 239</blockquote> 240 241<ul> 242<li>Pointer</li> 243</ul> 244<blockquote> 245The pointer specifications are defined as macro constants. 246 247<table border="1"> 248<TR> 249<TD width="150"><CODE>WPAD_DPD_MAX_OBJECTS</CODE></TD> 250<TD>The maximum number of objects that the pointer can detect simultaneously.</TD> 251</TR> 252<TR> 253<TD width="150"><CODE>WPAD_DPD_ANGLE</CODE></TD> 254<TD>The pointer view angle (in degrees).</TD> 255</TR> 256<TR> 257<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WX</CODE></TD> 258<TD>Pointer resolution along the x-axis.</TD> 259</TR> 260<TR> 261<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WY</CODE></TD> 262<TD>Pointer resolution along the y-axis.</TD> 263</TR> 264</table> 265 266<p> 267Object data items are stored in the obj[] array in the order that they are detected by the pointer. The pointer scans the image captured by the internal sensor from top left to bottom right and outputs object data in the order detected. At the same time, trace ID(s) are assigned in the order that the objects are detected. 268</p> 269<p> 270The trace ID helps 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 data parity is preserved. 271</p> 272</blockquote> 273 274<ul> 275<li>Motion Sensor</li> 276</ul> 277<blockquote> 278The motion sensor specifications are defined as macro constants. 279 280<table border="1" 281 282<TR> 283<TD width="150"><CODE>WPAD_ACC_RESO</CODE></TD> 284<TD>The motion sensor's resolution.</TD> 285</TR> 286 287</table> 288</blockquote> 289 290<ul> 291<li>Controller Type</li> 292</ul> 293<blockquote> 294Controller types are defined with the following macro constants. 295 <TABLE border="1" width="500" cellspacing="0.1"> 296 <TBODY> 297 <TR> 298<TD width="150"><CODE>WPAD_DEV_CORE</CODE></TD> 299<TD width="350">Wii Remote.</TD> 300 </TR> 301 <TR> 302<TD width="150"><CODE>WPAD_DEV_FREESTYLE</CODE></TD> 303<TD width="350">Nunchuk Style.</TD> 304 </TR> 305 <TR> 306<TD width="150"><CODE>WPAD_DEV_CLASSIC</CODE></TD> 307<TD width="350">Classic Style. 308 </TR> 309 <TR> 310<TD width="150"><CODE>WPAD_DEV_UNKNOWN</CODE></TD> 311<TD width="350">Unknown device. 312 </TD> 313 </TR> 314 </TBODY> 315 </TABLE> 316</blockquote> 317<ul> 318<li>Error Status</li> 319</ul> 320<blockquote> 321Error statuses are defined with the following macro constants. 322 <TABLE border="1" width="500" cellspacing="0.1"> 323 <TBODY> 324 <TR> 325<TD width="150"><CODE>WPAD_ERR_NONE</CODE></TD> 326<TD width="350">Indicates the Wii Remote is connected. The <code>WPADStatusEx</code> structure maintains valid data.</TD> 327 </TR> 328 <TR> 329<TD width="150"><CODE>WPAD_ERR_NO_CONTROLLER</CODE></TD> 330<TD width="350">Indicates the Wii Remote is not connected. The <code>WPADStatusEx</code> structure does not contain valid data. (Members other than <CODE>err</CODE> are undefined.) 331 </TD> 332 </TR> 333 <TR> 334<TD width="150"><CODE>WPAD_ERR_BUSY</CODE></TD> 335<TD width="350">Processing is being carried out for the Wii Remote. Only button information is valid for the <code>WPADStatusEx</code> structure.<BR> 336 </TR> 337 <TR> 338<TD width="150"><CODE>WPAD_ERR_TRANSFER</CODE></TD> 339<TD width="350">Indicates a problem occurred during communications. The <code>WPADStatusEx</code> structure does not contain valid data. (Members other than <CODE>err</CODE> are undefined.)<BR> 340 </TD> 341 </TR> 342 <TR> 343<TD width="150"><CODE>WPAD_ERR_INVALID</CODE></TD> 344<TD width="350">The data format of data received from the Wii Remote differs from that set by the <a href="./WPADSetDataFormat.html"><code>WPADSetDataFormat</code></a> function. (Structure members other than err are undefined.)</TD> 345 </TR> 346 </TBODY> 347 </TABLE> 348</blockquote> 349 350</p> 351<H2>See Also</H2> 352<p> 353<A href="./toc.html" target="contents"><CODE>WPAD Functions</CODE></A><br> 354</p> 355 356 357<H2>Revision History</H2> 358<P> 35908/15/2006 Initial version. 360</P> 361<hr> 362<P>CONFIDENTIAL</p> 363</BODY> 364</HTML>