diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-07-08 02:20:40 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-07-08 02:20:40 +0000 |
| commit | 2e61352b441ad25b01cf574269cda55d7944ac47 (patch) | |
| tree | 7cedfdd0b7d251cdac6b2be319b890fc6b41b196 /plugins | |
| parent | d90ff02b76e0703cde0e7a6e3d7799b832594b9b (diff) | |
| download | pcsxr-2e61352b441ad25b01cf574269cda55d7944ac47.tar.gz | |
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@54333 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/dfcdrom/cdr-freebsd.c | 36 | ||||
| -rw-r--r-- | plugins/dfcdrom/cdr-linux.c | 1 | ||||
| -rw-r--r-- | plugins/dfcdrom/cdr.h | 4 |
3 files changed, 38 insertions, 3 deletions
diff --git a/plugins/dfcdrom/cdr-freebsd.c b/plugins/dfcdrom/cdr-freebsd.c index e960592d..d97f76ff 100644 --- a/plugins/dfcdrom/cdr-freebsd.c +++ b/plugins/dfcdrom/cdr-freebsd.c @@ -26,10 +26,36 @@ char *LibName = N_("CD-ROM Drive Reader"); int OpenCdHandle(const char *dev) { - return -1; + int h, parameter, bsize = CD_FRAMESIZE_RAW; + char spindown; + + h = open(dev, O_RDONLY); + + if (h != -1) { + if (SpinDown != SPINDOWN_VENDOR_SPECIFIC) { + if (SpinDown > SPINDOWN_1S) { + parameter = ((int)SpinDown << (SpinDown - SPINDOWN_1S)); + } else { + parameter = 1; + } + + ioctl(h, IOCATASSPINDOWN, ¶meter); + + parameter = CdrSpeed * 177; + ioctl(h, CDRIOCREADSPEED, ¶meter); + + ioctl(h, CDRIOCSETBLOCKSIZE, &bsize); + } + } + + return h; } void CloseCdHandle(int handle) { + int spindown = 0; + ioctl(handle, IOCATASSPINDOWN, &spindown); + + close(handle); } long GetTN(int handle, unsigned char *buffer) { @@ -48,7 +74,13 @@ long GetTE(int handle, unsigned char track, unsigned char *m, unsigned char *s, } long ReadSector(int handle, crdata *cr) { - return -1; + unsigned int lba = msf_to_lba(cr->msf.cdmsf_min0, cr->msf.cdmsf_sec0, + cr->msf.cdmsf_frame0); + + if (pread(handle, (void *)cr->buf, CD_FRAMESIZE_RAW, lba * CD_FRAMESIZE_RAW) != CD_FRAMESIZE_RAW) + return -1; + + return 0; } long PlayCDDA(int handle, unsigned char *sector) { diff --git a/plugins/dfcdrom/cdr-linux.c b/plugins/dfcdrom/cdr-linux.c index d0e520b2..b55e15d2 100644 --- a/plugins/dfcdrom/cdr-linux.c +++ b/plugins/dfcdrom/cdr-linux.c @@ -47,6 +47,7 @@ int OpenCdHandle(const char *dev) { void CloseCdHandle(int handle) { char spindown = SPINDOWN_VENDOR_SPECIFIC; ioctl(handle, CDROMSETSPINDOWN, &spindown); + close(handle); } diff --git a/plugins/dfcdrom/cdr.h b/plugins/dfcdrom/cdr.h index 5ebdbbc0..7faa3c0e 100644 --- a/plugins/dfcdrom/cdr.h +++ b/plugins/dfcdrom/cdr.h @@ -76,8 +76,10 @@ struct cdrom_msf { #ifdef __FreeBSD__ -#include <sys/disklabel.h> +#include <sys/ata.h> #include <sys/cdio.h> +#include <sys/cdrio.h> +#include <sys/disklabel.h> #define DEV_DEF "/dev/acd0" |
