Removed more ifdefs from scsi code (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2011-01-10 15:37:23 +00:00
parent 2d32a07198
commit 0986367da7
3 changed files with 45 additions and 42 deletions

View File

@ -1911,34 +1911,34 @@ static DEVICE_RESET( ide_controller )
LOG(("IDE controller reset performed\n")); LOG(("IDE controller reset performed\n"));
#ifdef MESS if (device->machine->device( "harddisk" )) {
if (!ide->disk) if (!ide->disk)
{
ide->handle = hd_get_chd_file( device->machine->device( "harddisk" ) ); // should be config->master
if (ide->handle)
{ {
ide->disk = hd_get_hard_disk_file( device->machine->device( "harddisk" ) ); // should be config->master ide->handle = hd_get_chd_file( device->machine->device( "harddisk" ) ); // should be config->master
if (ide->disk != NULL) if (ide->handle)
{ {
const hard_disk_info *hdinfo; ide->disk = hd_get_hard_disk_file( device->machine->device( "harddisk" ) ); // should be config->master
hdinfo = hard_disk_get_info(ide->disk); if (ide->disk != NULL)
if (hdinfo->sectorbytes == IDE_DISK_SECTOR_SIZE)
{ {
ide->num_cylinders = hdinfo->cylinders; const hard_disk_info *hdinfo;
ide->num_sectors = hdinfo->sectors;
ide->num_heads = hdinfo->heads;
if (PRINTF_IDE_COMMANDS) printf("CHS: %d %d %d\n", ide->num_cylinders, ide->num_heads, ide->num_sectors);
}
/* build the features page */ hdinfo = hard_disk_get_info(ide->disk);
ide_build_features(ide); if (hdinfo->sectorbytes == IDE_DISK_SECTOR_SIZE)
{
ide->num_cylinders = hdinfo->cylinders;
ide->num_sectors = hdinfo->sectors;
ide->num_heads = hdinfo->heads;
if (PRINTF_IDE_COMMANDS) printf("CHS: %d %d %d\n", ide->num_cylinders, ide->num_heads, ide->num_sectors);
}
/* build the features page */
ide_build_features(ide);
}
} }
} }
} }
#endif
/* reset the drive state */ /* reset the drive state */
ide->status = IDE_STATUS_DRIVE_READY | IDE_STATUS_SEEK_COMPLETE; ide->status = IDE_STATUS_DRIVE_READY | IDE_STATUS_SEEK_COMPLETE;

View File

@ -21,6 +21,7 @@ typedef struct
UINT32 cur_subblock; UINT32 cur_subblock;
UINT32 play_err_flag; UINT32 play_err_flag;
cdrom_file *cdrom; cdrom_file *cdrom;
bool is_file;
} SCSICd; } SCSICd;
static void phys_frame_to_msf(int phys_frame, int *m, int *s, int *f) static void phys_frame_to_msf(int phys_frame, int *m, int *s, int *f)
@ -689,28 +690,29 @@ static void scsicd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr
state_save_register_item( machine, "scsicd", diskregion, 0, our_this->cur_subblock ); state_save_register_item( machine, "scsicd", diskregion, 0, our_this->cur_subblock );
state_save_register_item( machine, "scsicd", diskregion, 0, our_this->play_err_flag ); state_save_register_item( machine, "scsicd", diskregion, 0, our_this->play_err_flag );
#ifdef MESS if (machine->device( diskregion )) {
/* TODO: get rid of this ifdef MESS section */ our_this->is_file = TRUE;
our_this->cdrom = cd_get_cdrom_file( machine->device( diskregion ) ); our_this->cdrom = cd_get_cdrom_file( machine->device( diskregion ) );
#else } else {
our_this->cdrom = cdrom_open(get_disk_handle( machine, diskregion )); our_this->is_file = FALSE;
our_this->cdrom = cdrom_open(get_disk_handle( machine, diskregion ));
}
if (!our_this->cdrom) if (!our_this->cdrom)
{ {
logerror("SCSICD: no CD found!\n"); logerror("SCSICD: no CD found!\n");
} }
#endif
} }
static void scsicd_delete_instance( SCSIInstance *scsiInstance ) static void scsicd_delete_instance( SCSIInstance *scsiInstance )
{ {
#ifndef MESS
SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance ); SCSICd *our_this = (SCSICd *)SCSIThis( &SCSIClassCDROM, scsiInstance );
if( our_this->cdrom ) if (!our_this->is_file) {
{ if( our_this->cdrom )
cdrom_close( our_this->cdrom ); {
cdrom_close( our_this->cdrom );
}
} }
#endif
} }
static void scsicd_get_device( SCSIInstance *scsiInstance, cdrom_file **cdrom ) static void scsicd_get_device( SCSIInstance *scsiInstance, cdrom_file **cdrom )

View File

@ -15,6 +15,7 @@ typedef struct
UINT32 lba; UINT32 lba;
UINT32 blocks; UINT32 blocks;
hard_disk_file *disk; hard_disk_file *disk;
bool is_file;
} SCSIHd; } SCSIHd;
@ -253,12 +254,13 @@ static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr
state_save_register_item( machine, "scsihd", diskregion, 0, our_this->lba ); state_save_register_item( machine, "scsihd", diskregion, 0, our_this->lba );
state_save_register_item( machine, "scsihd", diskregion, 0, our_this->blocks ); state_save_register_item( machine, "scsihd", diskregion, 0, our_this->blocks );
#ifdef MESS if (machine->device( diskregion )) {
/* TODO: get rid of this ifdef MESS section */ our_this->is_file = TRUE;
our_this->disk = hd_get_hard_disk_file( machine->device( diskregion ) ); our_this->disk = hd_get_hard_disk_file( machine->device( diskregion ) );
#else } else {
our_this->disk = hard_disk_open(get_disk_handle( machine, diskregion )); our_this->is_file = FALSE;
#endif our_this->disk = hard_disk_open(get_disk_handle( machine, diskregion ));
}
if (!our_this->disk) if (!our_this->disk)
{ {
@ -268,14 +270,13 @@ static void scsihd_alloc_instance( SCSIInstance *scsiInstance, const char *diskr
static void scsihd_delete_instance( SCSIInstance *scsiInstance ) static void scsihd_delete_instance( SCSIInstance *scsiInstance )
{ {
#ifndef MESS
SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance ); SCSIHd *our_this = (SCSIHd *)SCSIThis( &SCSIClassHARDDISK, scsiInstance );
if (!our_this->is_file) {
if( our_this->disk ) if( our_this->disk )
{ {
hard_disk_close( our_this->disk ); hard_disk_close( our_this->disk );
}
} }
#endif
} }
static void scsihd_get_device( SCSIInstance *scsiInstance, hard_disk_file **disk ) static void scsihd_get_device( SCSIInstance *scsiInstance, hard_disk_file **disk )