]> Shamusworld >> Repos - virtualjaguar/commitdiff
Initial refactoring of CD interface backend code.
authorShamus Hammons <jlhamm@acm.org>
Thu, 31 May 2007 03:42:39 +0000 (03:42 +0000)
committerShamus Hammons <jlhamm@acm.org>
Thu, 31 May 2007 03:42:39 +0000 (03:42 +0000)
src/cdintf.cpp

index f6e647f202ee181adc485ac14bdb22161443756a..35ebf986b919add92999328b9722fa47ec8b195d 100644 (file)
 
 #endif
 
+/*
 static void TestCDIO(void)
 {
        // See what (if anything) is installed.
-       CdIo_t * p_cdio = cdio_open(0/*NULL*/, DRIVER_DEVICE);
+       CdIo_t * p_cdio = cdio_open(0, DRIVER_DEVICE);
        driver_id_t driver_id;
 
        if (p_cdio != NULL)
@@ -52,6 +53,7 @@ static void TestCDIO(void)
                WriteLog("CDIO: A suitable CD-ROM driver was not found.\n\n");
        }
 }
+*/
 
 //
 // *** OK, here's where we're going to attempt to put the platform agnostic CD interface ***
@@ -61,51 +63,72 @@ static CdIo_t * cdioPtr = NULL;
 
 bool CDIntfInit(void)
 {
-       WriteLog("CDINTF: Init unimplemented!\n");
-       return false;
+       cdioPtr = cdio_open(NULL, DRIVER_DEVICE);
+
+       if (cdioPtr == NULL)
+       {
+               WriteLog("CDINTF: No suitable CD-ROM driver found.\n");
+               return false;
+       }
+
+       return true;
 }
 
 void CDIntfDone(void)
 {
+       WriteLog("CDINTF: Shutting down CD-ROM subsystem.\n");
+
+       if (cdioPtr)
+               cdio_destroy(cdioPtr);
 }
 
 bool CDIntfReadBlock(uint32 sector, uint8 * buffer)
 {
+       // !!! FIX !!!
        WriteLog("CDINTF: ReadBlock unimplemented!\n");
        return false;
 }
 
 uint32 CDIntfGetNumSessions(void)
 {
+       // !!! FIX !!!
        // Still need relevant code here... !!! FIX !!!
        return 2;
 }
 
 void CDIntfSelectDrive(uint32 driveNum)
 {
+       // !!! FIX !!!
        WriteLog("CDINTF: SelectDrive unimplemented!\n");
 }
 
 uint32 CDIntfGetCurrentDrive(void)
 {
+       // !!! FIX !!!
        WriteLog("CDINTF: GetCurrentDrive unimplemented!\n");
        return 0;
 }
 
-const uint8 * CDIntfGetDriveName(uint32)
+const uint8 * CDIntfGetDriveName(uint32 driveNum)
 {
-       WriteLog("CDINTF: GetDriveName unimplemented!\n");
-       return NULL;
+       // driveNum is currently ignored... !!! FIX !!!
+
+       uint8 * driveName = (uint8 *)cdio_get_default_device(cdioPtr);
+       WriteLog("CDINTF: The drive name for the current driver is %s.\n", driveName);
+
+       return driveName;
 }
 
 uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset)
 {
+       // !!! FIX !!!
        WriteLog("CDINTF: GetSessionInfo unimplemented!\n");
        return 0xFF;
 }
 
 uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset)
 {
+       // !!! FIX !!!
        WriteLog("CDINTF: GetTrackInfo unimplemented!\n");
        return 0xFF;
 }