nn::applet::CTR::SetHomeButtonCallback Function
void SetHomeButtonCallback(
AppletHomeButtonCallback callback,
uptr arg = 0
);
| Name | Description | |
|---|---|---|
| in | callback | Callback. |
| in | arg | Callback arguments. |
Sets the callback invoked when HOME is pressed.
The callback is called when a HOME Button press is detected.
A number of applet functions will not end until the process has left the callback, so promptly end the callback to reduce the risk of deadlock.
Example
bool myHomeButtonCallback( uptr arg, bool isActive, applet::HomeButtonState state )
{
NN_UNUSED_VAR(arg);
if ( isActive )
{
if ( state == applet::HOME_BUTTON_SINGLE_PRESSED )
{
NN_LOG("HOME BUTTON is clicked.\n");
}
else
{
NN_LOG("HOME BUTTON is double-clicked.\n");
}
return true;
}
else
{
return false;
}
}
nnMain()
{
applet::SetHomeButtonCallback( myHomeButtonCallback, 0 );
…
}
Note:
In CTR-SDK 4.0 and later versions, the double-click is no longer returned as a state parameter for the callback. The process does not enter the portion of the sample code that displays "HOME BUTTON is double-clicked." The definition for the double-click itself remains for purposes of compatibility, but in the future it might be deleted.
CONFIDENTIAL