I can help with that. It's pretty straightforward. First of all, you need the authoritative source, the "Red Book" standard:byuu wrote: ↑Sat May 04, 2019 5:49 amSo then as I presume the Mega CD BIOS expects to be able to read the raw TOC data, it would be nice to be able to recreate it, even if presently we have to HLE the CDD that reports on what it says. I don't know the format, though.You are correct that TOC is stored in q-channel within the lead-in. Pretty sure the cd ripper programs that extract subchannel data don't even include this, but that info is stored in the cue file to be recreated.
http://nemesis.exodusemulator.com/MegaD ... system.pdf
In that, check out section 17.3, that talks about the subcode structure in general. Follow that to section 17.5.1 specifically, and you'll find that it has a section that states "During the lead-in track, the data format shall be:", which will show the way the channel Q subcode data is used to encode the TOC information in the lead-in area. Of course, a sample makes it easier to understand, so here's some TOC data from a MegaLD rip:
http://nemesis.exodusemulator.com/MegaLD/TOCSnippet.bin
This is just the subcode data, stored in a de-interleaved format (so that each subcode channel appears as a separate sequence of bytes). There's 96 bytes per sector, with 12 bytes per subcode channel running from P-W. Here's a handy program to interpret it:
http://nemesis.exodusemulator.com/MegaLD/sca073.lzh
Open up the TOCSnippet.bin file with that program, and it'll decode the Q channel into its sections for you. The names are based on the ones used for the standard "audio" sectors, but the standards document above will help you map them correctly. One nice thing about the CloneCD (ccd) format is that it actually lists the separate dcoded Q channel fields in its file, at least in the ones I've seen, so it's fairly easy to map the entries in the file to the actual subcode data and rebuild it from that.