@@ -818,13 +818,21 @@ TickCount CDROM::GetTicksForSeek(CDImage::LBA new_lba)
818
818
const u32 lba_diff = static_cast <u32 >((new_lba > current_lba) ? (new_lba - current_lba) : (current_lba - new_lba));
819
819
820
820
// Formula from Mednafen.
821
- TickCount ticks = std::max<TickCount>(20000 , lba_diff * MASTER_CLOCK * 1000 / (72 * 60 * 75 ) / 1000 );
821
+ TickCount ticks = std::max<TickCount>(
822
+ 20000 , static_cast <u32 >(
823
+ ((static_cast <u64 >(lba_diff) * static_cast <u64 >(MASTER_CLOCK) * static_cast <u64 >(1000 )) / (72 * 60 * 75 )) /
824
+ 1000 ));
822
825
if (!m_secondary_status.motor_on )
823
826
ticks += MASTER_CLOCK;
824
827
if (lba_diff >= 2550 )
825
828
ticks += static_cast <TickCount>(u64 (MASTER_CLOCK) * 300 / 1000 );
826
829
else if (m_drive_state == DriveState::Idle) // paused
827
- ticks += 1237952 << (BoolToUInt8 (!m_mode.double_speed ));
830
+ {
831
+ // When paused, the CDC seems to keep reading the disc until it hits the position it's set to, then skip 10-15
832
+ // sectors back (depending on how far into the disc it is). We'll be generous and use 4 sectors, since on average
833
+ // it's probably closer.
834
+ ticks += GetTicksForRead () * 4u ;
835
+ }
828
836
829
837
if (m_mode.double_speed != m_current_double_speed)
830
838
{
@@ -836,10 +844,6 @@ TickCount CDROM::GetTicksForSeek(CDImage::LBA new_lba)
836
844
ticks += static_cast <u32 >(static_cast <double >(MASTER_CLOCK) * 0.1 );
837
845
}
838
846
839
- // it's unlikely that the drive would seek to exactly the correct position, so simulate this by adding the time
840
- // required to read a few sectors
841
- ticks += GetTicksForRead () * 4u ;
842
-
843
847
Log_DevPrintf (" Seek time for %u LBAs: %d" , lba_diff, ticks);
844
848
return ticks;
845
849
}
0 commit comments