+ unsigned int buflen = CD_FRAMESIZE_RAW; // Raw read, 2352 bytes per sector
+ //unsigned char *buf = new unsigned int[buflen]; // DOSBOX, do we need this?
+ int ret;
+ struct cdrom_read cdrom_read;
+
+ // Let us open the device_name and check if we can open the CD-ROM.
+ int cdrom_fd = open(device_name, O_RDONLY | O_NONBLOCK);
+ if (cdrom_fd <= 0)
+ {
+ // CD-ROM isn't accessable.
+ // Write the error in the log file and return false.
+ WriteLog("CDINTF: CDIntfReadBlock - Unable to open CDROM!\n");
+ return false;
+ }
+
+ // Setting up the cdrom_read struct :
+ cdrom_read.cdread_lba = sector; // Which sector to read.
+ cdrom_read.cdread_bufaddr = (char*)buffer; // Where to put the data (?)
+ cdrom_read.cdread_buflen = buflen; // 2352 bytes/sector -> RAW read
+
+ // Let us read the content we want. -1 (false) when it didn't work.
+ ret = ioctl(cdrom_fd, CDROMREADRAW, &cdrom_read);
+
+ // Close the CD-ROM.
+ close(cdrom_fd);
+
+ // The following was taken from DOSBOX. After reading the content, they write
+ // back the information from buf (based upon the size of buflen) to buffer.
+ // I think that this is not needed. *fingers crossed*
+ //
+ // MEM_BlockWrite(buffer, buf, buflen);
+ // delete[] buf;
+
+ // Uncomment the following for debug reasons.
+ //
+ // WriteLog("CDINTF: CDIntfReadBlock - Reading sector %d!\n", sector);
+
+ return (ret > 0);
+