Move GetMountType to dos_mscdex file
This was the only user of this function.
This commit is contained in:
parent
3e6e97bf47
commit
d035c2cbd9
3 changed files with 23 additions and 29 deletions
|
@ -18,24 +18,6 @@
|
|||
|
||||
#include "cdrom.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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;
|
||||
|
|
|
@ -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<typename T>
|
||||
|
@ -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:
|
||||
|
|
|
@ -18,8 +18,12 @@
|
|||
|
||||
#include "dos_mscdex.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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);
|
||||
|
|
Loading…
Add table
Reference in a new issue