From 53ff458754e3a54ded4b092dc3dfeffce7344243 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 30 Sep 2019 01:08:17 +1000 Subject: [PATCH] CDROM: Don't crash when booting the BIOS without media --- src/pse/cdrom.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pse/cdrom.cpp b/src/pse/cdrom.cpp index bd1b2ac44..d42636de2 100644 --- a/src/pse/cdrom.cpp +++ b/src/pse/cdrom.cpp @@ -128,6 +128,12 @@ u8 CDROM::ReadRegister(u32 offset) case 1: // always response FIFO { + if (m_response_fifo.IsEmpty()) + { + Log_DebugPrintf("Response FIFO empty on read"); + return 0xFF; + } + const u8 value = m_response_fifo.Pop(); UpdateStatusRegister(); Log_DebugPrintf("CDROM read response FIFO <- 0x%08X", ZeroExtend32(value)); @@ -749,7 +755,7 @@ void CDROM::DoSectorRead() // return; } - Log_DebugPrintf("Reading sector %llu", m_media->GetCurrentLBA()); + Log_DevPrintf("Reading sector %llu", m_media->GetCurrentLBA()); // TODO: Error handling // TODO: Sector buffer should be two sectors?