diff --git a/pcsx2/CDVD/CDVDdiscReader.cpp b/pcsx2/CDVD/CDVDdiscReader.cpp index 89ba329a4d..f8f804201b 100644 --- a/pcsx2/CDVD/CDVDdiscReader.cpp +++ b/pcsx2/CDVD/CDVDdiscReader.cpp @@ -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 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; } }