Search
lxdream.org :: lxdream :: r832:40e5bb525c4e
lxdream 0.9.1
released Jun 29
Download Now
changeset832:40e5bb525c4e
parent831:677a887f3e06
child833:1ea87e0221f8
authornkeynes
dateWed Aug 27 06:23:19 2008 +0000 (12 years ago)
Fix handling of nrg images with multiple DAOX/DAOI sections
src/gdrom/nrg.c
1.1 --- a/src/gdrom/nrg.c Mon Aug 25 11:31:52 2008 +0000
1.2 +++ b/src/gdrom/nrg.c Wed Aug 27 06:23:19 2008 +0000
1.3 @@ -242,7 +242,7 @@
1.4 image->track[track_id-1].sector_count =
1.5 lba - image->track[track_id-1].lba;
1.6 } else {
1.7 - track = cue_track_id + bcd_to_uint8(cue->track) - 1;
1.8 + track = bcd_to_uint8(cue->track) - 1;
1.9 if( (cue->control & 0x01) == 0 ) {
1.10 /* Pre-gap address. */
1.11 if( track != 0 ) {
1.12 @@ -260,9 +260,9 @@
1.13 dao = (struct nrg_daoi *)data;
1.14 memcpy( image->mcn, dao->mcn, 13 );
1.15 image->mcn[13] = '\0';
1.16 - assert( dao->track_count * 30 + 22 == chunk.length );
1.17 - assert( dao->track_count == cue_track_count );
1.18 - for( i=0; i<dao->track_count; i++ ) {
1.19 + assert( (dao->track_count - cue_track_id) * 30 + 22 == chunk.length );
1.20 + assert( dao->track_count == track_id );
1.21 + for( i=0; i<(dao->track_count-cue_track_id); i++ ) {
1.22 image->track[cue_track_id].sector_size = GUINT32_FROM_BE(dao->track[i].sector_size);
1.23 image->track[cue_track_id].offset = GUINT32_FROM_BE(dao->track[i].offset);
1.24 image->track[cue_track_id].mode = nrg_track_mode( dao->track[i].mode );
1.25 @@ -276,9 +276,9 @@
1.26 daox = (struct nrg_daox *)data;
1.27 memcpy( image->mcn, daox->mcn, 13 );
1.28 image->mcn[13] = '\0';
1.29 - assert( daox->track_count * 42 + 22 == chunk.length );
1.30 - assert( daox->track_count == cue_track_count );
1.31 - for( i=0; i<daox->track_count; i++ ) {
1.32 + assert( (daox->track_count - cue_track_id) * 42 + 22 == chunk.length );
1.33 + assert( daox->track_count == track_id );
1.34 + for( i=0; i<(daox->track_count-cue_track_id); i++ ) {
1.35 image->track[cue_track_id].sector_size = GUINT32_FROM_BE(daox->track[i].sector_size);
1.36 image->track[cue_track_id].offset = GUINT64_FROM_BE(daox->track[i].offset);
1.37 image->track[cue_track_id].mode = nrg_track_mode( daox->track[i].mode );
.