aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/ps2/iop/CoDyVDfs/iop/codyvdfs.h
blob: d50e89e4f34c4f62077c4c260316d05d4d100100 (plain)
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
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 */

#ifndef __CoDyVDfs_H__
#define __CoDyVDfs_H__

#include <cdvdman.h>
#include "cdtypes.h"

typedef cd_read_mode_t CdRMode;

// for reading misaligned ints
#define READ_ARRAY32(a) \
	(a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24))

#define SECTOR_SIZE 0x800
#define SECTOR_MASK 0x7FF
#define NUM_SECTORS(a) ((a + 2047) >> 11)

#define IS_DIR(a)  ((a)->flags & 2)

#define DISC_UNKNOWN 0xFE
#define DISC_NONE  0xFF
#define DISC_DVD   0
#define DISC_MODE1 1
#define DISC_MODE2 2

enum ReadModes {
	CdSect2048 = 0,
	CdSect2328, // 1
	CdSect2340  // 2
};

enum {
    CdDiskNone = 0x00,
    CdDiskDetect, // 0x01
    CdDiskDetectCD, // 0x02
    CdDiskDetectDVD, // 0x03
    CdDiskDetectUnk = 0x05,
    CdDiskCDPS1 = 0x10,
    CdDiskCDDAPS1 = 0x11,
    CdDiskCDPS2 = 0x12,
    CdDiskCDDAPS2 = 0x13,
    CdDiskDVDPS2 = 0x14,
    CdDiskDVDV2 = 0xFC,
    CdDiskCDDA = 0xFD,
    CdDiskDVDV = 0xFE,
    CdDiskIllegal = 0xFF
};

#define DISC_NOT_READY(type) ((type > CdDiskNone) && (type < CdDiskCDPS1) && (type != CdDiskDetectUnk))

int initRpc(void);

int verifyDriveReady(void);
int cdReadSectors(int lba, int num, void *dest, CdRMode *rmode);
int initRootCache(void);
ISODirectoryRecord *findPath(const char *path);
int cacheEnterDir(ISODirectoryRecord *dir);
int initDisc(void);
int checkDiscReady(int retries);
int strnicmp(const char *s1, const char *s2, int n);

#endif // __MYCDVDFS_H__