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
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/pad.h&gt;
16
17typedef 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 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
50</pre></dd></dl>
51
52<H2>Description</H2>
53<P>The <CODE>PADStatus</CODE> data structure represents the status of a controller.<BR>The resolution of the analog inputs can be controlled by the <A href="PADSetAnalogMode.html"><CODE>PADSetAnalogMode</CODE></A> function.</P>
54<TABLE class="arguments" border="1" >
55  <TBODY>
56    <TR>
57<TH>button</TH>
58<TD>If any button is pressed, the corresponding bit (<CODE>PAD_BUTTON_*</CODE> or <CODE>PAD_TRIGGER_*</CODE>) is set to 1.</TD>
59    </TR>
60    <TR>
61<TH>stickX</TH>
62<TD>Movement data given in terms of the x-axis of the Control Stick.</TD>
63    </TR>
64    <TR>
65<TH>stickY</TH>
66<TD>Movement data given in terms of the y-axis of the Control Stick.</TD>
67    </TR>
68    <TR>
69<TH>substickX</TH>
70<TD>Movement data given in terms of the x-axis of the C-Stick (sub analog stick).</TD>
71    </TR>
72    <TR>
73<TH>substickY</TH>
74<TD>Movement data given in terms of the y-axis of the C-Stick.</TD>
75    </TR>
76    <TR>
77<TH>triggerLeft</TH>
78<TD>Movement data of the L Button.</TD>
79    </TR>
80    <TR>
81<TH>triggerRight</TH>
82<TD>Movement data of the R Button.</TD>
83    </TR>
84    <TR>
85<TH>analogA</TH>
86<TD>Analog input of the A Button. (See Note below.)</TD>
87    </TR>
88    <TR>
89<TH>analogB</TH>
90<TD>Analog input of the B Button. (See Note below.)</TD>
91    </TR>
92    <TR>
93<TH>err</TH>
94<TD>Controller error code:
95      <TABLE class="arguments" border="1" >
96        <TBODY>
97          <TR>
98<TH>PAD_ERR_NONE</TH>
99<TD>A GameCube Controller is connected to the controller port. The controller status contains valid data.</TD>
100          </TR>
101          <TR>
102<TH>PAD_ERR_NO_CONTROLLER</TH>
103<TD>A GameCube Controller is not connected to the controller port. The controller status does not contain valid data (that is, all structure members other than <SPAN class="argument">err</SPAN> have been zero-cleared). To restart controller data sampling, the corresponding Controller Socket must be reinitialized by using <A href="PADReset.html"><CODE>PADReset</CODE></A>.<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 <A href="../si/SIProbe.html"><CODE>SIProbe</CODE></A> to verify what is connected.</TD>
104          </TR>
105          <TR>
106<TH>PAD_ERR_NOT_READY</TH>
107<TD>The Controller Socket is still being initialized by a previous call to <A href="PADInit.html"><CODE>PADInit</CODE></A>, <A href="PADReset.html"><CODE>PADReset</CODE></A> or <A href="PADRecalibrate.html"><CODE>PADRecalibrate</CODE></A>. The controller status does not contain valid data (that is, all structure members other than <SPAN class="argument">err</SPAN> have been zero-cleared).<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>
108          </TR>
109          <TR>
110<TH>PAD_ERR_TRANSFER</TH>
111<TD>Due to external electrical noise, the prior sampling of Controller data failed. No valid data is available for the current <A href="PADRead.html"><CODE>PADRead</CODE></A> (that is, all structure members other than <SPAN class="argument">err</SPAN> have been zero-cleared).<BR><strong>Note:</strong> It may often be suitable to continue using the previous valid pad 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.</TD>
112          </TR>
113        </TBODY>
114      </TABLE>
115      </TD>
116    </TR>
117  </TBODY>
118</TABLE>
119<P><b>Note:</b> <font size="2">The GameCube Controller does not support analog input values (</font><CODE>AnalogA/B</CODE><font size="2">) for the A and B Buttons. Also, the Revolution SDK 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>
120
121<H2>See Also</H2>
122<P class="reference">
123<A href="PADButtonDown.html">PADButtonDown</A>,
124<A href="PADButtonUp.html">PADButtonUp</A>,
125<A href="PADInit.html">PADInit</A>,
126<A href="PADRead.html">PADRead</A>,
127<A href="PADReset.html">PADReset</A>,
128<A href="PADSetAnalogMode.html">PADSetAnalogMode</A>
129</P>
130
131<H2>Revision History</H2>
132<P>
1332006/03/01 Initial version.<br>
134</p>
135
136<hr><p>CONFIDENTIAL</p></body>
137</HTML>