Added hidden options to be able to define your own device delay before loading ART...
[open-ps2-loader.git] / include / hddsupport.h
blob730569a2ccb73e7ea654b3210863f6c119aa7b46
1 #ifndef __HDD_SUPPORT_H
2 #define __HDD_SUPPORT_H
4 #include "include/iosupport.h"
6 #define PS2PART_IDMAX 32
7 #define HDL_GAME_NAME_MAX 64
9 // APA Partition
10 #define APA_MAGIC 0x00415041 // 'APA\0'
11 #define APA_IDMAX PS2PART_IDMAX
12 #define APA_MAXSUB 64 // Maximum # of sub-partitions
13 #define APA_PASSMAX 8
14 #define APA_FLAG_SUB 0x0001
15 #define APA_MBR_VERSION 2
16 #define APA_IOCTL2_GETHEADER 0x6836
17 #define PFS_IOCTL2_GET_INODE 0x7007
19 typedef struct
21 char partition_name[PS2PART_IDMAX + 1];
22 char name[HDL_GAME_NAME_MAX + 1];
23 char startup[8 + 1 + 3 + 1];
24 u8 hdl_compat_flags;
25 u8 ops2l_compat_flags;
26 u8 dma_type;
27 u8 dma_mode;
28 u32 layer_break;
29 int disctype;
30 u32 start_sector;
31 u32 total_size_in_kb;
32 } hdl_game_info_t;
34 typedef struct
36 u32 count;
37 hdl_game_info_t *games;
38 u32 total_chunks;
39 u32 free_chunks;
40 } hdl_games_list_t;
42 typedef struct {
43 u8 unused;
44 u8 sec;
45 u8 min;
46 u8 hour;
47 u8 day;
48 u8 month;
49 u16 year;
50 } ps2time_t;
52 typedef struct
54 u32 checksum;
55 u32 magic; // APA_MAGIC
56 u32 next;
57 u32 prev;
58 char id[APA_IDMAX]; // 16
59 char rpwd[APA_PASSMAX]; // 48
60 char fpwd[APA_PASSMAX]; // 56
61 u32 start; // 64
62 u32 length; // 68
63 u16 type; // 72
64 u16 flags; // 74
65 u32 nsub; // 76
66 ps2time_t created; // 80
67 u32 main; // 88
68 u32 number; // 92
69 u32 modver; // 96
70 u32 pading1[7]; // 100
71 char pading2[128]; // 128
72 struct { // 256
73 char magic[32];
74 u32 version;
75 u32 nsector;
76 ps2time_t created;
77 u32 osdStart;
78 u32 osdSize;
79 char pading3[200];
80 } mbr;
81 struct {
82 u32 start;
83 u32 length;
84 } subs[APA_MAXSUB];
85 } apa_header;
87 typedef struct
89 int existing;
90 int modified;
91 int linked;
92 apa_header header;
93 } apa_partition_t;
95 typedef struct
97 u32 device_size_in_mb;
98 u32 total_chunks;
99 u32 allocated_chunks;
100 u32 free_chunks;
102 u8 *chunks_map;
104 // existing partitions
105 u32 part_alloc_;
106 u32 part_count;
107 apa_partition_t *parts;
108 } apa_partition_table_t;
110 typedef struct {
111 u32 number;
112 u16 subpart;
113 u16 count;
114 } pfs_blockinfo_t;
116 typedef struct {
117 u32 checksum;
118 u32 magic;
119 pfs_blockinfo_t inode_block;
120 pfs_blockinfo_t next_segment;
121 pfs_blockinfo_t last_segment;
122 pfs_blockinfo_t unused;
123 pfs_blockinfo_t data[114];
124 u16 mode;
125 u16 attr;
126 u16 uid;
127 u16 gid;
128 ps2time_t atime;
129 ps2time_t ctime;
130 ps2time_t mtime;
131 u64 size;
132 u32 number_blocks;
133 u32 number_data;
134 u32 number_segdesg;
135 u32 subpart;
136 u32 reserved[4];
137 } pfs_inode_t;
139 typedef struct {
140 u32 start;
141 u32 length;
142 } apa_subs;
144 #ifdef VMC
145 #include "include/mcemu.h"
146 typedef struct {
147 int active; /* Activation flag */
148 apa_subs parts[5]; /* Vmc file Apa partitions */
149 pfs_blockinfo_t blocks[10]; /* Vmc file Pfs inode */
150 int flags; /* Card flag */
151 vmc_spec_t specs; /* Card specifications */
152 } hdd_vmc_infos_t;
153 #endif
155 int hddCheck(void);
156 u32 hddGetTotalSectors(void);
157 int hddIs48bit(void);
158 int hddSetTransferMode(int type, int mode);
159 int hddSetIdleTimeout(int timeout);
160 int hddGetHDLGamelist(hdl_games_list_t **game_list);
161 int hddFreeHDLGamelist(hdl_games_list_t *game_list);
162 int hddSetHDLGameInfo(hdl_game_info_t *ginfo);
163 int hddDeleteHDLGame(hdl_game_info_t *ginfo);
165 void hddInit();
166 item_list_t* hddGetObject(int initOnly);
167 void hddLoadModules(void);
169 #endif