1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     pl_SharedFont.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: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_PL_CTR_PL_SHAREDFONT_H_
17 #define NN_PL_CTR_PL_SHAREDFONT_H_
18 
19 #include <nn/Handle.h>
20 #include <nn/Result.h>
21 #include <nn/types.h>
22 #include <nn/fnd.h>
23 
24 namespace nn {
25 namespace pl {
26 namespace CTR {
27 
28 /* Please see man pages for details
29 
30 
31  */
32 /* Please see man pages for details
33 
34  */
35 enum SharedFontType
36 {
37     SHARED_FONT_TYPE_NULL,
38     SHARED_FONT_TYPE_STD,     //
39     SHARED_FONT_TYPE_CN,      //
40     SHARED_FONT_TYPE_KR,      //
41     SHARED_FONT_TYPE_TW       //
42 };
43 
44 /* Please see man pages for details
45 
46  */
47 enum SharedFontLoadState
48 {
49     SHARED_FONT_LOAD_STATE_NULL,
50     SHARED_FONT_LOAD_STATE_LOADING,     //
51     SHARED_FONT_LOAD_STATE_LOADED,      //
52     SHARED_FONT_LOAD_STATE_FAILED,      //
53 
54     SHARED_FONT_LOAD_STATE_MAX_BIT = (1u << 31)
55 };
56 
57 namespace detail
58 {
59     // Shared memory size for shared fonts: 3,272 KB
60     const size_t  SHAREDFONT_MEMORY_SIZE = 1024 * 4 * 818;
61 
62     struct SharedFontBufferHeader
63     {
64         util::SizedEnum4<SharedFontLoadState>   state;
65         util::SizedEnum4<SharedFontType>        type;
66         size_t                                  size;
67         bit8                                    padding[116];
68     };
69 
70     struct SharedFontBuffer
71     {
72         SharedFontBufferHeader  header;
73         // 128-byte alignment necessary
74         bit8    font[SHAREDFONT_MEMORY_SIZE - sizeof(SharedFontBufferHeader)];
75     };
76 }
77 
78 /* Please see man pages for details
79 
80 
81  */
82 nn::Result          InitializeSharedFont();
83 
84 /* Please see man pages for details
85 
86 
87  */
88 void*               GetSharedFontAddress();
89 
90 /* Please see man pages for details
91 
92 
93  */
94 size_t              GetSharedFontSize();
95 
96 /* Please see man pages for details
97 
98 
99  */
100 SharedFontType      GetSharedFontType();
101 
102 /* Please see man pages for details
103 
104 
105  */
106 SharedFontLoadState GetSharedFontLoadState();
107 
108 /* Please see man pages for details
109 
110 
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 */
121 nn::Result MountSharedFont(const char* archiveName, SharedFontType sharedFontType, size_t maxFile, size_t maxDirectory, void* workingMemory, size_t workingMemorySize);
122 
123 /* Please see man pages for details
124 
125 
126 
127 
128 
129 */
130 nn::Result UnmountSharedFont(const char* archiveName);
131 
132 /* Please see man pages for details
133 
134 
135 
136 */
137 inline void Initialize();
138 
Initialize()139 inline void Initialize() {}
140 
141 /* Please see man pages for details
142 
143 
144 
145 */
146 inline void Finalize();
147 
Finalize()148 inline void Finalize() {}
149 
150 /*
151 
152 */
153 
154 } // end of namespace CTR
155 } // end of namespace pl
156 } // end of namespace nn
157 
158 
159 #endif  // ifndef NN_PL_CTR_PL_SHAREDFONT_H_
160