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>ProcessHomeButtonAndWait</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>::ProcessHomeButtonAndWait</CODE> Function</h1>
11<h2>Syntax</h2>
12    <div class="section">
13      <pre class="definition">
14void ProcessHomeButtonAndWait();
15</pre>
16    </div>
17<h2>Parameters</h2>
18    <div class="section">
19<p>None.</p>
20    </div>
21<h2>Return Values</h2>
22    <div class="section">
23None.
24               </div>
25<h2>Description</h2>
26    <div class="section">
27<p>Processes HOME Menu transition and goes into standby until activated.</p><p>
28This function was designed to be used as follows. Only call this function if the <CODE><a href="../../../nn/applet/CTR/IsExpectedToProcessHomeButton.html">nn::applet::CTR::IsExpectedToProcessHomeButton</a></CODE> function returns <CODE>true</CODE>. After this function returns, make sure to check whether to exit the application using the <CODE><a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html">nn::applet::CTR::IsExpectedToCloseApplication</a></CODE> function.
29      </p><pre>
30    if ( nn::applet::CTR::IsExpectedToProcessHomeButton() )
31    {
32        // Perform processing as needed here before transitioning to the HOME Menu.
33
34        nn::applet::CTR::ProcessHomeButtonAndWait();
35        if ( nn::applet::CTR::IsExpectedToCloseApplication )
36        {
37            // Leave the main loop, and perform termination processing
38        }
39
40        // Perform processing as needed here after returning from the HOME Menu.
41    }
42</pre><p>
43This function performs the following processing internally.
44<pre>
45    // Disable sleep
46    bool e = IS_SLEEP_ENABLED();  // pseudocode: Check if sleep is enabled.
47    if ( e )
48    {
49        nn::applet::CTR::DisableSleep();
50    }
51    // Process HOME button
52    nn::applet::CTR::ProcessHomeButton();
53    nn::applet::CTR::WaitForStarting();
54    // Enable sleep if necessary
55    if ( e )
56    {
57        nn::applet::CTR::EnableSleep();
58    }
59</pre></p><p>There is no need to take the sleep-enabled status into account when calling this function. This is because although it will return to Sleep Mode regardless of the return value of the <CODE><a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html">nn::applet::CTR::IsExpectedToCloseApplication</a></CODE> function, the sleep-related callback will not be called if the application termination flag is <CODE>true</CODE>.
60      </p><p>
61In addition, you must initialize the graphics library using the <CODE>nngxInitialize</CODE> function before calling this function. Then, after the display buffer has been set and buffers have been swapped once, you must turn on the LCD screens.
62      </p><p>
63If 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.
64      </p><p>
65Before 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 />In addition, after returning from an applet such as the HOME Menu, be sure to reset all necessary registers because GPU register values will have been updated if the return value of <a href="../../../nn/applet/CTR/IsExpectedToCloseApplication.html"><CODE>nn::applet::CTR::IsExpectedToCloseApplication</CODE></a> is <CODE>false</CODE>.
66      </p><pre>
67   /* When using the GL library */
68   nngxUpdateState(NN_GX_STATE_ALL);
69
70   /* When using the GD library */
71   nn::gd::System::ForceDirty(nn::gd::MODULE_ALL);
72
73   /* When using the GR library */
74   // There is no API for returning settings because internal settings are not maintained.
75   // Create all necessary commands for the next rendering pass.
76
77   /* Others */
78   // Reset all necessary registers for the next rendering pass.
79</pre></div>
80<h2>Revision History</h2>
81    <div class="section">
82      <dl class="history">
83        <dt>2012/02/07</dt>
84<dd>Noted that execution halts on an assertion if rendering has not yet completed at the time this function is called. <br />
85        </dd>
86        <dt>2012/01/16</dt>
87<dd>Added a specific example about limitations when calling this function (the need to wait for rendering to complete).<BR>
88        </dd>
89        <dt>2011/09/08</dt>
90<dd>Added information about rendering before and after calling this function.<BR>
91        </dd>
92        <dt>2011/08/01</dt>
93<dd>Added information about limitations related to display buffer swapping and the LCD screens when calling this function.<BR>
94        </dd>
95        <dt>2011/03/30</dt>
96<dd>Added note about the need for the <CODE>nngxInitialize</CODE> function.
97        </dd>
98        <dt>2011/03/07</dt>
99<dd>Initial version.<br />
100        </dd>
101      </dl>
102    </div>
103  <hr><p>CONFIDENTIAL</p></body>
104</html>
105