sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
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
17#ifndef __LIBMC_COMMON_H__
18#define __LIBMC_COMMON_H__
19
20#include <tamtypes.h>
21#include <errno.h>
22
23typedef struct _sceMcStDateTime
24{
25 u8 Resv2;
26 u8 Sec;
27 u8 Min;
28 u8 Hour;
29 u8 Day;
30 u8 Month;
31 u16 Year;
32} sceMcStDateTime;
33
34/* MCMAN public structures */
35typedef struct
36{ // size = 128
37 int mode; // 0
38 int length; // 4
39 s16 linked_block; // 8
40 char name[20]; // 10
41 u8 field_1e; // 30
42 u8 field_1f; // 31
43 sceMcStDateTime created; // 32
44 int field_28; // 40
45 u16 field_2c; // 44
46 u16 field_2e; // 46
47 sceMcStDateTime modified; // 48
48 int field_38; // 56
49 u8 unused2[65]; // 60
50 u8 field_7d; // 125
51 u8 field_7e; // 126
52 u8 edc; // 127
54
55typedef struct
56{ // size = 512
57 u16 mode; // 0
58 u16 unused; // 2
59 u32 length; // 4
60 sceMcStDateTime created; // 8
61 u32 cluster; // 16
62 u32 dir_entry; // 20
63 sceMcStDateTime modified; // 24
64 u32 attr; // 32
65 u32 unused2[7]; // 36
66 char name[32]; // 64
67 u8 unused3[416]; // 96
68} McFsEntry;
69
70typedef struct _MCCacheEntry
71{
72 int cluster; // 0
73 u8 *cl_data; // 4
74 u16 mc_slot; // 8
75 u8 wr_flag; // 10
76 u8 mc_port; // 11
77 u8 rd_flag; // 12
78 u8 unused[3]; // 13
79} McCacheEntry;
80
84typedef struct
85{ // size = 48
86 int fd; // 0
87 int port; // 4
88 int slot; // 8
89 int size; // 12
90 int offset; // 16
91 int origin; // 20
92 void *buffer; // 24
93 void *param; // 28
94 u8 data[16]; // 32
96
100typedef struct
101{ // size = 64
102 union
103 {
104 s32 size1; // 0
105 s32 type;
106 };
107 union
108 {
109 s32 size2; // 4
110 s32 free;
111 };
112 void *dest1; // 8
113 void *dest2; // 12
114 u8 src1[16]; // 16
115 u8 src2[16]; // 32
116 u8 unused[16]; // 48
118
122typedef struct
123{ // size = 192
124 union
125 {
126 s32 size1; // 0
127 s32 type;
128 };
129 union
130 {
131 s32 size2; // 4
132 s32 free;
133 };
134 void *dest1; // 8
135 void *dest2; // 12
136 u8 src1[64]; // 16
137 u8 src2[64]; // 80
138 union
139 {
140 s32 formatted; // 144
141 u8 unused[48];
142 };
144
145typedef struct
146{
147 s32 result;
148 u32 mcserv_version;
149 u32 mcman_version;
151
152// in addition to errno
153#ifndef EFORMAT
154#define EFORMAT 47
155#endif
156
157// MCMAN basic error codes
158#define sceMcResSucceed 0
159#define sceMcResChangedCard -1
160#define sceMcResNoFormat -2
161#define sceMcResFullDevice -3
162#define sceMcResNoEntry -4
163#define sceMcResDeniedPermit -5
164#define sceMcResNotEmpty -6
165#define sceMcResUpLimitHandle -7
166#define sceMcResFailReplace -8
167#define sceMcResFailResetAuth -11
168#define sceMcResFailDetect -12
169#define sceMcResFailDetect2 -13
170#define sceMcResDeniedPS1Permit -51
171#define sceMcResFailAuth -90
172
173// Memory Card device types
174#define sceMcTypeNoCard 0
175#define sceMcTypePS1 1
176#define sceMcTypePS2 2
177#define sceMcTypePDA 3
178
179/* High-Level File I/O */
180// Used with the statmask field of chstat() to indicate which field(s) to change.
181#define SCE_CST_MODE 0x01
182#define SCE_CST_ATTR 0x02
183#define SCE_CST_SIZE 0x04
184#define SCE_CST_CT 0x08
185#define SCE_CST_AT 0x10
186#define SCE_CST_MT 0x20
187#define SCE_CST_PRVT 0x40
188
189// Used with the mode field of chstat() to indicate what to change.
190#define SCE_STM_R 0x01
191#define SCE_STM_W 0x02
192#define SCE_STM_X 0x04
193#define SCE_STM_C 0x08
194#define SCE_STM_F 0x10
195#define SCE_STM_D 0x20
196
197/* file attributes */
198#define sceMcFileAttrReadable SCE_STM_R // Readable
199#define sceMcFileAttrWriteable SCE_STM_W // Writable
200#define sceMcFileAttrExecutable SCE_STM_X // Executable
201#define sceMcFileAttrDupProhibit SCE_STM_C // Copy Protected
202#define sceMcFileAttrFile SCE_STM_F // Is a file.
203#define sceMcFileAttrSubdir SCE_STM_D // Is a sub-directory
204#define sceMcFileCreateDir 0x0040 // Used internally to create directories.
205#define sceMcFileAttrClosed 0x0080 // Indicates whether a file _may_ not have been written properly. Earlier browsers do not copy this flag.
206#define sceMcFileCreateFile 0x0200 // Equivalent in value and functionality to O_CREAT.
207#define sceMcFile0400 0x0400 // Set during creation.
208#define sceMcFileAttrPDAExec 0x0800 // PDA Application (1st Generation PDA Download)
209#define sceMcFileAttrPS1 0x1000 // PlayStation-format data
210#define sceMcFileAttrHidden 0x2000 // Indicates whether the file is a hidden file (but not to the browser).
211#define sceMcFileAttrExists 0x8000 // Indicates whether the file exists.
212
213/* Valid information bit fields for sceMcSetFileInfo */
214#define sceMcFileInfoCreate 0x01 // Creation Date/Time
215#define sceMcFileInfoModify 0x02 // Modification Date/Time
216#define sceMcFileInfoAttr 0x04 // File Attributes
217
218#endif /* __LIBMC_COMMON_H__ */