Sony PlayStation2 Study
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

201 lines
5.1 KiB

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