Search
lxdream.org :: lxdream/src/gdrom/gdrom.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdrom.c
changeset 142:2f631c3a3946
prev138:afabd7e6d26d
next143:9446fb6df0c5
author nkeynes
date Tue May 02 14:09:11 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Add packet.h
Implement read toc, request sense, test ready commands.
Fix failure to clear error status on new command
file annotate diff log raw
1.1 --- a/src/gdrom/gdrom.c Sun Apr 30 01:51:08 2006 +0000
1.2 +++ b/src/gdrom/gdrom.c Tue May 02 14:09:11 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: gdrom.c,v 1.1 2006-04-30 01:51:08 nkeynes Exp $
1.6 + * $Id: gdrom.c,v 1.2 2006-05-02 14:09:11 nkeynes Exp $
1.7 *
1.8 * GD-Rom access functions.
1.9 *
1.10 @@ -65,7 +65,7 @@
1.11
1.12 for( i=0; i<disc->track_count; i++ ) {
1.13 if( disc->track[i].lba <= sector &&
1.14 - disc->track[i].lba + disc->track[i].sector_count <= sector + sector_count ) {
1.15 + (sector + sector_count) <= (disc->track[i].lba + disc->track[i].sector_count) ) {
1.16 track = i;
1.17 break;
1.18 }
1.19 @@ -102,8 +102,21 @@
1.20
1.21 gboolean gdrom_get_toc( char *buf )
1.22 {
1.23 + struct gdrom_toc *toc = (struct gdrom_toc *)buf;
1.24 + int i;
1.25 +
1.26 if( gdrom_disc == NULL )
1.27 return FALSE;
1.28 +
1.29 + for( i=0; i<gdrom_disc->track_count; i++ ) {
1.30 + toc->track[i] = htonl( gdrom_disc->track[i].lba ) | gdrom_disc->track[i].flags;
1.31 + }
1.32 + toc->first = 0x0100 | gdrom_disc->track[0].flags;
1.33 + toc->last = (gdrom_disc->track_count<<8) | gdrom_disc->track[i-1].flags;
1.34 + toc->leadout = htonl(gdrom_disc->track[i-1].lba + gdrom_disc->track[i-1].sector_count) |
1.35 + gdrom_disc->track[i-1].flags;
1.36 + for( ;i<99; i++ )
1.37 + toc->track[i] = 0xFFFFFFFF;
1.38 return TRUE;
1.39 }
1.40
.