CDROM: Cancel speed changes if they're not complete

This commit is contained in:
Connor McLaughlin 2021-06-19 15:01:42 +10:00
parent b1776dea61
commit 2c19c7ce57

View file

@ -1020,8 +1020,18 @@ void CDROM::ExecuteCommand(TickCount ticks_late)
SendACKAndStat();
EndCommand();
if (speed_change && m_drive_state != DriveState::SeekingImplicit &&
m_drive_state != DriveState::ChangingSpeedOrTOCRead)
if (speed_change)
{
if (m_drive_state == DriveState::ChangingSpeedOrTOCRead)
{
// cancel the speed change if it's less than a quarter complete
if (m_drive_event->GetTicksUntilNextExecution() >= (GetTicksForSpeedChange() / 4))
{
Log_DevPrintf("Cancelling speed change event");
ClearDriveState();
}
}
else if (m_drive_state != DriveState::SeekingImplicit)
{
// if we're seeking or reading, we need to add time to the current seek/read
const TickCount change_ticks = GetTicksForSpeedChange();
@ -1039,6 +1049,7 @@ void CDROM::ExecuteCommand(TickCount ticks_late)
m_drive_event->Schedule(change_ticks);
}
}
}
return;
}