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 14<H2>C Specification</H2> 15<DL> 16 <DD> 17 <PRE><code>#include <revolution/wpad.h> 18 19#define WPAD_CHAN0 0 20#define WPAD_CHAN1 1 21#define WPAD_CHAN2 2 22#define WPAD_CHAN3 3 23 24#define WPAD_MEM_GAMEDATA_LEN 3888 25 26s32 WPADReadGameData( s32 chan, void *p_buf, u16 len, u16 offset, WPADCallback callback ); 27</code></PRE> 28</DL> 29<H2>Arguments</H2> 30<TABLE border="1"> 31 <TBODY> 32 <TR> 33<TD width="120" bgcolor="#ffffe8"><code><b><i>chan</i></b></code></TD> 34<TD>One of the <code>WPAD_CHAN<i>n</i></code> values.</TD> 35 </TR> 36 <TR> 37<TD width="120" bgcolor="#ffffe8"><code><b><i>p_buf</i></b></code></TD> 38<TD>The leading address for the buffer to which the read data is copied.</TD> 39 </TR> 40 <TR> 41<TD width="120" bgcolor="#ffffe8"><code><b><i>len</i></b></code></TD> 42<TD>The size of the data to be read</TD> 43 </TR> 44 <TR> 45<TD width="120" bgcolor="#ffffe8"><code><b><i>offset</i></b></code></TD> 46<TD>The offset from the game data's leading address to the start of the read.</TD> 47 </TR> 48 <TR> 49<TD width="120" bgcolor="#ffffe8"><code><b><i>callback</i></b></code></TD> 50<TD>Callback function for reporting the result.</TD> 51 </TR> 52 </TBODY> 53</TABLE> 54<H2>Return Values</H2> 55<p> 56Returns one of the following codes: 57</p> 58<p> 59<code>WPAD_ERR_NONE</code><br> <code>WPAD_ERR_NO_CONTROLLER</code><br> <code>WPAD_ERR_BUSY</code><br> <code>WPAD_ERR_BROKEN</code><br> <code>WPAD_ERR_NOPERM</code><br> 60 61</P> 62<H2>Description</H2> 63<p> 64Reads data from the memory of the Wii Remote control of the specified channel. This function registers the command used to read data to the library. The WPAD library processes registered commands when other commands are not running. 65</p> 66<p> 67For saving game data, 4000 bytes are allocated in the Wii remote control 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. 68</p> 69<p> 70The 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. 71</p> 72<p> 73Applications 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, such as disconnection during writing, <code>WPAD_ERR_BROKEN</code> is returned. 74</p> 75 76<ul> 77<li>Error Codes</li> 78</ul> 79<p> 80The return values have the following meanings: 81</p> 82<table border="1"> 83<tr><td><code>WPAD_ERR_NONE</code></td><td>The WPAD library received a command.</td> 84<tr><td><code>WPAD_ERR_BUSY</code></td><td>The WPAD library was unable to receive a command.</td> 85<tr><td><code>WPAD_ERR_NO_CONTROLLER</code></td><td>The connection was broken.</td> 86<tr><td><code>WPAD_ERR_NOPERM</code></td><td>Could not be read because another game file was being saved.</td> 87<tr><td><code>WPAD_ERR_BROKEN</code></td><td>The file does not exist or the file information is corrupted.</td> 88</table> 89 90<ul> 91<li>Callbacks</li> 92</ul> 93<p> 94In 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: 95</p> 96<table border="1"> 97<tr> 98<td><code>WPAD_ERR_NONE</code></td> 99<td>The command was processed normally.</td> 100</tr> 101<tr> 102<td><code>WPAD_ERR_BUSY</code></td> 103<td>The WPAD library was unable to receive a command. Call it again later.</td> 104</tr> 105<tr> 106<td><code>WPAD_ERR_TRANSFER</code></td> 107<td>A communications error prevented normal processing of the command.</td> 108</tr> 109<tr> 110<td><code>WPAD_ERR_NO_CONTROLLER</code></td> 111<td>The connection was broken.</td> 112</tr> 113<tr> 114<td><code>WPAD_ERR_NOPERM</code></td> 115<td>Could not be read because another game file was being saved.</td> 116</tr> 117<tr> 118<td><code>WPAD_ERR_BROKEN</code></td> 119<td>The file does not exist or the file information is corrupted.</td> 120</tr> 121</table> 122 123<H2>See Also</H2> 124<p> 125<A href="./toc.html" target="contents">WPAD Functions</A><br> <A href="./WPADWriteGameData.html"><CODE>WPADWriteGameData</CODE></A>, <A href="./WPADSetGameTitleUtf16.html"><CODE>WPADSetGameTitleUtf16</CODE></A>, <A href="./WPADGetGameTitleUtf16.html"><CODE>WPADGetGameTitleUtf16</CODE></A>, <A href="./WPADGetGameDataTimeStamp.html"><CODE>WPADGetGameDataTimeStamp</CODE></A><br> 126</p> 127 128<H2>Revision History</H2> 129<p> 1302007/02/08 Revised the description of offset.<br>2006/11/29 Added errors that were left out of the error codes passed by the callback.<br>2006/09/23 Added explanations 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> 131 132</p> 133<hr> 134<P>CONFIDENTIAL</p> 135</BODY> 136</HTML>