From d035c2cbd9a3cad8eecc157e776a2a135bf1a4b2 Mon Sep 17 00:00:00 2001 From: Patryk Obara Date: Fri, 13 Dec 2019 02:07:36 +0100 Subject: [PATCH] Move GetMountType to dos_mscdex file This was the only user of this function. --- src/dos/cdrom.cpp | 18 ------------------ src/dos/cdrom.h | 8 -------- src/dos/dos_mscdex.cpp | 26 +++++++++++++++++++++++--- 3 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/dos/cdrom.cpp b/src/dos/cdrom.cpp index 7b46db85..9a5acaf9 100644 --- a/src/dos/cdrom.cpp +++ b/src/dos/cdrom.cpp @@ -18,24 +18,6 @@ #include "cdrom.h" -#include -#include -#include - -#include "support.h" - -MountType CDROM_GetMountType(const char *path) { - struct stat file_stat; - if ((stat(path, &file_stat) == 0) && (file_stat.st_mode & S_IFREG)) - return MountType::ISO_IMAGE; - else - return MountType::DIRECTORY; -} - -// ****************************************************** -// Fake CDROM -// ****************************************************** - bool CDROM_Interface_Fake :: GetAudioTracks(int& stTrack, int& end, TMSF& leadOut) { stTrack = end = 1; leadOut.min = 60; diff --git a/src/dos/cdrom.h b/src/dos/cdrom.h index 3f02f6b8..1edcb6b5 100644 --- a/src/dos/cdrom.h +++ b/src/dos/cdrom.h @@ -56,12 +56,6 @@ typedef struct SCtrl { Bit8u vol[4]; // channel volume (0 to 255) } TCtrl; -enum class MountType { - PHYSICAL_CD, - ISO_IMAGE, - DIRECTORY, -}; - // Conversion function from frames to Minutes/Second/Frames // template @@ -79,8 +73,6 @@ inline int msf_to_frames(int m, int s, int f) { return m * 60 * REDBOOK_FRAMES_PER_SECOND + s * REDBOOK_FRAMES_PER_SECOND + f; } -MountType CDROM_GetMountType(const char *path); - class CDROM_Interface { public: diff --git a/src/dos/dos_mscdex.cpp b/src/dos/dos_mscdex.cpp index 91fbdaa5..80552177 100644 --- a/src/dos/dos_mscdex.cpp +++ b/src/dos/dos_mscdex.cpp @@ -18,8 +18,12 @@ #include "dos_mscdex.h" -#include -#include +#include +#include +#include +#include +#include + #include "regs.h" #include "callback.h" #include "dos_system.h" @@ -46,8 +50,15 @@ #define REQUEST_STATUS_DONE 0x0100 #define REQUEST_STATUS_ERROR 0x8000 +enum class MountType { + PHYSICAL_CD, + ISO_IMAGE, + DIRECTORY, +}; + static Bitu MSCDEX_Strategy_Handler(void); static Bitu MSCDEX_Interrupt_Handler(void); +static MountType MSCDEX_GetMountType(const char *path); class DOS_DeviceHeader:public MemStruct { public: @@ -247,7 +258,7 @@ int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit) // Set return type to ok int result = 0; // Get Mounttype and init needed cdrom interface - switch (CDROM_GetMountType(physicalPath)) { + switch (MSCDEX_GetMountType(physicalPath)) { case MountType::PHYSICAL_CD: LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: Mounting physical cdrom: %s", physicalPath); // TODO: support for mounting physical CD-ROMs removed, provide @@ -1004,6 +1015,15 @@ static Bit16u MSCDEX_IOCTL_Optput(PhysPt buffer,Bit8u drive_unit) { return 0x00; // success } +static MountType MSCDEX_GetMountType(const char *path) +{ + struct stat file_stat; + if ((stat(path, &file_stat) == 0) && (file_stat.st_mode & S_IFREG)) + return MountType::ISO_IMAGE; + else + return MountType::DIRECTORY; +} + static Bitu MSCDEX_Strategy_Handler(void) { curReqheaderPtr = PhysMake(SegValue(es),reg_bx); // MSCDEX_LOG("MSCDEX: Device Strategy Routine called, request header at %x",curReqheaderPtr);