From a6f5ac264e071fdbaf0ed166e16b13c974260654 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 28 Nov 2022 18:03:38 +1000 Subject: [PATCH] CDROM: Handle some edge cases - Reel Fishing: Reads while an implicit seek is still going. - Transformers - Beast Wars: Needs a longer delay when it issues a ReadN after a SeekL and simulated position hits exactly. --- src/core/cdrom.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/cdrom.cpp b/src/core/cdrom.cpp index 7f3d412e1..2cf98324c 100644 --- a/src/core/cdrom.cpp +++ b/src/core/cdrom.cpp @@ -816,7 +816,8 @@ TickCount CDROM::GetTicksForSeek(CDImage::LBA new_lba, bool ignore_speed_change) if (lba_diff < 32) { - ticks += ticks_per_sector * std::min(5u, lba_diff); + // Special case: when we land exactly on the right sector, we're already too late. + ticks += ticks_per_sector * std::min(5u, (lba_diff == 0) ? 5u : lba_diff); } else { @@ -1783,6 +1784,11 @@ void CDROM::BeginReading(TickCount ticks_late /* = 0 */, bool after_seek /* = fa { Log_DevPrintf("Read command while seeking, scheduling read after seek %u -> %u finishes in %d ticks", m_seek_start_lba, m_seek_end_lba, m_drive_event->GetTicksUntilNextExecution()); + + // Implicit seeks won't trigger the read, so swap it for a logical. + if (m_drive_state == DriveState::SeekingImplicit) + m_drive_state = DriveState::SeekingLogical; + m_read_after_seek = true; m_play_after_seek = false; return;