]> Shamusworld >> Repos - virtualjaguar/blob - src/cdintf.cpp
Extensive changes to remove gcc 4.x warnings, general code cleanup
[virtualjaguar] / src / cdintf.cpp
1 //
2 // OS agnostic CDROM interface functions
3 //
4 // by James L. Hammons
5 //
6 // This file is basically a shell to keep the front-end clean and also pull in the
7 // appropriate back-end code depending on which target is being compiled for.
8 //
9
10 #include "cdintf.h"                                                             // Every OS has to implement these
11
12 #include <cdio/cdio.h>                                                  // Now using OS agnostic CD access routines!
13 #include "log.h"
14
15 // Not any more!
16 #if 0
17
18 // OS dependent implementations
19
20 #if defined(__GCCWIN32__)
21
22 #include "cdintf_win32.cpp"
23
24 #elif defined(__GCCUNIX__)
25         #if defined(_OSX_)
26
27 #include "cdintf_osx.cpp"
28
29         #else
30
31 #include "cdintf_linux.cpp"
32
33         #endif
34 #endif
35
36 #endif
37
38 /*
39 static void TestCDIO(void)
40 {
41         // See what (if anything) is installed.
42         CdIo_t * p_cdio = cdio_open(0, DRIVER_DEVICE);
43         driver_id_t driver_id;
44
45         if (p_cdio != NULL)
46         {
47                 WriteLog("CDIO: The driver selected is %s.\n", cdio_get_driver_name(p_cdio));
48                 WriteLog("CDIO: The default device for this driver is %s.\n\n", cdio_get_default_device(p_cdio));
49                 cdio_destroy(p_cdio);
50         }
51         else
52         {
53                 WriteLog("CDIO: A suitable CD-ROM driver was not found.\n\n");
54         }
55 }
56 */
57
58 //
59 // *** OK, here's where we're going to attempt to put the platform agnostic CD interface ***
60 //
61
62 static CdIo_t * cdioPtr = NULL;
63
64 bool CDIntfInit(void)
65 {
66         cdioPtr = cdio_open(NULL, DRIVER_DEVICE);
67
68         if (cdioPtr == NULL)
69         {
70                 WriteLog("CDINTF: No suitable CD-ROM driver found.\n");
71                 return false;
72         }
73
74         WriteLog("CDINTF: Successfully opened CD-ROM interface.\n");
75
76         return true;
77 }
78
79 void CDIntfDone(void)
80 {
81         WriteLog("CDINTF: Shutting down CD-ROM subsystem.\n");
82
83         if (cdioPtr)
84                 cdio_destroy(cdioPtr);
85 }
86
87 bool CDIntfReadBlock(uint32 sector, uint8 * buffer)
88 {
89         // !!! FIX !!!
90         WriteLog("CDINTF: ReadBlock unimplemented!\n");
91         return false;
92 }
93
94 uint32 CDIntfGetNumSessions(void)
95 {
96         // !!! FIX !!!
97         // Still need relevant code here... !!! FIX !!!
98         return 2;
99 }
100
101 void CDIntfSelectDrive(uint32 driveNum)
102 {
103         // !!! FIX !!!
104         WriteLog("CDINTF: SelectDrive unimplemented!\n");
105 }
106
107 uint32 CDIntfGetCurrentDrive(void)
108 {
109         // !!! FIX !!!
110         WriteLog("CDINTF: GetCurrentDrive unimplemented!\n");
111         return 0;
112 }
113
114 const uint8 * CDIntfGetDriveName(uint32 driveNum)
115 {
116         // driveNum is currently ignored... !!! FIX !!!
117
118         uint8 * driveName = (uint8 *)cdio_get_default_device(cdioPtr);
119         WriteLog("CDINTF: The drive name for the current driver is %s.\n", driveName);
120
121         return driveName;
122 }
123
124 uint8 CDIntfGetSessionInfo(uint32 session, uint32 offset)
125 {
126         // !!! FIX !!!
127         WriteLog("CDINTF: GetSessionInfo unimplemented!\n");
128         return 0xFF;
129 }
130
131 uint8 CDIntfGetTrackInfo(uint32 track, uint32 offset)
132 {
133         // !!! FIX !!!
134         WriteLog("CDINTF: GetTrackInfo unimplemented!\n");
135         return 0xFF;
136 }