static bool NewTest(string path) { bool ret = false; Disc disc; if (Path.GetExtension(path).ToLower() == ".cue") disc = Disc.FromCuePath(path, new CueBinPrefs()); else disc = Disc.FromCCDPath(path); IntPtr mednadisc = mednadisc_LoadCD(path); //TODO - test leadout a bit, or determine length some superior way //TODO - check length against mednadisc int nSectors = (int)(disc.Structure.BinarySize / 2352) - 150; var subbuf = new byte[96]; var discbuf = new byte[2352 + 96]; var monkeybuf = new byte[2352 + 96]; var disc_qbuf = new byte[96]; var monkey_qbuf = new byte[96]; for (int i = 0; i < nSectors; i++) { mednadisc_ReadSector(mednadisc, i, monkeybuf); disc.ReadLBA_2352(i, discbuf, 0); disc.ReadLBA_SectorEntry(i).SubcodeSector.ReadSubcodeDeinterleaved(subbuf, 0); SubcodeUtils.Interleave(subbuf, 0, discbuf, 2352); //remove P for (int q = 2352; q < 2352 + 96; q++) { discbuf[q] &= 0x7F; monkeybuf[q] &= 0x7F; } for (int q = 0; q < 2352 + 96; q++) { if (discbuf[q] != monkeybuf[q]) { Console.WriteLine("MISMATCH: " + Path.GetFileName(path)); //decode Q subchannels for manual investigation SubcodeUtils.Deinterleave(discbuf, 2352, disc_qbuf, 0); var asr = new QuickSubcodeReader(disc_qbuf); SubchannelQ disc_q = new SubchannelQ(); asr.ReadLBA_SubchannelQ(12, ref disc_q); SubcodeUtils.Deinterleave(monkeybuf, 2352, monkey_qbuf, 0); asr = new QuickSubcodeReader(monkey_qbuf); SubchannelQ monkey_q = new SubchannelQ(); asr.ReadLBA_SubchannelQ(12, ref monkey_q); goto END; } } } ret = true; END: disc.Dispose(); mednadisc_CloseCD(mednadisc); return ret; }
static bool NewTest(string path) { bool ret = false; Disc disc; if (Path.GetExtension(path).ToLower() == ".cue") { disc = Disc.FromCuePath(path, new CueBinPrefs()); } else { disc = Disc.FromCCDPath(path); } IntPtr mednadisc = mednadisc_LoadCD(path); //TODO - test leadout a bit, or determine length some superior way //TODO - check length against mednadisc int nSectors = (int)(disc.Structure.BinarySize / 2352) - 150; var subbuf = new byte[96]; var discbuf = new byte[2352 + 96]; var monkeybuf = new byte[2352 + 96]; var disc_qbuf = new byte[96]; var monkey_qbuf = new byte[96]; for (int i = 0; i < nSectors; i++) { mednadisc_ReadSector(mednadisc, i, monkeybuf); disc.ReadLBA_2352(i, discbuf, 0); disc.ReadLBA_SectorEntry(i).SubcodeSector.ReadSubcodeDeinterleaved(subbuf, 0); SubcodeUtils.Interleave(subbuf, 0, discbuf, 2352); //remove P for (int q = 2352; q < 2352 + 96; q++) { discbuf[q] &= 0x7F; monkeybuf[q] &= 0x7F; } for (int q = 0; q < 2352 + 96; q++) { if (discbuf[q] != monkeybuf[q]) { Console.WriteLine("MISMATCH: " + Path.GetFileName(path)); //decode Q subchannels for manual investigation SubcodeUtils.Deinterleave(discbuf, 2352, disc_qbuf, 0); var asr = new QuickSubcodeReader(disc_qbuf); SubchannelQ disc_q = new SubchannelQ(); asr.ReadLBA_SubchannelQ(12, ref disc_q); SubcodeUtils.Deinterleave(monkeybuf, 2352, monkey_qbuf, 0); asr = new QuickSubcodeReader(monkey_qbuf); SubchannelQ monkey_q = new SubchannelQ(); asr.ReadLBA_SubchannelQ(12, ref monkey_q); goto END; } } } ret = true; END: disc.Dispose(); mednadisc_CloseCD(mednadisc); return(ret); }