nn::applet::CTR::IsExpectedToProcessPowerButton Function
bool IsExpectedToProcessPowerButton(
void
);
None.
true indicates that the POWER Button was pressed and a value of false indicates that it was not. Finds the state of the POWER Button.
A return value of true indicates that the POWER Button was pressed. In this case, the application must immediately call the nn::applet::CTR::ProcessPowerButton function and then wait with the nn::applet::CTR::WaitForStarting function.
A value of false indicates that a POWER Button press was not detected. In this case, do nothing.
Call this function periodically (usually every frame).
Example
if ( applet::IsExpectedToProcessPowerButton() )
{
applet::DisableSleep();
// POWER Button processing (transition to HOME Menu)
applet::ProcessPowerButton();
// Wait
applet::WaitForStarting();
if ( applet::IsExpectedToCloseApplication() ) // Probably 'true'
{
_close_application();
}
// Control is unlikely to reach this point, so the lines below here can be omitted
applet::EnableSleep();
}
Although this function was planned to be removed in SDK 0.14.9, it was determined to be necessary upon further review of the shutdown sequence for the POWER Button. Though this is inconvenient, it is required to implement POWER Button handling.
DisableSleep and EnableSleep functions.CONFIDENTIAL