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 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 starting address of the data to be saved.</TD>
39    </TR>
40    <TR>
41<TD width="120" bgcolor="#ffffe8"><code><b><i>len</i></b></code></TD>
42<TD>Size of the data to be saved.</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 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 width="120" bgcolor="#ffffe8"><code><b><i>callback</i></b></code></TD>
50<TD>Callback function to report on 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 Wii Remote memory at 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. 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
73<ul>
74<li>Error Codes</li>
75</ul>
76<p>
77The return values have the following meanings:
78</p>
79<table border="1">
80<tr><td><code>WPAD_ERR_NONE</code></td><td>The WPAD library received a command.</td>
81<tr><td><code>WPAD_ERR_BUSY</code></td><td>The WPAD library was unable to receive a command.</td>
82<tr><td><code>WPAD_ERR_NO_CONTROLLER</code></td><td>The connection was broken.</td>
83</table>
84
85<ul>
86<li>Callbacks</li>
87</ul>
88<p>
89In 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:
90</p>
91<table border="1">
92<tr>
93<td><code>WPAD_ERR_NONE</code></td>
94<td>The command was processed normally.</td>
95</tr>
96<tr>
97<td><code>WPAD_ERR_BUSY</code></td>
98<td>The WPAD library was unable to receive a command. Call it again later.</td>
99</tr>
100<tr>
101<td><code>WPAD_ERR_TRANSFER</code></td>
102<td>A communications error prevented normal processing of the command.</td>
103</tr>
104<tr>
105<td><code>WPAD_ERR_NO_CONTROLLER</code></td>
106<td>The connection was broken.</td>
107</tr>
108</table>
109
110<H2>See Also</H2>
111<p>
112<A href="./toc.html" target="contents">WPAD Function</A><br> <A href="./WPADReadGameData.html"><CODE>WPADReadGameData</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>
113</p>
114
115<H2>Revision History</H2>
116<p>
1172007/02/08 Revised the description of offset.<br>2006/11/29 Added <CODE>WPAD_ERR_BUSY</CODE>, which had been left off the list, to the error codes passed by the callback.<br>2006/09/27 Added descriptions of <CODE>WPADSetGameTitleUtf16</CODE> and <CODE>WPADGetGameTitleUtf16</CODE>.<br>2006/08/15 Initial version. <br>
118
119</p>
120<hr>
121<P>CONFIDENTIAL</p>
122</BODY>
123</HTML>