s32 CDreadTrack(u32 lsn, int mode, u8 *buffer) { s32 s32result; #ifdef VERBOSE_FUNCTION PrintLog("CDVD driver: CDreadTrack(%i)", lsn); #endif /* VERBOSE_FUNCTION */ s32result = 0; if (buffer == NULL) return(-1); // The CD way of figuring out where to read. LBAtoMSF(lsn, buffer); switch (mode) { case CDVD_MODE_2048: case CDVD_MODE_2328: case CDVD_MODE_2340: case CDVD_MODE_2352: errno = 4; // Interrupted system call... (simulated the first time) while (errno == 4) { errno = 0; s32result = ioctl(devicehandle, CDROMREADRAW, buffer); } // ENDWHILE- Continually being interrupted by the system... break; case CDVD_MODE_2368: // Unimplemented... as yet. default: #ifdef VERBOSE_WARNINGS PrintLog("CDVD driver: Unknown Mode %i", mode); #endif /* VERBOSE_WARNINGS */ return(-1); // Illegal Read Mode? Abort break; } // ENDSWITCH- Which read mode should we choose? if ((s32result == -1) || (errno != 0)) { #ifdef VERBOSE_WARNINGS PrintLog("CDVD driver: Error reading CD: %i:%s", errno, strerror(errno)); #endif /* VERBOSE_WARNINGS */ InitCDSectorInfo(); return(-1); } // ENDIF- Trouble getting a track count? cdmode = mode; // Save mode for buffer positioning later. return(0); // Call accomplished } // END CDreadTrack()
void InitCDInfo() { InitCDSectorInfo(); } // END InitDiscType()