nn::applet::CTR::IsExpectedToProcessHomeButton Function
bool IsExpectedToProcessHomeButton(
void
);
None.
true, the HOME Button must be processed. Determines whether there has been a request to process the HOME Button.
A return value of true indicates that either the HOME Button was pressed to jump to the HOME Menu, or another applet made a similar request to jump to the HOME Menu.
In such cases, call the nn::applet::CTR::ProcessHomeButton function to process the HOME Button. Then call nn::applet::CTR::WaitForStarting to wait if necessary.
Example
// HOME Button transition check
if ( applet::IsExpectedToProcessHomeButton() )
{
_save_my_data();
// HOME Button transition process
applet::ProcessHomeButton();
// Wait
applet::WaitForStarting();
if( applet::IsExpectedToCloseApplication() )
{
_close_application();
}
_recover_my_data();
}
Prevent other applet-transition functions from being called between this function and nn::applet::CTR::ProcessHomeButton. If there is an inconsistency in the internal state, for example because of an attempt to preload library applets from another thread between these two function calls, a warning is generated on an assertion.
This example assumes that determination functions such as this one and the function for actually making the transition are called successively in the same thread, but depending on the implementation you may be able to call them in different threads. However, be very careful that the determination thread does not continue executing after execution control is passed.
ProcessHomeButton.
ClearHomeButtonState function from an example.CONFIDENTIAL