ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
libmc-common.h
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
16 #ifndef __LIBMC_COMMON_H__
17 #define __LIBMC_COMMON_H__
18 
19 #include <tamtypes.h>
20 
21 typedef struct _sceMcStDateTime {
30 
31 /* MCMAN public structures */
32 typedef struct { // size = 128
33  int mode; // 0
34  int length; // 4
36  char name[20]; // 10
37  u8 field_1e; // 30
38  u8 field_1f; // 31
40  int field_28; // 40
41  u16 field_2c; // 44
42  u16 field_2e; // 46
44  int field_38; // 56
45  u8 unused2[65]; // 60
46  u8 field_7d; // 125
47  u8 field_7e; // 126
48  u8 edc; // 127
49 } McFsEntryPS1;
50 
51 typedef struct { // size = 512
52  u16 mode; // 0
53  u16 unused; // 2
54  u32 length; // 4
56  u32 cluster; // 16
57  u32 dir_entry; // 20
59  u32 attr; // 32
60  u32 unused2[7]; // 36
61  char name[32]; // 64
62  u8 unused3[416]; // 96
63 } McFsEntry;
64 
65 typedef struct _MCCacheEntry {
66  int cluster; // 0
67  u8 *cl_data; // 4
68  u16 mc_slot; // 8
69  u8 wr_flag; // 10
70  u8 mc_port; // 11
71  u8 rd_flag; // 12
72  u8 unused[3]; // 13
73 } McCacheEntry;
74 
78 typedef struct { // size = 48
79  int fd; // 0
80  int port; // 4
81  int slot; // 8
82  int size; // 12
83  int offset; // 16
84  int origin; // 20
85  void *buffer; // 24
86  void *param; // 28
87  u8 data[16]; // 32
89 
93 typedef struct { // size = 64
94  union {
95  s32 size1; // 0
97  };
98  union {
99  s32 size2; // 4
101  };
102  void *dest1; // 8
103  void *dest2; // 12
104  u8 src1[16]; // 16
105  u8 src2[16]; // 32
106  u8 unused[16]; // 48
107 } mcEndParam_t;
108 
112 typedef struct { // size = 192
113  union {
114  s32 size1; // 0
116  };
117  union {
118  s32 size2; // 4
120  };
121  void *dest1; // 8
122  void *dest2; // 12
123  u8 src1[64]; // 16
124  u8 src2[64]; // 80
125  union {
126  s32 formatted; // 144
127  u8 unused[48];
128  };
129 } mcEndParam2_t;
130 
131 typedef struct {
135 } mcRpcStat_t;
136 
137 // in addition to errno
138 #define EFORMAT 140
139 
140 // MCMAN basic error codes
141 #define sceMcResSucceed 0
142 #define sceMcResChangedCard -1
143 #define sceMcResNoFormat -2
144 #define sceMcResFullDevice -3
145 #define sceMcResNoEntry -4
146 #define sceMcResDeniedPermit -5
147 #define sceMcResNotEmpty -6
148 #define sceMcResUpLimitHandle -7
149 #define sceMcResFailReplace -8
150 #define sceMcResFailResetAuth -11
151 #define sceMcResFailDetect -12
152 #define sceMcResFailDetect2 -13
153 #define sceMcResDeniedPS1Permit -51
154 #define sceMcResFailAuth -90
155 
156 // Memory Card device types
157 #define sceMcTypeNoCard 0
158 #define sceMcTypePS1 1
159 #define sceMcTypePS2 2
160 #define sceMcTypePDA 3
161 
162 /* High-Level File I/O */
163 // Used with the statmask field of chstat() to indicate which field(s) to change.
164 #define SCE_CST_MODE 0x01
165 #define SCE_CST_ATTR 0x02
166 #define SCE_CST_SIZE 0x04
167 #define SCE_CST_CT 0x08
168 #define SCE_CST_AT 0x10
169 #define SCE_CST_MT 0x20
170 #define SCE_CST_PRVT 0x40
171 
172 // Used with the mode field of chstat() to indicate what to change.
173 #define SCE_STM_R 0x01
174 #define SCE_STM_W 0x02
175 #define SCE_STM_X 0x04
176 #define SCE_STM_C 0x08
177 #define SCE_STM_F 0x10
178 #define SCE_STM_D 0x20
179 
180 /* file attributes */
181 #define sceMcFileAttrReadable SCE_STM_R //Readable
182 #define sceMcFileAttrWriteable SCE_STM_W //Writable
183 #define sceMcFileAttrExecutable SCE_STM_X //Executable
184 #define sceMcFileAttrDupProhibit SCE_STM_C //Copy Protected
185 #define sceMcFileAttrFile SCE_STM_F //Is a file.
186 #define sceMcFileAttrSubdir SCE_STM_D //Is a sub-directory
187 #define sceMcFileCreateDir 0x0040 //Used internally to create directories.
188 #define sceMcFileAttrClosed 0x0080 //Indicates whether a file _may_ not have been written properly. Earlier browsers do not copy this flag.
189 #define sceMcFileCreateFile 0x0200 //Equivalent in value and functionality to O_CREAT.
190 #define sceMcFile0400 0x0400 //Set during creation.
191 #define sceMcFileAttrPDAExec 0x0800 //PDA Application (1st Generation PDA Download)
192 #define sceMcFileAttrPS1 0x1000 //PlayStation-format data
193 #define sceMcFileAttrHidden 0x2000 //Indicates whether the file is a hidden file (but not to the browser).
194 #define sceMcFileAttrExists 0x8000 //Indicates whether the file exists.
195 
196 /* Valid information bit fields for sceMcSetFileInfo */
197 #define sceMcFileInfoCreate 0x01 //Creation Date/Time
198 #define sceMcFileInfoModify 0x02 //Modification Date/Time
199 #define sceMcFileInfoAttr 0x04 //File Attributes
200 
201 #endif /* __LIBMC_COMMON_H__ */
u32 data
Definition: libmouse.c:36
sceMcStDateTime created
Definition: libmc-common.h:39
sceMcStDateTime modified
Definition: libmc-common.h:43
sceMcStDateTime modified
Definition: libmc-common.h:58
sceMcStDateTime created
Definition: libmc-common.h:55
u32 dir_entry
Definition: libmc-common.h:57
u32 mcserv_version
Definition: libmc-common.h:133
signed int s32
Definition: tamtypes.h:58
unsigned int u32
Definition: tamtypes.h:30
signed short s16
Definition: tamtypes.h:52
unsigned short u16
Definition: tamtypes.h:24
unsigned char u8
Definition: tamtypes.h:23