To call the HOME Menu, press HOME on the Wii Remote. The HOME Menu must be incorporated into every application. It includes the buttons for shutting down and resetting applications, and displaying and setting information related to the Wii Remote.
For descriptions of the HOME Menu's functionalities and each of its buttons, refer to the Wii console manual.
The homebuttonLib.vcmv[D].a library included in the RVL directory can be used only with certain channel applications. The homebuttonLib.nwm[D].a library is for WiiWare. Do not use these two libraries with disc applications.
Link the homebuttonLib[D].a file and embed the shared resource data contained in the dvddata/HomeButton2 directory into the application's project.
To start the HOME Menu, call HBMCreate then HBMInit in the application source code, in that order; next, call HBMCalc and HBMDraw in the main loop.
The HOME Menu can be incorporated in one of the following two ways:
HBMCreate.
HBMInit function to initialize internal library variables.
HBMDraw function to display the HOME Menu.
HBMDelete.
HBMCreate during, for example, game initialization.
HBMInit function to initialize internal library variables.
HBMDraw function to display the HOME Menu.
HBMDelete function to free the resources.
Note: For details on introducing WiiWare, see the WiiWare Support Guide.
The following items are passed as arguments to HBMCreate.
SoundLib is not used)
SC_LANG_????)
Settings of the HBMDataInfo structure, passed to HBMCreate, depend on the type of the HBM library and where the memory allocator is prepared. When pAllocator is set, it is given priority and used.
The following settings can be configured using the HOME Menu:
These items, which must be set on the console or Wii Remote, are saved when you exit the HOME Menu.
The application should suspend simple pairing with the Wii Remote before processing the HOME Menu. To be safe, however, simple pairing is terminated by executing WPADStopSimpleSync in the HBMInit function. If desired, resume pairing processing after exiting the HOME Menu.
When KPADRead returns zero, the value of KPADStatus is undefined. If this value is used unchanged and HBMUpdate is run, improper behavior may result. When the return value of KPADRead is 0, pass the last normal value obtained in KPADStatus.
Note: This method of handling is not needed when using Revolution SDK 3.2 or later.
If you want to disable Classic Controller values even on the HOME Button Menu for software that does not support Classic Controllers, set use_devtype of the HBMControllerData structure to WPAD_DEV_CORE when the device type obtained by WPADProbe is WPAD_DEV_CLASSIC.
Before rendering the HOME Menu with HBMDraw, a designated projection matrix must be passed to GX using the GXSetProjection 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.
For 4:3 Settings:
f32 viRateX = viWidth / 670.f;
f32 viRateY = viHeight / 456.f;
MTXOrtho(projMtx, viRateY * 228.0f, -viRateY * 228.0f, -viRateX * 304.0f, viRateX * 304.0f, 0.0f, 500.0f);
For 16:9 Settings:
f32 viRateX = viWidth / 686.f;
f32 viRateY = viHeight / 456.f;
MTXOrtho(projMtx, viRateY * 228.0f, -viRateY * 228.0f, -viRateX * 416.0.0f, viRateX * 416.0.0f, 0.0f, 500.0f);
When leaving sound effect (SE) processing to the library, initialize sounds by calling the HBMCreateSound function after HBMCreate, and then call HBMUpdateSound at each frame.
To carry out sound effect processing in the application, set a callback function in the sound_callback member of the HBMDataInfo structure without calling the HBMCreateSound() 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 evt, identify the event type according to the HBMSEV_XXX enumerator; then have the application perform suitable processing.
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.
The sound data (SpeakerSe.arc, provided as a shared resource data), which is set to the spkSeBuf member of the HBMDataInfo structure, 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.)
Sound effect updates and Wii Remote updates are performed by HBMUpdateSound. When updates are performed by the program component on its own behalf, it is not necessary to call HBMUpdateSound.
To obtain the number of the button pressed to exit the HOME Menu, use HBMGetSelectBtnNum. Have your application perform the required processing that corresponds to that button number (return to the system menu, reset, and so on).
When HOME is pressed (or Close is clicked) to exit the HOME Menu, HBMGetSelectBtnNum returns <button number> + 1. When the HOME Menu is running, HBMGetSelectBtnNum returns –1.
To call the HOME Menu again after exiting, call HBMInit.
If the RESET or Power Button on the Wii console is pressed while the HOME Menu is open, call the HBMStartBlackOut function to close the HOME Menu.
Note that the status after a forced reset is the same as after closing the HOME Menu by pressing RESET (the HBMGetSelectBtnNum return value is HBM_SELECT_BTN2).
Use the HBMCreateSound function to create a sound thread in the HBM library. The stack size is 16 KB.
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.
If execution halts due to an insufficient stack size, increase the value of HBM_SND_THREAD_STACK_SIZE by defining it before including hbm.h.
// Set floating point/integer fast cast feature
OSInitFastCast(void);
This is used by the HBM library for the drawing process.
If this function is not called, display of the HOME Menu will be distorted.
Call it once at the start of the application.
// Whether or not to allow updates to the color buffer
GXSetColorUpdate(GX_TRUE);
// Clipping functions
GXSetScissor( *1 );
GXSetScissorBoxOffset( *1 );
// Viewport
GXSetViewport( *1 );
// Other viewport-related functions
// Projection
GXSetProjection( *1 );
// Other projection-related functions
// Frame buffer-related functions
GXSetCopyFilter( *2 );
GXSetDispCopyDst( *1 );
GXSetDispCopySrc( *1 );
// Other frame buffer-related functions
For these functions, set values on the application side before starting the HOME Menu.
After the HOME Menu has completed, reconfigure the values on the application side as needed.
*1 For these functions' arguments, substitute items appropriate to the application.
*2 For this function's arguments, substitute application-appropriate items to items other than antialiasing. Turn antialiasing off.
Do not perform simple pairing while in the HOME Menu. Halt it before starting the HOME Menu.
However, to be safe, WPADStopSimpleSync is called within HBMInit to stop processing.
Resume simple pairing in the application after exiting from the HOME Menu, if desired.
Have the application set the sound volume to zero. Use 300 ms for the fade time.
static void nw4r::snd::SoundSystem::ClearEffect(nw4r::snd::AuxBus bus, int fadeTime);
Use this code to shut down all effects AUX_A through AUX_C. Use 250 ms for the fade time.
// Fade process
AXGetAux?ReturnVolume() // ?=A,B,C
AXSetAux?ReturnVolume() // ?=A,B,C
// Shutdown
AXFXReverbHiShutdown() // When ReverbHi
Use functions such as these to fade out all the effects AUX_A through AUX_C, then shut them down. Use 250 ms for the fade time.
Note: Effect fade-outs should end while the sound is still fading. The sound completely fades out in 300 ms.
Note: Do not use functions such as AXFXReverbHiSettings that internally change parameters, including shutdown. Noise will be generated if these functions are used to change output values during a fade.
// Alpha compare TEV settings
GXSetAlphaCompare( GX_ALWAYS,0, GX_AOP_OR, GX_ALWAYS, 0 );
// Z-compare mode settings
GXSetZMode(GX_DISABLE, GX_ALWAYS, GX_DISABLE);
// Settings for the number of indirect lookups to use
GXSetNumIndStages(0);
// TEV swap table settings
GXSetTevSwapModeTable(GX_TEV_SWAP_0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA);
// Settings for the swap mode for swapping to a given TEV stage
GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP0);
// Culling control
GXSetCullMode(GX_CULL_NONE);
// Gamma correction for pixels being copied from EFB to XFB
GXSetDispCopyGamma(GX_GM_1_0);
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.
Note: Values in parentheses are the actual values set internally by the HOME button.
Be sure to restore the sound volume on the application side. Allocate 300 ms or more for the fade time.
Initialize effects AUX_A through AUX_C on the application side. Also:
AXSetAux?ReturnVolume() // ?=A,B,C
Use this code to restore the output on AUX_A through AUX_C (no need to apply fade).
The above does not necessarily apply when leaving the HOME Menu by clicking Wii Menu or Reset.
Simple pairing for the Wii Remote is suspended if it is active when the HOME Menu is executed.
Resume simple pairing in the application, if desired.
In addition, the status returned for the Wii Remote speaker is unstable. Since the HOME Menu uses the Wii Remote speaker, set the speaker's state to WPAD_SPEAKER_OFF on completion if it is not used.
RVL-06-0172-001-S
CONFIDENTIAL