Search
lxdream.org :: lxdream/src/gdrom/gdi.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/gdi.c
changeset 1023:264e2fd90be8
prev836:d314bf370949
author nkeynes
date Mon Jun 08 04:12:21 2009 +0000 (13 years ago)
permissions -rw-r--r--
last change General cleanup of the GD-rom subsystem
- merge gdrom_image_t and gdrom_disc_t
- Abstract MMC devices using a lower-level scsi transport
- OSX: only look at the whole disc device, and ignore partitions
file annotate diff log raw
1.1 --- a/src/gdrom/gdi.c Thu Aug 28 00:08:12 2008 +0000
1.2 +++ b/src/gdrom/gdi.c Mon Jun 08 04:12:21 2009 +0000
1.3 @@ -54,7 +54,6 @@
1.4 int i;
1.5 uint32_t track_count;
1.6 gdrom_disc_t disc;
1.7 - gdrom_image_t image;
1.8 struct stat st;
1.9 char line[512];
1.10 int session = 0;
1.11 @@ -76,15 +75,14 @@
1.12 return NULL;
1.13 }
1.14 dirname = g_path_get_dirname(filename);
1.15 - image = (gdrom_image_t)disc;
1.16 - image->disc_type = IDE_DISC_GDROM;
1.17 - image->track_count = track_count;
1.18 + disc->disc_type = IDE_DISC_GDROM;
1.19 + disc->track_count = track_count;
1.20 for( i=0; i<track_count; i++ ) {
1.21 int track_no, start_lba, flags, size, offset;
1.22 char filename[256];
1.23
1.24 if( fgets( line, sizeof(line), f ) == NULL ) {
1.25 - gdrom_image_destroy_no_close(disc);
1.26 + disc->destroy(disc,FALSE);
1.27 return NULL;
1.28 }
1.29 sscanf( line, "%d %d %d %d %s %d", &track_no, &start_lba, &flags, &size,
1.30 @@ -92,47 +90,47 @@
1.31 if( start_lba >= 45000 ) {
1.32 session = 1;
1.33 }
1.34 - image->track[i].session = session;
1.35 - image->track[i].lba = start_lba + 150; // 2-second offset
1.36 - image->track[i].flags = (flags & 0x0F)<<4;
1.37 - image->track[i].sector_size = size;
1.38 + disc->track[i].session = session;
1.39 + disc->track[i].lba = start_lba + 150; // 2-second offset
1.40 + disc->track[i].flags = (flags & 0x0F)<<4;
1.41 + disc->track[i].sector_size = size;
1.42 if( strcasecmp( filename, "none" ) == 0 ) {
1.43 - image->track[i].file = NULL;
1.44 - image->track[i].sector_count = 0;
1.45 - image->track[i].mode = GDROM_MODE1;
1.46 + disc->track[i].file = NULL;
1.47 + disc->track[i].sector_count = 0;
1.48 + disc->track[i].mode = GDROM_MODE1;
1.49 } else {
1.50 gchar *pathname = g_strdup_printf( "%s%c%s", dirname, G_DIR_SEPARATOR, filename );
1.51 - image->track[i].file = fopen( pathname, "ro" );
1.52 + disc->track[i].file = fopen( pathname, "ro" );
1.53 g_free(pathname);
1.54 - if( image->track[i].file == NULL ) {
1.55 - gdrom_image_destroy_no_close(disc);
1.56 + if( disc->track[i].file == NULL ) {
1.57 + disc->destroy(disc,FALSE);
1.58 g_free(dirname);
1.59 return NULL;
1.60 }
1.61 - fstat( fileno(image->track[i].file), &st );
1.62 - image->track[i].sector_count = st.st_size / size;
1.63 - if( image->track[i].flags & TRACK_DATA ) {
1.64 + fstat( fileno(disc->track[i].file), &st );
1.65 + disc->track[i].sector_count = st.st_size / size;
1.66 + if( disc->track[i].flags & TRACK_DATA ) {
1.67 /* Data track */
1.68 switch(size) {
1.69 - case 2048: image->track[i].mode = GDROM_MODE1; break;
1.70 - case 2336: image->track[i].mode = GDROM_SEMIRAW_MODE2; break;
1.71 - case 2352: image->track[i].mode = GDROM_RAW_XA; break;
1.72 + case 2048: disc->track[i].mode = GDROM_MODE1; break;
1.73 + case 2336: disc->track[i].mode = GDROM_SEMIRAW_MODE2; break;
1.74 + case 2352: disc->track[i].mode = GDROM_RAW_XA; break;
1.75 default:
1.76 - gdrom_image_destroy_no_close(disc);
1.77 + disc->destroy(disc,FALSE);
1.78 g_free(dirname);
1.79 return NULL;
1.80 }
1.81 } else {
1.82 /* Audio track */
1.83 - image->track[i].mode = GDROM_CDDA;
1.84 + disc->track[i].mode = GDROM_CDDA;
1.85 if( size != 2352 ) {
1.86 - gdrom_image_destroy_no_close(disc);
1.87 + disc->destroy(disc,FALSE);
1.88 g_free(dirname);
1.89 return NULL;
1.90 }
1.91 }
1.92 }
1.93 - image->track[i].offset = offset;
1.94 + disc->track[i].offset = offset;
1.95 }
1.96 g_free(dirname);
1.97 return disc;
.