diff --git a/src/ide.c b/src/ide.c index 704101341..93b2cc64d 100644 --- a/src/ide.c +++ b/src/ide.c @@ -1890,6 +1890,7 @@ static void atapicommand(int ide_board) int format; int ret; int real_pos; + int track = 0; // pclog("ATAPI command 0x%02X, Sense Key %02X, Asc %02X, Ascq %02X, %i, Unit attention: %i\n",idebufferb[0],SCSISense.SenseKey,SCSISense.Asc,SCSISense.Ascq,ins,SCSISense.UnitAttention); @@ -2555,6 +2556,11 @@ static void atapicommand(int ide_board) max_len <<= 8; max_len |= idebufferb[8]; + track = ((uint32_t) idebufferb[2]) << 24; + track |= ((uint32_t) idebufferb[3]) << 16; + track |= ((uint32_t) idebufferb[4]) << 8; + track |= (uint32_t) idebufferb[5]; + if (cdrom->read_track_information) { cdrom->read_track_information(idebufferb, idebufferb); @@ -2566,7 +2572,7 @@ static void atapicommand(int ide_board) } else { - if ((idebufferb[3] != 1) || (idebufferb[2] != 1)) + if (((idebufferb[1] & 0x03) != 1) || (track != 1)) { ide->atastat = READY_STAT | ERR_STAT; /*CHECK CONDITION*/ ide->error = (SENSE_ILLEGAL_REQUEST << 4) | ABRT_ERR; diff --git a/src/scsi_cdrom.c b/src/scsi_cdrom.c index 9c503ddd7..6d7c571c9 100644 --- a/src/scsi_cdrom.c +++ b/src/scsi_cdrom.c @@ -1158,6 +1158,7 @@ void SCSICDROM_ReadData(uint8_t id, uint8_t *cdb, uint8_t *data, int datalen) unsigned char Temp; int read_length = 0; int max_length = 0; + int track = 0; msf = cdb[1] & 2; @@ -1559,6 +1560,11 @@ SCSIOut: max_length <<= 8; max_length |= SCSIDevices[id].Cdb[8]; + track = ((uint32_t) idebufferb[2]) << 24; + track |= ((uint32_t) idebufferb[3]) << 16; + track |= ((uint32_t) idebufferb[4]) << 8; + track |= (uint32_t) idebufferb[5]; + if (cdrom->read_track_information) { cdrom->read_track_information(SCSIDevices[id].Cdb, SCSIDevices[id].CmdBuffer); @@ -1570,7 +1576,7 @@ SCSIOut: } else { - if ((SCSIDevices[id].Cdb[3] != 1) || (SCSIDevices[id].Cdb[2] != 1)) + if (((SCSIDevices[id].Cdb[1] & 0x03) != 1) || (track != 1)) { SCSIStatus = SCSI_STATUS_CHECK_CONDITION; SCSISenseCodeError(SENSE_ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET, 0x00);