CDROM: Fix overflow in UpdatePositionWhileSeeking()

This commit is contained in:
Stenzek 2024-03-09 01:29:50 +10:00
parent b76af42acc
commit 3395853ba2
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -2406,8 +2406,9 @@ void CDROM::UpdatePositionWhileSeeking()
{
DebugAssert(IsSeeking());
const float completed_frac = 1.0f - (static_cast<float>(s_drive_event->GetTicksUntilNextExecution()) /
static_cast<float>(s_drive_event->GetInterval()));
const float completed_frac = 1.0f - std::min(static_cast<float>(s_drive_event->GetTicksUntilNextExecution()) /
static_cast<float>(s_drive_event->GetInterval()),
1.0f);
CDImage::LBA current_lba;
if (s_seek_end_lba > s_seek_start_lba)