1.1 --- a/src/gdrom/gdimage.c Wed Jul 30 22:50:44 2008 +0000
1.2 +++ b/src/gdrom/gdimage.c Thu Aug 28 01:39:51 2008 +0000
1.7 -void gdrom_image_dump_info( gdrom_disc_t d ) {
1.8 - gdrom_image_t disc = (gdrom_image_t)d;
1.10 - int last_session = disc->track[disc->track_count-1].session;
1.11 - gboolean is_bootable = FALSE;
1.13 - INFO( "Disc ID: %s, %d tracks in %d sessions", disc->mcn, disc->track_count,
1.14 - disc->track[disc->track_count-1].session + 1 );
1.15 - if( last_session > 0 ) {
1.16 - /* Boot track is the first data track of the last session, provided that it
1.17 - * cannot be a single-session disc.
1.19 - int boot_track = -1;
1.20 - for( i=disc->track_count-1; i>=0 && disc->track[i].session == last_session; i-- ) {
1.21 - if( disc->track[i].flags & TRACK_DATA ) {
1.25 - if( boot_track != -1 ) {
1.26 - unsigned char boot_sector[MAX_SECTOR_SIZE];
1.27 - uint32_t length = sizeof(boot_sector);
1.28 - if( d->read_sector( d, disc->track[boot_track].lba, 0x28,
1.29 - boot_sector, &length ) == PKT_ERR_OK ) {
1.30 - bootstrap_dump(boot_sector, FALSE);
1.31 - is_bootable = TRUE;
1.35 - if( !is_bootable ) {
1.36 - WARN( "Disc does not appear to be bootable" );
1.40 gdrom_device_t gdrom_device_new( const gchar *name, const gchar *dev_name )
1.42 struct gdrom_device *dev = g_malloc0( sizeof(struct gdrom_device) );
1.43 @@ -520,3 +487,41 @@
1.49 + * Check the disc for a useable DC bootstrap, and update the disc
1.50 + * with the title accordingly.
1.51 + * @return TRUE if we found a bootstrap, otherwise FALSE.
1.53 +gboolean gdrom_image_read_info( gdrom_disc_t d ) {
1.54 + gdrom_image_t disc = (gdrom_image_t)d;
1.55 + if( disc->track_count > 0 ) {
1.56 + /* Find the first data track of the last session */
1.57 + int last_session = disc->track[disc->track_count-1].session;
1.58 + int i, boot_track = -1;
1.59 + for( i=disc->track_count-1; i>=0 && disc->track[i].session == last_session; i-- ) {
1.60 + if( disc->track[i].flags & TRACK_DATA ) {
1.64 + if( boot_track != -1 ) {
1.65 + unsigned char boot_sector[MAX_SECTOR_SIZE];
1.66 + uint32_t length = sizeof(boot_sector);
1.67 + if( d->read_sector( d, disc->track[boot_track].lba, 0x28,
1.68 + boot_sector, &length ) == PKT_ERR_OK ) {
1.69 + if( memcmp( boot_sector, "SEGA SEGAKATANA SEGA ENTERPRISES", 32) == 0 ) {
1.71 + memcpy( d->title, boot_sector+128, 128 );
1.72 + for( i=127; i>=0; i-- ) {
1.73 + if( !isspace(d->title[i]) )
1.76 + d->title[i+1] = '\0';
1.78 + bootstrap_dump(boot_sector, FALSE);