nn::applet::CTR::ProcessHomeButton Function

Syntax

bool ProcessHomeButton(
     void
);

Arguments

None.

Return Values

Returns a value indicating whether it is necessary to wait.

Description

Processes transitions to the HOME Menu.

This function is used to jump to the HOME Menu when this is required by the nn::applet::CTR::IsExpectedToProcessHomeButton function.

The return value indicates whether it is necessary to wait with the nn::applet::CTR::WaitForStarting function after this function is called. If this is true, call the function. If this is false, you do not need to call the function. (Of course, even if you call the function it will simply exit without waiting.)

To ensure mutual exclusion with Sleep Mode, you must call nn::applet::CTR::DisableSleep(true) before calling this function. You must call nn::applet::CTR::EnableSleep(true) after waiting and determining to finish waiting. (Note that the constraint above is particular to the current version and may change in the future.)

You must also initialize the graphics library using the nngxInitialize function before calling this function.

Example

   // HOME Button transition check
   if ( applet::IsExpectedToProcessHomeButton() )
   {
       _save_my_data();
       applet::DisableSleep(true);
       // HOME Button transition process
       applet::ProcessHomeButton();
       // Wait
       applet::WaitForStarting();
       if ( applet::IsExpectedToCloseApplication() )
       {
             _close_application();
       }
       applet::EnableSleep(true);
       _recover_my_data();
   }

If HomeButtonCallback has been set by the nn::applet::CTR::SetHomeButtonCallback function, do not call this function until after the process has left the callback. (If you call the function beforehand, the process might become deadlocked.)

Although old versions of the library had the nn::applet::CTR::ProcessHomeButtonIfPrepared function, it has the exact same behavior as this function. Use this function instead.

Revision History

2011/03/30
Added note about the need for the nngxInitialize function.
2011/02/17
Added a cautionary note about setting the callback.
2011/01/24
Added mention of the DisableSleep and EnableSleep functions.
2010/12/10
Added information about the removal of ProcessHomeButtonIfPrepared.
2010/11/10
Initial version.

CONFIDENTIAL