2 // OS agnostic CDROM interface functions
5 // (C) 2010 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- -------------------------------------------------------------
11 // JLH 01/16/2010 Created this log ;-)
15 // This now uses the supposedly cross-platform libcdio to do the necessary
16 // low-level CD twiddling we need that libsdl can't do currently. Jury is
17 // still out on whether or not to make this a conditional compilation or not.
20 // Comment this out if you don't have libcdio installed
21 // (Actually, this is defined in the Makefile to prevent having to edit
22 // things too damn much. Jury is still out whether or not to make this
24 //#define HAVE_LIB_CDIO
26 #include "cdintf.h" // Every OS has to implement these
29 #include <cdio/cdio.h> // Now using OS agnostic CD access routines!
35 static void TestCDIO(void)
37 // See what (if anything) is installed.
38 CdIo_t * p_cdio = cdio_open(0, DRIVER_DEVICE);
39 driver_id_t driver_id;
43 WriteLog("CDIO: The driver selected is %s.\n", cdio_get_driver_name(p_cdio));
44 WriteLog("CDIO: The default device for this driver is %s.\n\n", cdio_get_default_device(p_cdio));
49 WriteLog("CDIO: A suitable CD-ROM driver was not found.\n\n");
55 // *** OK, here's where we're going to attempt to put the platform agnostic CD interface ***
59 static CdIo_t * cdioPtr = NULL;
65 cdioPtr = cdio_open(NULL, DRIVER_DEVICE);
70 WriteLog("CDINTF: No suitable CD-ROM driver found.\n");
75 WriteLog("CDINTF: Successfully opened CD-ROM interface.\n");
83 WriteLog("CDINTF: Shutting down CD-ROM subsystem.\n");
87 cdio_destroy(cdioPtr);
91 bool CDIntfReadBlock(uint32 sector, uint8 * buffer)
93 #warning "!!! FIX !!! CDIntfReadBlock not implemented!"
95 WriteLog("CDINTF: ReadBlock unimplemented!\n");
99 uint32 CDIntfGetNumSessions(void)
101 #warning "!!! FIX !!! CDIntfGetNumSessions not implemented!"
103 // Still need relevant code here... !!! FIX !!!
107 void CDIntfSelectDrive(uint32 driveNum)
109 #warning "!!! FIX !!! CDIntfSelectDrive not implemented!"
111 WriteLog("CDINTF: SelectDrive unimplemented!\n");
114 uint32 CDIntfGetCurrentDrive(void)
116 #warning "!!! FIX !!! CDIntfGetCurrentDrive not implemented!"
118 WriteLog("CDINTF: GetCurrentDrive unimplemented!\n");
122 const uint8 * CDIntfGetDriveName(uint32 driveNum)
124 #warning "!!! FIX !!! CDIntfGetDriveName driveNum is currently ignored!"
125 // driveNum is currently ignored... !!! FIX !!!
128 uint8 * driveName = (uint8 *)cdio_get_default_device(cdioPtr);
129 WriteLog("CDINTF: The drive name for the current driver is %s.\n", driveName);
133 return (uint8 *)"NONE";
137 uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset)
139 #warning "!!! FIX !!! CDIntfGetSessionInfo not implemented!"
141 WriteLog("CDINTF: GetSessionInfo unimplemented!\n");
145 uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset)
147 #warning "!!! FIX !!! CDIntfTrackInfo not implemented!"
149 WriteLog("CDINTF: GetTrackInfo unimplemented!\n");