1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gx_ScreenCapture.cpp
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 46365 $
14  *---------------------------------------------------------------------------*/
15 
16 #include <nn.h>
17 #include <nn/os.h>
18 #include <nn/fnd.h>
19 #include <nn/gx.h>
20 #include <nn/math.h>
21 #include <nn/fs.h>
22 #include <nn/init.h>
23 #include <nn/applet.h>
24 
25 extern void Initialize(void);
26 extern void Finalize(void);
27 extern bool DrawFrame(bool isCapture);
28 
PadReadAndEvent(nn::hid::PadReader & padReader)29 bool PadReadAndEvent(nn::hid::PadReader& padReader)
30 {
31     nn::hid::PadStatus pad;
32     padReader.ReadLatest(&pad);
33 
34     if (pad.trigger & nn::hid::BUTTON_A)
35     {
36         return true;
37     }
38 
39     return false;
40 }
41 
nnMain(void)42 void nnMain(void)
43 {
44     // Call only nn::applet::Enable to also allow execution from the HOME Menu
45     // HOME Menu transitions, POWER Button presses, and sleep are all unsupported
46     nn::applet::Enable();
47 
48     Initialize();
49 
50     nn::hid::PadReader padReader;
51     bool flag = true;
52     while ( flag )
53     {
54         flag = DrawFrame(PadReadAndEvent(padReader));
55     }
56 
57     Finalize();
58 }
59