Search
lxdream.org :: lxdream/src/gdrom/gdrom.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdrom.c
changeset 149:d88dd2e9a190
prev143:9446fb6df0c5
next152:d42a4c5cc709
author nkeynes
date Sat May 20 06:24:49 2006 +0000 (14 years ago)
permissions -rw-r--r--
last change Add disc info + spin up (probably seek) commands
file annotate diff log raw
1.1 --- a/src/gdrom/gdrom.c Wed May 03 12:52:38 2006 +0000
1.2 +++ b/src/gdrom/gdrom.c Sat May 20 06:24:49 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: gdrom.c,v 1.3 2006-05-03 12:52:38 nkeynes Exp $
1.6 + * $Id: gdrom.c,v 1.4 2006-05-20 06:24:49 nkeynes Exp $
1.7 *
1.8 * GD-Rom access functions.
1.9 *
1.10 @@ -105,13 +105,13 @@
1.11 }
1.12 }
1.13
1.14 -gboolean gdrom_get_toc( char *buf )
1.15 +gdrom_error_t gdrom_get_toc( char *buf )
1.16 {
1.17 struct gdrom_toc *toc = (struct gdrom_toc *)buf;
1.18 int i;
1.19
1.20 if( gdrom_disc == NULL )
1.21 - return FALSE;
1.22 + return PKT_ERR_NODISC;
1.23
1.24 for( i=0; i<gdrom_disc->track_count; i++ ) {
1.25 toc->track[i] = htonl( gdrom_disc->track[i].lba ) | gdrom_disc->track[i].flags;
1.26 @@ -122,7 +122,23 @@
1.27 gdrom_disc->track[i-1].flags;
1.28 for( ;i<99; i++ )
1.29 toc->track[i] = 0xFFFFFFFF;
1.30 - return TRUE;
1.31 + return PKT_ERR_OK;
1.32 +}
1.33 +
1.34 +gdrom_error_t gdrom_get_info( char *buf )
1.35 +{
1.36 + if( gdrom_disc == NULL )
1.37 + return PKT_ERR_NODISC;
1.38 + struct gdrom_track *last_track = &gdrom_disc->track[gdrom_disc->track_count-1];
1.39 + unsigned int end_of_disc = last_track->lba + last_track->sector_count;
1.40 +
1.41 + buf[0] = 0x01; /* Unknown. First session? */
1.42 + buf[1] = 0;
1.43 + buf[2] = last_track->session+1; /* last session */
1.44 + buf[3] = (end_of_disc >> 16) & 0xFF;
1.45 + buf[4] = (end_of_disc >> 8) & 0xFF;
1.46 + buf[5] = end_of_disc & 0xFF;
1.47 + return PKT_ERR_OK;
1.48 }
1.49
1.50 void gdrom_mount_disc( gdrom_disc_t disc )
.