Search
lxdream.org :: lxdream/src/gdrom/gdimage.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdimage.c
changeset 782:1af8b5ce627c
prev759:f16975739abc
next796:a2dc83592467
author nkeynes
date Tue Jul 29 06:35:28 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Workaround OS X's inability to handle CD reads of unknown size (ie where the read
request failed to specify an expected sector type) - read raw sectors and parse it
out by hand.
file annotate diff log raw
1.1 --- a/src/gdrom/gdimage.c Mon Jul 21 01:01:39 2008 +0000
1.2 +++ b/src/gdrom/gdimage.c Tue Jul 29 06:35:28 2008 +0000
1.3 @@ -131,7 +131,7 @@
1.4 free( disc );
1.5 }
1.6
1.7 -static int gdrom_image_get_track_by_lba( gdrom_image_t image, uint32_t lba )
1.8 +int gdrom_image_get_track_by_lba( gdrom_image_t image, uint32_t lba )
1.9 {
1.10 int i;
1.11 for( i=0; i<image->track_count; i++ ) {
1.12 @@ -228,6 +228,22 @@
1.13 }
1.14 }
1.15
1.16 +void gdrom_extract_raw_data_sector( char *sector_data, int channels, unsigned char *buf, uint32_t *length )
1.17 +{
1.18 + int sector_mode;
1.19 + int start, size;
1.20 + struct cdrom_sector_header *secthead = (struct cdrom_sector_header *)sector_data;
1.21 + if( secthead->mode == 1 ) {
1.22 + sector_mode = GDROM_MODE1;
1.23 + } else {
1.24 + sector_mode = ((secthead->subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;
1.25 + }
1.26 + gdrom_get_read_bounds( sector_mode, channels, &start, &size );
1.27 +
1.28 + memcpy( buf, sector_data+start, size );
1.29 + *length = size;
1.30 +}
1.31 +
1.32 /**
1.33 * Read a single sector from a disc image. If you thought this would be simple,
1.34 * I have just one thing to say to you: Bwahahahahahahahah.
.