1 /***************************************************************************
2 * Copyright (C) 2007 PCSX-df Team *
3 * Copyright (C) 2009 Wei Mingzhi *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA. *
19 ***************************************************************************/
21 #include "psxcommon.h"
35 static FILE *cdHandle = NULL;
36 static FILE *cddaHandle = NULL;
37 static FILE *subHandle = NULL;
39 static boolean subChanMixed = FALSE;
40 static boolean subChanRaw = FALSE;
42 static unsigned char cdbuffer[DATA_SIZE];
43 static unsigned char subbuffer[SUB_FRAMESIZE];
45 static unsigned char sndbuffer[CD_FRAMESIZE_RAW * 10];
47 #define CDDA_FRAMETIME (1000 * (sizeof(sndbuffer) / CD_FRAMESIZE_RAW) / 75)
50 static HANDLE threadid;
52 static pthread_t threadid;
54 static unsigned int initial_offset = 0;
55 static boolean playing = FALSE;
56 static boolean cddaBigEndian = FALSE;
57 static unsigned int cddaCurOffset = 0;
58 static unsigned int cddaStartOffset;
60 char* CALLBACK CDR__getDriveLetter(void);
61 long CALLBACK CDR__configure(void);
62 long CALLBACK CDR__test(void);
63 void CALLBACK CDR__about(void);
64 long CALLBACK CDR__setfilename(char *filename);
65 long CALLBACK CDR__getStatus(struct CdrStat *stat);
67 static void DecodeRawSubData(void);
69 extern void *hCDRDriver;
72 enum {DATA, CDDA} type;
73 char start[3]; // MSF-format
74 char length[3]; // MSF-format
75 FILE *handle; // for multi-track images CDDA
76 int start_offset; // sector offset from start of above file
79 #define MAXTRACKS 100 /* How many tracks can a CD hold? */
81 static int numtracks = 0;
82 static struct trackinfo ti[MAXTRACKS];
84 // get a sector from a msf-array
85 static unsigned int msf2sec(char *msf) {
86 return ((msf[0] * 60 + msf[1]) * 75) + msf[2];
89 static void sec2msf(unsigned int s, char *msf) {
91 s = s - msf[0] * 75 * 60;
97 // divide a string of xx:yy:zz into m, s, f
98 static void tok2msf(char *time, char *msf) {
101 token = strtok(time, ":");
103 msf[0] = atoi(token);
109 token = strtok(NULL, ":");
111 msf[1] = atoi(token);
117 token = strtok(NULL, ":");
119 msf[2] = atoi(token);
127 static long GetTickCount(void) {
128 static time_t initial_time = 0;
131 gettimeofday(&now, NULL);
133 if (initial_time == 0) {
134 initial_time = now.tv_sec;
137 return (now.tv_sec - initial_time) * 1000L + now.tv_usec / 1000L;
141 // this thread plays audio data
143 static void playthread(void *param)
145 static void *playthread(void *param)
154 d = t - (long)GetTickCount();
158 else if (d > CDDA_FRAMETIME) {
166 // HACK: stop feeding data while emu is paused
173 t = GetTickCount() + CDDA_FRAMETIME;
178 for (i = 0; i < sizeof(sndbuffer) / CD_FRAMESIZE_RAW; i++) {
180 d = fread(sndbuffer + CD_FRAMESIZE_RAW * i, 1, CD_FRAMESIZE_RAW, cddaHandle);
181 if (d < CD_FRAMESIZE_RAW) {
187 fread(subbuffer, 1, SUB_FRAMESIZE, cddaHandle);
188 if (subChanRaw) DecodeRawSubData();
192 s = fread(sndbuffer, 1, sizeof(sndbuffer), cddaHandle);
194 if (subHandle != NULL) {
195 fread(subbuffer, 1, SUB_FRAMESIZE, subHandle);
196 if (subChanRaw) DecodeRawSubData();
198 // a bit crude but ohwell
199 fseek(subHandle, (sizeof(sndbuffer) / CD_FRAMESIZE_RAW - 1) * SUB_FRAMESIZE, SEEK_CUR);
209 if (!cdr.Muted && playing) {
211 for (i = 0; i < s / 2; i++) {
212 tmp = sndbuffer[i * 2];
213 sndbuffer[i * 2] = sndbuffer[i * 2 + 1];
214 sndbuffer[i * 2 + 1] = tmp;
218 SPU_playCDDAchannel((short *)sndbuffer, s);
232 // stop the CDDA playback
233 static void stopCDDA() {
240 WaitForSingleObject(threadid, INFINITE);
242 pthread_join(threadid, NULL);
248 // start the CDDA playback
249 static void startCDDA(unsigned int offset) {
251 if (initial_offset == offset) {
257 initial_offset = offset;
258 cddaCurOffset = initial_offset;
259 fseek(cddaHandle, initial_offset, SEEK_SET);
264 threadid = (HANDLE)_beginthread(playthread, 0, NULL);
266 pthread_create(&threadid, NULL, playthread, NULL);
270 // this function tries to get the .toc file of the given .bin
271 // the necessary data is put into the ti (trackinformation)-array
272 static int parsetoc(const char *isofile) {
273 char tocname[MAXPATHLEN];
275 char linebuf[256], dummy[256], name[256];
277 char time[20], time2[20];
278 unsigned int t, sector_offs;
282 // copy name of the iso and change extension from .bin to .toc
283 strncpy(tocname, isofile, sizeof(tocname));
284 tocname[MAXPATHLEN - 1] = '\0';
285 if (strlen(tocname) >= 4) {
286 strcpy(tocname + strlen(tocname) - 4, ".toc");
292 if ((fi = fopen(tocname, "r")) == NULL) {
293 // try changing extension to .cue (to satisfy some stupid tutorials)
294 strcpy(tocname + strlen(tocname) - 4, ".cue");
295 if ((fi = fopen(tocname, "r")) == NULL) {
296 // if filename is image.toc.bin, try removing .bin (for Brasero)
297 strcpy(tocname, isofile);
299 if (t >= 8 && strcmp(tocname + t - 8, ".toc.bin") == 0) {
300 tocname[t - 4] = '\0';
301 if ((fi = fopen(tocname, "r")) == NULL) {
311 memset(&ti, 0, sizeof(ti));
312 cddaBigEndian = TRUE; // cdrdao uses big-endian for CD Audio
314 sector_offs = 2 * 75;
316 // parse the .toc file
317 while (fgets(linebuf, sizeof(linebuf), fi) != NULL) {
319 strncpy(dummy, linebuf, sizeof(linebuf));
320 token = strtok(dummy, " ");
322 if (token == NULL) continue;
324 if (!strcmp(token, "TRACK")) {
326 token = strtok(NULL, " ");
329 if (!strncmp(token, "MODE2_RAW", 9)) {
330 ti[numtracks].type = DATA;
331 sec2msf(2 * 75, ti[numtracks].start); // assume data track on 0:2:0
333 // check if this image contains mixed subchannel data
334 token = strtok(NULL, " ");
335 if (token != NULL && !strncmp(token, "RW_RAW", 6)) {
340 else if (!strncmp(token, "AUDIO", 5)) {
341 ti[numtracks].type = CDDA;
344 else if (!strcmp(token, "DATAFILE")) {
345 if (ti[numtracks].type == CDDA) {
346 sscanf(linebuf, "DATAFILE \"%[^\"]\" #%d %8s", name, &t, time2);
347 t /= CD_FRAMESIZE_RAW + (subChanMixed ? SUB_FRAMESIZE : 0);
348 ti[numtracks].start_offset = t;
350 sec2msf(t, (char *)&ti[numtracks].start);
351 tok2msf((char *)&time2, (char *)&ti[numtracks].length);
354 sscanf(linebuf, "DATAFILE \"%[^\"]\" %8s", name, time);
355 tok2msf((char *)&time, (char *)&ti[numtracks].length);
358 else if (!strcmp(token, "FILE")) {
359 sscanf(linebuf, "FILE \"%[^\"]\" #%d %8s %8s", name, &t, time, time2);
360 tok2msf((char *)&time, (char *)&ti[numtracks].start);
361 t /= CD_FRAMESIZE_RAW + (subChanMixed ? SUB_FRAMESIZE : 0);
362 ti[numtracks].start_offset = t;
363 t += msf2sec(ti[numtracks].start) + sector_offs;
364 sec2msf(t, (char *)&ti[numtracks].start);
365 tok2msf((char *)&time2, (char *)&ti[numtracks].length);
367 else if (!strcmp(token, "ZERO")) {
368 sscanf(linebuf, "ZERO AUDIO RW_RAW %8s", time);
369 tok2msf((char *)&time, dummy);
370 sector_offs += msf2sec(dummy);
379 // this function tries to get the .cue file of the given .bin
380 // the necessary data is put into the ti (trackinformation)-array
381 static int parsecue(const char *isofile) {
382 char cuename[MAXPATHLEN];
383 char filepath[MAXPATHLEN];
389 char linebuf[256], tmpb[256], dummy[256];
390 unsigned int incue_max_len;
391 unsigned int t, file_len, sector_offs;
395 // copy name of the iso and change extension from .bin to .cue
396 strncpy(cuename, isofile, sizeof(cuename));
397 cuename[MAXPATHLEN - 1] = '\0';
398 if (strlen(cuename) >= 4) {
399 strcpy(cuename + strlen(cuename) - 4, ".cue");
405 if ((fi = fopen(cuename, "r")) == NULL) {
409 // Some stupid tutorials wrongly tell users to use cdrdao to rip a
410 // "bin/cue" image, which is in fact a "bin/toc" image. So let's check
412 if (fgets(linebuf, sizeof(linebuf), fi) != NULL) {
413 if (!strncmp(linebuf, "CD_ROM_XA", 9)) {
414 // Don't proceed further, as this is actually a .toc file rather
417 return parsetoc(isofile);
419 fseek(fi, 0, SEEK_SET);
422 // build a path for files referenced in .cue
423 strncpy(filepath, cuename, sizeof(filepath));
424 tmp = strrchr(filepath, '/') + 1;
426 tmp = strrchr(filepath, '\\') + 1;
430 filepath[sizeof(filepath) - 1] = 0;
432 incue_max_len = sizeof(filepath) - (tmp - filepath) - 1;
434 memset(&ti, 0, sizeof(ti));
437 sector_offs = 2 * 75;
439 while (fgets(linebuf, sizeof(linebuf), fi) != NULL) {
440 strncpy(dummy, linebuf, sizeof(linebuf));
441 token = strtok(dummy, " ");
447 if (!strcmp(token, "TRACK")) {
450 if (strstr(linebuf, "AUDIO") != NULL) {
451 ti[numtracks].type = CDDA;
453 else if (strstr(linebuf, "MODE1/2352") != NULL || strstr(linebuf, "MODE2/2352") != NULL) {
454 ti[numtracks].type = DATA;
457 else if (!strcmp(token, "INDEX")) {
458 sscanf(linebuf, " INDEX %02d %8s", &t, time);
459 tok2msf(time, (char *)&ti[numtracks].start);
461 t = msf2sec(ti[numtracks].start);
462 ti[numtracks].start_offset = t;
464 sec2msf(t, ti[numtracks].start);
466 // default track length to file length
467 t = file_len - ti[numtracks].start_offset;
468 sec2msf(t, ti[numtracks].length);
470 if (numtracks > 1 && ti[numtracks].handle == NULL) {
471 // this track uses the same file as the last,
472 // start of this track is last track's end
473 t = msf2sec(ti[numtracks].start) - msf2sec(ti[numtracks - 1].start);
474 sec2msf(t, ti[numtracks - 1].length);
477 else if (!strcmp(token, "PREGAP")) {
478 if (sscanf(linebuf, " PREGAP %8s", time) == 1) {
479 tok2msf(time, dummy);
480 sector_offs += msf2sec(dummy);
483 else if (!strcmp(token, "FILE")) {
484 sscanf(linebuf, " FILE \"%[^\"]\"", tmpb);
487 ti[numtracks + 1].handle = fopen(tmpb, "rb");
488 if (ti[numtracks + 1].handle == NULL) {
490 tmp = strrchr(tmpb, '\\');
492 tmp = strrchr(tmpb, '/');
497 strncpy(incue_fname, tmp, incue_max_len);
498 ti[numtracks + 1].handle = fopen(filepath, "rb");
501 // update global offset if this is not first file in this .cue
502 if (numtracks + 1 > 1)
503 sector_offs += file_len;
506 if (ti[numtracks + 1].handle == NULL) {
507 SysPrintf(_("\ncould not open: %s\n"), filepath);
510 fseek(ti[numtracks + 1].handle, 0, SEEK_END);
511 file_len = ftell(ti[numtracks + 1].handle) / 2352;
513 if (numtracks == 0 && strlen(isofile) >= 4 &&
514 strcmp(isofile + strlen(isofile) - 4, ".cue") == 0)
516 // user selected .cue as image file, use it's data track instead
518 cdHandle = fopen(filepath, "rb");
528 // this function tries to get the .ccd file of the given .img
529 // the necessary data is put into the ti (trackinformation)-array
530 static int parseccd(const char *isofile) {
531 char ccdname[MAXPATHLEN];
538 // copy name of the iso and change extension from .img to .ccd
539 strncpy(ccdname, isofile, sizeof(ccdname));
540 ccdname[MAXPATHLEN - 1] = '\0';
541 if (strlen(ccdname) >= 4) {
542 strcpy(ccdname + strlen(ccdname) - 4, ".ccd");
548 if ((fi = fopen(ccdname, "r")) == NULL) {
552 memset(&ti, 0, sizeof(ti));
554 while (fgets(linebuf, sizeof(linebuf), fi) != NULL) {
555 if (!strncmp(linebuf, "[TRACK", 6)){
558 else if (!strncmp(linebuf, "MODE=", 5)) {
559 sscanf(linebuf, "MODE=%d", &t);
560 ti[numtracks].type = ((t == 0) ? CDDA : DATA);
562 else if (!strncmp(linebuf, "INDEX 1=", 8)) {
563 sscanf(linebuf, "INDEX 1=%d", &t);
564 sec2msf(t + 2 * 75, ti[numtracks].start);
565 ti[numtracks].start_offset = t;
567 // If we've already seen another track, this is its end
569 t = msf2sec(ti[numtracks].start) - msf2sec(ti[numtracks - 1].start);
570 sec2msf(t, ti[numtracks - 1].length);
577 // Fill out the last track's end based on size
578 if (numtracks >= 1) {
579 fseek(cdHandle, 0, SEEK_END);
580 t = ftell(cdHandle) / 2352 - msf2sec(ti[numtracks].start) + 2 * 75;
581 sec2msf(t, ti[numtracks].length);
587 // this function tries to get the .mds file of the given .mdf
588 // the necessary data is put into the ti (trackinformation)-array
589 static int parsemds(const char *isofile) {
590 char mdsname[MAXPATHLEN];
592 unsigned int offset, extra_offset, l, i;
597 // copy name of the iso and change extension from .mdf to .mds
598 strncpy(mdsname, isofile, sizeof(mdsname));
599 mdsname[MAXPATHLEN - 1] = '\0';
600 if (strlen(mdsname) >= 4) {
601 strcpy(mdsname + strlen(mdsname) - 4, ".mds");
607 if ((fi = fopen(mdsname, "rb")) == NULL) {
611 memset(&ti, 0, sizeof(ti));
613 // check if it's a valid mds file
614 fread(&i, 1, sizeof(unsigned int), fi);
616 if (i != 0x4944454D) {
617 // not an valid mds file
622 // get offset to session block
623 fseek(fi, 0x50, SEEK_SET);
624 fread(&offset, 1, sizeof(unsigned int), fi);
625 offset = SWAP32(offset);
627 // get total number of tracks
629 fseek(fi, offset, SEEK_SET);
630 fread(&s, 1, sizeof(unsigned short), fi);
634 // get offset to track blocks
635 fseek(fi, 4, SEEK_CUR);
636 fread(&offset, 1, sizeof(unsigned int), fi);
637 offset = SWAP32(offset);
641 fseek(fi, offset + 4, SEEK_SET);
642 if (fgetc(fi) < 0xA0) {
648 // check if the image contains mixed subchannel data
649 fseek(fi, offset + 1, SEEK_SET);
650 subChanMixed = (fgetc(fi) ? TRUE : FALSE);
653 for (i = 1; i <= numtracks; i++) {
654 fseek(fi, offset, SEEK_SET);
656 // get the track type
657 ti[i].type = ((fgetc(fi) == 0xA9) ? CDDA : DATA);
658 fseek(fi, 8, SEEK_CUR);
660 // get the track starting point
661 ti[i].start[0] = fgetc(fi);
662 ti[i].start[1] = fgetc(fi);
663 ti[i].start[2] = fgetc(fi);
665 // get the track length
666 fread(&extra_offset, 1, sizeof(unsigned int), fi);
667 extra_offset = SWAP32(extra_offset);
669 fseek(fi, extra_offset + 4, SEEK_SET);
670 fread(&l, 1, sizeof(unsigned int), fi);
672 sec2msf(l, ti[i].length);
674 // get track start offset (in .mdf)
675 fseek(fi, offset + 0x28, SEEK_SET);
676 fread(&l, 1, sizeof(unsigned int), fi);
678 ti[i].start_offset = l / CD_FRAMESIZE_RAW;
687 // this function tries to get the .sub file of the given .img
688 static int opensubfile(const char *isoname) {
689 char subname[MAXPATHLEN];
691 // copy name of the iso and change extension from .img to .sub
692 strncpy(subname, isoname, sizeof(subname));
693 subname[MAXPATHLEN - 1] = '\0';
694 if (strlen(subname) >= 4) {
695 strcpy(subname + strlen(subname) - 4, ".sub");
701 subHandle = fopen(subname, "rb");
702 if (subHandle == NULL) {
709 static int opensbifile(const char *isoname) {
710 char sbiname[MAXPATHLEN];
713 strncpy(sbiname, isoname, sizeof(sbiname));
714 sbiname[MAXPATHLEN - 1] = '\0';
715 if (strlen(sbiname) >= 4) {
716 strcpy(sbiname + strlen(sbiname) - 4, ".sbi");
722 fseek(cdHandle, 0, SEEK_END);
723 s = ftell(cdHandle) / 2352;
725 return LoadSBI(sbiname, s);
728 static void PrintTracks(void) {
731 for (i = 1; i <= numtracks; i++) {
732 SysPrintf(_("Track %.2d (%s) - Start %.2d:%.2d:%.2d, Length %.2d:%.2d:%.2d\n"),
733 i, (ti[i].type == DATA ? "DATA" : "AUDIO"),
734 ti[i].start[0], ti[i].start[1], ti[i].start[2],
735 ti[i].length[0], ti[i].length[1], ti[i].length[2]);
739 // This function is invoked by the front-end when opening an ISO
741 static long CALLBACK ISOopen(void) {
742 if (cdHandle != NULL) {
743 return 0; // it's already open
746 cdHandle = fopen(GetIsoFile(), "rb");
747 if (cdHandle == NULL) {
751 SysPrintf(_("Loaded CD Image: %s"), GetIsoFile());
753 cddaBigEndian = FALSE;
754 subChanMixed = FALSE;
757 if (parsecue(GetIsoFile()) == 0) {
760 else if (parsetoc(GetIsoFile()) == 0) {
763 else if (parseccd(GetIsoFile()) == 0) {
766 else if (parsemds(GetIsoFile()) == 0) {
770 if (!subChanMixed && opensubfile(GetIsoFile()) == 0) {
773 if (opensbifile(GetIsoFile()) == 0) {
781 // make sure we have another handle open for cdda
782 if (numtracks > 1 && ti[1].handle == NULL) {
783 ti[1].handle = fopen(GetIsoFile(), "rb");
785 cddaCurOffset = cddaStartOffset = 0;
790 static long CALLBACK ISOclose(void) {
793 if (cdHandle != NULL) {
797 if (subHandle != NULL) {
804 for (i = 1; i <= numtracks; i++) {
805 if (ti[i].handle != NULL) {
806 fclose(ti[i].handle);
816 static long CALLBACK ISOinit(void) {
817 assert(cdHandle == NULL);
818 assert(subHandle == NULL);
820 return 0; // do nothing
823 static long CALLBACK ISOshutdown(void) {
828 // return Starting and Ending Track
830 // byte 0 - start track
831 // byte 1 - end track
832 static long CALLBACK ISOgetTN(unsigned char *buffer) {
836 buffer[1] = numtracks;
850 static long CALLBACK ISOgetTD(unsigned char track, unsigned char *buffer) {
852 // CD length according pcsxr-svn (done a bit different here)
854 unsigned char time[3];
855 sect = msf2sec(ti[numtracks].start) + msf2sec(ti[numtracks].length);
856 sec2msf(sect, (char *)time);
861 else if (numtracks > 0 && track <= numtracks) {
862 buffer[2] = ti[track].start[0];
863 buffer[1] = ti[track].start[1];
864 buffer[0] = ti[track].start[2];
875 // decode 'raw' subchannel data ripped by cdrdao
876 static void DecodeRawSubData(void) {
877 unsigned char subQData[12];
880 memset(subQData, 0, sizeof(subQData));
882 for (i = 0; i < 8 * 12; i++) {
883 if (subbuffer[i] & (1 << 6)) { // only subchannel Q is needed
884 subQData[i >> 3] |= (1 << (7 - (i & 7)));
888 memcpy(&subbuffer[12], subQData, 12);
892 // time: byte 0 - minute; byte 1 - second; byte 2 - frame
894 static long CALLBACK ISOreadTrack(unsigned char *time) {
895 int sector = MSF2SECT(btoi(time[0]), btoi(time[1]), btoi(time[2]));
897 if (cdHandle == NULL) {
902 fseek(cdHandle, sector * (CD_FRAMESIZE_RAW + SUB_FRAMESIZE) + 12, SEEK_SET);
903 fread(cdbuffer, 1, DATA_SIZE, cdHandle);
904 fread(subbuffer, 1, SUB_FRAMESIZE, cdHandle);
906 if (subChanRaw) DecodeRawSubData();
909 fseek(cdHandle, sector * CD_FRAMESIZE_RAW + 12, SEEK_SET);
910 fread(cdbuffer, 1, DATA_SIZE, cdHandle);
912 if (subHandle != NULL) {
913 fseek(subHandle, sector * SUB_FRAMESIZE, SEEK_SET);
914 fread(subbuffer, 1, SUB_FRAMESIZE, subHandle);
916 if (subChanRaw) DecodeRawSubData();
923 // return readed track
924 static unsigned char * CALLBACK ISOgetBuffer(void) {
929 // sector: byte 0 - minute; byte 1 - second; byte 2 - frame
930 // does NOT uses bcd format
931 static long CALLBACK ISOplay(unsigned char *time) {
932 unsigned int i, abs_sect;
939 abs_sect = msf2sec((char *)time);
940 for (i = numtracks; i > 1; i--)
941 if (msf2sec(ti[i].start) <= abs_sect + 2 * 75)
944 file_sect = ti[i].start_offset + (abs_sect - msf2sec(ti[i].start));
948 // find the file that contains this track
950 if (ti[i].handle != NULL)
953 cddaStartOffset = abs_sect - file_sect;
954 cddaHandle = ti[i].handle;
956 if (SPU_playCDDAchannel != NULL) {
958 startCDDA(file_sect * (CD_FRAMESIZE_RAW + SUB_FRAMESIZE));
961 startCDDA(file_sect * CD_FRAMESIZE_RAW);
962 if (subHandle != NULL)
963 fseek(subHandle, file_sect * SUB_FRAMESIZE, SEEK_SET);
970 static long CALLBACK ISOstop(void) {
975 // gets subchannel data
976 static unsigned char* CALLBACK ISOgetBufferSub(void) {
977 if (subHandle != NULL || subChanMixed) {
984 static long CALLBACK ISOgetStatus(struct CdrStat *stat) {
987 CDR__getStatus(stat);
991 stat->Status |= 0x80;
997 sec = (cddaStartOffset + cddaCurOffset) / CD_FRAMESIZE_RAW;
998 sec2msf(sec, (char *)stat->Time);
1003 void cdrIsoInit(void) {
1005 CDR_shutdown = ISOshutdown;
1007 CDR_close = ISOclose;
1008 CDR_getTN = ISOgetTN;
1009 CDR_getTD = ISOgetTD;
1010 CDR_readTrack = ISOreadTrack;
1011 CDR_getBuffer = ISOgetBuffer;
1014 CDR_getBufferSub = ISOgetBufferSub;
1015 CDR_getStatus = ISOgetStatus;
1017 CDR_getDriveLetter = CDR__getDriveLetter;
1018 CDR_configure = CDR__configure;
1019 CDR_test = CDR__test;
1020 CDR_about = CDR__about;
1021 CDR_setfilename = CDR__setfilename;
1026 int cdrIsoActive(void) {
1027 return (cdHandle != NULL);