Skip to content

Commit

Permalink
0 index into tracks array
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdbeardgame committed Sep 16, 2024
1 parent 9d74f5e commit 7544b77
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pcsx2/CDVD/CDVDdiscReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,31 +76,35 @@ void cdvdParseTOC()
strack = 0xFF;
etrack = 0;

int i = 0;

for (auto& entry : src->ReadTOC())
{
if (entry.track < 1 || entry.track > 99)
continue;
strack = std::min(strack, entry.track);
etrack = std::max(etrack, entry.track);
tracks[entry.track].start_lba = entry.lba;
tracks[i].start_lba = entry.lba;
if ((entry.control & 0x0C) == 0x04)
{
std::array<u8, 2352> buffer;
// Byte 15 of a raw CD data sector determines the track mode
if (src->ReadSectors2352(entry.lba, 1, buffer.data()) && (buffer[15] & 3) == 2)
{
tracks[entry.track].type = CDVD_MODE2_TRACK;
tracks[i].type = CDVD_MODE2_TRACK;
}
else
{
tracks[entry.track].type = CDVD_MODE1_TRACK;
tracks[i].type = CDVD_MODE1_TRACK;
}
}
else
{
tracks[entry.track].type = CDVD_AUDIO_TRACK;
tracks[i].type = CDVD_AUDIO_TRACK;
}
fprintf(stderr, "Track %u start sector: %u\n", entry.track, entry.lba);

i += 1;
}
}

Expand Down

0 comments on commit 7544b77

Please sign in to comment.