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>PADStatus</TITLE>
9</HEAD>
10<BODY>
11<H1>PADStatus</H1>
12<H2>C Specification</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;revolution/pad.h&gt;</CODE></PRE>
16  <DD>
17  <PRE><CODE>typedef struct PADStatus
18{
19    u16 button;                 // Or-ed PAD_BUTTON_* and PAD_TRIGGER_* bits
20    s8  stickX;                 // -128 &lt;= stickX       &lt;= 127
21    s8  stickY;                 // -128 &lt;= stickY       &lt;= 127
22    s8  substickX;              // -128 &lt;= substickX    &lt;= 127
23    s8  substickY;              // -128 &lt;= substickY    &lt;= 127
24    u8  triggerLeft;            //    0 &lt;= triggerLeft  &lt;= 255
25    u8  triggerRight;           //    0 &lt;= triggerRight &lt;= 255
26    u8  analogA;                //    0 &lt;= analogA      &lt;= 255
27    u8  analogB;                //    0 &lt;= analogB      &lt;= 255
28    s8  err;                    // one of the PAD_ERR_* number
29} PADStatus;
30
31#define PAD_MAX_CONTROLLERS     4
32
33#define PAD_BUTTON_LEFT         0x0001
34#define PAD_BUTTON_RIGHT        0x0002
35#define PAD_BUTTON_DOWN         0x0004
36#define PAD_BUTTON_UP           0x0008
37#define PAD_TRIGGER_Z           0x0010
38#define PAD_TRIGGER_R           0x0020
39#define PAD_TRIGGER_L           0x0040
40#define PAD_BUTTON_A            0x0100
41#define PAD_BUTTON_B            0x0200
42#define PAD_BUTTON_X            0x0400
43#define PAD_BUTTON_Y            0x0800
44#define PAD_BUTTON_START        0x1000
45
46#define PAD_ERR_NONE            0
47#define PAD_ERR_NO_CONTROLLER   -1
48#define PAD_ERR_NOT_READY       -2
49#define PAD_ERR_TRANSFER        -3</CODE></PRE>
50</DL>
51<H2>Description</H2>
52<P>The <code>PADStatus</code> data structure represents the status of a controller.<BR>The resolution of the analog inputs can be controlled with the <a href="PADSetAnalogMode.html"><code>PADSetAnalogMode</code></a> function. </P>
53<TABLE border="1" cellpadding="3" cellspacing="0.1">
54  <TBODY>
55    <TR>
56<TD width="120" bgcolor="#ffffe8"><CODE>button</CODE></TD>
57<TD width="520">If any button is depressed, the corresponding bit (<code>PAD_BUTTON_*</code> or <code>PAD_TRIGGER_*</code>) is set to 1.</TD>
58    </TR>
59    <TR>
60<TD width="120" bgcolor="#ffffe8"><CODE>stickX</CODE></TD>
61<TD width="520">Movement data given in terms of the x-axis of the Control Stick.</TD>
62    </TR>
63    <TR>
64<TD width="120" bgcolor="#ffffe8"><CODE>stickY</CODE></TD>
65<TD width="520">Movement data given in terms of the y-axis of the Control Stick.</TD>
66    </TR>
67    <TR>
68<TD width="120" bgcolor="#ffffe8"><CODE>substickX</CODE></TD>
69<TD width="520">Movement data given in terms of the x-axis of the C-Stick (sub analog stick).</TD>
70    </TR>
71    <TR>
72<TD width="120" bgcolor="#ffffe8"><CODE>substickY</CODE></TD>
73<TD width="520">Movement data given in terms of the y-axis of the C-Stick. </TD>
74    </TR>
75    <TR>
76<TD width="120" valign="top" bgcolor="#ffffe8"><CODE>triggerLeft</CODE></TD>
77<TD width="520">Movement data of the L Button.</TD>
78    </TR>
79    <TR>
80<TD width="120" valign="top" bgcolor="#ffffe8"><CODE>triggerRight</CODE></TD>
81<TD width="520">Movement data of the R Button.</TD>
82    </TR>
83    <TR>
84<TD width="120" valign="top" bgcolor="#ffffe8"><CODE>analogA</CODE></TD>
85<TD width="520">Analog input of the A Button. <font size="2">(see note)</font></TD>
86    </TR>
87    <TR>
88<TD width="120" valign="top" bgcolor="#ffffe8"><CODE>analogB</CODE></TD>
89<TD width="520">Analog input of the B Button. <font size="2">(see note)</font></TD>
90    </TR>
91    <TR>
92<TD width="120" valign="top" bgcolor="#ffffe8"><CODE>err</CODE></TD>
93<TD width="520">Controller error code:
94      <TABLE border="1" width="500" cellspacing="0.1">
95        <TBODY>
96          <TR>
97<TD width="150"><CODE>PAD_ERR_NONE</CODE></TD>
98<TD width="350">A GameCube Controller is connected to the controller port. The pad status contains valid data.</TD>
99          </TR>
100          <TR>
101<TD width="150"><CODE>PAD_ERR_NO_CONTROLLER</CODE></TD>
102<TD width="350">A GameCube Controller is not connected to the controller port. The pad status does not contain valid data (i.e., structure members other than <code>err</code> are all zeroed out). To restart the controller data sampling, the corresponding controller port must be reinitialized by using <code><a href="PADReset.html">PADReset()</a></code>.<br><em><strong>Note:</strong></em> Something other than a GameCube Controller might be connected to the controller port. If that is the case, call <CODE><A href="../si/SIProbe.html">SIProbe()</A></CODE> to verify what it is.&nbsp;</TD>
103          </TR>
104          <TR>
105<TD width="150"><CODE>PAD_ERR_NOT_READY</CODE></TD>
106<TD width="350">The controller port is still being initialized from previous calls to <code><a         href="PADInit.html">PADInit</a></code>, <code><a href="PADReset.html">PADReset</a></code> and <code><a href="PADRecalibrate.html">PADRecalibrate</a></code>. The controller status does not contain valid data (i.e., the structure members other than <code>err</code> are all zeroed out).<br> <em><strong>Note:</strong></em> The <code>PAD_ERR_NOT_READY</code> state does not continue more than a few video frames except due to programming error.</TD>
107          </TR>
108          <TR>
109<TD width="150"><CODE>PAD_ERR_TRANSFER</CODE></TD>
110<TD width="350">Due to external electrical noise, the prior sampling of Controller data failed. &nbsp; No valid data is available for the current <code><a href="PADRead.html">PADRead()</a></code> (i.e., the structure members other than <code>err</code> are all zeroed out).<br><em><strong>Note:</strong></em>&nbsp;It may be suitable to continue using the previous valid controller status if <code>PAD_ERR_TRANSFER</code> is returned (rather than presuming the player might have released controller buttons during <code>PAD_ERR_TRANSFER</code>). The GameCube Controller normally recovers from the <code>PAD_ERR_TRANSFER</code> error state within a few frames. Unless the <code>PAD_ERR_NO_CONTROLLER</code> error is returned, the game program should not assume that the GameCube Controller has been unplugged.&nbsp;&nbsp;</TD>
111          </TR>
112        </TBODY>
113      </TABLE>
114      </TD>
115    </TR>
116  </TBODY>
117</TABLE>
118<P><b>Note:</b> <font size="2">The GameCube Controller does not support analog input values (<CODE>AnalogA/B</CODE>) for the A and B Buttons. Also, the Revolution controller library <A href="../wpad/list.html"><CODE>WPAD</CODE></A> does not support analog input values from the A and B Buttons.</font></P>
119
120
121<H2>See Also</H2>
122<P><A href="toc.html" target="contents">Controller Functions</A>, <CODE><A href="PADButtonDown.html">PADButtonDown</A></CODE>, <CODE><A href="PADButtonUp.html">PADButtonUp</A></CODE>, <CODE><A href="PADInit.html">PADInit</A></CODE>, <CODE><A href="PADRead.html">PADRead</A></CODE>, <CODE><A href="PADReset.html">PADReset</A></CODE>,<CODE> <A href="PADSetAnalogMode.html">PADSetAnalogMode</A></CODE></P>
123<H2>Revision History</H2>
124<P>2006/03/01 Initial version.</p>
125<hr>
126<P>CONFIDENTIAL</p>
127</BODY>
128</HTML>