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 http-equiv="Content-Style-Type" content="text/css">
6<LINK rel="stylesheet" type="text/css" href="../CSS/revolution.css">
7<TITLE>WPADReadGameData</TITLE>
8</HEAD>
9<BODY>
10
11<H1>WPADReadGameData</H1>
12
13<H2>Syntax</H2>
14<dl><dd><pre class="construction">
15#include &lt;revolution/wpad.h&gt;
16
17#define WPAD_CHAN0                    0
18#define WPAD_CHAN1                    1
19#define WPAD_CHAN2                    2
20#define WPAD_CHAN3                    3
21
22#define WPAD_MEM_GAMEDATA_LEN         3888
23
24s32 WPADReadGameData( s32 chan, void *p_buf, u16 len, u16 offset, WPADCallback callback );
25</pre></dd></dl>
26
27<H2>Arguments</H2>
28<TABLE class="arguments" border="1" >
29  <TBODY>
30    <TR>
31<TH>chan</TH>
32<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD>
33    </TR>
34    <TR>
35<TH>p_buf</TH>
36<TD>The leading address for the buffer to which the read game data is copied.</TD>
37    </TR>
38    <TR>
39<TH>len</TH>
40<TD>The size of the game data to be read.</TD>
41    </TR>
42    <TR>
43<TH>offset</TH>
44<TD>The offset from the game data's leading address to the start of the read.</TD>
45    </TR>
46    <TR>
47<TH>callback</TH>
48<TD>Callback function for reporting the result.</TD>
49    </TR>
50  </TBODY>
51</TABLE>
52
53<H2>Return Values</H2>
54<p>
55Returns one of the following codes:
56</p>
57<p>
58<code>WPAD_ERR_NONE</code><br>
59<code>WPAD_ERR_NO_CONTROLLER</code><br>
60<code>WPAD_ERR_BUSY</code><br>
61<code>WPAD_ERR_BROKEN</code><br>
62<code>WPAD_ERR_NOPERM</code><br>
63
64</P>
65<H2>Description</H2>
66<p>
67Reads game data from the memory of the specified channel's Wii Remote. This function registers the commands for reading game data to the library. The WPAD library processes registered commands when other commands are not running.
68</p>
69<p>
70For saving game data, 4000 bytes are allocated in the Wii Remote memory, but the first 112 bytes are used by the library to manage file information. Even though an application can only save game data to the 3888 bytes from the 112th to the 4000th byte, the 112th byte has an offset value of 0 within the library so there is no need to be particularly aware of it.
71</p>
72<p>
73The game title set with the <a href="./WPADSetGameTitleUtf16.html"><code>WPADSetGameTitleUtf16</code></a> function, and the date and time when the file was saved are stored in the file information. The game title can be obtained with the <a href="./WPADGetGameTitleUtf16.html"><code>WPADGetGameTitleUtf16</code></a> function, and the date and time can be obtained with the <a href="./WPADGetGameDataTimeStamp.html"><code>WPADGetGameDataTimeStamp</code></a> function.
74</p>
75<p>
76Applications can read only the game data that was created by the same application. When attempting to load game data that was created on a different application, <code>WPAD_ERR_NOPERM</code> is returned. In addition, when attempting to read game data that does not have correctly written file information due to causes such as disconnection during writing, <code>WPAD_ERR_BROKEN</code> is returned.
77</p>
78
79<ul>
80<li>Error Codes</li>
81</ul>
82<p>
83The return values have the following meanings:
84</p>
85<TABLE class="arguments" border="1" >
86<tr><th>WPAD_ERR_NONE</th><td>The WPAD library received a command.</td>
87<tr><th>WPAD_ERR_BUSY</th><td>The WPAD library was unable to receive a command.</td>
88<tr><th>WPAD_ERR_NO_CONTROLLER</th><td>The connection was broken.</td>
89<tr><th>WPAD_ERR_NOPERM</th><td>Could not be read because another game file was saved.</td>
90<tr><th>WPAD_ERR_BROKEN</th><td>The file does not exist, or the file information is corrupted.</td>
91</table>
92
93<ul>
94<li>Callbacks</li>
95</ul>
96<p>
97In addition, if a callback function is set, the callback function returns the following error codes when the processing is complete. Their meanings are as follows:
98</p>
99<TABLE class="arguments" border="1" >
100<tr>
101<th>WPAD_ERR_NONE</th>
102<td>The command was processed normally.</td>
103</tr>
104<tr>
105<th>WPAD_ERR_BUSY</th>
106<td>The WPAD library was unable to receive a command. Call it again later.</td>
107</tr>
108<tr>
109<th>WPAD_ERR_TRANSFER</th>
110<td>A communications error prevented normal processing of the command.</td>
111</tr>
112<tr>
113<th>WPAD_ERR_NO_CONTROLLER</th>
114<td>The connection was broken.</td>
115</tr>
116<tr>
117<th>WPAD_ERR_NOPERM</th>
118<td>Could not be read because another game file was saved.</td>
119</tr>
120<tr>
121<th>WPAD_ERR_BROKEN</th>
122<td>The file does not exist or the file information is corrupted.</td>
123</tr>
124</table>
125
126<H2>See Also</H2>
127<p class="reference">
128<A href="./WPADWriteGameData.html">WPADWriteGameData</A>,
129<A href="./WPADSetGameTitleUtf16.html">WPADSetGameTitleUtf16</A>,
130<A href="./WPADGetGameTitleUtf16.html">WPADGetGameTitleUtf16</A>,
131<A href="./WPADGetGameDataTimeStamp.html">WPADGetGameDataTimeStamp</A>
132</p>
133
134<H2>Revision History</H2>
135<p>
1362007/02/08 Revised the offset description.<br>2006/11/29 Added errors that had been left out of the error codes passed by the callback.<br>2006/09/23 Added descriptions for <CODE>WPADSetGameTitleUtf16</CODE>, <CODE>WPADGetGameTitleUtf16</CODE>, and error codes.<br>2006/09/20 Added <CODE>WPAD_ERR_BROKEN</CODE> and <CODE>WPAD_ERR_NOPERM</CODE>.<br>2006/08/15 Initial version.<br>
137
138</p>
139<hr><p>CONFIDENTIAL</p></body>
140</HTML>