diff --git a/src/buslogic.c b/src/buslogic.c index f9b6f819d..14d662437 100644 --- a/src/buslogic.c +++ b/src/buslogic.c @@ -1612,11 +1612,11 @@ static void BuslogicSenseBufferFree(BuslogicRequests_t *BuslogicRequests, int Co uint8_t temp_sense[256]; - cdrom_request_sense_for_scsi(cdrom_id, temp_sense, SenseLength); - if (SenseLength && Copy) { uint32_t SenseBufferAddress; + + cdrom_request_sense_for_scsi(cdrom_id, temp_sense, SenseLength); /*The sense address, in 32-bit mode, is located in the Sense Pointer of the CCB, but in 24-bit mode, it is located at the end of the Command Descriptor Block. */ diff --git a/src/cdrom.c b/src/cdrom.c index 37993377b..e8e1120db 100644 --- a/src/cdrom.c +++ b/src/cdrom.c @@ -1551,6 +1551,20 @@ void cdrom_reset(uint8_t id) cdrom[id].unit_attention = 0; } +void cdrom_playing_completed(uint8_t id) +{ + cdrom[id].prev_status = cdrom[id].cd_status; + cdrom[id].cd_status = cdrom_drives[id].handler->status(id); + if (((cdrom[id].prev_status == CD_STATUS_PLAYING) || (cdrom[id].prev_status == CD_STATUS_PAUSED)) && ((cdrom[id].cd_status != CD_STATUS_PLAYING) && (cdrom[id].cd_status != CD_STATUS_PAUSED))) + { + return 1; + } + else + { + return 0; + } +} + void cdrom_request_sense(uint8_t id, uint8_t *buffer, uint8_t alloc_length) { /*Will return 18 bytes of 0*/ @@ -1562,7 +1576,7 @@ void cdrom_request_sense(uint8_t id, uint8_t *buffer, uint8_t alloc_length) buffer[0] = 0x70; - if ((cdrom_sense_key > 0) && ((cdrom[id].cd_status < CD_STATUS_PLAYING) || (cdrom[id].cd_status == CD_STATUS_STOPPED)) && cdrom[id].completed) + if ((cdrom_sense_key > 0) && ((cdrom[id].cd_status < CD_STATUS_PLAYING) || (cdrom[id].cd_status == CD_STATUS_STOPPED)) && cdrom_playing_completed(id)) { buffer[2]=SENSE_ILLEGAL_REQUEST; buffer[12]=ASC_AUDIO_PLAY_OPERATION; @@ -1702,15 +1716,9 @@ void cdrom_command(uint8_t id, uint8_t *cdb) return; } - cdrom[id].prev_status = cdrom[id].cd_status; - cdrom[id].cd_status = cdrom_drives[id].handler->status(id); - if (((cdrom[id].prev_status == CD_STATUS_PLAYING) || (cdrom[id].prev_status == CD_STATUS_PAUSED)) && ((cdrom[id].cd_status != CD_STATUS_PLAYING) && (cdrom[id].cd_status != CD_STATUS_PAUSED))) + if (cdb[0] != GPCMD_REQUEST_SENSE) { - completed = 1; - } - else - { - completed = 0; + completed = cdrom_playing_completed(id); } switch (cdb[0])