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