1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../../css/manpage.css" type="text/css" /> 7<title>ProcessPowerButton</title> 8 </head> 9 <body> 10<h1><CODE><a href="../../../nn/Overview.html">nn</a>::<a href="../../../nn/applet/Overview.html">applet</a>::<a href="../../../nn/applet/CTR/Overview.html">CTR</a>::ProcessPowerButton</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14bool ProcessPowerButton( 15 void 16); 17</pre> 18 </div> 19<h2>Parameters</h2> 20 <div class="section"> 21<p>None.</p> 22 </div> 23<h2>Return Values</h2> 24<div class="section">Returns a value indicating whether it is necessary to wait. </div> 25<h2>Description</h2> 26 <div class="section"> 27<p>Processes POWER Button transitions.</p><!-- write here --><P> 28This function is used to handle POWER Button transitions when this is required by the <a href="../../../nn/applet/CTR/IsExpectedToProcessPowerButton.html"><CODE>nn::applet::CTR::IsExpectedToProcessPowerButton</CODE></a> function. 29</P><P> 30The return value indicates whether it is necessary to wait with the <a href="../../../nn/applet/CTR/WaitForStarting.html"><CODE>nn::applet::CTR::WaitForStarting</CODE></a> function after this function is called. If this is <CODE>true</CODE>, call the function. There is no need to call the function if the value is <CODE>false</CODE>, but if called the function exits without problems. (Currently no case exists where the value could be <CODE>false</CODE>.) 31</P><P> 32To ensure mutual exclusion with Sleep Mode, you must call <CODE><a href="../../../nn/applet/CTR/DisableSleep.html">nn::applet::CTR::DisableSleep</a>(true)</CODE> before calling this function. For strict symmetry, it would be necessary to call <CODE><a href="../../../nn/applet/CTR/EnableSleep.html">nn::applet::CTR::EnableSleep</a>(true)</CODE> after waiting and determining to finish waiting. However, since the finish determination is always <CODE>true</CODE>, it should cause no problems to omit that function call. (Note that the above constraint is specific to the current version and may change in the future.) 33</P><P> 34You must also initialize the graphics library using the <CODE>nngxInitialize</CODE> function before calling this function. Also, after the display buffer has been set and buffers have been swapped once, you must turn on the LCD screens. 35</P><P> 36If the LCD screens are not turned on, the upper and lower screens will remain black even if you return to the HOME Menu. (Background music and sound effects will play normally, and key input will be handled as usual.) Although this function can be called even if a display buffer has not been configured, the image shown when the LCDs are turned on may be undefined. 37</P><P> 38Before calling this function, be sure that rendering has finished by calling the <CODE>nngxWaitCmdlistDone</CODE> function. For frameworks where multiple command lists will be swapped and commands will be created in parallel with rendering, pay close attention to the timing of <a href="../../../nn_gx/nngxRunCmdlist.html"><CODE>nngxRunCmdlist</CODE></a> function calls.<br />The GPU may hang if rendering has not completed before this function is called.<BR>If rendering has not yet completed at the time that this function is called (while a command request is processing), execution halts on an assertion (only for the Development/Debug builds).<br /></P><P> 39Example 40</P><PRE> 41 if ( applet::IsExpectedToProcessPowerButton() ) 42 { 43 applet::DisableSleep(); 44 45 // POWER Button processing (transition to HOME Menu) 46 <FONT color="red">applet::ProcessPowerButton();</FONT> 47 48 // Wait 49 applet::WaitForStarting(); 50 if ( applet::IsExpectedToCloseApplication() ) // Probably 'true' 51 { 52 _close_application(); 53 } 54 55 // Control is unlikely to reach this point, so the lines below here can be omitted 56 applet::EnableSleep(); 57 } 58</PRE><P>If <CODE>HomeButtonCallback</CODE> has been set by the <CODE><a href="../../../nn/applet/CTR/SetHomeButtonCallback.html">nn::applet::CTR::SetHomeButtonCallback</a></CODE> 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.) 59</P></div> 60<h2>Revision History</h2> 61 <div class="section"> 62 <dl class="history"> 63 <dt>2012/02/07</dt> 64<dd> Noted that execution halts on an assertion if rendering has not yet completed at the time this function is called. <br /> 65 </dd> 66 <dt>2012/01/16</dt> 67<dd> Added a specific example about limitations when calling this function (the need to wait for rendering to complete).<BR> 68 </dd> 69 <dt>2011/09/08</dt> 70<dd> Added information about limitations when calling this function (the need to wait for rendering to complete).<BR> 71 </dd> 72 <dt>2011/08/01</dt> 73<dd> Added information about limitations related to display buffer swapping and the LCD screens when calling this function.<BR> 74 </dd> 75 <dt>2011/03/30</dt> 76<dd> Added note about the need for the <CODE>nngxInitialize</CODE> function. 77 </dd> 78 <dt>2011/02/17</dt> 79<dd> Added a cautionary note about setting the callback.<br /> 80 </dd> 81 <dt>2011/01/24</dt> 82<dd>Added mention of the <CODE>DisableSleep</CODE> and <CODE>EnableSleep</CODE> functions.<br /> 83 </dd> 84 <dt>2010/12/09</dt> 85<dd>Initial version.<br /> 86 </dd> 87 </dl> 88 </div> 89 <hr><p>CONFIDENTIAL</p></body> 90</html> 91