# HG changeset patch # User nkeynes # Date 1245633196 0 # Node ID 864417a576628fb8ae1c646529811fbf98c93e3d # Parent 7138bbb9537c5e42b7d14d639861e0d458f3007f Fix disc type breakage introduced in last refactor --- a/src/gdrom/cdi.c Sun Jun 14 21:46:05 2009 +0000 +++ b/src/gdrom/cdi.c Mon Jun 22 01:13:16 2009 +0000 @@ -203,5 +203,6 @@ fseek( f, 12, SEEK_CUR ); } disc->track_count = total_tracks; + gdrom_set_disc_type(disc); return disc; } --- a/src/gdrom/gddriver.h Sun Jun 14 21:46:05 2009 +0000 +++ b/src/gdrom/gddriver.h Mon Jun 22 01:13:16 2009 +0000 @@ -258,4 +258,9 @@ */ void mmc_parse_toc2( gdrom_disc_t disc, unsigned char *buf ); +/** + * Set the disc type flag based on the track contents + */ +void gdrom_set_disc_type( gdrom_disc_t disc ); + #endif /* !lxdream_gddriver_H */ --- a/src/gdrom/gdimage.c Sun Jun 14 21:46:05 2009 +0000 +++ b/src/gdrom/gdimage.c Mon Jun 22 01:13:16 2009 +0000 @@ -243,6 +243,24 @@ } } +void gdrom_set_disc_type( gdrom_disc_t disc ) +{ + int type = IDE_DISC_NONE, i; + for( i=0; itrack_count; i++ ) { + if( disc->track[i].mode == GDROM_CDDA ) { + if( type == IDE_DISC_NONE ) + type = IDE_DISC_AUDIO; + } else if( disc->track[i].mode == GDROM_MODE1 || disc->track[i].mode == GDROM_RAW_NONXA ) { + if( type != IDE_DISC_CDROMXA ) + type = IDE_DISC_CDROM; + } else { + type = IDE_DISC_CDROMXA; + break; + } + } + disc->disc_type = type; +} + /** * Determine the start position in a raw sector, and the amount of data to read * in bytes, for a given combination of sector mode and read mode. --- a/src/gdrom/nrg.c Sun Jun 14 21:46:05 2009 +0000 +++ b/src/gdrom/nrg.c Mon Jun 22 01:13:16 2009 +0000 @@ -343,6 +343,7 @@ } } while( !end ); disc->track_count = track_id; + gdrom_set_disc_type(disc); return disc; }