forked from lukaszdk/ps2doom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhdd.h
128 lines (113 loc) · 2.08 KB
/
hdd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef __HDD_H
#define __HDD_H
//taken from open ps2 loader but adopted for ps2doom
#include <libhdd.h>
#include <tamtypes.h>
#include "d_main.h"
//pfs whole structure
#define PFS_INODE_MAX_BLOCKS 114
#define HDD_MODE_UPDATE_DELAY
// APA Partition
#define APA_IOCTL2_GETHEADER 0x6836
typedef struct
{
u32 start; // Sector address
u32 length; // Sector count
} apa_sub_t;
typedef struct
{
u8 unused;
u8 sec;
u8 min;
u8 hour;
u8 day;
u8 month;
u16 year;
} ps2time_t;
typedef struct
{
u32 checksum;
u32 magic; // APA_MAGIC
u32 next;
u32 prev;
char id[APA_IDMAX];
char rpwd[APA_PASSMAX];
char fpwd[APA_PASSMAX];
u32 start;
u32 length;
u16 type;
u16 flags;
u32 nsub;
ps2time_t created;
u32 main;
u32 number;
u32 modver;
u32 pading1[7];
char pading2[128];
struct
{
char magic[32];
u32 version;
u32 nsector;
ps2time_t created;
u32 osdStart;
u32 osdSize;
char pading3[200];
} mbr;
apa_sub_t subs[APA_MAXSUB];
} apa_header_t;
typedef struct
{
u32 number;
u16 subpart;
u16 count;
} pfs_blockinfo_t;
typedef struct
{
u32 checksum;
u32 magic;
pfs_blockinfo_t inode_block;
pfs_blockinfo_t next_segment;
pfs_blockinfo_t last_segment;
pfs_blockinfo_t unused;
pfs_blockinfo_t data[PFS_INODE_MAX_BLOCKS];
u16 mode;
u16 attr;
u16 uid;
u16 gid;
ps2time_t atime;
ps2time_t ctime;
ps2time_t mtime;
u64 size;
u32 number_blocks;
u32 number_data;
u32 number_segdesg;
u32 subpart;
u32 reserved[4];
} pfs_inode_t;
//end
typedef struct
{
char partition_name[APA_IDMAX + 1];
char name[MAXWADFILES];
char startup[8 + 1 + 3 + 1];
u8 hdl_compat_flags;
u8 ops2l_compat_flags;
u8 dma_type;
u8 dma_mode;
u8 disctype;
u32 layer_break;
u32 start_sector;
u32 total_size_in_kb;
} hdl_wad_info_t;
typedef struct
{
u32 count;
hdl_wad_info_t *wads;
} hdl_wad_list_t;
typedef struct
{
u32 start;
u32 length;
} apa_subs;
#endif