default cdrom interface now sdl
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@812
This commit is contained in:
parent
e78dc0067d
commit
57d5d97852
3 changed files with 196 additions and 772 deletions
|
@ -5,17 +5,20 @@
|
|||
#define MAX_ASPI_CDROM 5
|
||||
|
||||
#include <string.h>
|
||||
#include "sdl.h"
|
||||
|
||||
#define RAW_SECTOR_SIZE 2352
|
||||
#define COOKED_SECTOR_SIZE 2048
|
||||
|
||||
enum { CDROM_USE_SDL, CDROM_USE_ASPI, CDROM_USE_IOCTL };
|
||||
|
||||
typedef struct SMSF {
|
||||
unsigned char min;
|
||||
unsigned char sec;
|
||||
unsigned char fr;
|
||||
} TMSF;
|
||||
|
||||
extern int CDROM_GetMountType(char* path);
|
||||
extern int CDROM_GetMountType(char* path, int force);
|
||||
|
||||
class CDROM_Interface
|
||||
{
|
||||
|
@ -23,7 +26,7 @@ public:
|
|||
// CDROM_Interface (void);
|
||||
virtual ~CDROM_Interface (void) {};
|
||||
|
||||
virtual bool SetDevice (char* path) = 0;
|
||||
virtual bool SetDevice (char* path, int forceCD) = 0;
|
||||
|
||||
virtual bool GetUPC (unsigned char& attr, char* upc) = 0;
|
||||
|
||||
|
@ -42,10 +45,38 @@ public:
|
|||
virtual bool LoadUnloadMedia (bool unload) = 0;
|
||||
};
|
||||
|
||||
class CDROM_Interface_SDL : public CDROM_Interface
|
||||
{
|
||||
public:
|
||||
CDROM_Interface_SDL (void);
|
||||
~CDROM_Interface_SDL (void);
|
||||
|
||||
bool SetDevice (char* path, int forceCD);
|
||||
bool GetUPC (unsigned char& attr, char* upc) { attr = 0; strcpy(upc,"UPC"); return true; };
|
||||
bool GetAudioTracks (int& stTrack, int& end, TMSF& leadOut);
|
||||
bool GetAudioTrackInfo (int track, TMSF& start, unsigned char& attr);
|
||||
bool GetAudioSub (unsigned char& attr, unsigned char& track, unsigned char& index, TMSF& relPos, TMSF& absPos);
|
||||
bool GetAudioStatus (bool& playing, bool& pause);
|
||||
bool GetMediaTrayStatus (bool& mediaPresent, bool& mediaChanged, bool& trayOpen);
|
||||
bool PlayAudioSector (unsigned long start,unsigned long len);
|
||||
bool PauseAudio (bool resume);
|
||||
bool StopAudio (void);
|
||||
bool ReadSectors (void* buffer, bool raw, unsigned long sector, unsigned long num) { return true; };
|
||||
bool LoadUnloadMedia (bool unload);
|
||||
|
||||
private:
|
||||
bool Open (void);
|
||||
void Close (void);
|
||||
|
||||
SDL_CD* cd;
|
||||
int driveID;
|
||||
Uint32 oldLeadOut;
|
||||
};
|
||||
|
||||
class CDROM_Interface_Fake : public CDROM_Interface
|
||||
{
|
||||
public:
|
||||
bool SetDevice (char* path) { return true; };
|
||||
bool SetDevice (char* path, int forceCD) { return true; };
|
||||
bool GetUPC (unsigned char& attr, char* upc) { attr = 0; strcpy(upc,"UPC"); return true; };
|
||||
bool GetAudioTracks (int& stTrack, int& end, TMSF& leadOut);
|
||||
bool GetAudioTrackInfo (int track, TMSF& start, unsigned char& attr);
|
||||
|
@ -59,7 +90,6 @@ public:
|
|||
bool LoadUnloadMedia (bool unload) { return true; };
|
||||
};
|
||||
|
||||
|
||||
#if defined (WIN32) /* Win 32 */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
@ -73,7 +103,7 @@ public:
|
|||
CDROM_Interface_Aspi (void);
|
||||
~CDROM_Interface_Aspi (void);
|
||||
|
||||
bool SetDevice (char* path);
|
||||
bool SetDevice (char* path, int forceCD);
|
||||
|
||||
bool GetUPC (unsigned char& attr, char* upc);
|
||||
|
||||
|
@ -120,7 +150,7 @@ public:
|
|||
CDROM_Interface_Ioctl (void);
|
||||
~CDROM_Interface_Ioctl (void);
|
||||
|
||||
bool SetDevice (char* path);
|
||||
bool SetDevice (char* path, int forceCD);
|
||||
|
||||
bool GetUPC (unsigned char& attr, char* upc);
|
||||
|
||||
|
@ -148,41 +178,6 @@ private:
|
|||
TMSF oldLeadOut;
|
||||
};
|
||||
|
||||
#else /* Linux */
|
||||
|
||||
class CDROM_Interface_Linux : public CDROM_Interface
|
||||
{
|
||||
public:
|
||||
CDROM_Interface_Linux (void);
|
||||
~CDROM_Interface_Linux (void);
|
||||
|
||||
bool SetDevice (char* path);
|
||||
|
||||
bool GetUPC (unsigned char& attr, char* upc);
|
||||
|
||||
bool GetAudioTracks (int& stTrack, int& end, TMSF& leadOut);
|
||||
bool GetAudioTrackInfo (int track, TMSF& start, unsigned char& attr);
|
||||
bool GetAudioSub (unsigned char& attr, unsigned char& track, unsigned char& index, TMSF& relPos, TMSF& absPos);
|
||||
bool GetAudioStatus (bool& playing, bool& pause);
|
||||
bool GetMediaTrayStatus (bool& mediaPresent, bool& mediaChanged, bool& trayOpen);
|
||||
|
||||
bool PlayAudioSector (unsigned long start,unsigned long len);
|
||||
bool PauseAudio (bool resume);
|
||||
bool StopAudio (void);
|
||||
|
||||
bool ReadSectors (void* buffer, bool raw, unsigned long sector, unsigned long num);
|
||||
|
||||
bool LoadUnloadMedia (bool unload);
|
||||
|
||||
private:
|
||||
bool Open (void);
|
||||
void Close (void);
|
||||
|
||||
char pathname[64];
|
||||
int dhandle;
|
||||
TMSF oldLeadOut;
|
||||
};
|
||||
|
||||
#endif /* linux */
|
||||
#endif /* WIN 32 */
|
||||
|
||||
#endif /* __CDROM_INTERFACE__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue