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.
10 # $Id: hdd.h 1421 2007-07-07 01:56:53Z radad $
11 # Main APA Header file
28 #include <sys/fcntl.h>
36 #include "helper.h"// for old atad, dev9 names need..
39 //#define DEBUG_LEVEL2
42 #define dprintf1 printf
44 #define dprintf1 printf(format, args...)
48 #define dprintf2 printf
50 #define dprintf2(format, args...)
61 // modes for cacheGetHeader
62 #define THEADER_MODE_READ 0x00
63 #define THEADER_MODE_WRITE 0x01
77 // MAIN APA defines/struct
79 typedef struct { // for a hack :P
80 u32 start
; // Sector address
81 u32 length
; // Sector count
84 // Sectors for this and that ;)
85 #define APA_SECTOR_MBR 0
86 #define APA_SECTOR_SECTOR_ERROR 6// use for last sector that had a error...
87 #define APA_SECTOR_PART_ERROR 7// use for last partition that had a error...
88 #define APA_SECTOR_APAL 8
89 #define APA_SECTOR_APAL_HEADERS 10 // 10-262
92 #define APA_MAGIC 0x00415041 // 'APA\0'
94 #define APA_MAXSUB 64 // Maximum # of sub-partitions
96 #define APA_FLAG_SUB 0x0001
97 #define APA_MBR_VERSION 2
99 #define APA_TYPE_FREE 0x0000
100 #define APA_TYPE_MBR 0x0001 // Master Boot Record
101 #define APA_TYPE_EXT2SWAP 0x0082
102 #define APA_TYPE_EXT2 0x0083
103 #define APA_TYPE_PFS 0x0100
104 #define APA_TYPE_CFS 0x0101
106 #define APA_MODVER 0x0201
111 u32 magic
; // APA_MAGIC
114 char id
[APA_IDMAX
]; // 16
115 char rpwd
[APA_PASSMAX
]; // 48
116 char fpwd
[APA_PASSMAX
]; // 56
122 ps2time created
; // 80
126 u32 pading1
[7]; // 100
127 char pading2
[128]; // 128
156 iop_file_t
*f
; // used to see if open...
157 u32 post
; // offset/post....
161 u32 start
; // <--- TODO move to subs ..., has not been moved to risk e of fucking it up ;)
163 struct { // Sub-partition data
164 u32 start
; // Sector address
165 u32 length
; // Sector count
170 ///////////////////////////////////////////////////////////////////////////////
172 extern hdd_device_t hddDeviceBuf
[2];
174 extern hdd_file_slot_t
*fileSlots
;
175 extern char mbrMagic
[0x20];
176 extern char myPassHash
[APA_PASSMAX
];
177 ///////////////////////////////////////////////////////////////////////////////
178 // Function declerations
179 int inputError(char *input
);
180 int unlockDrive(u32 device
);