mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-19 14:55:38 +00:00
CDImage: Better handle sequential reading into lead-out area
This commit is contained in:
parent
684e83168e
commit
712168cf45
|
@ -233,7 +233,6 @@ bool CDImage::GenerateSubChannelQ(SubChannelQ* subq, LBA lba)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const u32 index_offset = index->start_lba_on_disc - lba;
|
const u32 index_offset = index->start_lba_on_disc - lba;
|
||||||
;
|
|
||||||
GenerateSubChannelQ(subq, index, index_offset);
|
GenerateSubChannelQ(subq, index, index_offset);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -241,7 +240,7 @@ bool CDImage::GenerateSubChannelQ(SubChannelQ* subq, LBA lba)
|
||||||
void CDImage::GenerateSubChannelQ(SubChannelQ* subq, const Index* index, u32 index_offset)
|
void CDImage::GenerateSubChannelQ(SubChannelQ* subq, const Index* index, u32 index_offset)
|
||||||
{
|
{
|
||||||
subq->control.bits = index->control.bits;
|
subq->control.bits = index->control.bits;
|
||||||
subq->track_number_bcd = BinaryToBCD(index->track_number);
|
subq->track_number_bcd = (index->track_number <= m_tracks.size() ? BinaryToBCD(index->track_number) : index->track_number);
|
||||||
subq->index_number_bcd = BinaryToBCD(index->index_number);
|
subq->index_number_bcd = BinaryToBCD(index->index_number);
|
||||||
|
|
||||||
const Position relative_position =
|
const Position relative_position =
|
||||||
|
@ -256,13 +255,15 @@ void CDImage::GenerateSubChannelQ(SubChannelQ* subq, const Index* index, u32 ind
|
||||||
|
|
||||||
void CDImage::AddLeadOutIndex()
|
void CDImage::AddLeadOutIndex()
|
||||||
{
|
{
|
||||||
|
Assert(!m_indices.empty());
|
||||||
|
const Index& last_index = m_indices.back();
|
||||||
|
|
||||||
Index index = {};
|
Index index = {};
|
||||||
index.start_lba_on_disc = m_lba_count;
|
index.start_lba_on_disc = last_index.start_lba_on_disc + last_index.length;
|
||||||
index.length = LEAD_OUT_SECTOR_COUNT;
|
index.length = LEAD_OUT_SECTOR_COUNT;
|
||||||
index.track_number = LEAD_OUT_TRACK_NUMBER;
|
index.track_number = LEAD_OUT_TRACK_NUMBER;
|
||||||
index.index_number = 0;
|
index.index_number = 0;
|
||||||
if (!m_indices.empty())
|
index.control.bits = last_index.control.bits;
|
||||||
index.control.bits = m_indices.back().control.bits;
|
|
||||||
m_indices.push_back(index);
|
m_indices.push_back(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue