CDImage: Fix incorrect index returned for track-relative 00:02:00

Fixes some voice lines being very briefly cut off in Tomb Raider.
This commit is contained in:
Connor McLaughlin
2021-05-27 03:46:33 +10:00
parent e8e8b910a5
commit 56c08254c9
5 changed files with 35 additions and 33 deletions

View File

@ -280,7 +280,7 @@ void CDROM::InsertMedia(std::unique_ptr<CDImage> media)
// reading TOC? interestingly this doesn't work for GetlocL though...
CDImage::SubChannelQ subq;
if (media->Seek(0) && media->ReadSubChannelQ(&subq) && subq.IsCRCValid())
if (media->Seek(0) && media->ReadRawSector(nullptr, &subq) && subq.IsCRCValid())
m_last_subq = subq;
m_reader.SetMedia(std::move(media));

View File

@ -88,7 +88,7 @@ bool CDROMAsyncReader::ReadSectorUncached(CDImage::LBA lba, CDImage::SubChannelQ
return false;
}
if ((subq && !m_media->ReadSubChannelQ(subq)) || (data && !m_media->ReadRawSector(data->data())))
if (!m_media->ReadRawSector(data, subq))
{
Log_WarningPrintf("Read of LBA %u failed", lba);
return false;
@ -149,8 +149,8 @@ void CDROMAsyncReader::DoSectorRead()
}
}
CDImage::LBA pos = m_media->GetPositionOnDisc();
if (!m_media->ReadSubChannelQ(&m_subq) || !m_media->ReadRawSector(m_sector_buffer.data()))
const CDImage::LBA pos = m_media->GetPositionOnDisc();
if (!m_media->ReadRawSector(m_sector_buffer.data(), &m_subq))
{
m_sector_read_result.store(false);
Log_WarningPrintf("Read of LBA %u failed", pos);