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
14<H2>C Specification</H2>
15<DL>
16  <DD>
17<PRE><code>#include &lt;revolution/wpad.h&gt;
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 WPADWriteGameData( 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><code><b><i>chan</i></b></code></TD>
34<TD>One of <code>WPAD_CHAN<i>n</i></code> values.</TD>
35    </TR>
36    <TR>
37<TD><code><b><i>p_buf</i></b></code></TD>
38<TD>The starting address of the data to be saved.</TD>
39    </TR>
40    <TR>
41<TD><code><b><i>len</i></b></code></TD>
42<TD>Size of the data to be saved.</TD>
43    </TR>
44    <TR>
45<TD><code><b><i>offset</i></b></code></TD>
46<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>
47    </TR>
48    <TR>
49<TD><code><b><i>callback</i></b></code></TD>
50<TD>Callback function to notify about 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>
60
61</P>
62<H2>Description</H2>
63<p>
64Writes data to the internal memory of the Wii Remote for 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 within the internal memory but the first 112 bytes are used by the library to manage file information. Although the application can actually save game data to the 3888 bytes from the 16th to the 4000th byte, this 16th 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 set game title and the date and time on which the file was saved are saved in the file information with the <a href="./WPADSetGameTitle.html"><code>WPADSetGameTitle</code></a> and <a href="./WPADSetGameTitleWChar.html"><code>WPADSetGameTitleWChar</code></a> functions, respectively. The <a href="./WPADGetGameTitle.html"><code>WPADGetGameTitle</code></a> and <a href="./WPADGetGameDataTimeStamp.html"><code>WPADGetGameDataTimeStamp</code></a> functions, respectively, can also get that data.
71</p>
72
73<ul>
74<li>Error Codes</li>
75<p>
76The return values have the following meanings:
77<table border="1">
78<tr><td><code>WPAD_ERR_NONE</code></td><td><code>The WPAD library received a command.</code></td>
79<tr><td><code>WPAD_ERR_BUSY</code></td><td><code>The WPAD library was unable to receive a command.</code></td>
80<tr><td><code>WPAD_ERR_NO_CONTROLLER</code></td><td><code>The connection was broken.</code></td>
81</table>
82</p>
83
84<li>Callbacks</li>
85<p>
86In 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:
87<table border="1">
88<tr>
89<td><code>WPAD_ERR_NONE</code></td>
90<td>The command was processed normally.</td>
91</tr>
92<tr>
93<td><code>WPAD_ERR_TRANSFER</code></td>
94<td>A communications error prevented normal processing of the command.</td>
95</tr>
96<tr>
97<td><code>WPAD_ERR_NO_CONTROLLER</code></td>
98<td>The connection was broken.</td>
99</tr>
100</table>
101</p>
102</ul>
103
104<H2>See Also</H2>
105<p>
106<A href="./toc.html" target="contents"><CODE>WPAD</CODE> Functions</A><br> <A href="./WPADReadGameData.html"><CODE>WPADReadGameData</CODE></A><br> <A href="./WPADSetGameTitle.html"><CODE>WPADSetGameTitle</CODE></A><br> <A href="./WPADSetGameTitleWChar.html"><CODE>WPADSetGameTitleWChar</CODE></A><br> <A href="./WPADGetGameTitle.html"><CODE>WPADGetGameTitle</CODE></A><br> <A href="./WPADGetGameDataTimeStamp.html"><CODE>WPADGetGameDataTimeStamp</CODE></A><br>
107</p>
108
109<H2>Revision History</H2>
110<p>
11108/15/2006 Initial version.
112
113</p>
114<hr>
115<P>CONFIDENTIAL</p>
116</BODY>
117</HTML>