mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-27 08:05:41 +00:00
CDROM: Jump to seek target on pause while seeking
Fixes music in No Fear Downhill Mountain Biking, but needs more hardware tests to confirm the behavior here.
This commit is contained in:
parent
52934aa563
commit
e64f8cc2c5
|
@ -1068,18 +1068,21 @@ void CDROM::ExecuteCommand()
|
||||||
|
|
||||||
case Command::Pause:
|
case Command::Pause:
|
||||||
{
|
{
|
||||||
if (m_secondary_status.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;
|
||||||
|
|
||||||
|
if (m_drive_state == DriveState::SeekingLogical || m_drive_state == DriveState::SeekingPhysical)
|
||||||
{
|
{
|
||||||
// TODO: On console, this returns an error. But perhaps only during the coarse/fine seek part? Needs more
|
// TODO: On console, this returns an error. But perhaps only during the coarse/fine seek part? Needs more
|
||||||
// hardware tests.
|
// hardware tests.
|
||||||
Log_WarningPrintf("CDROM Pause command while seeking - updating position");
|
Log_WarningPrintf("CDROM Pause command while seeking from %u to %u - jumping to seek target", m_seek_start_lba,
|
||||||
UpdatePositionWhileSeeking();
|
m_seek_end_lba);
|
||||||
m_drive_event->Deactivate();
|
m_drive_event->Deactivate();
|
||||||
|
m_read_after_seek = false;
|
||||||
|
m_play_after_seek = false;
|
||||||
|
CompleteSeek();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
|
||||||
Log_DebugPrintf("CDROM pause command");
|
Log_DebugPrintf("CDROM pause command");
|
||||||
SendACKAndStat();
|
SendACKAndStat();
|
||||||
|
|
||||||
|
@ -1553,6 +1556,8 @@ void CDROM::BeginSeeking(bool logical, bool read_after_seek, bool play_after_see
|
||||||
|
|
||||||
m_read_after_seek = read_after_seek;
|
m_read_after_seek = read_after_seek;
|
||||||
m_play_after_seek = play_after_seek;
|
m_play_after_seek = play_after_seek;
|
||||||
|
|
||||||
|
// TODO: Pending should stay set on seek command.
|
||||||
m_setloc_pending = false;
|
m_setloc_pending = false;
|
||||||
|
|
||||||
Log_DebugPrintf("Seeking to [%02u:%02u:%02u] (LBA %u) (%s)", m_setloc_position.minute, m_setloc_position.second,
|
Log_DebugPrintf("Seeking to [%02u:%02u:%02u] (LBA %u) (%s)", m_setloc_position.minute, m_setloc_position.second,
|
||||||
|
@ -1711,7 +1716,7 @@ void CDROM::DoResetComplete(TickCount ticks_late)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDROM::DoSeekComplete(TickCount ticks_late)
|
bool CDROM::CompleteSeek()
|
||||||
{
|
{
|
||||||
const bool logical = (m_drive_state == DriveState::SeekingLogical);
|
const bool logical = (m_drive_state == DriveState::SeekingLogical);
|
||||||
m_drive_state = DriveState::Idle;
|
m_drive_state = DriveState::Idle;
|
||||||
|
@ -1767,7 +1772,13 @@ void CDROM::DoSeekComplete(TickCount ticks_late)
|
||||||
|
|
||||||
m_current_lba = m_reader.GetLastReadSector();
|
m_current_lba = m_reader.GetLastReadSector();
|
||||||
ResetPhysicalPosition();
|
ResetPhysicalPosition();
|
||||||
|
return seek_okay;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CDROM::DoSeekComplete(TickCount ticks_late)
|
||||||
|
{
|
||||||
|
const bool logical = (m_drive_state == DriveState::SeekingLogical);
|
||||||
|
const bool seek_okay = CompleteSeek();
|
||||||
if (seek_okay)
|
if (seek_okay)
|
||||||
{
|
{
|
||||||
// seek complete, transition to play/read if requested
|
// seek complete, transition to play/read if requested
|
||||||
|
|
|
@ -264,6 +264,8 @@ private:
|
||||||
TickCount GetTicksForSeek(CDImage::LBA new_lba);
|
TickCount GetTicksForSeek(CDImage::LBA new_lba);
|
||||||
TickCount GetTicksForStop(bool motor_was_on);
|
TickCount GetTicksForStop(bool motor_was_on);
|
||||||
CDImage::LBA GetNextSectorToBeRead();
|
CDImage::LBA GetNextSectorToBeRead();
|
||||||
|
bool CompleteSeek();
|
||||||
|
|
||||||
void BeginCommand(Command command); // also update status register
|
void BeginCommand(Command command); // also update status register
|
||||||
void EndCommand(); // also updates status register
|
void EndCommand(); // also updates status register
|
||||||
void AbortCommand();
|
void AbortCommand();
|
||||||
|
|
Loading…
Reference in a new issue