Search
lxdream.org :: lxdream :: r1180:f2b9f4ef1987
lxdream 0.9.1
released Jun 29
Download Now
changeset1180:f2b9f4ef1987
parent1179:af1c5d7d5a5a
child1181:3dc028106b08
authorNathan Keynes <nkeynes@lxdream.org>
dateSun Sep 25 20:36:34 2011 +1000 (8 years ago)
Fix various CDI variations that weren't being parsed properly
src/drivers/cdrom/cd_cdi.c
1.1 --- a/src/drivers/cdrom/cd_cdi.c Sun Sep 18 08:24:27 2011 +1000
1.2 +++ b/src/drivers/cdrom/cd_cdi.c Sun Sep 25 20:36:34 2011 +1000
1.3 @@ -109,8 +109,11 @@
1.4
1.5 for( i=0; i< session_count; i++ ) {
1.6 fread( &track_count, sizeof(track_count), 1, f );
1.7 + if( (i != session_count-1 && track_count < 1) || track_count > 99 ) {
1.8 + RETURN_PARSE_ERROR("Invalid number of tracks (%d), bad cdi image", track_count);
1.9 + }
1.10 if( track_count + total_tracks > 99 ) {
1.11 - RETURN_PARSE_ERROR("Invalid number of tracks, bad cdi image" );
1.12 + RETURN_PARSE_ERROR("Invalid number of tracks in disc, bad cdi image" );
1.13 }
1.14 for( j=0; j<track_count; j++ ) {
1.15 struct cdi_track_data trk;
1.16 @@ -176,14 +179,19 @@
1.17 disc->track[total_tracks].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );
1.18 posn += trk.total_length * CDROM_SECTOR_SIZE(mode);
1.19 total_tracks++;
1.20 - fread( marker, 1, 9, f );
1.21 - if( memcmp( marker, EXT_MARKER, 9 ) == 0 ) {
1.22 - fseek( f, 79, SEEK_CUR );
1.23 - } else {
1.24 - fseek( f, -9, SEEK_CUR );
1.25 + if( trail.cdi_version != CDI_V2_ID ) {
1.26 + uint32_t extmarker;
1.27 + fseek( f, 5, SEEK_CUR );
1.28 + fread( &extmarker, sizeof(extmarker), 1, f);
1.29 + if( extmarker == 0xFFFFFFFF ) {
1.30 + fseek( f, 78, SEEK_CUR );
1.31 + }
1.32 }
1.33 }
1.34 fseek( f, 12, SEEK_CUR );
1.35 + if( trail.cdi_version != CDI_V2_ID ) {
1.36 + fseek( f, 1, SEEK_CUR );
1.37 + }
1.38 }
1.39
1.40 disc->track_count = total_tracks;
.