nn::applet::CTR::IsExpectedToCloseApplication Function
bool IsExpectedToCloseApplication(
void
);
None.
true indicates that the application should be closed and false indicates that the application does not need to be closed. Determines whether an application should be closed.
A return value of true indicates that the shutdown process has started because there was a close request or for some other reason. In this case, close the application immediately.
A return value of false indicates that the application does not need to be closed. In this case, do nothing.
WaitForStarting. Again, also check after execution of the nn::applet::CTR::Enable function.
Do this before calling any of the other check functions in the APPLET library (nn::applet::CTR::IsExpectedToProcessHomeButton, nn::applet::CTR::IsExpectedToProcessPowerButton, and nn::applet::CTR::IsExpectedToReplySleepQuery) once control has returned from the waiting state.
Example
nnMain()
{
...
while(1)
{
_exec();
_draw();
// Checking for close after each frame
if ( applet::IsExpectedToCloseApplication() )
{
_application_finalize();
applet::PrepareToCloseApplication();
applet::CloseApplication();
// Execution doesn't reach this point.
}
// Launch library applet after A Button press
if ( _pushed_A_button() )
{
_start_library_applet();
// Wait for return from library applet
applet::WaitForStarting();
// Check for close after control returns
if ( applet::IsExpectedToCloseApplication() )
{
_application_finalize();
applet::PrepareToCloseApplication();
applet::CloseApplication();
// Execution doesn't reach this point.
}
}
...
Enable function.CONFIDENTIAL