1 /*---------------------------------------------------------------------------*
2 Project: Horizon
3 File: pl_SharedFont.h
4 Copyright (C)2010 Nintendo Co., Ltd. All rights reserved.
5 These coded instructions, statements, and computer programs contain
6 proprietary information of Nintendo of America Inc. and/or Nintendo
7 Company Ltd., and are protected by Federal copyright law. They may
8 not be disclosed to third parties or copied or duplicated in any form,
9 in whole or in part, without the prior written consent of Nintendo.
10 $Rev: 31762 $
11 *---------------------------------------------------------------------------
12
13
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
122
123
124
125
126
127
128
129
130
131
132
133 */
134 nn::Result MountSharedFont(const char* archiveName, SharedFontType sharedFontType, size_t maxFile, size_t maxDirectory, void* workingMemory, size_t workingMemorySize);
135
136 /* Please see man pages for details
137
138
139
140
141
142 */
143 nn::Result UnmountSharedFont(const char* archiveName);
144
145 /* Please see man pages for details
146
147
148
149 */
150 inline void Initialize();
151
Initialize()152 inline void Initialize() {}
153
154 /* Please see man pages for details
155
156
157
158 */
159 inline void Finalize();
160
Finalize()161 inline void Finalize() {}
162
163 /*
164
165 */
166
167 } // end of namespace CTR
168 } // end of namespace pl
169 } // end of namespace nn
170
171
172 #endif // ifndef NN_PL_CTR_PL_SHAREDFONT_H_
173