From f6711cbafa9b4c3de696fc5e225decf40f91e772 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Tue, 31 Mar 2020 22:28:55 +1000 Subject: [PATCH] CDROM: Pausing while seeking should be an error response Confirmed by hardware test. --- src/core/cdrom.cpp | 8 ++++++++ src/core/cdrom.h | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/src/core/cdrom.cpp b/src/core/cdrom.cpp index 7ffa00cb5..00a7b3f85 100644 --- a/src/core/cdrom.cpp +++ b/src/core/cdrom.cpp @@ -767,6 +767,14 @@ void CDROM::ExecuteCommand() case Command::Pause: { + if (m_secondary_status.seeking) + { + Log_WarningPrintf("CDROM Pause command while seeking - sending error response"); + SendErrorResponse(STAT_ERROR, ERROR_NOT_READY); + EndCommand(); + return; + } + // TODO: Should return an error if seeking. const bool was_reading = (m_drive_state == DriveState::Reading || m_drive_state == DriveState::Playing); const TickCount pause_time = was_reading ? (m_mode.double_speed ? 2000000 : 1000000) : 7000; diff --git a/src/core/cdrom.h b/src/core/cdrom.h index 5e94bb893..724c9c5d7 100644 --- a/src/core/cdrom.h +++ b/src/core/cdrom.h @@ -148,6 +148,15 @@ private: STAT_PLAYING_CDDA = (1 << 7) }; + enum ErrorReason : u8 + { + ERROR_INVALID_ARGUMENT = 0x10, + ERROR_INCORRECT_NUMBER_OF_PARAMETERS = 0x20, + ERROR_INVALID_COMMAND = 0x40, + ERROR_NOT_READY = 0x80 + }; + + union SecondaryStatusRegister { u8 bits;