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>Enable</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>::Enable</CODE> Function</h1> 11<h2>Syntax</h2> 12 <div class="section"> 13 <pre class="definition"> 14void Enable( 15 bool isSleepEnabled = true 16); 17</pre> 18 </div> 19<h2>Parameters</h2> 20 <div class="section"> 21 <table class="arguments"> 22 <thead> 23 <tr> 24 <td width="15" /> 25<th>Name</th> 26<td>Description</td> 27 </tr> 28 </thead> 29 <tr> 30<td>in</td> 31<th>isSleepEnabled</th> 32<td>This option specifies whether sleep is enabled.</td> 33 </tr> </table> 34 </div> 35<h2>Return Values</h2> 36 <div class="section"> 37None. 38 </div> 39<h2>Description</h2> 40 <div class="section"> 41<p>Enables features specific to the applet library.</p><P> 42You must always call this function. Calling this function enables the features provided by the Applet library. The application is inactive until this function is called. 43</P><P> 44Because the sleep-related callbacks, the HOME Button callback, and POWER Button callback are enabled immediately after this function is called, applications must configure each of the callbacks as early as possible and then call this function. However, call this function before calling the nngxInitialize, nn::snd::Initialize, or nn::dsp::Initialize functions. (There is more information about the <CODE>nngxInitialize</CODE> function below.) 45</P><P> 46Specify <CODE>true</CODE> for the <SPAN class="argument">isSleepEnabled</SPAN> argument to have the function call <CODE><a href="../../../nn/applet/CTR/EnableSleep.html">nn::applet::CTR::EnableSleep</a>(applet::NO_SHELL_CHECK)</CODE> internally. In other words, this enables sleep notifications. However, the <CODE>applet::NO_SHELL_CHECK</CODE> argument indicates that when the <a href="../../../nn/applet/CTR/EnableSleep.html"><CODE>nn::applet::CTR::EnableSleep</CODE></a> function is called it does not check whether the system is closed. If you want to account for the possibility that that system may already be closed by that time, call <CODE><a href="../../../nn/applet/CTR/EnableSleep.html">nn::applet::CTR::EnableSleep</a>(applet::SLEEP_IF_SHELL_CLOSED)</CODE> immediately after this function. 47</P><P> 48Specify <CODE>false</CODE> for the <SPAN class="argument">isSleepEnabled</SPAN> argument to not enable sleep notifications. After this, call the <a href="../../../nn/applet/CTR/EnableSleep.html"><CODE>nn::applet::CTR::EnableSleep</CODE></a> function as appropriate. 49</P><P> 50This function calls <a href="../../../nn/applet/CTR/WaitForStarting.html"><CODE>nn::applet::CTR::WaitForStarting</CODE></a>. Because you must determine whether to close the application when this function returns, call the <a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html"><CODE>nn::applet::CTR::IsExpectedToCloseApplication</CODE></a> function after this one exits. Call the <CODE>nngxInitialize</CODE> function only after this determination has finished. 51</P><P> 52Example 53</P><PRE> 54 nnMain() 55 { 56 applet::SetSleepQueryCallback( mySleepQueryCallback, 0 ); 57 applet::SetAwakeCallback( myAwakeCallback, 0 ); 58 <FONT color="red">applet::Enable();</FONT> 59 if ( <FONT color="red">applet::IsExpectedToCloseApplication()</FONT> ) // Check for a close request 60 { 61 _finalize_application(); 62 applet::PrepareToCloseApplication(); 63 applet::CloseApplication(); 64 } 65 <FONT color="red">applet::EnableSleep( applet::SLEEP_IF_SHELL_CLOSED );</FONT> 66 ... 67</PRE><P> 68<B>Note</B>: 69</P><P> 70When applications that do not call this function are run on a debugger, the following problems occur because the applications are running outside of the CTR system.</P><UL><LI>The DevMenu runs in parallel and accepts key input, even though this is not intended.</LI><LI>After the system enters and recovers from sleep, the upper and lower screens remain black.</LI></UL><P> 71This second problem can be resolved by calling the <CODE>nngxStartLcdDisplay</CODE> function. 72</P><P> 73If an application is started from the development menu and the POWER Button is pressed after startup, execution may stop at this function. For more information, see the documentation for the development menu. 74</P><P> 75Also, execution stops on the 3DS logo screen if an application that has not called this function is started from the HOME Menu. 76</P></div> 77<h2>Revision History</h2> 78 <div class="section"> 79 <dl class="history"> 80 <dt>2011/07/26</dt> 81<dd>Added a description of behavior when an application that has not called this function is started from the HOME Menu. 82 </dd> 83 <dt>2011/02/03</dt> 84<dd>Added that execution may stop when the POWER Button is pressed immediately after startup.<BR> 85 </dd> 86 <dt>2011/01/24</dt> 87<dd>Added description of the order of calling this function versus the initialization functions of other libraries.<br /> 88 </dd> 89 <dt>2010/12/14</dt> 90<dd>Added information related to determining whether to close the application. Added information on the <CODE>EnableSleep</CODE> function. 91 </dd> 92 <dt>2010/11/30</dt> 93<dd>Added example.<br /> 94 </dd> 95 <dt>2010/11/15</dt> 96<dd>Initial version.<br /> 97 </dd> 98 </dl> 99 </div> 100 <hr><p>CONFIDENTIAL</p></body> 101</html> 102