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 name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 8.0.2.0 for Windows">
6<meta http-equiv="Content-Style-Type" content="text/css">
7<link rel="stylesheet" type="text/css" href="CSS/revolution.css">
8<base target="main">
9<style type="text/css" media="all">
10<!--
11@import url("css/hbm_common.css");
12h4 {
13  font-size: x-large;
14  border-bottom: 3px double #000;
15}
16PRE
17{
18  font-family			: "Courier New", monospace;
19  font-weight			: normal;
20  font-size			: 10pt;
21  margin				: 0px 20px 10px 30px;
22  padding				: 2px 4px 2px 4px;
23  background-color	: #eee;
24}
25h5 {
26	clear:both;
27  margin:10px 0px 10px 15px;
28}
29ul.list {
30  margin:0px 0px 20px 0px;
31}
32ul.list li{
33  float:left;
34  width: 330px;
35}
36ul.list li a{
37  color:#060;
38}
39ul.list li a:active,ul.list li a:hover{
40  color:#0c0;
41}
42-->
43</style>
44<title>HBM API Introduction</title>
45</head>
46<body>
47<h1>HBM Library Overview</h1>
48<br> <br>
49<h2>HOME Menu</h2>
50
51<p>To call the HOME Menu, press HOME on the Wii Remote. <font color="red">The HOME Menu must be incorporated into every application. </font><br>It includes the buttons for shutting down and resetting applications, and for displaying and setting information related to the Wii Remote.</p>
52<p>For descriptions of the HOME Menu's functionalities and each of its buttons, see the <I>Wii Operations Manual</I>.<br /><font color="red">Chapter 11 of the <I>Wii Programming Guidelines</I> addresses the HOME Menu. Read this chapter of the Guidelines before implementing the HOME Menu.</font></p>
53<p><font color="red"><b>Note:<br />Currently, using the library as an RSO leads to the following kinds of bugs.<br />Callback process is called after <CODE>HBMDelete</CODE>. Using the HOME Menu from an RSO causes memory to be accessed after unlinking.<br />When deleting the library from memory, after running <CODE>HBMDelete</CODE> on the application side, check that the return value of running the <CODE>WPADProbe</CODE> function against the connected Wii Remote channel is not <CODE>WPAD_ERR_BUSY</CODE>, and then deallocate the RSO or memory.</b></font></p>
54<h2>Types of Applications and Libraries Used </h2>
55<p>
56Applications use the following libraries.
57</p>
58<TABLE class="table" style="margin-top:15px;">
59  <TBODY>
60    <TR>
61<TH class="category" width="190" style="text-align:center;">Application Types</TH>
62<TH class="category" width="190" style="text-align:center;">Library Used </TH>
63    </TR>
64    <TR>
65<TD style="text-align:center;">Disc Applications</TD>
66<TD style="text-align:center;"><CODE>homebuttonLib[D].a</CODE> </TD>
67    </TR>
68    <TR>
69<TD style="text-align:center;">WiiWare Applications </TD>
70<TD style="text-align:center;"><CODE>homebuttonLib.nwm[D].a</CODE> </TD>
71    </TR>
72  </TBODY>
73</TABLE>
74<p>
75<B>Note:</B> The <CODE>homebuttonLib.vcmv[D].a</CODE> file is a library that can be used only with certain channel applications. Do not use this for ordinary applications.</p>
76
77<a id="intro" name="intro"></a>
78<h4>Installation</h4>
79<h5>Initialization</h5>
80<ul class="list">
81<li><a href="#intro_0">Incorporating Into Applications</a>
82<li><a href="#intro_1">The <SPAN class="argument">HBMDataInfo</SPAN> Argument of the <CODE>HBMCreate</CODE> Function </a>
83<li style=" clear:both;"><a href="#intro_2">Using Memory Allocator</a>
84<li><a href="#intro_2_1">Notes When Using the <CODE>HBMCreateSound</CODE> Function </a>
85</ul>
86<h5>Wii Remote</h5>
87<ul class="list">
88<li><a href="#intro_3">Console and Wii Remote Settings</a>
89<li><a href="#intro_4">Simple Pairing with the Wii Remote</a>
90<li style=" clear:both;"><a href="#intro_5">Notes for a KPADRead Value of Zero</a>
91<li><a href="#intro_4_1">With No Support for Classic Controllers</a>
92</ul>
93<h5>Rendering</h5>
94<ul class="list">
95<li><a href="#intro_2_2">Making the HOME Menu Background Translucent </a>
96<li><a href="#projection">Projection Matrix Settings During Rendering</a>
97</ul>
98<h5>Sound</h5>
99<ul class="list">
100<li><a href="#intro_6">Processing Sound Effects</a>
101<li><a href="#intro_7">Updating Sounds</a>
102<li style=" clear:both;"><a href="#intro_10">Notes for the Stack Size of the Sound Thread</a>
103</ul>
104<h5>End</h5>
105<ul class="list">
106<li><a href="#intro_8">Standard Close Process</a>
107<li><a href="#intro_9">Forced Close Process</a>
108</ul>
109<br style="clear:both;"> <a id="intro_0" name="intro_0"></a>
110<h2>Incorporating Into Applications</h2>
111<p>Link the <CODE>homebuttonLib[D].a</CODE> file and embed the shared resource data contained in the <CODE>dvddata/HomeButton2</CODE> directory into the application's project.</p>
112<p>To start the HOME Menu, call <A href="hbm_HBMCreate.html"><CODE>HBMCreate</CODE></A> then <A href="hbm_HBMInit.html"><CODE>HBMInit</CODE></A> in the application source code, in that order; next, call <A href="hbm_HBMCalc.html"><CODE>HBMCalc</CODE></A> and <A href="hbm_HBMDraw.html"><CODE>HBMDraw</CODE></A> in the main loop.<br>The HOME Menu can be incorporated in several ways:
113</p>
114<ul>
115<li>How to create an instance every time that is not memory-resident
116  <ol style="padding-top:10px;">
117<li>Detect that HOME has been pressed.
118<li>Create an instance with the <CODE>HBMCreate</CODE> function.
119<li>Create a sound instance with the <CODE>HBMCreateSound</CODE> function.
120<li>Use the <CODE>HBMInit</CODE> function to initialize internal library variables.
121<li>Use the <CODE>HBMDraw</CODE> function to display the HOME Menu.
122<li>Exit the HOME Menu and then release the instances with the <CODE>HBMDeleteSound</CODE> and <CODE>HBMDelete</CODE> functions.
123    <dl>
124<dt style="padding:0px;margin:0px;">To re-display, repeat from step 1.
125    </dl>
126  </ol>
127<li style="padding-top:10px;">How to keep resources resident in memory and omit the loading and instance creation steps
128  <ol style="padding-top:10px;">
129<li>Create instances with the <CODE>HBMCreate</CODE> and <CODE>HBMCreateSound</CODE> functions during, for example, game initialization.
130<li>Detect that HOME has been pressed.
131<li>Use the <CODE>HBMInit</CODE> function to initialize internal library variables.
132<li>Use the <CODE>HBMDraw</CODE> function to display the HOME Menu.
133<li>Exit from HOME Menu.
134    <dl>
135<dt style="padding:0px;margin:0px;">To re-display, repeat from step 2.
136    </dl>
137<li>When the game ends, use the <CODE>HBMDelete</CODE> and <CODE>HBMDeleteSound</CODE> functions to release the instances.
138  </ol>
139<li style="padding-top:10px;">How to create just a sound instance
140  <dl>
141<dt style="padding:0px;margin:0px;">(Clearing out a sound instance allows you to deallocate sound resources. Use this approach when you want to take the middle road between the two approaches above, for memory or start-up speed reasons.)
142  </dl>
143  <ol style="padding-top:10px;">
144<li>Create instances with the <CODE>HBMCreate</CODE> function during, for example, game initialization.
145<li>Detect that HOME has been pressed.
146<li>Create a sound instance with the <CODE>HBMCreateSound</CODE> function.
147<li>Use the <CODE>HBMInit</CODE> function to initialize internal library variables.
148<li>Use the <CODE>HBMDraw</CODE> function to display the HOME Menu.
149<li>Exit from the HOME Menu.
150<li>Release the sound instance using the <CODE>HBMDeleteSound</CODE> function.
151    <dl>
152<dt style="padding:0px;margin:0px;">To re-display, return to step 2.
153    </dl>
154<li>When the game ends, use the <CODE>HBMDelete</CODE> function to release the instance.
155  </ol>
156</ul>
157<p>Note: For details on introducing WiiWare, see the <a href="./wiiware.html">WiiWare Support Guide</a>.</p>
158<a id="intro_1" name="intro_1"></a>
159<h2>The HBMDataInfo Argument of the HBMCreate Function </h2>
160<p>The following items are passed to the <CODE>HBMCreate</CODE> function's argument, <a href="hbm_HBMDataInfo.html"><SPAN class="argument">HBMDataInfo</SPAN></a>:<br /><font color="red"><B>Note:</B> <SPAN class="argument">HBMDataInfo</SPAN> must be retained until the <a style="color:#f00;" href="hbm_HBMDelete.html"><CODE>HBMDelete</CODE></a> function is called.</font></p>
161<ul class="index">
162<li><SPAN class="argument">layoutBuf</SPAN>: Passes the address where the layout resource file was loaded. For disc applications, use the 2-button file (<CODE>HomeButton2</CODE>).
163  <table class="table" style="margin-top:15px;">
164    <TR>
165      <TH class="category" width="140"></TH>
166<TH class="category" width="180">Japan</TH>
167<TH class="category" width="180">English</TH>
168<TH class="category" width="180">German</TH>
169<TH class="category" width="180">French</TH>
170<TH class="category" width="180">Spanish</TH>
171    </TR>
172    <TR>
173<TH class="category" style="text-align:center;">Disc</TD>
174<TD style="text-align:center;">homeBtn.arc</TD>
175<TD style="text-align:center;">homeBtn_ENG.arc</TD>
176<TD style="text-align:center;">homeBtn_GER.arc</TD>
177<TD style="text-align:center;">homeBtn_FRA.arc</TD>
178<TD style="text-align:center;">homeBtn_SPA.arc</TD>
179    </TR>
180    <TR>
181<TH class="category" style="text-align:center;">WiiWare</TD>
182<TD style="text-align:center;">LZ77_homeBtn.arc</TD>
183<TD style="text-align:center;">LZ77_homeBtn_ENG.arc</TD>
184<TD style="text-align:center;">LZ77_homeBtn_GER.arc</TD>
185<TD style="text-align:center;">LZ77_homeBtn_FRA.arc</TD>
186<TD style="text-align:center;">LZ77_homeBtn_SPA.arc</TD>
187    </TR>
188    <TR>
189      <TH class="category"></TH>
190<TH class="category" width="180">Italian</TH>
191<TH class="category" width="180">Dutch</TH>
192<TH class="category" width="180">Chinese</TH>
193<TH class="category" width="180">Korean</TH>
194     </TR>
195    <TR>
196<TH class="category" style="text-align:center;">Disc</TD>
197<TD style="text-align:center;">homeBtn_ITA.arc</TD>
198<TD style="text-align:center;">homeBtn_NED.arc</TD>
199<TD style="text-align:center;">homeBtn_CHN.arc</TD>
200<TD style="text-align:center;">homeBtn_KOR.arc</TD>
201    </TR>
202    <TR>
203<TH class="category" style="text-align:center;">WiiWare</TD>
204<TD style="text-align:center;">LZ77_homeBtn_ITA.arc</TD>
205<TD style="text-align:center;">LZ77_homeBtn_NED.arc</TD>
206<TD style="text-align:center;">LZ77_homeBtn_CHN.arc</TD>
207<TD style="text-align:center;">LZ77_homeBtn_KOR.arc</TD>
208    </TR>
209  </table>
210<li><SPAN class="argument">spkSeBuf</SPAN>: Passes the address where the waveform archive file to send to the Wii Remote speaker was loaded. Disc applications load <CODE>SpeakerSe.arc</CODE> and WiiWare applications load <CODE>Huf8_SpeakerSe.arc</CODE>.
211<li><SPAN class="argument">msgBuf</SPAN>: Passes the address where the message file was loaded. Load <CODE>home.csv</CODE> if a Save Data warning is necessary when resetting or returning to the Wii Menu, and load <CODE>home_nosave.csv</CODE> if no warning is necessary.<font color="red"><B>Note:</B> With WiiWare applications, the <SPAN class="argument">messageFlag</SPAN> setting may cause a warning to be displayed even if the application loaded <CODE>home_nosave.csv</CODE>. If no warning is necessary, you must separately set <SPAN class="argument">messageFlag</SPAN> to an appropriate value.</font>
212<li><SPAN class="argument">messageFlag</SPAN>: If <CODE>home.cvs</CODE> was loaded in <SPAN class="argument">msgBuf</SPAN>, use this flag to control the message(s) displayed.
213<li><SPAN class="argument">configBuf</SPAN>: Passes the address where the button settings file data displayed on the initial screen was loaded.  For two buttons, use <CODE>config.txt</CODE> under the <CODE>HomeButton2</CODE> folder; for three buttons, use <CODE>config.txt</CODE> under the <CODE>HomeButton3</CODE> folder.
214<li><SPAN class="argument">configBufSize</SPAN>: Size of the file that was loaded by <SPAN class="argument">configBuf</SPAN>.
215<li><SPAN class="argument">mem</SPAN>: If a memory allocator was prepared by the application, this is <CODE>NULL</CODE>. If you are managing the allocator using the HBM Library, allocate memory of <CODE>HBM_MEM_SIZE</CODE> and pass its starting address in this argument.
216<li><SPAN class="argument">memSize</SPAN>: Size of the work region used by the library. If you are not using the allocator, this is <CODE>HBM_MEM_SIZE</CODE>.
217<li><SPAN class="argument">pAllocator</SPAN>: If memory allocation is controlled by the application, this sets a pointer to the memory allocator. When you are leaving the creation of the memory allocator up to the HBM library, set this to <CODE>NULL</CODE>.
218<li><SPAN class="argument">sound_callback</SPAN>: Callback function when issuing a sound. If not necessary, <CODE>NULL</CODE>.
219<li><SPAN class="argument">backFlag</SPAN>: HOME Menu background flag (set to zero for translucent background when HOME Menu is displayed; set to 1 for opaque background when HOME Menu is displayed).
220<li><SPAN class="argument">region</SPAN>: Set this to the console's language setting. Region number (specify as <CODE>SC_LANG_XXX</CODE>).
221<li><SPAN class="argument">frameDelta</SPAN>: Amount of change per frame (for 60 frames, set to 1.0; for 50 frames, set to 1.2; for 30 frames, set to 2.0).
222<li><SPAN class="argument">adjust</SPAN>: When the aspect ratio is 4:3, <CODE>adjust.x = 1.0f</CODE> and <CODE>adjust.y = 1.0f</CODE>. When the aspect ratio is 16:9, <CODE>adjust.x = 832.f/608.f</CODE> and <CODE>adjust.y = 1.0f</CODE>. This has no relationship to resolution or the VI value.
223<li><SPAN class="argument">cursor</SPAN>: 0 (Fixed value).
224</ul>
225
226<a id="intro_2" name="intro_2"></a>
227<h2>Using a Memory Allocator</h2>
228<p>The settings of <SPAN class="argument">mem</SPAN>, <SPAN class="argument">memSize</SPAN>, and <SPAN class="argument">pAllocator</SPAN> (members of the <A href="hbm_HBMDataInfo.html"><CODE>HBMDataInfo</CODE> structure</a> passed to the <A href="hbm_HBMCreate.html"><CODE>HBMCreate</CODE></A> function) change depending on where the memory allocator is prepared. When <SPAN class="argument">pAllocator</SPAN> is set, that setting is given priority and used.</p>
229
230
231<a id="intro_2_1" name="intro_2_1"></a>
232<h2>Notes When Using the HBMCreateSound Function </h2>
233<p>The following processes are performed by the <CODE>HBMCreateSound</CODE> function. <br />There is a possibility that this function will overwrite the <CODE>AXRegisterCallback</CODE> setting, so call this function only after the user's sound initialization has ended.</p>
234
235<p>When AI and AX initialization are not performed</p>
236<pre><code>AIInit( NULL );
237AXInit();
238</code></pre>
239
240<p>Always</p>
241<pre><code>HBMMIXInit();
242HBMSYNInit();
243HBMSEQInit();
244
245/*Initialize the Sound Data Archive*/
246ARCInitHandle(...);
247      :
248
249/* Sound thread start*/
250OSCreateThread(...);
251      :
252
253AXRegisterCallback(...);
254</code></pre>
255
256<p><B>Note:</B> The <CODE>AXRegisterCallback</CODE> function saves the user callback, and when HBM processing has finished within the callback, it calls the function set by the user.</p>
257
258<H2>Making the HOME Menu Background Translucent </H2>
259<p>It is possible to choose one of two types of backgrounds when the HOME Menu is being displayed: a semi-transparent background through which the application screen is visible, and an opaque background through which the application screen is not visible.<br> The background can be changed by the <SPAN class="argument">backFlag</SPAN> member of the <a href="hbm_HBMDataInfo.html"><CODE>HBMDataInfo</CODE> structure</a>, which is passed to the <a href="hbm_HBMCreate.html"><CODE>HBMCreate</CODE></a> function.
260</p>
261
262
263
264
265<a id="intro_3" name="intro_3"></a>
266<h2>Console and Wii Remote Settings</h2>
267<p>The following settings can be configured using the HOME Menu:</p>
268<ul class="index">
269<li>Wii Remote Volume Setting
270<li>Wii Remote Rumble Setting
271</ul>
272<p>These items, which must be set on the console or Wii Remote, are saved when you exit the HOME Menu.</p>
273<a id="intro_4" name="intro_4"></a>
274<h2>Simple Pairing with the Wii Remote</h2>
275<p><font color="red">If the application is performing simple pairing with a Wii Remote, it must suspend simple pairing before processing the HOME Menu. </font>To be safe, however, simple pairing is terminated by executing <CODE>WPADStopSimpleSync</CODE> in the <A href="hbm_HBMInit.html"><CODE>HBMInit</CODE></a> function. If desired, resume pairing processing after exiting the HOME Menu.</p>
276<a id="intro_5" name="intro_5"></a>
277<h2>Notes for a KPADRead Value of Zero</h2>
278<p>When <CODE>KPADRead</CODE> returns zero, the value of <CODE>KPADStatus</CODE> is undefined. If this value is used unchanged and <CODE>HBMUpdate</CODE> is run, improper behavior may result. When the return value of <CODE>KPADRead</CODE> is 0, pass the last normal value obtained in <CODE>KPADStatus</CODE>.</p>
279<a id="intro_4_1" name="intro_4_1"></a>
280<h2>With No Support for Classic Controllers</h2>
281<p>
282If you want to disable Classic Controller values even on the HOME Button Menu for software that does not support Classic Controllers, set <CODE>use_devtype</CODE> of the <a href="hbm_HBMControllerData.html">HBMControllerData structure</a> to <CODE>WPAD_DEV_CORE</CODE> when the device type obtained by <CODE>WPADProbe</CODE> is <CODE>WPAD_DEV_CLASSIC</CODE>.
283</p>
284
285<a id="intro_2_2" name="intro_2_2"></a>
286<H2>Making the HOME Menu Background Translucent </H2>
287<p>It is possible to choose one of two types of backgrounds when the HOME Menu is being displayed: a semi-transparent background through which the application screen is visible, and an opaque background through which the application screen is not visible.<br> The background can be changed by the <SPAN class="argument">backFlag</SPAN> member of the <a href="hbm_HBMDataInfo.html"><CODE>HBMDataInfo</CODE> structure</a>, which is passed to the <a href="hbm_HBMCreate.html"><CODE>HBMCreate</CODE></a> function.
288</p>
289
290<a id="projection" name="projection"></a>
291<h2>Projection Matrix Settings During Rendering</h2>
292<p>Before rendering the HOME Menu with <CODE>HBMDraw</CODE>, a designated projection matrix must be passed to GX using the <CODE>GXSetProjection</CODE> function. Although the projection matrix will change based on the extent of expansion in VI, the following examples show how to create projection matrices with arbitrary VI settings that will display the same as the sample.<br> <br>
293</p>
294<p>For 4:3 Settings:</p>
295<pre><code>f32 viRateX = viWidth  / 670.f;
296f32 viRateY = viHeight / 456.f;
297MTXOrtho(projMtx, viRateY * 228.0f, -viRateY * 228.0f, -viRateX * 304.0f, viRateX * 304.0f, 0.0f, 500.0f);
298</code></pre>
299<p>For 16:9 Settings:</p>
300<pre><code>f32 viRateX = viWidth  / 686.f;
301f32 viRateY = viHeight / 456.f;
302MTXOrtho(projMtx, viRateY * 228.0f, -viRateY * 228.0f, -viRateX * 416.0.0f, viRateX * 416.0.0f, 0.0f, 500.0f);
303</code></pre>
304<p> </p>
305<a id="intro_6" name="intro_6"></a>
306<h2>Processing Sound Effects</h2>
307<p>When leaving sound effect (SE) processing to the library, initialize sounds by calling the <CODE><A href="hbm_HBMCreateSound.html">HBMCreateSound</A></CODE> function after <CODE><A href="hbm_HBMCreate.html">HBMCreate</A></CODE>, and then call <CODE><A href="hbm_HBMUpdateSound.html">HBMUpdateSound</A></CODE> at each frame.</p>
308<p>To carry out sound effect processing in the application, set a callback function in the <CODE>sound_callback</CODE> member of the <CODE><A href="hbm_HBMDataInfo.html">HBMDataInfo</CODE> structure</a> without calling the <CODE>HBMCreateSound()</CODE> function. Because the callback function will be called from the library whenever SE are played, perform any necessary processing there. Sound callback functions may also be called by events other than those playing sound effects. From the value passed by <B><I><CODE>evt</CODE></I></B>, identify the event type according to the <A href="hbm_HBMSEV_XXX.html"><CODE>HBMSEV_XXX</CODE> enumerator</a>; then have the application perform suitable processing.</p>
309<p>Sound generation for the Wii remote speaker is always performed in the HBM Library; the application side does not need to be aware of its operation.<BR>The sound data (<CODE>SpeakerSe.arc</CODE>, provided as a shared resource data), which is set to the <SPAN class="argument"><CODE>spkSeBuf</CODE></SPAN> member of the <A href="hbm_HBMDataInfo.html"><CODE>HBMDataInfo</CODE> structure</a>, is played when the volume is raised or lowered and when the Wii Remote is connected at pairing. (Depending on the state of surrounding networks and on the system processing load, it may not play properly from the Wii Remote speakers. However, because this is in the specification, applications do not need to enact countermeasures.)</p>
310<a id="intro_7" name="intro_7"></a>
311<h2>Updating Sounds</h2>
312<p>Sound effect updates and Wii Remote updates are performed by <a href="hbm_HBMUpdateSound.html"><CODE>HBMUpdateSound</CODE></a>. When updates are performed by the program component on its own behalf, it is not necessary to call <CODE>HBMUpdateSound</CODE>.</p>
313<a id="intro_8" name="intro_8"></a>
314<h2>Standard Close Process</h2>
315<p>To obtain the number of the button pressed to exit the HOME Menu, use <CODE><A href="hbm_HBMGetSelectBtnNum.html">HBMGetSelectBtnNum</A></CODE>. Have your application perform the required processing that corresponds to that button number (return to the system menu, reset, and so on).</p>
316<p>When HOME is pressed (or <B>Close</B> is clicked) to exit the HOME Menu, <A href="hbm_HBMGetSelectBtnNum.html"><CODE>HBMGetSelectBtnNum</CODE></A> returns &lt;<I>button number</I>&gt; + 1. When the HOME Menu is running, <CODE><A href="hbm_HBMGetSelectBtnNum.html">HBMGetSelectBtnNum</A></CODE> returns –1.</p>
317<p>To call the HOME Menu again after exiting, call <CODE><A href="hbm_HBMInit.html">HBMInit</A></CODE>.</p>
318<a id="intro_9" name="intro_9"></a>
319<h2>Forced Close Process</h2>
320<p>If the RESET or Power Button on the Wii console is pressed while the HOME Menu is open, call the <A href="hbm_HBMGetSelectBtnNum.html"><CODE>HBMStartBlackOut</CODE></A> function to close the HOME Menu.
321</p>
322<p>Note that the status after a forced reset is the same as after closing the HOME Menu by pressing RESET (the <A href="hbm_HBMGetSelectBtnNum.html"><CODE>HBMGetSelectBtnNum</CODE></A> return value is <CODE>HBM_SELECT_BTN2</CODE>).</p>
323<a id="intro_10" name="intro_10"></a>
324<h2>Notes for the Stack Size of the Sound Thread</h2>
325<p>Use the <A href="hbm_HBMCreateSound.html"><CODE>HBMCreateSound</A></CODE></A> function to create a sound thread in the HBM library. The stack size is 16 KB.</p>
326<p>The current thread's stack is also used within interrupt handlers on Wii. As a result, the HMB library's sound thread stack may prove to be insufficient.</p>
327<p><b><font color="red">If execution halts due to an insufficient stack size, increase the value of <CODE>HBM_SND_THREAD_STACK_SIZE</CODE> by defining it before including <CODE>hbm.h</CODE>.</font></b><br>
328</p>
329<br> <br> <a id="mount" name="mount"></a>
330<h4>Typical Implementation for Entering and Leaving HOME Menu </h4>
331<ul class="list">
332<li><a href="#inout_0">When Entering the HOME Menu</a>
333<li><a href="#inout_1">When Leaving the HOME Menu</a>
334</ul>
335<br style="clear:both;"> <br> <a id="inout_0" name="inout_0"></a>
336<h2>When Entering the HOME Menu</h2>
337<ul>
338<li>Functions that should be called before entering the HOME Menu
339</ul>
340<pre><code>// Set floating point/integer fast cast feature
341OSInitFastCast(void);
342</code></pre>
343<p>This is used by the HBM library for the drawing process.<br>If this function is not called, display of the HOME Menu will be distorted.<br>Call it once at the start of the application.<br>
344</p>
345<ul>
346<li>GX functions that have an effect on the HOME Menu
347</ul>
348<pre><code>// Whether or not to allow updates to the color buffer
349GXSetColorUpdate(GX_TRUE);
350</code></pre>
351<pre><code>// Clipping functions
352GXSetScissor( *1 );
353GXSetScissorBoxOffset( *1 );
354</code></pre>
355<pre><code>// Viewport
356GXSetViewport( *1 );
357// Other viewport-related functions
358</code></pre>
359<pre><code>// Projection
360GXSetProjection( *1 );
361// Other projection-related functions
362</code></pre>
363<pre><code>// Frame buffer-related functions
364GXSetCopyFilter( *2 );
365GXSetDispCopyDst( *1 );
366GXSetDispCopySrc( *1 );
367// Other frame buffer-related functions
368</code></pre>
369<p>For these functions, set values on the application side before starting the HOME Menu.<br> After the HOME Menu has ended, reconfigure the values on the application side as needed.<br> <br> *1 For these functions' arguments, substitute items appropriate to the application. <br>*2 For this function's arguments, substitute application-appropriate items to items other than antialiasing. Turn antialiasing off.</p>
370<ul>
371<li>Wii Remote Processing
372</ul>
373<p>Do not perform simple pairing while in the HOME Menu. Halt it before starting the HOME Menu.<br>However, to be safe, <CODE>WPADStopSimpleSync</CODE> is called within <A href="hbm_HBMInit.html"><CODE>HBMInit</CODE></a> to stop processing.<br>Resume simple pairing in the application after exiting from the HOME Menu, if desired.</p>
374<ul>
375<li>Sound Processing
376</ul>
377<p>On the application side, set the volume to 0 (zero) for all sound playback, and shut down all effects for AUX_A through AUX_C.</p>
378<p>
379<font color="red"><B>Note:</B> <CODE>AXSetMasterVolume</CODE> also lowers the volume for the HOME Menu itself. Do not use this function.</font><br />
380</p>
381<h5>When an Application Uses NintendoWare </h5>
382<pre><code>// Set the sound volume to 0 (zero) for all players and pause
383nw4r::snd::SoundPlayer::PauseAllSound( true, fadeFrames );
384
385// Clear the effect
386void nw4r::snd::SoundSystem::ClearEffect(bus, fadeTime);
387</code></pre>
388<h5>When an Application Does Not Use NintendoWare </h5>
389<pre><code>AXFXReverbHiShutdown()   // When ReverbHi </code></pre>
390<p>Use such functions to shut down all sound for AUX_A through AUX_C.<br /><br />Reference: Use a fade to counteract any noise arising from sudden changes in volume. The Wii Menu uses a 300msec fade.</p>
391<a id="inout_1" name="inout_1"></a>
392<h2>When Leaving the HOME Menu</h2>
393<ul>
394<li>GX functions, which are called internally by the HOME button
395</ul>
396<pre><code>// Alpha compare TEV settings<br>GXSetAlphaCompare( GX_ALWAYS,0, GX_AOP_OR, GX_ALWAYS, 0 );</code></pre>
397<pre><code>// Z-compare mode settings<br>GXSetZMode(GX_DISABLE, GX_ALWAYS, GX_DISABLE);</code></pre>
398<pre><code>// Settings for the number of indirect lookups to use<br>GXSetNumIndStages(0);</code></pre>
399<pre><code>// TEV swap table settings<br>GXSetTevSwapModeTable(GX_TEV_SWAP_0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);</code></pre>
400<pre><code>// Settings for the swap mode for swapping to a given TEV stage<br>GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0);</code></pre>
401<pre><code>// Texture coordinate scale settings<br>GXSetTexCoordScaleManually(GX_TEXCOORD0, GX_FALSE, 0, 0);
402GXSetTexCoordScaleManually(GX_TEXCOORD1, GX_FALSE, 0, 0);</code></pre>
403<pre><code>// Cylinder wrapping settings<br>GXSetTexCoordCylWrap(GX_TEXCOORD0, GX_FALSE, GX_FALSE);
404GXSetTexCoordCylWrap(GX_TEXCOORD1, GX_FALSE, GX_FALSE);</code></pre>
405<pre><code>// Culling control<br>GXSetCullMode(GX_CULL_NONE);</code></pre>
406<pre><code>// Gamma correction for pixels being copied from EFB to XFB<br>GXSetDispCopyGamma(GX_GM_1_0);</code></pre>
407<pre><code>// Fog settings<br>GXSetFog(GX_FOG_NONE, 0, 0, 0, 0, (GXColor){ 0, 0, 0, 255 });</code></pre>
408<p>For these functions, the settings of the application will be overwritten during execution of the HOME Menu. They should be reset as necessary when closing the HOME Menu.<br><B>Note:</B> Values in parentheses are the actual values set internally by the HOME button.</p>
409<ul>
410<li>Sound Processing
411</ul>
412<p>Be sure to restore the sound volume on the application side. </p>
413<h5>When an Application Uses NintendoWare</h5>
414<pre><code>// Restore all player sound levels
415nw4r::snd::SoundPlayer::PauseAllSound( false, fadeFrames );
416
417// Restore effects
418nw4r::snd::SoundSystem::AppendEffect( bus, effect );</code></pre>
419
420<h5>When an Application Does Not Use NintendoWare</h5>
421<p>The above does not necessarily apply when leaving the HOME Menu by clicking Wii Menu or Reset.</p>
422<ul>
423<li>Wii Remote Processing
424</ul>
425<p>Simple pairing for the Wii Remote is suspended if it is active when the HOME Menu is executed.<br> Resume simple pairing in the application, if desired. <br><br>In addition, the status returned for the Wii Remote speaker is unstable. If you want to continue using the Wii Remote speaker in the application, set the speaker to <CODE>WPAD_SPEAKER_ON</CODE> after termination. If you are not using the Wii Remote speaker, set the speaker to <CODE>WPAD_SPEAKER_OFF</CODE> after termination.
426</p>
427<p><B>Note:</B> When using NintendoWare sounds<br />Set the Wii Remote speaker to <CODE>WPAD_SPEAKER_ON</CODE> after termination as follows.</p>
428<pre><code>nw4r::snd::SoundSystem::GetRemoteSpeaker( remote_no ).Shutdown();
429nw4r::snd::SoundSystem::GetRemoteSpeaker( remote_no ).Setup();</code></pre>
430<br> <a id="homeng" name="homeng"></a>
431<H4>HOME Menu Prohibited Icon</H4>
432<P>When HOME is pressed during a scene that cannot allow the HOME Menu to be shown, a &quot;HOME Menu Prohibited&quot; icon should be displayed. Embed this icon in the application according to the following specifications. You can check the &quot;HOME Menu Prohibited&quot; icon in the sample demo by pressing the + Button when the HOME Menu is not being displayed.</p>
433
434<h2>Icon Data</h2>
435<p>
436Convert <CODE>Icon-HomeButtonMenu_is_not_available.tga</CODE> in the <CODE>data/icon</CODE> directory to a file format that can be easily used by the application, and use this converted file. When you convert it, do not change the size or pixel pattern of the original image in any way.
437</p>
438
439<h2>Displaying the Icon</h2>
440<p>
441Display anywhere on the screen that is within the safe frame. Alpha-blend in for 0.25 seconds, show fixed for 1 second, and finally alpha-blend out for 0.25 seconds (linearly interpolated).
442</P>
443
444
445<br>
446<h2>Revision History</h2>
447<dl class="history">
448<dt>2009/11/10</dt><dd>Modified the description for <B>Incorporating into WiiWare</B>.</dd>
449<dd>Revised description of Wii remote processing of speakers in <B>When Leaving the HOME Menu</B>.</dd>
450<dt>2009/06/01</dt><dd>Revised description of sound effects in <B>When Entering the HOME Menu</B>.</dd>
451<dd>Added description of GX function in <B>When Leaving the HOME Menu</B>.</dd>
452<dt>2009/01/30</dt><dd>Integrated with the page on notes for implementation, and corrected content.</dd>
453<dd>Revised <B>Notes for a KPADRead Value of Zero</B>.</dd>
454  <dt>2008/09/24
455  <dd>Revised <B>Notes for a KPADRead Value of Zero</B>.
456  <dd>Added <B>With No Support for Classic Controllers</B>.
457  <dd>Revised terminology.
458  <dt>2008/02/07
459  <dd>Added Wii Remote processing information when leaving the HOME Menu.
460  <dt>2008/02/01
461  <dd>Added text about the use of WiiWare to <B>Special Libraries</B> and <B>Incorporating into Applications</B>.
462  <dt>2007/11/26
463  <dd>Added <B>Simple Pairing with the Wii Remote</B>, <B>Notes for a KPADRead Value of Zero</B>, and <B>Projection Matrix Settings During Rendering</B>.
464<dd>Revised notes related to the sound thread's stack size and resumption of simple pairing.
465  <dt>2007/09/28
466  <dd>Added cautions related to the stack size of the sound thread and restarting of simple pairing.
467  <dt>2007/09/03
468  <dd>Added precautions related to the sound fade-out time. Removed the item related to sound customization.
469  <dt>2007/05/09
470  <dd>Revised the description for the SDK version.
471  <dt>2007/04/12
472  <dd>Added information to <B>Incorporating into Applications</B>.
473  <dd>Added the values that are set to <B>When Leaving the HOME Menu</B>.
474  <dt>2007/01/30
475  <dd>Revised <B>Typical Implementation for Entering and Leaving the HOME Menu</B>.
476  <dd>Revised page layout.
477  <dt>2006/12/18
478  <dd>Revised <B>Processing Sound Effects</B>.
479  <dt>2006/11/11
480  <dd>Added information to <B>Incorporating into Applications</B>.
481  <dd>Deleted information about manual viewer and added a section about special libraries.
482  <dt>2006/10/19
483  <dd>Manual edition (added <B>Displaying the Manual from the HOME Menu</B>).
484  <dt>2006/10/02
485  <dd>Initial version.
486</dl>
487<HR>
488<P>RVL-06-0172-001-V<br>CONFIDENTIAL</P>
489</BODY>
490</HTML>