Another fix for READ TRACK INFORMATION.

This commit is contained in:
OBattler
2016-12-25 17:46:06 +01:00
parent e9327bbc84
commit 4d71ebaf67
2 changed files with 14 additions and 2 deletions

View File

@@ -1890,6 +1890,7 @@ static void atapicommand(int ide_board)
int format; int format;
int ret; int ret;
int real_pos; 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); // 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 <<= 8;
max_len |= idebufferb[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) if (cdrom->read_track_information)
{ {
cdrom->read_track_information(idebufferb, idebufferb); cdrom->read_track_information(idebufferb, idebufferb);
@@ -2566,7 +2572,7 @@ static void atapicommand(int ide_board)
} }
else else
{ {
if ((idebufferb[3] != 1) || (idebufferb[2] != 1)) if (((idebufferb[1] & 0x03) != 1) || (track != 1))
{ {
ide->atastat = READY_STAT | ERR_STAT; /*CHECK CONDITION*/ ide->atastat = READY_STAT | ERR_STAT; /*CHECK CONDITION*/
ide->error = (SENSE_ILLEGAL_REQUEST << 4) | ABRT_ERR; ide->error = (SENSE_ILLEGAL_REQUEST << 4) | ABRT_ERR;

View File

@@ -1158,6 +1158,7 @@ void SCSICDROM_ReadData(uint8_t id, uint8_t *cdb, uint8_t *data, int datalen)
unsigned char Temp; unsigned char Temp;
int read_length = 0; int read_length = 0;
int max_length = 0; int max_length = 0;
int track = 0;
msf = cdb[1] & 2; msf = cdb[1] & 2;
@@ -1559,6 +1560,11 @@ SCSIOut:
max_length <<= 8; max_length <<= 8;
max_length |= SCSIDevices[id].Cdb[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) if (cdrom->read_track_information)
{ {
cdrom->read_track_information(SCSIDevices[id].Cdb, SCSIDevices[id].CmdBuffer); cdrom->read_track_information(SCSIDevices[id].Cdb, SCSIDevices[id].CmdBuffer);
@@ -1570,7 +1576,7 @@ SCSIOut:
} }
else 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; SCSIStatus = SCSI_STATUS_CHECK_CONDITION;
SCSISenseCodeError(SENSE_ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET, 0x00); SCSISenseCodeError(SENSE_ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET, 0x00);