@@ -47,8 +47,18 @@
#define REQUEST_STATUS_DONE 0x0100
#define REQUEST_STATUS_ERROR 0x8000

// With no CD-ROM support on SDL 2.0, we need this. ***Taken off SDL_cdrom.h***
#ifndef CD_FPS
#define CD_FPS 75
#endif
#ifndef MSF_TO_FRAMES
#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
#endif

// Use cdrom Interface
#if !SDL_VERSION_ATLEAST(2,0,0)
int useCdromInterface = CDROM_USE_SDL;
#endif
int forceCD = -1;

static Bitu MSCDEX_Strategy_Handler(void);
@@ -254,7 +264,9 @@ int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit)
// Set return type to ok
int result = 0;
// Get Mounttype and init needed cdrom interface
// (physical is unsupported in SDL 2.0)
switch (CDROM_GetMountType(physicalPath,forceCD)) {
#if !SDL_VERSION_ATLEAST(2,0,0)
case 0x00: {
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: Mounting physical cdrom: %s" ,physicalPath);
#if defined (WIN32)
@@ -297,6 +309,7 @@ int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit)
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: SDL Interface.");
#endif
} break;
#endif // !SDL_VERSION_ATLEAST(2,0,0)
case 0x01: // iso cdrom interface
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: Mounting iso file as cdrom: %s", physicalPath);
cdrom[numDrives] = new CDROM_Interface_Image((Bit8u)numDrives);
@@ -1366,10 +1379,12 @@ bool MSCDEX_HasMediaChanged(Bit8u subUnit)
return true;
}

#if !SDL_VERSION_ATLEAST(2,0,0)
void MSCDEX_SetCDInterface(int intNr, int numCD) {
useCdromInterface = intNr;
forceCD = numCD;
}
#endif

void MSCDEX_ShutDown(Section* /*sec*/) {
delete mscdex;
@@ -48,7 +48,9 @@
Bitu DEBUG_EnableDebugger(void);
#endif

#if !SDL_VERSION_ATLEAST(2,0,0)
void MSCDEX_SetCDInterface(int intNr, int forceCD);
#endif
static Bitu ZDRIVE_NUM = 25;

class MOUNT : public Program {
@@ -173,11 +175,15 @@ class MOUNT : public Program {
}
/* Show list of cdroms */
if (cmd->FindExist("-cd",false)) {
#if SDL_VERSION_ATLEAST(2,0,0)
WriteOut(MSG_Get("PROGRAM_MOUNT_PHYS_CDROMS_NOT_SUPPORTED"));
#else
int num = SDL_CDNumDrives();
WriteOut(MSG_Get("PROGRAM_MOUNT_CDROMS_FOUND"),num);
for (int i=0; i<num; i++) {
WriteOut("%2d. %s\n",i,SDL_CDName(i));
};
#endif
return;
}

@@ -308,9 +314,22 @@ class MOUNT : public Program {
if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT;
Bit8u bit8size=(Bit8u) sizes[1];
if (type=="cdrom") {
#if SDL_VERSION_ATLEAST(2,0,0)
if (cmd->FindExist("-usecd",false)
|| cmd->FindExist("-aspi",false)
|| cmd->FindExist("-ioctl_dio",false)
|| cmd->FindExist("-ioctl_dx",false)
#if defined (WIN32)
|| cmd->FindExist("-ioctl_mci",false)
#endif
|| cmd->FindExist("-noioctl",false)
) {
WriteOut(MSG_Get("PROGRAM_MOUNT_PHYS_CDROMS_NOT_SUPPORTED"));
/* Just ignore, mount anyway */
}
#else // SDL_VERSION_ATLEAST(2,0,0)
int num = -1;
cmd->FindInt("-usecd",num,true);
int error = 0;
if (cmd->FindExist("-aspi",false)) {
MSCDEX_SetCDInterface(CDROM_USE_ASPI, num);
} else if (cmd->FindExist("-ioctl_dio",false)) {
@@ -339,6 +358,8 @@ class MOUNT : public Program {
MSCDEX_SetCDInterface(CDROM_USE_IOCTL_DIO, num);
#endif
}
#endif // SDL_VERSION_ATLEAST(2,0,0)
int error = 0;
newdrive = new cdromDrive(drive,temp_line.c_str(),sizes[0],bit8size,sizes[2],0,mediaid,error);
// Check Mscdex, if it worked out...
switch (error) {
@@ -1317,7 +1338,9 @@ class IMGMOUNT : public Program {
WriteOut(MSG_Get("PROGRAM_IMGMOUNT_ALREADY_MOUNTED"));
return;
}
#if !SDL_VERSION_ATLEAST(2,0,0)
MSCDEX_SetCDInterface(CDROM_USE_SDL, -1);
#endif
// create new drives for all images
std::vector<DOS_Drive*> isoDisks;
std::vector<std::string>::size_type i;
@@ -1468,7 +1491,11 @@ static void KEYB_ProgramStart(Program * * make) {
void DOS_SetupPrograms(void) {
/*Add Messages */

#if SDL_VERSION_ATLEAST(2,0,0)
MSG_Add("PROGRAM_MOUNT_PHYS_CDROMS_NOT_SUPPORTED","Physical CDROMs aren't fully supported. IMGMOUNT may be more useful.\n");
#else
MSG_Add("PROGRAM_MOUNT_CDROMS_FOUND","CDROMs found: %d\n");
#endif
MSG_Add("PROGRAM_MOUNT_STATUS_FORMAT","%-5s %-58s %-12s\n");
MSG_Add("PROGRAM_MOUNT_STATUS_2","Drive %c is mounted as %s\n");
MSG_Add("PROGRAM_MOUNT_STATUS_1","The currently mounted drives are:\n");
@@ -1558,7 +1585,11 @@ void DOS_SetupPrograms(void) {
);
MSG_Add("PROGRAM_INTRO_CDROM",
"\033[2J\033[32;1mHow to mount a Real/Virtual CD-ROM Drive in DOSBox:\033[0m\n"
#if SDL_VERSION_ATLEAST(2,0,0)
"DOSBox provides CD-ROM emulation on a few levels.\n"
#else
"DOSBox provides CD-ROM emulation on several levels.\n"
#endif
"\n"
"The \033[33mbasic\033[0m level works on all CD-ROM drives and normal directories.\n"
"It installs MSCDEX and marks the files read-only.\n"
@@ -1567,6 +1598,14 @@ void DOS_SetupPrograms(void) {
"If it doesn't work you might have to tell DOSBox the label of the CD-ROM:\n"
"\033[34;1mmount d C:\\example -t cdrom -label CDLABEL\033[0m\n"
"\n"
#if SDL_VERSION_ATLEAST(2,0,0)
"The \033[33mhigher\033[0m level adds CD-ROM image mounting support.\n"
"Therefore only works on supported CD-ROM images:\n"
"\033[34;1mimgmount d \033[0;31mD:\\example.img\033[34;1m -t cdrom\033[0m\n"
"\n"
"Replace \033[0;31mD:\\\033[0m with the location of your CD-ROM.\n"
"Replace \033[0;31mD:\\example.img\033[0m with the location of your CD-ROM image.\n"
#else
"The \033[33mnext\033[0m level adds some low-level support.\n"
"Therefore only works on CD-ROM drives:\n"
"\033[34;1mmount d \033[0;31mD:\\\033[34;1m -t cdrom -usecd \033[33m0\033[0m\n"
@@ -1580,6 +1619,7 @@ void DOS_SetupPrograms(void) {
"Replace \033[0;31mD:\\\033[0m with the location of your CD-ROM.\n"
"Replace the \033[33;1m0\033[0m in \033[34;1m-usecd \033[33m0\033[0m with the number reported for your CD-ROM if you type:\n"
"\033[34;1mmount -cd\033[0m\n"
#endif
);
MSG_Add("PROGRAM_INTRO_SPECIAL",
"\033[2J\033[32;1mSpecial keys:\033[0m\n"

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -412,6 +412,9 @@ static void MIXER_Mix_NoSound(void) {
}

static void MIXER_CallBack(void * userdata, Uint8 *stream, int len) {
#if SDL_VERSION_ATLEAST(2,0,0)
memset(stream, 0, len);
#endif
Bitu need=(Bitu)len/MIXER_SSIZE;
Bit16s * output=(Bit16s *)stream;
Bitu reduce;
@@ -30,6 +30,7 @@
#include <shlobj.h>
#endif


#if defined HAVE_SYS_TYPES_H && defined HAVE_PWD_H
#include <sys/types.h>
#include <pwd.h>