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 &lt;revolution/wpad.h&gt;</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{
69    u16       button;
70    s16       accX;
71    s16       accY;
72    s16       accZ;
73    DPDObject obj[WPAD_DPD_MAX_OBJECTS];
74    u8        dev;
75    s8        err;
76    DPDObjEx  exp[WPAD_DPD_MAX_OBJECTS];
77} WPADStatusEx;
78
79typedef struct DPDObject
80{
81    s16 x;
82    s16 y;
83    u16 size;
84    u8  traceId;
85} DPDObject;
86
87typedef struct DPDObjEx
88{
89    s16       range_x1;
90    s16       range_y1;
91    s16       range_x2;
92    s16       range_y2;
93    u16       pixel;
94    s8        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 &lt;= <code><b><i>accX</i></b></code> &lt; 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 (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 (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 (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 (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 &lt;= exp[].radius &lt;= 15.</TD>
166    </tr>
167  </TBODY>
168</TABLE>
169
170
171
172<h2>Description</h2>
173<p>
174The <CODE>WPADStatus</CODE> structure represents the status of the Wii Remote.
175</p>
176<ul>
177<li>Number of Controllers</li>
178</ul>
179<blockquote>
180The maximum number of Wii Remotes that can connect is defined as the macro constant below.
181<table border="1">
182<TR>
183<TD width="150"><CODE>WPAD_MAX_CONTROLLERS</CODE></TD>
184<TD>The maximum number of Wii Remotes that can connect.</TD>
185</TR>
186</table>
187</blockquote>
188
189<ul>
190<li>Button Input</li>
191</ul>
192<blockquote>
193Button inputs are defined with the following macro constants. The Wii Remote is equipped with +Control Pad, A, B, 1, 2, -, +, and HOME digital buttons.
194<table border="1">
195<TR>
196<TD width="150"><CODE>WPAD_BUTTON_UP</CODE></TD>
197<TD>+Control Pad UP is being pressed.</TD>
198</TR>
199<TR>
200<TD width="150"><CODE>WPAD_BUTTON_DOWN</CODE></TD>
201<TD>+Control Pad DOWN is being pressed.</TD>
202</TR>
203<TR>
204<TD width="150"><CODE>WPAD_BUTTON_LEFT</CODE></TD>
205<TD>+Control Pad LEFT is being pressed.</TD>
206</TR>
207<TR>
208<TD width="150"><CODE>WPAD_BUTTON_RIGHT</CODE></TD>
209<TD>+Control Pad RIGHT is being pressed.</TD>
210</TR>
211<TR>
212<TD width="150"><CODE>WPAD_BUTTON_A</CODE></TD>
213<TD>The A Button is being pressed.</TD>
214</TR>
215<TR>
216<TD width="150"><CODE>WPAD_BUTTON_B</CODE></TD>
217<TD>The B Button is being pressed.</TD>
218</TR>
219<TR>
220<TD width="150"><CODE>WPAD_BUTTON_1</CODE></TD>
221<TD>The 1 Button is being pressed.</TD>
222</TR>
223<TR>
224<TD width="150"><CODE>WPAD_BUTTON_2</CODE></TD>
225<TD>The 2 Button is being pressed.</TD>
226</TR>
227<TR>
228<TD width="150"><CODE>WPAD_BUTTON_MINUS</CODE></TD>
229<TD>The - Button is being pressed.</TD>
230</TR>
231<TR>
232<TD width="150"><CODE>WPAD_BUTTON_PLUS</CODE></TD>
233<TD>The + Button is being pressed.</TD>
234</TR>
235<TR>
236<TD width="150"><CODE>WPAD_BUTTON_HOME</CODE></TD>
237<TD>HOME is being pressed.</TD>
238</TR>
239</table>
240</blockquote>
241
242<ul>
243<li>Pointer</li>
244</ul>
245<blockquote>
246The pointer specifications are defined by the following macro constants.
247
248<table border="1">
249<TR>
250<TD width="150"><CODE>WPAD_DPD_MAX_OBJECTS</CODE></TD>
251<TD>The maximum number of objects that the pointer can detect simultaneously.</TD>
252</TR>
253<TR>
254<TD width="150"><CODE>WPAD_DPD_ANGLE</CODE></TD>
255<TD>The pointer view angle (in degrees).</TD>
256</TR>
257<TR>
258<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WX</CODE></TD>
259<TD>Pointer resolution along the x-axis.</TD>
260</TR>
261<TR>
262<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WY</CODE></TD>
263<TD>Pointer resolution along the y-axis.</TD>
264</TR>
265</table>
266
267<p>
268Object data items are stored in the <CODE>obj</CODE> 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.
269</p>
270<p>
271The 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.
272</p>
273</blockquote>
274
275<ul>
276<li>Motion Sensor</li>
277</ul>
278<blockquote>
279The motion sensor specifications are defined by the macro constant below.
280
281<table border="1">
282
283<TR>
284<TD width="150"><CODE>WPAD_ACC_RESO</CODE></TD>
285<TD>The motion sensor's resolution.</TD>
286</TR>
287
288</table>
289</blockquote>
290
291<ul>
292<li>Controller Type</li>
293</ul>
294<blockquote>
295Controller types are defined with the following macro constants.
296      <TABLE border="1" width="500" cellspacing="0.1">
297        <TBODY>
298          <TR>
299            <TD width="150"><CODE>WPAD_DEV_NOT_FOUND</CODE></TD>
300            <TD width="350">Nothing is connected to the specified channel.</TD>
301          </TR>
302          <TR>
303            <TD width="150"><CODE>WPAD_DEV_CORE</CODE></TD>
304            <TD width="350">Wii Remote.</TD>
305          </TR>
306          <TR>
307            <TD width="150"><CODE>WPAD_DEV_FREESTYLE</CODE></TD>
308            <TD width="350">Nunchuk Style.</TD>
309          </TR>
310          <TR>
311            <TD width="150"><CODE>WPAD_DEV_CLASSIC</CODE></TD>
312            <TD width="350">Classic Style.<BR>
313          </TR>
314          <TR>
315            <TD width="150"><CODE>WPAD_DEV_FUTURE</CODE></TD>
316            <TD width="350">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 may be operated as a Wii Remote.<BR>
317          </TR>
318          <TR>
319            <TD width="150"><CODE>WPAD_DEV_NOT_SUPPORTED</CODE></TD>
320            <TD width="350">A 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.<BR>
321          </TR>
322          <TR>
323            <TD width="150"><CODE>WPAD_DEV_UNKNOWN</CODE></TD>
324            <TD width="350">Unknown 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.<BR>
325            </TD>
326          </TR>
327        </TBODY>
328      </TABLE>
329</blockquote>
330<ul>
331<li>Error Status</li>
332</ul>
333<blockquote>
334Error statuses are defined with the following macro constants.
335      <TABLE border="1" width="500" cellspacing="0.1">
336        <TBODY>
337          <TR>
338            <TD width="150"><CODE>WPAD_ERR_NONE</CODE></TD>
339            <TD width="350">Indicates the Wii Remote is connected. The <code>WPADStatusEx</code> structure maintains valid data.</TD>
340          </TR>
341          <TR>
342            <TD width="150"><CODE>WPAD_ERR_BUSY</CODE></TD>
343            <TD width="350">This is the ACK control command sent to the Wii Remote. Only button information is valid for the <code>WPADStatusEx</code> structure.<BR>
344          </TR>
345          <TR>
346            <TD width="150"><CODE>WPAD_ERR_INVALID</CODE></TD>
347            <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 <CODE><STRONG><EM>err</EM></STRONG></CODE> are undefined.)</TD>
348          </TR>
349          <TR>
350            <TD width="150"><CODE>WPAD_ERR_CORRUPTED</CODE></TD>
351            <TD width="350">The data in the External Extension Controller is corrupted. The structure members of the External Extension Controller are undefined.</TD>
352          </TR>
353        </TBODY>
354      </TABLE>
355</blockquote>
356
357<H2>See Also</H2>
358<p>
359<A href="./toc.html" target="contents"><CODE>WPAD Functions</CODE></A><br>
360</p>
361
362
363<H2>Revision History</H2>
364<P>
3652007/12/10 Revised the description of <CODE>WPAD_ERR_BUSY</CODE>, and deleted <CODE>WPAD_ERR_NO_CONTROLLER</CODE> and <CODE>WPAD_ERR_TRANSFER</CODE>.<br>
366 2006/09/22 Added <CODE>WPAD_ERR_CORRUPTED</CODE><br> 2007/08/15 Initial version<br></P>
367<hr><p>CONFIDENTIAL</p></body>
368</HTML>