214 |
|
// Read TOC |
215 |
|
memset(info.toc, 0, sizeof(info.toc)); |
216 |
|
SysCDReadTOC(info.fh, info.toc); |
217 |
< |
D(bug(" TOC: %08lx %08lx\n", ntohl(((uint32 *)info.toc)[0]), ntohl(((uint32 *)info.toc)[1]))); |
217 |
> |
|
218 |
> |
#if DEBUG |
219 |
> |
// Dump TOC for debugging |
220 |
> |
D(bug(" TOC:\n %02x%02x%02x%02x : %d bytes, first track = %d, last track = %d\n", info.toc[0], info.toc[1], info.toc[2], info.toc[3], (info.toc[0] << 8) | info.toc[1], info.toc[2], info.toc[3])); |
221 |
> |
for (int i=4; i<804; i+=8) { |
222 |
> |
D(bug(" %02x%02x%02x%02x%02x%02x%02x%02x: ", info.toc[i+0], info.toc[i+1], info.toc[i+2], info.toc[i+3], info.toc[i+4], info.toc[i+5], info.toc[i+6], info.toc[i+7])); |
223 |
> |
const char *type = (info.toc[i+2] == 0xaa ? "lead-out" : (info.toc[i+1] & 0x04 ? "data" : "audio")); |
224 |
> |
D(bug("track %d (%s), addr/ctrl 0x%02x, M %d S %d F %d\n", info.toc[i+2], type, info.toc[i+1], info.toc[i+5], info.toc[i+6], info.toc[i+7])); |
225 |
> |
if (info.toc[i+2] == 0xaa) |
226 |
> |
break; |
227 |
> |
} |
228 |
> |
#endif |
229 |
|
|
230 |
|
// Find lead-out track |
231 |
|
info.lead_out[0] = 0; |