1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     fs_Parameters.h
4 
5   Copyright (C)2009 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: 30789 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_FS_FS_PARAMETERS_H_
17 #define NN_FS_FS_PARAMETERS_H_
18 
19 #include <nn/types.h>
20 #include <nn/config.h>
21 #include <nn/dbg/dbg_Logger.h>
22 #include <nn/assert.h>
23 #include <nn/util.h>
24 #include <nn/util/util_Int64.h>
25 
26 namespace nn {
27 namespace fs {
28 
29 static const size_t MAX_ARCHIVE_NAME_LENGTH = 7;
30 static const size_t MAX_FILE_PATH_LENGTH = MAX_ARCHIVE_NAME_LENGTH + 1 + 253;
31 
32 /*!
33     @brief ファイルのオープンモードを示す列挙定数です。
34 
35     ファイルのオープンモードをこれらの論理和で指定します。
36 */
37 enum OpenMode
38 {
39     OPEN_MODE_READ    = (1u << 0),  //!< 読み込みモードで開きます。
40     OPEN_MODE_WRITE   = (1u << 1),  //!< 書き込みモードで開きます。
41     OPEN_MODE_CREATE  = (1u << 2)   //!< ファイルが無ければファイルを作成します。OPEN_MODE_WRITE を同時に指定する必要があります。
42 };
43 
44 /*!
45     @brief ファイルの読み書きの位置を指定することを示す定数群です。
46 */
47 enum PositionBase
48 {
49     /*!
50         @brief ファイルの先頭を基準としてファイルのカレント位置を設定することを示す定数です。
51     */
52     POSITION_BASE_BEGIN,
53 
54     /*!
55         @brief ファイルのカレント位置を基準としてファイルのカレント位置を設定することを示す定数です。
56     */
57     POSITION_BASE_CURRENT,
58 
59     /*!
60         @brief ファイルの末尾を基準としてファイルのカレント位置を設定することを示す定数です。
61     */
62     POSITION_BASE_END
63 };
64 
65 struct Transaction
66 {
67     bit32   dummy;
68 };
69 
70 struct Attributes
71 {
72     bool isDirectory;
73     bool isHidden;
74     bool isArchive;
75     bool isReadOnly;
76 };
77 
78 struct ShortName
79 {
80     char body[10];
81     char ext[4];
82     bool valid;
83     bit8 pad;
84 };
85 
86 struct DirectoryEntry
87 {
88     wchar_t            entryName[MAX_FILE_PATH_LENGTH + 1];
89     ShortName          shortName;
90     nn::fs::Attributes attributes;
91     s64                entrySize;
92 };
93 
94 struct PathMark
95 {
96     bit32 rawPathMark;
97 };
98 
99 enum MediaType
100 {
101     MEDIA_TYPE_NAND     = 0,
102     MEDIA_TYPE_SDMC     = 1,
103     MEDIA_TYPE_CTRCARD  = 2
104 };
105 
106 namespace detail { struct ArchiveHandleTag {}; }
107 typedef nn::util::Int64<bit64, detail::ArchiveHandleTag> ArchiveHandle;
108 
109 typedef bit64 ExtSaveDataId;
110 typedef bit64 TitleId;
111 
112 } // end of namespace tcb
113 } // end of namespace nn
114 
115 namespace nn { namespace CTR {
116 
117 typedef struct DUMMY1
118 {
119     bit8 data[948];
120 } Dummy1;
121 
122 typedef struct DUMMY2
123 {
124     bit8 data[9152];
125 } Dummy2;
126 
127 }}
128 
129 #endif  // ifndef NN_FS_FS_ENUMS_H_
130