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>WPADCLStatus</title>
9</head>
10
11<body>
12
13
14<h1>WPADCLStatus</h1>
15
16
17<H2>C Specification</H2>
18<DL>
19  <DD>
20<PRE><CODE>#include &lt;revolution/wpad.h&gt;</CODE></PRE>
21  <DD>
22  <PRE><CODE>
23#define WPAD_DPD_MAX_OBJECTS        4
24
25#define WPAD_BUTTON_LEFT            0x0001
26#define WPAD_BUTTON_RIGHT           0x0002
27#define WPAD_BUTTON_DOWN            0x0004
28#define WPAD_BUTTON_UP              0x0008
29#define WPAD_BUTTON_PLUS            0x0010
30#define WPAD_BUTTON_2               0x0100
31#define WPAD_BUTTON_1               0x0200
32#define WPAD_BUTTON_B               0x0400
33#define WPAD_BUTTON_A               0x0800
34#define WPAD_BUTTON_MINUS           0x1000
35#define WPAD_BUTTON_HOME            0x8000
36
37// for FreeStyle
38#define WPAD_BUTTON_Z               0x2000
39#define WPAD_BUTTON_C               0x4000
40
41// for ClassicStyle
42#define WPAD_CL_BUTTON_UP           0x0001
43#define WPAD_CL_BUTTON_LEFT         0x0002
44#define WPAD_CL_TRIGGER_ZR          0x0004
45#define WPAD_CL_BUTTON_X            0x0008
46#define WPAD_CL_BUTTON_A            0x0010
47#define WPAD_CL_BUTTON_Y            0x0020
48#define WPAD_CL_BUTTON_B            0x0040
49#define WPAD_CL_TRIGGER_ZL          0x0080
50#define WPAD_CL_RESERVED            0x0100
51#define WPAD_CL_TRIGGER_R           0x0200
52#define WPAD_CL_BUTTON_PLUS         0x0400
53#define WPAD_CL_BUTTON_HOME         0x0800
54#define WPAD_CL_BUTTON_MINUS        0x1000
55#define WPAD_CL_TRIGGER_L           0x2000
56#define WPAD_CL_BUTTON_DOWN         0x4000
57#define WPAD_CL_BUTTON_RIGHT        0x8000
58
59// for compatibility
60#define WPAD_BUTTON_SELECT          WPAD_BUTTON_MINUS
61#define WPAD_BUTTON_START           WPAD_BUTTON_PLUS
62#define WPAD_BUTTON_SMALL_B         WPAD_BUTTON_2
63#define WPAD_BUTTON_SMALL_A         WPAD_BUTTON_1
64#define WPAD_BUTTON_Z1              WPAD_BUTTON_Z
65#define WPAD_BUTTON_Z2              WPAD_BUTTON_C
66
67
68typedef struct WPADCLStatus
69{
70u16       button;
71s16       accX;
72s16       accY;
73s16       accZ;
74DPDObject obj[WPAD_DPD_MAX_OBJECTS];
75u8        dev;
76s8        err;
77u16       clButton;
78s8        clLStickX;
79s8        clLStickY;
80s8        clRStickX;
81s8        clRStickY;
82u8        clTriggerL;
83u8        clTriggerR;
84} WPADCLStatus;
85
86typedef struct DPDObject
87{
88s16 x;
89s16 y;
90u16 size;
91u8  traceId;
92} DPDObject;
93</CODE></PRE>
94</DL>
95<H2>Elements</H2>
96<TABLE border="1" cellpadding="3" cellspacing="0.1">
97  <TBODY>
98  <tr>
99<TD><code><b><i>button</i></b></code></TD>
100<TD>When a Wii Remote button is pressed, the corresponding bit (<code>WPAD_BUTTON_*</code>) is set to 1.</TD>
101    </tr>
102  <tr>
103<TD><code><b><i>accX</i></b></code></TD>
104<TD>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 &lt;= <code><b><i>accX</i></b></code> &lt; 512).</TD>
105    </tr>
106  <tr>
107<TD><code><b><i>accY</i></b></code></TD>
108<TD>Output of the Wii Remote's motion sensor's y-component. The resolution is the same as for <code><b><i>accX</i></b></code>.</TD>
109    </tr>
110  <tr>
111<TD><code><b><i>accZ</i></b></code></TD>
112<TD>Output of the Wii Remote's motion sensor's z-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>obj[].x</i></b></code></TD>
116<TD>The x-coordinate of the center of mass for the object obtained with the pointer. The resolution is 1024.</TD>
117    </tr>
118  <tr>
119<TD><code><b><i>obj[].y</i></b></code></TD>
120<TD>The y-coordinate of the center of mass for the object obtained with the pointer. The resolution is 768.</TD>
121    </tr>
122  <tr>
123<TD><code><b><i>obj[].size</i></b></code></TD>
124<TD>The size of the object obtained with the pointer. The resolution is 128*96.</TD>
125    </tr>
126  <tr>
127<TD><code><b><i>obj[].traceId</i></b></code></TD>
128<TD>The trace ID of the object obtained with the pointer.</TD>
129    </tr>
130  <tr>
131<TD><code><b><i>dev</i></b></code></TD>
132<TD>The controller type.</TD>
133    </tr>
134    <TR>
135<TD width="120" valign="top"><CODE><b><i>err</i></b></CODE></TD>
136<TD width="520">The controller error status.
137      </TD>
138    </TR>
139  <tr>
140<TD><code><b><i>clButton</i></b></code></TD>
141<TD>When a Classic controller button is pressed, the corresponding bit (<code>WPAD_CL_BUTTON_*</code>) is set to 1.</TD>
142    </tr>
143  <tr>
144<TD><code><b><i>clLStickX</i></b></code></TD>
145<TD>Movement data given in terms of the x-axis for the Classic controller's L-Stick. (Values are output in the range -128 &lt;= clLStickX &lt; 128.)</TD>
146    </tr>
147  <tr>
148<TD><code><b><i>clLStickY</i></b></code></TD>
149<TD>Movement data given in terms of the y-axis for the Classic controller's L-Stick. The value range is the same as for clLStickX.</TD>
150    </tr>
151  <tr>
152<TD><code><b><i>clRStickX</i></b></code></TD>
153<TD>Movement data given in terms of the x-axis for the Classic controller's R-Stick. (Values are output in the -128 &lt;= clRStickX &lt; 128.)</TD>
154    </tr>
155  <tr>
156<TD><code><b><i>clRStickY</i></b></code></TD>
157<TD>Movement data given in terms of the y-axis for the Classic controller's R-Stick. The value range is the same as for clRStickX.</TD>
158    </tr>
159  <tr>
160<TD><code><b><i>clTriggerL</i></b></code></TD>
161<TD>Movement data given in terms of the L-button of the Classic controller. (Values are output in the range 0 &lt;= clTriggerL &lt; 256.)</TD>
162    </tr>
163  <tr>
164<TD><code><b><i>clTriggerR</i></b></code></TD>
165<TD>Movement data given in terms of the R-button of the Classic controller. The value range is the same as clTriggerL.</TD>
166    </tr>
167  </TBODY>
168</TABLE>
169
170
171
172<h2>Description</h2>
173<p>
174The WPADCLStatus structure represents the status of the Classic style.
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 has +Control, A, B, 1, 2, MINUS, PLUS, and HOME digital buttons; the Classic controller has +Control, A, B, X, Y, MINUS, PLUS, HOME, L, R, and Z digital buttons. The button status for the Wii Remote and the Classic controller can be obtained independently.
193<table border="1">
194<TR>
195<TD width="150"><CODE>WPAD_BUTTON_UP</CODE></TD>
196<TD>+Control Pad UP on the Wii Remote is being pressed.</TD>
197</TR>
198<TR>
199<TD width="150"><CODE>WPAD_BUTTON_DOWN</CODE></TD>
200<TD>+Control Pad DOWN on the Wii Remote is being pressed.</TD>
201</TR>
202<TR>
203<TD width="150"><CODE>WPAD_BUTTON_LEFT</CODE></TD>
204<TD>+Control Pad LEFT on the Wii Remote is being pressed.</TD>
205</TR>
206<TR>
207<TD width="150"><CODE>WPAD_BUTTON_RIGHT</CODE></TD>
208<TD>+Control Pad RIGHT on the Wii Remote is being pressed.</TD>
209</TR>
210<TR>
211<TD width="150"><CODE>WPAD_BUTTON_A</CODE></TD>
212<TD>The A Button on the Wii Remote is being pressed.</TD>
213</TR>
214<TR>
215<TD width="150"><CODE>WPAD_BUTTON_B</CODE></TD>
216<TD>The B Button on the Wii Remote is being pressed.</TD>
217</TR>
218<TR>
219<TD width="150"><CODE>WPAD_BUTTON_1</CODE></TD>
220<TD>The 1 Button on the Wii Remote is being pressed.</TD>
221</TR>
222<TR>
223<TD width="150"><CODE>WPAD_BUTTON_2</CODE></TD>
224<TD>The 2 Button on the Wii Remote is being pressed.</TD>
225</TR>
226<TR>
227<TD width="150"><CODE>WPAD_BUTTON_MINUS</CODE></TD>
228<TD>The MINUS Button on the Wii Remote is being pressed.</TD>
229</TR>
230<TR>
231<TD width="150"><CODE>WPAD_BUTTON_PLUS</CODE></TD>
232<TD>The PLUS Button on the Wii Remote is being pressed.</TD>
233</TR>
234<TR>
235<TD width="150"><CODE>WPAD_BUTTON_HOME</CODE></TD>
236<TD>HOME on the Wii Remote is being pressed.</TD>
237</TR>
238</table>
239<br>
240<table border="1">
241<TR>
242<TD width="150"><CODE>WPAD_CL_BUTTON_UP</CODE></TD>
243<TD>+Control Pad UP on the Classic controller is being pressed.</TD>
244</TR>
245<TR>
246<TD width="150"><CODE>WPAD_CL_BUTTON_DOWN</CODE></TD>
247<TD>+Control Pad DOWN on the Classic controller is being pressed.</TD>
248</TR>
249<TR>
250<TD width="150"><CODE>WPAD_CL_BUTTON_LEFT</CODE></TD>
251<TD>+Control Pad LEFT on the Classic controller is being pressed.</TD>
252</TR>
253<TR>
254<TD width="150"><CODE>WPAD_CL_BUTTON_RIGHT</CODE></TD>
255<TD>+Control Pad RIGHT on the Classic controller is being pressed.</TD>
256</TR>
257<TR>
258<TD width="150"><CODE>WPAD_CL_BUTTON_A</CODE></TD>
259<TD>The A Button on the Classic controller is being pressed.</TD>
260</TR>
261<TR>
262<TD width="150"><CODE>WPAD_CL_BUTTON_B</CODE></TD>
263<TD>The B Button on the Classic controller is being pressed.</TD>
264</TR>
265<TR>
266<TD width="150"><CODE>WPAD_CL_BUTTON_Y</CODE></TD>
267<TD>The Y Button on the Classic controller is being pressed.</TD>
268</TR>
269<TR>
270<TD width="150"><CODE>WPAD_CL_BUTTON_X</CODE></TD>
271<TD>The X Button on the Classic controller is being pressed.</TD>
272</TR>
273<TR>
274<TD width="150"><CODE>WPAD_CL_TRIGGER_L</CODE></TD>
275<TD>The L Button on the Classic controller is being pressed.</TD>
276</TR>
277<TR>
278<TD width="150"><CODE>WPAD_CL_TRIGGER_R</CODE></TD>
279<TD>The R Button on the Classic controller is being pressed.</TD>
280</TR>
281<TR>
282<TD width="150"><CODE>WPAD_CL_TRIGGER_ZL</CODE></TD>
283<TD>The ZL Button on the Classic controller is being pressed.</TD>
284</TR>
285<TR>
286<TD width="150"><CODE>WPAD_CL_TRIGGER_ZR</CODE></TD>
287<TD>The ZR Button on the Classic controller is being pressed.</TD>
288<TR>
289<TD width="150"><CODE>WPAD_CL_BUTTON_MINUS</CODE></TD>
290<TD>The MINUS Button on the Classic controller is being pressed.</TD>
291</TR>
292<TR>
293<TD width="150"><CODE>WPAD_CL_BUTTON_PLUS</CODE></TD>
294<TD>The PLUS Button on the Classic controller is being pressed.</TD>
295</TR>
296<TR>
297<TD width="150"><CODE>WPAD_CL_BUTTON_HOME</CODE></TD>
298<TD>HOME on the Classic controller is being pressed.</TD>
299</TR>
300</TR>
301</table>
302</blockquote>
303
304<ul>
305<li>Pointer</li>
306</ul>
307<blockquote>
308The pointer specifications are defined as macro constants.
309
310<table border="1">
311<TR>
312<TD width="150"><CODE>WPAD_DPD_MAX_OBJECTS</CODE></TD>
313<TD>The maximum number of objects that the pointer can detect simultaneously.</TD>
314</TR>
315<TR>
316<TD width="150"><CODE>WPAD_DPD_ANGLE</CODE></TD>
317<TD>The pointer view angle (in degrees).</TD>
318</TR>
319<TR>
320<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WX</CODE></TD>
321<TD>Pointer resolution along the x-axis.</TD>
322</TR>
323<TR>
324<TD width="150"><CODE>WPAD_DPD_IMG_RESO_WY</CODE></TD>
325<TD>Pointer resolution along the y-axis.</TD>
326</TR>
327</table>
328
329<p>
330Object 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.
331</p>
332<p>
333The 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 fact that the data is the same is preserved.
334</p>
335</blockquote>
336
337<ul>
338<li>Controller Type</li>
339</ul>
340<blockquote>
341Controller types are defined with the following macro constants.
342      <TABLE border="1" width="500" cellspacing="0.1">
343        <TBODY>
344          <TR>
345<TD width="150"><CODE>WPAD_DEV_CORE</CODE></TD>
346<TD width="350">Wii Remote.</TD>
347          </TR>
348          <TR>
349<TD width="150"><CODE>WPAD_DEV_FREESTYLE</CODE></TD>
350<TD width="350">Nunchuk Style.</TD>
351          </TR>
352          <TR>
353<TD width="150"><CODE>WPAD_DEV_CLASSIC</CODE></TD>
354<TD width="350">Classic Style.
355          </TR>
356          <TR>
357<TD width="150"><CODE>WPAD_DEV_UNKNOWN</CODE></TD>
358<TD width="350">Unknown device.
359            </TD>
360          </TR>
361        </TBODY>
362      </TABLE>
363</blockquote>
364
365<ul>
366<li>Error Status</li>
367</ul>
368<blockquote>
369Error statuses are defined with the following macro constants.
370      <TABLE border="1" width="500" cellspacing="0.1">
371        <TBODY>
372          <TR>
373<TD width="150"><CODE>WPAD_ERR_NONE</CODE></TD>
374<TD width="350">Indicates the Wii Remote is connected. The <code>WPADCLStatus</code> structure maintains valid data.</TD>
375          </TR>
376          <TR>
377<TD width="150"><CODE>WPAD_ERR_NO_CONTROLLER</CODE></TD>
378<TD width="350">Indicates the Wii Remote is not connected. The <code>WPADCLStatus</code> structure does not maintain valid data. (Members other than <CODE>err</CODE> are undefined.)
379            </TD>
380          </TR>
381          <TR>
382<TD width="150"><CODE>WPAD_ERR_BUSY</CODE></TD>
383<TD width="350">Processing is being carried out for the Wii Remote. Only Wii Remote button information is valid for the <code>WPADCLStatus</code> structure.
384          </TR>
385          <TR>
386<TD width="150"><CODE>WPAD_ERR_TRANSFER</CODE></TD>
387<TD width="350">Indicates a problem occurred during communications. The <code>WPADCLStatus</code> structure does not contain valid data. (Structure members other than <CODE>err</CODE> are undefined.)<BR>
388            </TD>
389          </TR>
390          <TR>
391<TD width="150"><CODE>WPAD_ERR_INVALID</CODE></TD>
392<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>
393          </TR>
394        </TBODY>
395      </TABLE>
396</blockquote>
397
398</p>
399<H2>See Also</H2>
400<p>
401<A href="./toc.html" target="contents"><CODE>WPAD Functions</CODE></A><br>
402</p>
403
404
405<H2>Revision History</H2>
406<P>
40708/15/2006 Changed the description of WPAD_ERR_INVALID.<br> 2006/06/19 Initial version.<br>
408</P>
409<hr>
410<P>CONFIDENTIAL</p>
411</BODY>
412</HTML>