Remove code ifdefed for OS/2
Cleanup before replacing SDL1.2 with SDL2. OS/2 support was introduced in DOSBox in March 2006. OS/2 reached EOL in December 2006. As of 2019, OS/2 is being continued by proprietary 32-bit only ArcaOS, although there is no official SDL2 support, despite pledges from SDL2 maintainers.
This commit is contained in:
parent
ef2686ac02
commit
5f9ac5eeab
19 changed files with 29 additions and 529 deletions
|
@ -7,4 +7,4 @@ libdos_a_SOURCES = dos.cpp dos_devices.cpp dos_execute.cpp dos_files.cpp dos_ioc
|
|||
drives.cpp drives.h drive_virtual.cpp drive_local.cpp drive_cache.cpp drive_fat.cpp \
|
||||
drive_iso.cpp dev_con.h dos_mscdex.cpp dos_keyboard_layout.cpp \
|
||||
cdrom.h cdrom.cpp cdrom_ioctl_win32.cpp cdrom_aspi_win32.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp \
|
||||
cdrom_ioctl_os2.cpp drive_overlay.cpp
|
||||
drive_overlay.cpp
|
||||
|
|
|
@ -153,7 +153,7 @@ int CDROM_GetMountType(char* path, int forceCD) {
|
|||
const char* cdName;
|
||||
char buffer[512];
|
||||
strcpy(buffer,path);
|
||||
#if defined (WIN32) || defined(OS2)
|
||||
#if defined (WIN32)
|
||||
upcase(buffer);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ private:
|
|||
|
||||
#endif /* WIN 32 */
|
||||
|
||||
#if defined (LINUX) || defined(OS2)
|
||||
#if defined (LINUX)
|
||||
|
||||
class CDROM_Interface_Ioctl : public CDROM_Interface_SDL
|
||||
{
|
||||
|
|
|
@ -1159,9 +1159,8 @@ bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
#if defined (WIN32) || defined(OS2)
|
||||
//Nothing
|
||||
#else
|
||||
|
||||
#if !defined (WIN32)
|
||||
//Consider the possibility that the filename has a windows directory seperator (inside the CUE file)
|
||||
//which is common for some commercial rereleases of DOS games using DOSBox
|
||||
|
||||
|
@ -1181,7 +1180,6 @@ bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname)
|
|||
filename = tmpstr;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,152 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2019 The DOSBox Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "dosbox.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
#if defined (OS2)
|
||||
#define INCL_DOSFILEMGR
|
||||
#define INCL_DOSERRORS
|
||||
#define INCL_DOSDEVICES
|
||||
#define INCL_DOSDEVIOCTL
|
||||
#include "os2.h"
|
||||
|
||||
// Ripped from linux/cdrom.h
|
||||
#define CD_FRAMESIZE_RAW 2352
|
||||
#define CD_FRAMESIZE 2048
|
||||
|
||||
CDROM_Interface_Ioctl::CDROM_Interface_Ioctl(void) : CDROM_Interface_SDL(){
|
||||
strcpy(device_name, "");
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc){
|
||||
HFILE cdrom_fd = 0;
|
||||
ULONG ulAction = 0;
|
||||
APIRET rc = DosOpen((unsigned char*)device_name, &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
|
||||
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
|
||||
if (rc != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
char data[50];
|
||||
ULONG len = sizeof(data);
|
||||
char sig[] = {'C', 'D', '0', '1'};
|
||||
ULONG sigsize = 4;
|
||||
rc = DosDevIOCtl(cdrom_fd, IOCTL_CDROMDISK, CDROMDISK_GETUPC, sig, sigsize, &sigsize,
|
||||
data, len, &len);
|
||||
if (rc != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
rc = DosClose(cdrom_fd);
|
||||
return rc == NO_ERROR;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num){
|
||||
HFILE cdrom_fd = 0;
|
||||
ULONG ulAction = 0;
|
||||
APIRET rc = DosOpen((unsigned char*)device_name, &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
|
||||
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
|
||||
if (rc != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Bitu buflen = raw ? num * CD_FRAMESIZE_RAW : num * CD_FRAMESIZE;
|
||||
Bit8u* buf = new Bit8u[buflen];
|
||||
int ret = NO_ERROR;
|
||||
|
||||
if (raw) {
|
||||
struct paramseek {
|
||||
UCHAR sig[4];
|
||||
UCHAR mode;
|
||||
ULONG sec;
|
||||
|
||||
paramseek(ULONG sector)
|
||||
{
|
||||
sig[0] = 'C'; sig[1] = 'D'; sig[2] = '0'; sig[3] = '1';
|
||||
sec = sector;
|
||||
}
|
||||
} param_seek(sector);
|
||||
ULONG paramsize = sizeof (paramseek);
|
||||
rc = DosDevIOCtl(cdrom_fd, IOCTL_CDROMDISK, CDROMDISK_SEEK, ¶m_seek, paramsize, ¶msize,
|
||||
0, 0, 0);
|
||||
if (rc != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct paramread {
|
||||
UCHAR sig[4];
|
||||
UCHAR mode;
|
||||
USHORT number;
|
||||
BYTE sec;
|
||||
BYTE reserved;
|
||||
BYTE interleave;
|
||||
|
||||
paramread(USHORT num)
|
||||
{
|
||||
sig[0] = 'C'; sig[1] = 'D'; sig[2] = '0'; sig[3] = '1';
|
||||
mode = 0; number = num;
|
||||
sec = interleave = 0;
|
||||
}
|
||||
} param_read(num);
|
||||
paramsize = sizeof (paramread);
|
||||
ULONG len = buflen;
|
||||
rc = DosDevIOCtl(cdrom_fd, IOCTL_CDROMDISK, CDROMDISK_READLONG, ¶m_read, paramsize, ¶msize,
|
||||
buf, len, &len);
|
||||
if (rc != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
ULONG pos = 0;
|
||||
rc = DosSetFilePtr(cdrom_fd, sector * CD_FRAMESIZE, FILE_BEGIN, &pos);
|
||||
if (rc != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
ULONG read = 0;
|
||||
rc = DosRead(cdrom_fd, buf, buflen, &read);
|
||||
if (rc != NO_ERROR || read != buflen) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
rc = DosClose(cdrom_fd);
|
||||
MEM_BlockWrite(buffer, buf, buflen);
|
||||
delete[] buf;
|
||||
|
||||
return (ret == NO_ERROR);
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD) {
|
||||
bool success = CDROM_Interface_SDL::SetDevice(path, forceCD);
|
||||
|
||||
if (success) {
|
||||
char temp[3] = {0, 0, 0};
|
||||
if (path[1] == ':') {
|
||||
temp[0] = path[0];
|
||||
temp[1] = path[1];
|
||||
temp[2] = 0;
|
||||
}
|
||||
strncpy(device_name, temp, 512);
|
||||
} else {
|
||||
strcpy(device_name, "");
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -285,8 +285,8 @@ int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit)
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
#if defined (LINUX) || defined(OS2)
|
||||
// Always use IOCTL in Linux or OS/2
|
||||
#if defined (LINUX)
|
||||
// Always use IOCTL in Linux
|
||||
cdrom[numDrives] = new CDROM_Interface_Ioctl();
|
||||
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: IOCTL Interface.");
|
||||
#else
|
||||
|
|
|
@ -40,11 +40,6 @@
|
|||
#include "dma.h"
|
||||
|
||||
|
||||
#if defined(OS2)
|
||||
#define INCL DOSFILEMGR
|
||||
#define INCL_DOSERRORS
|
||||
#include "os2.h"
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
#ifndef S_ISDIR
|
||||
|
@ -302,35 +297,12 @@ public:
|
|||
}
|
||||
struct stat test;
|
||||
//Win32 : strip tailing backslashes
|
||||
//os2: some special drive check
|
||||
//rest: substitute ~ for home
|
||||
bool failed = false;
|
||||
#if defined (WIN32) || defined(OS2)
|
||||
#if defined (WIN32)
|
||||
/* Removing trailing backslash if not root dir so stat will succeed */
|
||||
if(temp_line.size() > 3 && temp_line[temp_line.size()-1]=='\\') temp_line.erase(temp_line.size()-1,1);
|
||||
if (stat(temp_line.c_str(),&test)) {
|
||||
#endif
|
||||
#if defined(WIN32)
|
||||
// Nothing to do here.
|
||||
#elif defined (OS2)
|
||||
if (temp_line.size() <= 2) // Seems to be a drive.
|
||||
{
|
||||
failed = true;
|
||||
HFILE cdrom_fd = 0;
|
||||
ULONG ulAction = 0;
|
||||
|
||||
APIRET rc = DosOpen((unsigned char*)temp_line.c_str(), &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
|
||||
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
|
||||
DosClose(cdrom_fd);
|
||||
if (rc != NO_ERROR && rc != ERROR_NOT_READY)
|
||||
{
|
||||
failed = true;
|
||||
} else {
|
||||
failed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (failed) {
|
||||
#else
|
||||
if (stat(temp_line.c_str(),&test)) {
|
||||
failed = true;
|
||||
|
@ -345,22 +317,9 @@ public:
|
|||
}
|
||||
/* Not a switch so a normal directory/file */
|
||||
if (!S_ISDIR(test.st_mode)) {
|
||||
#ifdef OS2
|
||||
HFILE cdrom_fd = 0;
|
||||
ULONG ulAction = 0;
|
||||
|
||||
APIRET rc = DosOpen((unsigned char*)temp_line.c_str(), &cdrom_fd, &ulAction, 0L, FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS,
|
||||
OPEN_FLAGS_DASD | OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0L);
|
||||
DosClose(cdrom_fd);
|
||||
if (rc != NO_ERROR && rc != ERROR_NOT_READY) {
|
||||
WriteOut(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str());
|
||||
return;
|
||||
}
|
||||
#else
|
||||
WriteOut(MSG_Get("PROGRAM_MOUNT_ERROR_2"),temp_line.c_str());
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (temp_line[temp_line.size()-1]!=CROSS_FILESPLIT) temp_line+=CROSS_FILESPLIT;
|
||||
Bit8u bit8size=(Bit8u) sizes[1];
|
||||
|
@ -413,7 +372,7 @@ public:
|
|||
}
|
||||
} else {
|
||||
/* Give a warning when mount c:\ or the / */
|
||||
#if defined (WIN32) || defined(OS2)
|
||||
#if defined (WIN32)
|
||||
if( (temp_line == "c:\\") || (temp_line == "C:\\") ||
|
||||
(temp_line == "c:/") || (temp_line == "C:/") )
|
||||
WriteOut(MSG_Get("PROGRAM_MOUNT_WARNING_WIN"));
|
||||
|
@ -484,7 +443,7 @@ public:
|
|||
if(type == "floppy") incrementFDD();
|
||||
return;
|
||||
showusage:
|
||||
#if defined (WIN32) || defined(OS2)
|
||||
#if defined (WIN32)
|
||||
WriteOut(MSG_Get("PROGRAM_MOUNT_USAGE"),"d:\\dosprogs","d:\\dosprogs");
|
||||
#else
|
||||
WriteOut(MSG_Get("PROGRAM_MOUNT_USAGE"),"~/dosprogs","~/dosprogs");
|
||||
|
|
|
@ -33,11 +33,6 @@
|
|||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined (OS2)
|
||||
#define INCL_DOSERRORS
|
||||
#define INCL_DOSFILEMGR
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
int fileInfoCounter = 0;
|
||||
|
||||
|
@ -159,25 +154,14 @@ void DOS_Drive_Cache::SetBaseDir(const char* baseDir) {
|
|||
ReadDir(id,result);
|
||||
};
|
||||
// Get Volume Label
|
||||
#if defined (WIN32) || defined (OS2)
|
||||
#if defined (WIN32)
|
||||
bool cdrom = false;
|
||||
char labellocal[256]={ 0 };
|
||||
char drive[4] = "C:\\";
|
||||
drive[0] = basePath[0];
|
||||
#if defined (WIN32)
|
||||
if (GetVolumeInformation(drive,labellocal,256,NULL,NULL,NULL,NULL,0)) {
|
||||
UINT test = GetDriveType(drive);
|
||||
if(test == DRIVE_CDROM) cdrom = true;
|
||||
#else // OS2
|
||||
//TODO determine wether cdrom or not!
|
||||
FSINFO fsinfo;
|
||||
ULONG drivenumber = drive[0];
|
||||
if (drivenumber > 26) { // drive letter was lowercase
|
||||
drivenumber = drive[0] - 'a' + 1;
|
||||
}
|
||||
APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO));
|
||||
if (rc == NO_ERROR) {
|
||||
#endif
|
||||
/* Set label and allow being updated */
|
||||
SetLabel(labellocal,cdrom,true);
|
||||
}
|
||||
|
@ -209,12 +193,11 @@ char* DOS_Drive_Cache::GetExpandName(const char* path) {
|
|||
|
||||
if (*work) {
|
||||
size_t len = strlen(work);
|
||||
#if defined (WIN32)
|
||||
//What about OS/2
|
||||
#if defined (WIN32)
|
||||
if((work[len-1] == CROSS_FILESPLIT ) && (len >= 2) && (work[len-2] != ':')) {
|
||||
#else
|
||||
if((len > 1) && (work[len-1] == CROSS_FILESPLIT )) {
|
||||
#endif
|
||||
#endif
|
||||
work[len-1] = 0; // Remove trailing slashes except when in root
|
||||
}
|
||||
}
|
||||
|
@ -263,8 +246,7 @@ void DOS_Drive_Cache::AddEntryDirOverlay(const char* path, bool checkExists) {
|
|||
char* post = strrchr(dironly,CROSS_FILESPLIT);
|
||||
|
||||
if (post) {
|
||||
#if defined (WIN32)
|
||||
//OS2 ?
|
||||
#if defined (WIN32)
|
||||
if (post > dironly && *(post - 1) == ':' && (post - dironly) == 2)
|
||||
post++; //move away from X: as need to end up with x:\ .
|
||||
#else
|
||||
|
@ -392,7 +374,7 @@ bool DOS_Drive_Cache::GetShortName(const char* fullname, char* shortname) {
|
|||
|
||||
// The orgname part of the list is not sorted (shortname is)! So we can only walk through it.
|
||||
for(Bitu i = 0; i < filelist_size; i++) {
|
||||
#if defined (WIN32) || defined (OS2) /* Win 32 & OS/2*/
|
||||
#if defined (WIN32)
|
||||
if (strcasecmp(pos,curDir->longNameList[i]->orgname) == 0) {
|
||||
#else
|
||||
if (strcmp(pos,curDir->longNameList[i]->orgname) == 0) {
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
bool logoverlay = false;
|
||||
using namespace std;
|
||||
|
||||
#if defined (WIN32) || defined (OS2) /* Win 32 & OS/2*/
|
||||
#define CROSS_DOSFILENAME(blah)
|
||||
#if defined (WIN32)
|
||||
#define CROSS_DOSFILENAME(blah)
|
||||
#else
|
||||
//Convert back to DOS PATH
|
||||
//Convert back to DOS PATH
|
||||
#define CROSS_DOSFILENAME(blah) strreplace(blah,'/','\\')
|
||||
#endif
|
||||
|
||||
|
@ -345,7 +345,6 @@ void Overlay_Drive::convert_overlay_to_DOSname_in_base(char* dirname )
|
|||
if (strlen(overlaydir) >= strlen(basedir) ) {
|
||||
//Needs to be longer at least.
|
||||
#if defined (WIN32)
|
||||
//OS2 ?
|
||||
if (strncasecmp(overlaydir,basedir,strlen(basedir)) == 0) {
|
||||
#else
|
||||
if (strncmp(overlaydir,basedir,strlen(basedir)) == 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue