From 25bf2b3adcb7bfc9800ba98808b7e483cbc4c761 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 30 May 2024 20:49:56 +1000 Subject: [PATCH] CDROM: Clear async interrupt on read/seek start Fixes broken audio in Road Rash. --- src/core/cdrom.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/cdrom.cpp b/src/core/cdrom.cpp index a6ae417bd..4011c4080 100644 --- a/src/core/cdrom.cpp +++ b/src/core/cdrom.cpp @@ -791,8 +791,7 @@ std::unique_ptr CDROM::RemoveMedia(bool for_disc_swap) s_command_event->Deactivate(); // The console sends an interrupt when the shell is opened regardless of whether a command was executing. - if (HasPendingAsyncInterrupt()) - ClearAsyncInterrupt(); + ClearAsyncInterrupt(); SendAsyncErrorResponse(STAT_ERROR, 0x08); // Begin spin-down timer, we can't swap the new disc in immediately for some games (e.g. Metal Gear Solid). @@ -2301,8 +2300,6 @@ void CDROM::ClearDriveState() void CDROM::BeginReading(TickCount ticks_late /* = 0 */, bool after_seek /* = false */) { - ClearSectorBuffers(); - if (!after_seek && s_setloc_pending) { BeginSeeking(true, true, false); @@ -2331,6 +2328,8 @@ void CDROM::BeginReading(TickCount ticks_late /* = 0 */, bool after_seek /* = fa const TickCount first_sector_ticks = ticks + (after_seek ? 0 : GetTicksForSeek(s_current_lba)) - ticks_late; ClearCommandSecondResponse(); + ClearAsyncInterrupt(); + ClearSectorBuffers(); ResetAudioDecoder(); s_drive_state = DriveState::Reading; @@ -2374,6 +2373,7 @@ void CDROM::BeginPlaying(u8 track, TickCount ticks_late /* = 0 */, bool after_se const TickCount first_sector_ticks = ticks + (after_seek ? 0 : GetTicksForSeek(s_current_lba, true)) - ticks_late; ClearCommandSecondResponse(); + ClearAsyncInterrupt(); ClearSectorBuffers(); ResetAudioDecoder(); @@ -2405,6 +2405,8 @@ void CDROM::BeginSeeking(bool logical, bool read_after_seek, bool play_after_see const TickCount seek_time = GetTicksForSeek(seek_lba, play_after_seek); ClearCommandSecondResponse(); + ClearAsyncInterrupt(); + ClearSectorBuffers(); ResetAudioDecoder(); s_secondary_status.SetSeeking();