2 // OS agnostic CDROM interface functions
5 // (C) 2010 Underground Software
7 // JLH = James Hammons <jlhamm@acm.org>
8 // JPM = Jean-Paul Mari <djipi.mari@gmail.com>
11 // --- ---------- ------------------------------------------------------------
12 // JLH 01/16/2010 Created this log ;-)
13 // JPM 06/15/2016 Visual Studio support
17 // This now uses the supposedly cross-platform libcdio to do the necessary
18 // low-level CD twiddling we need that libsdl can't do currently. Jury is
19 // still out on whether or not to make this a conditional compilation or not.
22 // Comment this out if you don't have libcdio installed
23 // (Actually, this is defined in the Makefile to prevent having to edit
24 // things too damn much. Jury is still out whether or not to make this
26 //#define HAVE_LIB_CDIO
28 #include "cdintf.h" // Every OS has to implement these
31 #include <cdio/cdio.h> // Now using OS agnostic CD access routines!
37 static void TestCDIO(void)
39 // See what (if anything) is installed.
40 CdIo_t * p_cdio = cdio_open(0, DRIVER_DEVICE);
41 driver_id_t driver_id;
45 WriteLog("CDIO: The driver selected is %s.\n", cdio_get_driver_name(p_cdio));
46 WriteLog("CDIO: The default device for this driver is %s.\n\n", cdio_get_default_device(p_cdio));
51 WriteLog("CDIO: A suitable CD-ROM driver was not found.\n\n");
57 // *** OK, here's where we're going to attempt to put the platform agnostic CD interface ***
61 static CdIo_t
* cdioPtr
= NULL
;
68 cdioPtr
= cdio_open(NULL
, DRIVER_DEVICE
);
73 WriteLog("CDINTF: No suitable CD-ROM driver found.\n");
78 WriteLog("CDINTF: Successfully opened CD-ROM interface.\n");
87 WriteLog("CDINTF: Shutting down CD-ROM subsystem.\n");
91 cdio_destroy(cdioPtr
);
96 bool CDIntfReadBlock(uint32_t sector
, uint8_t * buffer
)
99 #pragma message("Warning: !!! FIX !!! CDIntfReadBlock not implemented!")
101 #warning "!!! FIX !!! CDIntfReadBlock not implemented!"
104 WriteLog("CDINTF: ReadBlock unimplemented!\n");
109 uint32_t CDIntfGetNumSessions(void)
112 #pragma message("Warning: !!! FIX !!! CDIntfGetNumSessions not implemented!")
114 #warning "!!! FIX !!! CDIntfGetNumSessions not implemented!"
117 // Still need relevant code here... !!! FIX !!!
122 void CDIntfSelectDrive(uint32_t driveNum
)
125 #pragma message("Warning: !!! FIX !!! CDIntfSelectDrive not implemented!")
127 #warning "!!! FIX !!! CDIntfSelectDrive not implemented!"
130 WriteLog("CDINTF: SelectDrive unimplemented!\n");
134 uint32_t CDIntfGetCurrentDrive(void)
137 #pragma message("Warning: !!! FIX !!! CDIntfGetCurrentDrive not implemented!")
139 #warning "!!! FIX !!! CDIntfGetCurrentDrive not implemented!"
142 WriteLog("CDINTF: GetCurrentDrive unimplemented!\n");
147 const uint8_t * CDIntfGetDriveName(uint32_t driveNum
)
150 #pragma message("Warning: !!! FIX !!! CDIntfGetDriveName driveNum is currently ignored!")
152 #warning "!!! FIX !!! CDIntfGetDriveName driveNum is currently ignored!"
154 // driveNum is currently ignored... !!! FIX !!!
157 uint8_t * driveName
= (uint8_t *)cdio_get_default_device(cdioPtr
);
158 WriteLog("CDINTF: The drive name for the current driver is %s.\n", driveName
);
162 return (uint8_t *)"NONE";
167 uint8_t CDIntfGetSessionInfo(uint32_t session
, uint32_t offset
)
170 #pragma message("Warning: !!! FIX !!! CDIntfGetSessionInfo not implemented!")
172 #warning "!!! FIX !!! CDIntfGetSessionInfo not implemented!"
175 WriteLog("CDINTF: GetSessionInfo unimplemented!\n");
180 uint8_t CDIntfGetTrackInfo(uint32_t track
, uint32_t offset
)
183 #pragma message("Warning: !!! FIX !!! CDIntfTrackInfo not implemented!")
185 #warning "!!! FIX !!! CDIntfTrackInfo not implemented!"
188 WriteLog("CDINTF: GetTrackInfo unimplemented!\n");