From 8802c5d3df8ae71e7100f38a19125f7684cd2b4f Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 20 Oct 2018 04:59:10 +0200 Subject: [PATCH] Some CD-ROM image and IDE fixes. --- src/cdrom/cdrom_image.cc | 11 +++-------- src/disk/hdc_ide.c | 10 +++++----- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/cdrom/cdrom_image.cc b/src/cdrom/cdrom_image.cc index cf5bcf4fa..77b67b460 100644 --- a/src/cdrom/cdrom_image.cc +++ b/src/cdrom/cdrom_image.cc @@ -8,7 +8,7 @@ * * CD-ROM image support. * - * Version: @(#)cdrom_image.cc 1.0.3 2018/10/17 + * Version: @(#)cdrom_image.cc 1.0.4 2018/10/20 * * Author: RichardG867, * Miran Grca, @@ -723,13 +723,8 @@ image_readsector_raw(cdrom_t *dev, uint8_t *buffer, int sector, int ismsf, int c if (!is_legal(dev->id, cdrom_sector_type, cdrom_sector_flags, audio, mode2)) return 0; - if ((cdrom_sector_type == 3) || ((cdrom_sector_type > 4) && (cdrom_sector_type != 8))) { - if (cdrom_sector_type == 3) { - cdrom_image_log("CD-ROM %i: Attempting to read a Yellowbook Mode 2 data sector from an image\n", dev->id); - } - if (cdrom_sector_type > 4) { - cdrom_image_log("CD-ROM %i: Attempting to read a XA Mode 2 Form 2 data sector from an image\n", dev->id); - } + if ((cdrom_sector_type > 5) && (cdrom_sector_type != 8)) { + cdrom_image_log("CD-ROM %i: Attempting to read an unrecognized sector type from an image\n", dev->id); return 0; } else if (cdrom_sector_type == 1) { if (!audio || dev->img_is_iso) { diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 483a2b472..11dcf9901 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -9,7 +9,7 @@ * Implementation of the IDE emulation for hard disks and ATAPI * CD-ROM devices. * - * Version: @(#)hdc_ide.c 1.0.51 2018/10/17 + * Version: @(#)hdc_ide.c 1.0.52 2018/10/20 * * Authors: Sarah Walker, * Miran Grca, @@ -1458,7 +1458,7 @@ static uint32_t ide_read_data(ide_t *ide, int length) { scsi_device_data_t *atapi = (scsi_device_data_t *) ide->p; - uint32_t temp; + uint32_t temp = 0; if (!ide->buffer) { switch (length) { @@ -1479,12 +1479,12 @@ ide_read_data(ide_t *ide, int length) if (ide->command == WIN_PACKETCMD) { ide->pos = 0; - if (!ide_drive_is_atapi(ide)) { + if (ide_drive_is_atapi(ide)) + temp = ide->packet_read(ide->p, length); + else { ide_log("Drive not ATAPI (position: %i)\n", ide->pos); return 0; } - if (ide_drive_is_atapi(ide)) - temp = ide->packet_read(ide->p, length); } else { switch (length) { case 1: