CD-i: Fix table of contents (#1043)

Repair of accidental removal of subcode generation
during Lead-In. (negative lba)

Bug was introduced with c0171c9
This commit is contained in:
Andre Zeps
2025-09-30 08:27:16 +02:00
committed by GitHub
parent aa998b6fa2
commit 1addb89ffe

View File

@@ -657,6 +657,8 @@ void subcode_data(int lba, struct subcode &out)
as = rem_lba / 75;
af = rem_lba % 75;
if (toc_entry_count == 0) // catch division by zero
return;
auto &toc_entry = toc_buffer[lba % toc_entry_count];
out.control = htons(toc_entry.control);
@@ -817,6 +819,7 @@ void cdi_read_cd(uint8_t *buffer, int lba, int cnt)
}
buffer += CD_SECTOR_LEN;
subcode_data(lba, *reinterpret_cast<struct subcode *>(buffer));
buffer += sizeof(struct subcode);
cnt--;
lba++;