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=utf-8">
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 &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 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> <code>WPAD_ERR_NO_CONTROLLER</code><br> <code>WPAD_ERR_BUSY</code><br>
59
60</P>
61<H2>Description</H2>
62<p>
63Writes 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.
64</p>
65<p>
66For 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.
67</p>
68<p>
69The 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 &quot;last saved&quot; timestamp with the <a href="./WPADGetGameDataTimeStamp.html"><code>WPADGetGameDataTimeStamp</code></a> function.
70</p>
71
72<ul>
73<li>Error Codes</li>
74</ul>
75<p>
76The return values have the following meanings:
77</p>
78<TABLE class="arguments" border="1" >
79<tr><th>WPAD_ERR_NONE</th><td>The WPAD library received a command.</td>
80<tr><th>WPAD_ERR_BUSY</th><td>The WPAD library was unable to receive a command.</td>
81<tr><th>WPAD_ERR_NO_CONTROLLER</th><td>The connection was broken.</td>
82</table>
83
84<ul>
85<li>Callbacks</li>
86</ul>
87<p>
88When a callback function has been set, the callback function is called together with the processing result. When the return value is <code>WPAD_ERR_NONE</code>, the callback function is called when the process is completed. Otherwise, it is called before the function escapes. The following error codes are passed to the callback function.
89</p>
90<TABLE class="arguments" border="1" >
91<tr>
92<th>WPAD_ERR_NONE</th>
93<td>The command was processed normally.</td>
94</tr>
95<tr>
96<th>WPAD_ERR_BUSY</th>
97<td>The WPAD library was unable to receive a command. Call it again later.</td>
98</tr>
99<tr>
100<th>WPAD_ERR_TRANSFER</th>
101<td>A communications error prevented normal processing of the command.</td>
102</tr>
103<tr>
104<th>WPAD_ERR_NO_CONTROLLER</th>
105<td>The connection was broken.</td>
106</tr>
107</table>
108
109<H2>See Also</H2>
110<p class="reference">
111<!--<A href="./toc.html" target="contents">WPAD関数</A>, --> <A href="./WPADReadGameData.html">WPADReadGameData</A><br><A href="./WPADSetGameTitleUtf16.html">WPADSetGameTitleUtf16</A><br><A href="./WPADGetGameTitleUtf16.html">WPADGetGameTitleUtf16</A><br><A href="./WPADGetGameDataTimeStamp.html">WPADGetGameDataTimeStamp</A>
112</p>
113
114<H2>Revision History</H2>
115<p>
1162009/09/24 Explained the timing of the call to the callback function.<br>2008/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>
117
118</p>
119<hr><p>CONFIDENTIAL</p></body>
120</HTML>