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>WPADWriteGameData</TITLE> 8</HEAD> 9<BODY> 10 11<H1>WPADWriteGameData</H1> 12 13<H2>Syntax</H2> 14<dl><dd><pre class="construction"> 15#include <revolution/wpad.h> 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 WPADWriteGameData( 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 starting address of the game data to save.</TD> 37 </TR> 38 <TR> 39<TH>len</TH> 40<TD>The size of the game data to save.</TD> 41 </TR> 42 <TR> 43<TH>offset</TH> 44<TD>The offset from the ending address of the game data's file information (the starting address for where game data can be actually written) to the starting address for the write process.</TD> 45 </TR> 46 <TR> 47<TH>callback</TH> 48<TD>Callback function to report on 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 62</P> 63<H2>Description</H2> 64<p> 65Writes data to the Wii Remote memory at the specified channel. This function registers the commands for writing game data to the library. The WPAD library processes registered commands when other commands are not running. 66</p> 67<p> 68For saving game data, 4000 bytes are allocated in the Wii Remote's memory, but the library uses the first 112 bytes 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. 69</p> 70<p> 71The file information contains the game title set with the <a href="./WPADSetGameTitleUtf16.html"><code>WPADSetGameTitleUtf16</code></a > function and the timestamp indicating when the file was last saved. When this function is called, that information is written to Wii Remote memory. Obtain the game title with the <a href="./WPADGetGameTitleUtf16.html"><code>WPADGetGameTitleUtf16</code></a> function and the "last saved" timestamp with the <a href="./WPADGetGameDataTimeStamp.html"><code>WPADGetGameDataTimeStamp</code></a> function. 72</p> 73 74<ul> 75<li>Error Codes</li> 76</ul> 77<p> 78The return values have the following meanings: 79</p> 80<TABLE class="arguments" border="1" > 81<tr><th>WPAD_ERR_NONE</th><td>The WPAD library received a command.</td> 82<tr><th>WPAD_ERR_BUSY</th><td>The WPAD library was unable to receive a command.</td> 83<tr><th>WPAD_ERR_NO_CONTROLLER</th><td>The connection was broken.</td> 84</table> 85 86<ul> 87<li>Callbacks</li> 88</ul> 89<p> 90In 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: 91</p> 92<TABLE class="arguments" border="1" > 93<tr> 94<th>WPAD_ERR_NONE</th> 95<td>The command was processed normally.</td> 96</tr> 97<tr> 98<th>WPAD_ERR_BUSY</th> 99<td>The WPAD library was unable to receive a command. Call it again later.</td> 100</tr> 101<tr> 102<th>WPAD_ERR_TRANSFER</th> 103<td>A communications error prevented normal processing of the command.</td> 104</tr> 105<tr> 106<th>WPAD_ERR_NO_CONTROLLER</th> 107<td>The connection was broken.</td> 108</tr> 109</table> 110 111<H2>See Also</H2> 112<p class="reference"> 113<A href="./WPADReadGameData.html">WPADReadGameData</A>, 114<A href="./WPADSetGameTitleUtf16.html">WPADSetGameTitleUtf16</A>, 115<A href="./WPADGetGameTitleUtf16.html">WPADGetGameTitleUtf16</A>, 116<A href="./WPADGetGameDataTimeStamp.html">WPADGetGameDataTimeStamp</A> 117</p> 118 119<H2>Revision History</H2> 120<p> 1212008/06/04 Standardized terminology.<br>2008/03/21 Added that the items set with the <code>WPADSetGameTitleUtf16</code> function will be included when data is written to internal memory.<br>2007/02/08 Revised the offset description.<br>2006/11/29 Added <CODE>WPAD_ERR_BUSY</CODE>, which had been left out of the error codes passed by the callback.<br>2006/09/27 Added descriptions for <CODE>WPADSetGameTitleUtf16</CODE> and <CODE>WPADGetGameTitleUtf16</CODE>.<br>2006/08/15 Initial version.<br> 122 123</p> 124<hr><p>CONFIDENTIAL</p></body> 125</HTML>