1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     savedata.h
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 #ifndef NN_SAMPLE_DEMOS_DEMO1_SAVEDATA_H_
17 #define NN_SAMPLE_DEMOS_DEMO1_SAVEDATA_H_
18 
19 #include "device.h"
20 #include <nn/os.h>
21 
22 class SaveDataDemo : public Device
23 {
24 public:
Initialize(demo::RenderSystemDrawing * p_RenderSystem)25     virtual void Initialize(demo::RenderSystemDrawing* p_RenderSystem) { Device::Initialize(p_RenderSystem); }
26     void Initialize(demo::RenderSystemDrawing* p_RenderSystem, nn::fnd::ExpHeap* p_AppHeap);
27     virtual void Finalize(void);
28 
29     virtual void Start(void);
30     virtual void End(void);
31 
32 private:
33     virtual void DrawFrame(void);
34 
35     void ThreadFuncImpl();
36     static void ThreadFunc(SaveDataDemo* saveDataDemo);
37 
38     static const size_t SAVEDATA_SIZE = 128;
39     static const char*  SAVEDATA_FILENAME;
40     static const char*  SAVEDATA_ARCHIVE;
41     char m_WriteFileBuffer[SAVEDATA_SIZE];
42     char m_ReadFileBuffer[SAVEDATA_SIZE];
43     char m_SaveDataBuffer[SAVEDATA_SIZE];
44 
45     NN_PADDING4;
46 
47     nn::fs::FileStream m_SaveDataFile;
48 
49     bool m_IsAvailable;
50     bool m_IsFormatted;
51     bool m_IsMounted;
52     NN_PADDING1;
53 
54     nn::os::Thread m_Thread;
55     nn::os::StackBuffer<1024>   m_Stack;
56 
57     nn::os::LightEvent m_ExitEvent;
58 };
59 
60 /* NN_SAMPLE_DEMOS_DEMO1_SAVEDATA_H_ */
61 #endif
62 
63 /*---------------------------------------------------------------------------*
64   End of file
65  *---------------------------------------------------------------------------*/
66