Remove MCI, DX, and DIO CD-ROM interfaces
Also, remove all traces of these interfaces from user manual (README file) and man page (docs/dosbox.1). MCI (Media Control Interface) was a primary Windows interface. Code comments and documentation claimed, that it's only for "NT, 2000, XP" but the code was enabled for Windows 2000 or later (version > 4.0). DX (Digital audio eXtraction (?)) could be forced on any Windows with autodetection working only on Vista and Windows 7 (code was disabled for Windows 8 or later - probably unintentionally). DIO used DeviceIoControl interface and Windows-specific ioctl calls. All 3 interfaces depend on SDL and SDL_cdrom functionality to work. SDL_cdrom 1.2 implementation uses MCI on Windows to provide the same functionality.
This commit is contained in:
parent
ba88bd97d7
commit
ddda555854
10 changed files with 15 additions and 1136 deletions
43
README
43
README
|
@ -46,7 +46,7 @@ Type INTRO in DOSBox for a quick tour.
|
|||
It is essential that you get familiar with the idea of mounting, DOSBox does not
|
||||
automatically make any drive (or a part of it) accessible to the emulation. See
|
||||
the FAQ entry "How to start?" as well as the description of the MOUNT command
|
||||
(Section 4: "Internal Programs"). If you have your game on a cdrom you may try
|
||||
(Section 4: "Internal Programs"). If you have your game on a CD-ROM you may try
|
||||
this guide: https://www.vogons.org/viewtopic.php?t=8933
|
||||
|
||||
|
||||
|
@ -134,23 +134,14 @@ CD-ROM: My CD-ROM doesn't work.
|
|||
|
||||
In some cases you might want to use a different CD-ROM interface,
|
||||
for example if CD audio does not work:
|
||||
To enable SDL-support (does not include low-level CD access!):
|
||||
- mount d f:\ -t cdrom -usecd 0 -noioctl
|
||||
To enable ioctl access using digital audio extraction for CD audio
|
||||
(Windows-only, useful for Vista):
|
||||
- mount d f:\ -t cdrom -ioctl_dx
|
||||
To enable ioctl access using MCI for CD audio (Windows-only):
|
||||
- mount d f:\ -t cdrom -ioctl_mci
|
||||
To force ioctl-only access (Windows-only):
|
||||
- mount d f:\ -t cdrom -ioctl_dio
|
||||
- mount d f:\ -t cdrom -usecd 0 -noioctl
|
||||
|
||||
explanation: - d driveletter you will get in DOSBox (d is the best,
|
||||
don't change it!)
|
||||
- f:\ location of CD-ROM on your PC. In most cases it will
|
||||
be d:\ or e:\
|
||||
- 0 The number of the CD-ROM drive, reported by "mount -cd"
|
||||
(note that this value is only needed when using SDL
|
||||
for CD audio, otherwise it is ignored)
|
||||
|
||||
See also the next question: The game/application can't find its CD-ROM.
|
||||
|
||||
|
||||
|
@ -159,10 +150,6 @@ CD-ROM: The game/application can't find its CD-ROM.
|
|||
MSCDEX interface required by DOS games to interface with CD-ROMs.
|
||||
Also try adding the correct label (-label LABEL) to the mount command,
|
||||
where LABEL is the CD-label (volume ID) of the CD-ROM.
|
||||
Under Windows you can specify -ioctl or -noioctl. Look at the
|
||||
description of the mount command in Section 4: "Internal programs"
|
||||
for their meaning and the
|
||||
additional audio-CD related options -ioctl_dx, -ioctl_mci, -ioctl_dio.
|
||||
|
||||
Try creating a CD-ROM image (preferably CUE/BIN pair) and use the
|
||||
DOSBox's internal IMGMOUNT tool to mount the image (the CUE sheet).
|
||||
|
@ -482,7 +469,7 @@ To get a list of the internal commands type "HELP" at the prompt.
|
|||
In addition, the following commands are available:
|
||||
|
||||
MOUNT "Emulated Drive letter" "Real Drive or Directory"
|
||||
[-t type] [-ioctl] [-noioctl] [-usecd number] [-size drivesize]
|
||||
[-t type] [-noioctl] [-usecd number] [-size drivesize]
|
||||
[-label drivelabel] [-freesize size_in_mb]
|
||||
[-freesize size_in_kb (floppies)]
|
||||
MOUNT -cd
|
||||
|
@ -527,16 +514,6 @@ MOUNT -u "Emulated Drive letter"
|
|||
If you do specify a label, this label will be kept as long as the drive
|
||||
is mounted. It will not be updated !!
|
||||
|
||||
-ioctl (automatic selection of the CD audio interface)
|
||||
-ioctl_dx (digital audio extraction used for CD audio)
|
||||
-ioctl_dio (ioctl calls used for CD audio)
|
||||
-ioctl_mci (MCI used for CD audio)
|
||||
Forces use of ioctl commands. Only valid if mounting a CD-ROM under
|
||||
a Windows OS which support them (Win2000/XP/NT).
|
||||
The various choices only differ in the way CD audio is handled,
|
||||
preferably -ioctl_dio is used (lowest workload), but this might not
|
||||
work on all systems, so -ioctl_dx (or -ioctl_mci) can be used.
|
||||
|
||||
-noioctl
|
||||
Forces use of the SDL CD-ROM layer. Valid on all systems.
|
||||
|
||||
|
@ -816,7 +793,7 @@ MIXER
|
|||
channel
|
||||
Can be one of the following: MASTER, DISNEY, SPKR, GUS, SB, FM [, CDAUDIO].
|
||||
CDAUDIO is only available if a CD-ROM interface with volume control is
|
||||
enabled (CD image, ioctl_dx).
|
||||
enabled (CD image).
|
||||
|
||||
left:right
|
||||
The volume levels in percentages. If you put a D in front it will be
|
||||
|
@ -1466,16 +1443,16 @@ Running a certain game closes DOSBox, crashes with some message or hangs:
|
|||
- use loadfix before starting the game
|
||||
|
||||
The game exits to the DOSBox prompt with some error message:
|
||||
|
||||
- read the error message closely and try to locate the error
|
||||
- try the hints at the above sections
|
||||
- mount differently as some games are picky about the locations,
|
||||
for example if you used "mount d d:\oldgames\game" try
|
||||
"mount c d:\oldgames\game" and "mount c d:\oldgames"
|
||||
- if the game requires a CD-ROM be sure you used "-t cdrom" when
|
||||
mounting and try different additional parameters (the ioctl,
|
||||
usecd and label switches, see the appropriate section)
|
||||
- check the file permissions of the game files (remove read-only
|
||||
attributes, add write permissions etc.)
|
||||
- if the game requires a CD-ROM be sure you used "-t cdrom" when mounting and
|
||||
refer to the above section "CD-ROM: My CD-ROM doesn't work" for more help.
|
||||
- check the file permissions of the game files (remove read-only attributes,
|
||||
add write permissions etc.)
|
||||
- try reinstalling the game within DOSBox
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.TH DOSBOX 1 "Nov 29, 2019"
|
||||
.TH DOSBOX 1 "Dec 1, 2019"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.SH NAME
|
||||
dosbox \- an x86/DOS emulator with sound/graphics
|
||||
|
@ -132,7 +132,6 @@ following extra commands are available:
|
|||
.HP
|
||||
.BI "MOUNT [\-t " type "] [\-size " size ]
|
||||
.I driveletter sourcedirectory
|
||||
.B [\-ioctl]
|
||||
.BI "[\-usecd " number "] [\-label " drivelabel "] [\-freesize " freesize ]
|
||||
.LP
|
||||
.B MOUNT \-cd
|
||||
|
@ -162,7 +161,7 @@ Sets the amount of free space available on a drive in MB's. This is a more
|
|||
.RI "Sets the name of the drive to " drivelabel ". Needed on some"
|
||||
systems if the cd label isn't read correctly. Useful when a
|
||||
program can't find its cdrom. If you don't specify a label and no
|
||||
.RB "lowlevel support is selected (" "\-usecd #" " and/or " "\-ioctl" "):"
|
||||
.RB "lowlevel support is selected (" "\-usecd #" "):"
|
||||
.RS
|
||||
.LP
|
||||
For win32: label is extracted from "Real Drive".
|
||||
|
@ -173,9 +172,6 @@ If you do specify a label this label will be kept as long as the drive
|
|||
is mounted. It will not be updated !!
|
||||
.RE
|
||||
.TP
|
||||
.B \-ioctl
|
||||
Forces to use ioctl commands.
|
||||
.TP
|
||||
.BI \-usecd " number"
|
||||
Forces to use SDL cdrom support for drive number.
|
||||
.IR Number " can be found by "
|
||||
|
|
|
@ -6,5 +6,5 @@ libdos_a_SOURCES = dos.cpp dos_devices.cpp dos_execute.cpp dos_files.cpp dos_ioc
|
|||
dos_misc.cpp dos_classes.cpp dos_programs.cpp dos_tables.cpp \
|
||||
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_ioctl_linux.cpp cdrom_image.cpp \
|
||||
cdrom.h cdrom.cpp cdrom_ioctl_linux.cpp cdrom_image.cpp \
|
||||
drive_overlay.cpp
|
||||
|
|
|
@ -47,9 +47,6 @@
|
|||
|
||||
enum {
|
||||
CDROM_USE_SDL,
|
||||
CDROM_USE_IOCTL_DIO,
|
||||
CDROM_USE_IOCTL_DX,
|
||||
CDROM_USE_IOCTL_MCI
|
||||
};
|
||||
|
||||
typedef struct SMSF {
|
||||
|
@ -274,102 +271,6 @@ private:
|
|||
Bit8u subUnit;
|
||||
};
|
||||
|
||||
#if defined (WIN32) /* Win 32 */
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX // Don't clobber std::max and std::min
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
|
||||
class CDROM_Interface_Ioctl : public CDROM_Interface
|
||||
{
|
||||
public:
|
||||
enum cdioctl_cdatype { CDIOCTL_CDA_DIO, CDIOCTL_CDA_MCI, CDIOCTL_CDA_DX };
|
||||
cdioctl_cdatype cdioctl_cda_selected;
|
||||
|
||||
CDROM_Interface_Ioctl (CDROM_Interface_Ioctl::cdioctl_cdatype ioctl_cda);
|
||||
virtual ~CDROM_Interface_Ioctl(void);
|
||||
|
||||
bool SetDevice (char* path, int forceCD);
|
||||
|
||||
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);
|
||||
void ChannelControl (TCtrl ctrl);
|
||||
|
||||
bool ReadSector (Bit8u *buffer, bool raw, unsigned long sector);
|
||||
bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num);
|
||||
|
||||
bool LoadUnloadMedia (bool unload);
|
||||
|
||||
void InitNewMedia (void) { Close(); Open(); };
|
||||
private:
|
||||
|
||||
bool Open (void);
|
||||
void Close (void);
|
||||
|
||||
char pathname[32];
|
||||
HANDLE hIOCTL;
|
||||
TMSF oldLeadOut;
|
||||
|
||||
|
||||
/* track start/length data */
|
||||
bool track_start_valid;
|
||||
int track_start_first,track_start_last;
|
||||
int track_start[128];
|
||||
|
||||
bool GetAudioTracksAll (void);
|
||||
|
||||
|
||||
/* mci audio cd interface */
|
||||
bool use_mciplay;
|
||||
int mci_devid;
|
||||
|
||||
bool mci_CDioctl (UINT msg, DWORD flags, void *arg);
|
||||
bool mci_CDOpen (char drive);
|
||||
bool mci_CDClose (void);
|
||||
bool mci_CDPlay (int start, int length);
|
||||
bool mci_CDPause (void);
|
||||
bool mci_CDResume (void);
|
||||
bool mci_CDStop (void);
|
||||
int mci_CDStatus (void);
|
||||
bool mci_CDPosition (int *position);
|
||||
|
||||
|
||||
/* digital audio extraction cd interface */
|
||||
static void dx_CDAudioCallBack(Bitu len);
|
||||
|
||||
bool use_dxplay;
|
||||
static struct dxPlayer {
|
||||
CDROM_Interface_Ioctl *cd;
|
||||
MixerChannel *channel;
|
||||
SDL_mutex *mutex;
|
||||
Bit8u buffer[8192];
|
||||
int bufLen;
|
||||
int currFrame;
|
||||
int targetFrame;
|
||||
bool isPlaying;
|
||||
bool isPaused;
|
||||
bool ctrlUsed;
|
||||
TCtrl ctrlData;
|
||||
} player;
|
||||
|
||||
};
|
||||
|
||||
#endif /* WIN 32 */
|
||||
|
||||
#if defined (LINUX)
|
||||
|
||||
class CDROM_Interface_Ioctl : public CDROM_Interface_SDL
|
||||
|
|
|
@ -1,627 +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 "cdrom.h"
|
||||
|
||||
#if defined (WIN32)
|
||||
|
||||
// *****************************************************************
|
||||
// Windows IOCTL functions (not suitable for 95/98/Me)
|
||||
// *****************************************************************
|
||||
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
|
||||
#if (defined (_MSC_VER)) || (defined __MINGW64_VERSION_MAJOR)
|
||||
#include <winioctl.h> // Ioctl stuff
|
||||
#include <ntddcdrm.h> // Ioctl stuff
|
||||
#else
|
||||
#include "ddk/ntddcdrm.h" // Ioctl stuff
|
||||
#endif
|
||||
|
||||
#include <mmsystem.h>
|
||||
|
||||
// for a more sophisticated implementation of the mci cdda functionality
|
||||
// see the SDL sources, which the mci_ functions are based on
|
||||
|
||||
/* General ioctl() CD-ROM command function */
|
||||
bool CDROM_Interface_Ioctl::mci_CDioctl(UINT msg, DWORD flags, void *arg) {
|
||||
MCIERROR mci_error = mciSendCommand(mci_devid, msg, flags, (DWORD_PTR)arg);
|
||||
if (mci_error!=MMSYSERR_NOERROR) {
|
||||
char error[256];
|
||||
mciGetErrorString(mci_error, error, 256);
|
||||
LOG_MSG("mciSendCommand() error: %s", error);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::mci_CDOpen(char drive) {
|
||||
MCI_OPEN_PARMS mci_open;
|
||||
MCI_SET_PARMS mci_set;
|
||||
char device[3];
|
||||
DWORD flags;
|
||||
|
||||
/* Open the requested device */
|
||||
mci_open.lpstrDeviceType = (LPCSTR) MCI_DEVTYPE_CD_AUDIO;
|
||||
device[0] = drive;
|
||||
device[1] = ':';
|
||||
device[2] = '\0';
|
||||
mci_open.lpstrElementName = device;
|
||||
flags = (MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID|MCI_OPEN_SHAREABLE|MCI_OPEN_ELEMENT);
|
||||
if (mci_CDioctl(MCI_OPEN, flags, &mci_open)) {
|
||||
flags &= ~MCI_OPEN_SHAREABLE;
|
||||
if (mci_CDioctl(MCI_OPEN, flags, &mci_open)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
mci_devid = mci_open.wDeviceID;
|
||||
|
||||
/* Set the minute-second-frame time format */
|
||||
mci_set.dwTimeFormat = MCI_FORMAT_MSF;
|
||||
mci_CDioctl(MCI_SET, MCI_SET_TIME_FORMAT, &mci_set);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::mci_CDClose(void) {
|
||||
return mci_CDioctl(MCI_CLOSE, MCI_WAIT, NULL);
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::mci_CDPlay(int start, int length) {
|
||||
DWORD flags = MCI_FROM | MCI_TO | MCI_NOTIFY;
|
||||
MCI_PLAY_PARMS mci_play;
|
||||
mci_play.dwCallback = 0;
|
||||
|
||||
int m, s, f;
|
||||
frames_to_msf(start, &m, &s, &f);
|
||||
mci_play.dwFrom = MCI_MAKE_MSF(m, s, f);
|
||||
|
||||
frames_to_msf(start+length, &m, &s, &f);
|
||||
mci_play.dwTo = MCI_MAKE_MSF(m, s, f);
|
||||
|
||||
return mci_CDioctl(MCI_PLAY, flags, &mci_play);
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::mci_CDPause(void) {
|
||||
return mci_CDioctl(MCI_PAUSE, MCI_WAIT, NULL);
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::mci_CDResume(void) {
|
||||
return mci_CDioctl(MCI_RESUME, MCI_WAIT, NULL);
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::mci_CDStop(void) {
|
||||
return mci_CDioctl(MCI_STOP, MCI_WAIT, NULL);
|
||||
}
|
||||
|
||||
int CDROM_Interface_Ioctl::mci_CDStatus(void) {
|
||||
int status;
|
||||
MCI_STATUS_PARMS mci_status;
|
||||
|
||||
DWORD flags = MCI_STATUS_ITEM | MCI_WAIT;
|
||||
mci_status.dwItem = MCI_STATUS_MODE;
|
||||
if (mci_CDioctl(MCI_STATUS, flags, &mci_status)) {
|
||||
status = -1;
|
||||
} else {
|
||||
switch (mci_status.dwReturn) {
|
||||
case MCI_MODE_NOT_READY:
|
||||
case MCI_MODE_OPEN:
|
||||
status = 0;
|
||||
break;
|
||||
case MCI_MODE_STOP:
|
||||
status = 1;
|
||||
break;
|
||||
case MCI_MODE_PLAY:
|
||||
status = 2;
|
||||
break;
|
||||
case MCI_MODE_PAUSE:
|
||||
status = 3;
|
||||
break;
|
||||
default:
|
||||
status = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::mci_CDPosition(int *position) {
|
||||
*position = 0;
|
||||
|
||||
DWORD flags = MCI_STATUS_ITEM | MCI_WAIT;
|
||||
|
||||
MCI_STATUS_PARMS mci_status;
|
||||
mci_status.dwItem = MCI_STATUS_MODE;
|
||||
if (mci_CDioctl(MCI_STATUS, flags, &mci_status)) return true;
|
||||
switch (mci_status.dwReturn) {
|
||||
case MCI_MODE_NOT_READY:
|
||||
case MCI_MODE_OPEN:
|
||||
case MCI_MODE_STOP:
|
||||
return true; // not ready/undefined status
|
||||
case MCI_MODE_PLAY:
|
||||
case MCI_MODE_PAUSE:
|
||||
mci_status.dwItem = MCI_STATUS_POSITION;
|
||||
if (!mci_CDioctl(MCI_STATUS, flags, &mci_status)) {
|
||||
*position = msf_to_frames(
|
||||
MCI_MSF_MINUTE(mci_status.dwReturn),
|
||||
MCI_MSF_SECOND(mci_status.dwReturn),
|
||||
MCI_MSF_FRAME(mci_status.dwReturn));
|
||||
}
|
||||
return false; // no error, position read
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
CDROM_Interface_Ioctl::dxPlayer CDROM_Interface_Ioctl::player = {
|
||||
NULL, NULL, NULL, {0}, 0, 0, 0, false, false, false, {0} };
|
||||
|
||||
CDROM_Interface_Ioctl::CDROM_Interface_Ioctl(CDROM_Interface_Ioctl::cdioctl_cdatype ioctl_cda) {
|
||||
pathname[0] = 0;
|
||||
hIOCTL = INVALID_HANDLE_VALUE;
|
||||
memset(&oldLeadOut,0,sizeof(oldLeadOut));
|
||||
cdioctl_cda_selected = ioctl_cda;
|
||||
}
|
||||
|
||||
CDROM_Interface_Ioctl::~CDROM_Interface_Ioctl() {
|
||||
StopAudio();
|
||||
if (use_mciplay) mci_CDStop();
|
||||
Close();
|
||||
if (use_mciplay) mci_CDClose();
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetUPC(unsigned char& attr, char* upc) {
|
||||
// FIXME : To Do
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioTracks(int& stTrack, int& endTrack, TMSF& leadOut) {
|
||||
CDROM_TOC toc;
|
||||
DWORD byteCount;
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0,
|
||||
&toc, sizeof(toc), &byteCount,NULL);
|
||||
if (!bStat) return false;
|
||||
|
||||
stTrack = toc.FirstTrack;
|
||||
endTrack = toc.LastTrack;
|
||||
leadOut.min = toc.TrackData[endTrack].Address[1];
|
||||
leadOut.sec = toc.TrackData[endTrack].Address[2];
|
||||
leadOut.fr = toc.TrackData[endTrack].Address[3];
|
||||
|
||||
if ((use_mciplay || use_dxplay) && (!track_start_valid)) {
|
||||
Bits track_num = 0;
|
||||
// get track start address of all tracks
|
||||
for (Bits i=toc.FirstTrack; i<=toc.LastTrack+1; i++) {
|
||||
if (((toc.TrackData[i].Control&1)==0) || (i==toc.LastTrack+1)) {
|
||||
track_start[track_num] = msf_to_frames(
|
||||
toc.TrackData[track_num].Address[1],
|
||||
toc.TrackData[track_num].Address[2],
|
||||
toc.TrackData[track_num].Address[3]);
|
||||
track_num++;
|
||||
}
|
||||
}
|
||||
track_start_first = 0;
|
||||
track_start_last = track_num-1;
|
||||
track_start_valid = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioTrackInfo(int track, TMSF& start, unsigned char& attr) {
|
||||
CDROM_TOC toc;
|
||||
DWORD byteCount;
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0,
|
||||
&toc, sizeof(toc), &byteCount,NULL);
|
||||
if (!bStat) return false;
|
||||
|
||||
attr = (toc.TrackData[track-1].Control << 4) & 0xEF;
|
||||
start.min = toc.TrackData[track-1].Address[1];
|
||||
start.sec = toc.TrackData[track-1].Address[2];
|
||||
start.fr = toc.TrackData[track-1].Address[3];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioTracksAll(void) {
|
||||
if (track_start_valid) return true;
|
||||
|
||||
CDROM_TOC toc;
|
||||
DWORD byteCount;
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_TOC, NULL, 0,
|
||||
&toc, sizeof(toc), &byteCount,NULL);
|
||||
if (!bStat) return false;
|
||||
|
||||
Bits track_num = 0;
|
||||
// get track start address of all tracks
|
||||
for (Bits i=toc.FirstTrack; i<=toc.LastTrack+1; i++) {
|
||||
if (((toc.TrackData[i].Control&1)==0) || (i==toc.LastTrack+1)) {
|
||||
track_start[track_num] = msf_to_frames(
|
||||
toc.TrackData[track_num].Address[1],
|
||||
toc.TrackData[track_num].Address[2],
|
||||
toc.TrackData[track_num].Address[3]);
|
||||
track_num++;
|
||||
}
|
||||
}
|
||||
track_start_first = 0;
|
||||
track_start_last = track_num-1;
|
||||
track_start_valid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioSub(unsigned char& attr, unsigned char& track, unsigned char& index, TMSF& relPos, TMSF& absPos) {
|
||||
if (use_dxplay) {
|
||||
track = 1;
|
||||
frames_to_msf(player.currFrame + 150, &absPos.min, &absPos.sec, &absPos.fr);
|
||||
frames_to_msf(player.currFrame + 150, &relPos.min, &relPos.sec, &relPos.fr);
|
||||
|
||||
if (GetAudioTracksAll()) {
|
||||
// get track number from current frame
|
||||
for (int i=track_start_first; i<=track_start_last; i++) {
|
||||
if ((player.currFrame + 150<track_start[i+1]) && (player.currFrame + 150>=track_start[i])) {
|
||||
// track found, calculate relative position
|
||||
track = i;
|
||||
frames_to_msf(
|
||||
player.currFrame + 150 - track_start[i],
|
||||
&relPos.min,
|
||||
&relPos.sec,
|
||||
&relPos.fr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CDROM_SUB_Q_DATA_FORMAT insub;
|
||||
SUB_Q_CHANNEL_DATA sub;
|
||||
DWORD byteCount;
|
||||
|
||||
insub.Format = IOCTL_CDROM_CURRENT_POSITION;
|
||||
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_Q_CHANNEL, &insub, sizeof(insub),
|
||||
&sub, sizeof(sub), &byteCount,NULL);
|
||||
if (!bStat) return false;
|
||||
|
||||
attr = (sub.CurrentPosition.Control << 4) & 0xEF;
|
||||
track = sub.CurrentPosition.TrackNumber;
|
||||
index = sub.CurrentPosition.IndexNumber;
|
||||
relPos.min = sub.CurrentPosition.TrackRelativeAddress[1];
|
||||
relPos.sec = sub.CurrentPosition.TrackRelativeAddress[2];
|
||||
relPos.fr = sub.CurrentPosition.TrackRelativeAddress[3];
|
||||
absPos.min = sub.CurrentPosition.AbsoluteAddress[1];
|
||||
absPos.sec = sub.CurrentPosition.AbsoluteAddress[2];
|
||||
absPos.fr = sub.CurrentPosition.AbsoluteAddress[3];
|
||||
|
||||
if (use_mciplay) {
|
||||
int cur_pos;
|
||||
if (!mci_CDPosition(&cur_pos)) {
|
||||
// absolute position read, try to calculate the track-relative position
|
||||
if (GetAudioTracksAll()) {
|
||||
for (int i=track_start_first; i<=track_start_last; i++) {
|
||||
if ((cur_pos<track_start[i+1]) && (cur_pos>=track_start[i])) {
|
||||
// track found, calculate relative position
|
||||
frames_to_msf(cur_pos-track_start[i], &relPos.min, &relPos.sec, &relPos.fr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
frames_to_msf(cur_pos, &absPos.min, &absPos.sec, &absPos.fr);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetAudioStatus(bool& playing, bool& pause) {
|
||||
if (use_mciplay) {
|
||||
int status = mci_CDStatus();
|
||||
if (status<0) return false;
|
||||
playing = (status==2);
|
||||
pause = (status==3);
|
||||
return true;
|
||||
}
|
||||
if (use_dxplay) {
|
||||
playing = player.isPlaying;
|
||||
pause = player.isPaused;
|
||||
return true;
|
||||
}
|
||||
|
||||
CDROM_SUB_Q_DATA_FORMAT insub;
|
||||
SUB_Q_CHANNEL_DATA sub;
|
||||
DWORD byteCount;
|
||||
|
||||
insub.Format = IOCTL_CDROM_CURRENT_POSITION;
|
||||
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_READ_Q_CHANNEL, &insub, sizeof(insub),
|
||||
&sub, sizeof(sub), &byteCount,NULL);
|
||||
if (!bStat) return false;
|
||||
|
||||
playing = (sub.CurrentPosition.Header.AudioStatus == AUDIO_STATUS_IN_PROGRESS);
|
||||
pause = (sub.CurrentPosition.Header.AudioStatus == AUDIO_STATUS_PAUSED);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::GetMediaTrayStatus(bool& mediaPresent, bool& mediaChanged, bool& trayOpen) {
|
||||
// Seems not possible to get this values using ioctl...
|
||||
int track1,track2;
|
||||
TMSF leadOut;
|
||||
// If we can read, there's a media
|
||||
mediaPresent = GetAudioTracks(track1, track2, leadOut),
|
||||
trayOpen = !mediaPresent;
|
||||
mediaChanged = (oldLeadOut.min!=leadOut.min) || (oldLeadOut.sec!=leadOut.sec) || (oldLeadOut.fr!=leadOut.fr);
|
||||
if (mediaChanged) {
|
||||
Close();
|
||||
if (use_mciplay) mci_CDClose();
|
||||
// Open new medium
|
||||
Open();
|
||||
|
||||
if (cdioctl_cda_selected == CDIOCTL_CDA_MCI) {
|
||||
// check this (what to do if cd is ejected):
|
||||
use_mciplay = false;
|
||||
if (!mci_CDOpen(pathname[4])) use_mciplay = true;
|
||||
}
|
||||
track_start_valid = false;
|
||||
}
|
||||
// Save old values
|
||||
oldLeadOut.min = leadOut.min;
|
||||
oldLeadOut.sec = leadOut.sec;
|
||||
oldLeadOut.fr = leadOut.fr;
|
||||
// always success
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::PlayAudioSector (unsigned long start,unsigned long len) {
|
||||
if (use_mciplay) {
|
||||
if (!mci_CDPlay(start+150, len)) return true;
|
||||
if (!mci_CDPlay(start+150, len-1)) return true;
|
||||
return false;
|
||||
}
|
||||
if (use_dxplay) {
|
||||
SDL_mutexP(player.mutex);
|
||||
player.cd = this;
|
||||
player.currFrame = start;
|
||||
player.targetFrame = start + len;
|
||||
player.isPlaying = true;
|
||||
player.isPaused = false;
|
||||
SDL_mutexV(player.mutex);
|
||||
return true;
|
||||
}
|
||||
|
||||
CDROM_PLAY_AUDIO_MSF audio;
|
||||
DWORD byteCount;
|
||||
// Start
|
||||
unsigned long addr = start + 150;
|
||||
audio.StartingF = (UCHAR)(addr%75); addr/=75;
|
||||
audio.StartingS = (UCHAR)(addr%60);
|
||||
audio.StartingM = (UCHAR)(addr/60);
|
||||
// End
|
||||
addr = start + len + 150;
|
||||
audio.EndingF = (UCHAR)(addr%75); addr/=75;
|
||||
audio.EndingS = (UCHAR)(addr%60);
|
||||
audio.EndingM = (UCHAR)(addr/60);
|
||||
|
||||
BOOL bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_PLAY_AUDIO_MSF, &audio, sizeof(audio),
|
||||
NULL, 0, &byteCount,NULL);
|
||||
return bStat>0;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::PauseAudio(bool resume) {
|
||||
if (use_mciplay) {
|
||||
if (resume) {
|
||||
if (!mci_CDResume()) return true;
|
||||
} else {
|
||||
if (!mci_CDPause()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (use_dxplay) {
|
||||
player.isPaused = !resume;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL bStat;
|
||||
DWORD byteCount;
|
||||
if (resume) bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RESUME_AUDIO, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
else bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_PAUSE_AUDIO, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
return bStat>0;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::StopAudio(void) {
|
||||
if (use_mciplay) {
|
||||
if (!mci_CDStop()) return true;
|
||||
return false;
|
||||
}
|
||||
if (use_dxplay) {
|
||||
player.isPlaying = false;
|
||||
player.isPaused = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL bStat;
|
||||
DWORD byteCount;
|
||||
bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_STOP_AUDIO, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
return bStat>0;
|
||||
}
|
||||
|
||||
void CDROM_Interface_Ioctl::ChannelControl(TCtrl ctrl)
|
||||
{
|
||||
if (player.channel == NULL) return;
|
||||
|
||||
// Adjust the volme of our mixer channel as defined by the application
|
||||
player.channel->SetScale(static_cast<float>(ctrl.vol[0]/255.0), // left vol
|
||||
static_cast<float>(ctrl.vol[1]/255.0)); // right vol
|
||||
|
||||
// Map the audio channels in our mixer channel as defined by the application
|
||||
player.channel->MapChannels(ctrl.out[0], // left map
|
||||
ctrl.out[1]); // right map
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::LoadUnloadMedia(bool unload) {
|
||||
BOOL bStat;
|
||||
DWORD byteCount;
|
||||
if (unload) bStat = DeviceIoControl(hIOCTL,IOCTL_STORAGE_EJECT_MEDIA, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
else bStat = DeviceIoControl(hIOCTL,IOCTL_STORAGE_LOAD_MEDIA, NULL, 0,
|
||||
NULL, 0, &byteCount,NULL);
|
||||
track_start_valid = false;
|
||||
return bStat>0;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::ReadSector(Bit8u *buffer, bool raw, unsigned long sector) {
|
||||
BOOL bStat;
|
||||
DWORD byteCount = 0;
|
||||
|
||||
Bitu buflen = raw ? BYTES_PER_RAW_REDBOOK_FRAME : BYTES_PER_COOKED_REDBOOK_FRAME;
|
||||
|
||||
if (!raw) {
|
||||
// Cooked
|
||||
int success = 0;
|
||||
DWORD newPos = SetFilePointer(hIOCTL, sector*BYTES_PER_COOKED_REDBOOK_FRAME, 0, FILE_BEGIN);
|
||||
if (newPos != 0xFFFFFFFF) success = ReadFile(hIOCTL, buffer, buflen, &byteCount, NULL);
|
||||
bStat = (success!=0);
|
||||
} else {
|
||||
// Raw
|
||||
RAW_READ_INFO in;
|
||||
in.DiskOffset.LowPart = sector*BYTES_PER_COOKED_REDBOOK_FRAME;
|
||||
in.DiskOffset.HighPart = 0;
|
||||
in.SectorCount = 1;
|
||||
in.TrackMode = CDDA;
|
||||
bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RAW_READ, &in, sizeof(in),
|
||||
buffer, buflen, &byteCount,NULL);
|
||||
}
|
||||
|
||||
return (byteCount==buflen) && (bStat>0);
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::ReadSectors(PhysPt buffer, bool raw, unsigned long sector, unsigned long num) {
|
||||
BOOL bStat;
|
||||
DWORD byteCount = 0;
|
||||
|
||||
Bitu buflen = raw ? num*BYTES_PER_RAW_REDBOOK_FRAME : num*BYTES_PER_COOKED_REDBOOK_FRAME;
|
||||
Bit8u* bufdata = new Bit8u[buflen];
|
||||
|
||||
if (!raw) {
|
||||
// Cooked
|
||||
int success = 0;
|
||||
DWORD newPos = SetFilePointer(hIOCTL, sector*BYTES_PER_COOKED_REDBOOK_FRAME, 0, FILE_BEGIN);
|
||||
if (newPos != 0xFFFFFFFF) success = ReadFile(hIOCTL, bufdata, buflen, &byteCount, NULL);
|
||||
bStat = (success!=0);
|
||||
} else {
|
||||
// Raw
|
||||
RAW_READ_INFO in;
|
||||
in.DiskOffset.LowPart = sector*BYTES_PER_COOKED_REDBOOK_FRAME;
|
||||
in.DiskOffset.HighPart = 0;
|
||||
in.SectorCount = num;
|
||||
in.TrackMode = CDDA;
|
||||
bStat = DeviceIoControl(hIOCTL,IOCTL_CDROM_RAW_READ, &in, sizeof(in),
|
||||
bufdata, buflen, &byteCount,NULL);
|
||||
}
|
||||
|
||||
MEM_BlockWrite(buffer,bufdata,buflen);
|
||||
delete[] bufdata;
|
||||
|
||||
return (byteCount==buflen) && (bStat>0);
|
||||
}
|
||||
|
||||
void CDROM_Interface_Ioctl::dx_CDAudioCallBack(Bitu len) {
|
||||
len *= 4; // 16 bit, stereo
|
||||
if (!len) return;
|
||||
if (!player.isPlaying || player.isPaused) {
|
||||
player.channel->AddSilence();
|
||||
return;
|
||||
}
|
||||
SDL_mutexP(player.mutex);
|
||||
while (player.bufLen < (Bits)len) {
|
||||
bool success;
|
||||
if (player.targetFrame > player.currFrame)
|
||||
success = player.cd->ReadSector(&player.buffer[player.bufLen], true, player.currFrame);
|
||||
else success = false;
|
||||
|
||||
if (success) {
|
||||
player.currFrame++;
|
||||
player.bufLen += BYTES_PER_RAW_REDBOOK_FRAME;
|
||||
} else {
|
||||
memset(&player.buffer[player.bufLen], 0, len - player.bufLen);
|
||||
player.bufLen = len;
|
||||
player.isPlaying = false;
|
||||
}
|
||||
}
|
||||
SDL_mutexV(player.mutex);
|
||||
player.channel->AddSamples_s16(len/4,(Bit16s *)player.buffer);
|
||||
memmove(player.buffer, &player.buffer[len], player.bufLen - len);
|
||||
player.bufLen -= len;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::SetDevice(char* path, int forceCD) {
|
||||
mci_devid = 0;
|
||||
use_mciplay = false;
|
||||
use_dxplay = false;
|
||||
track_start_valid = false;
|
||||
if (GetDriveType(path)==DRIVE_CDROM) {
|
||||
char letter [3] = { 0, ':', 0 };
|
||||
letter[0] = path[0];
|
||||
strcpy(pathname,"\\\\.\\");
|
||||
strcat(pathname,letter);
|
||||
if (Open()) {
|
||||
if (cdioctl_cda_selected == CDIOCTL_CDA_MCI) {
|
||||
// check if MCI-interface can be used for cd audio
|
||||
if (!mci_CDOpen(path[0])) use_mciplay = true;
|
||||
}
|
||||
if (!use_mciplay) {
|
||||
if (cdioctl_cda_selected == CDIOCTL_CDA_DX) {
|
||||
// use direct sector access for cd audio routines
|
||||
player.mutex = SDL_CreateMutex();
|
||||
if (!player.channel) {
|
||||
player.channel = MIXER_AddChannel(&dx_CDAudioCallBack, 44100, "CDAUDIO");
|
||||
}
|
||||
player.channel->Enable(true);
|
||||
use_dxplay = true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Ioctl::Open(void) {
|
||||
hIOCTL = CreateFile(pathname, // drive to open
|
||||
GENERIC_READ, // read access
|
||||
FILE_SHARE_READ | // share mode
|
||||
FILE_SHARE_WRITE,
|
||||
NULL, // default security attributes
|
||||
OPEN_EXISTING, // disposition
|
||||
0, // file attributes
|
||||
NULL); // do not copy file attributes
|
||||
return (hIOCTL!=INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
void CDROM_Interface_Ioctl::Close(void) {
|
||||
CloseHandle(hIOCTL);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -255,30 +255,6 @@ int CMscdex::AddDrive(Bit16u _drive, char* physicalPath, Bit8u& subUnit)
|
|||
switch (CDROM_GetMountType(physicalPath,forceCD)) {
|
||||
case 0x00: {
|
||||
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: Mounting physical cdrom: %s" ,physicalPath);
|
||||
#if defined (WIN32)
|
||||
// Check OS
|
||||
OSVERSIONINFO osi;
|
||||
osi.dwOSVersionInfoSize = sizeof(osi);
|
||||
GetVersionEx(&osi);
|
||||
if ((osi.dwPlatformId==VER_PLATFORM_WIN32_NT) && (osi.dwMajorVersion>4)) {
|
||||
// only WIN NT/200/XP
|
||||
if (useCdromInterface==CDROM_USE_IOCTL_DIO) {
|
||||
cdrom[numDrives] = new CDROM_Interface_Ioctl(CDROM_Interface_Ioctl::CDIOCTL_CDA_DIO);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: IOCTL Interface.");
|
||||
break;
|
||||
}
|
||||
if (useCdromInterface==CDROM_USE_IOCTL_DX) {
|
||||
cdrom[numDrives] = new CDROM_Interface_Ioctl(CDROM_Interface_Ioctl::CDIOCTL_CDA_DX);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: IOCTL Interface (digital audio extraction).");
|
||||
break;
|
||||
}
|
||||
if (useCdromInterface==CDROM_USE_IOCTL_MCI) {
|
||||
cdrom[numDrives] = new CDROM_Interface_Ioctl(CDROM_Interface_Ioctl::CDIOCTL_CDA_MCI);
|
||||
LOG(LOG_MISC,LOG_NORMAL)("MSCDEX: IOCTL Interface (media control interface).");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if defined (LINUX)
|
||||
// Always use IOCTL in Linux
|
||||
cdrom[numDrives] = new CDROM_Interface_Ioctl();
|
||||
|
|
|
@ -327,31 +327,8 @@ public:
|
|||
int num = -1;
|
||||
cmd->FindInt("-usecd",num,true);
|
||||
int error = 0;
|
||||
if (cmd->FindExist("-ioctl_dio", false)) {
|
||||
MSCDEX_SetCDInterface(CDROM_USE_IOCTL_DIO, num);
|
||||
} else if (cmd->FindExist("-ioctl_dx",false)) {
|
||||
MSCDEX_SetCDInterface(CDROM_USE_IOCTL_DX, num);
|
||||
#if defined (WIN32)
|
||||
} else if (cmd->FindExist("-ioctl_mci",false)) {
|
||||
MSCDEX_SetCDInterface(CDROM_USE_IOCTL_MCI, num);
|
||||
#endif
|
||||
} else if (cmd->FindExist("-noioctl",false)) {
|
||||
if (cmd->FindExist("-noioctl",false)) {
|
||||
MSCDEX_SetCDInterface(CDROM_USE_SDL, num);
|
||||
} else {
|
||||
#if defined (WIN32)
|
||||
// Check OS
|
||||
OSVERSIONINFO osi;
|
||||
osi.dwOSVersionInfoSize = sizeof(osi);
|
||||
GetVersionEx(&osi);
|
||||
if ((osi.dwPlatformId==VER_PLATFORM_WIN32_NT) && (osi.dwMajorVersion>5)) {
|
||||
// Vista/above
|
||||
MSCDEX_SetCDInterface(CDROM_USE_IOCTL_DX, num);
|
||||
} else {
|
||||
MSCDEX_SetCDInterface(CDROM_USE_IOCTL_DIO, num);
|
||||
}
|
||||
#else
|
||||
MSCDEX_SetCDInterface(CDROM_USE_IOCTL_DIO, num);
|
||||
#endif
|
||||
}
|
||||
newdrive = new cdromDrive(drive,temp_line.c_str(),sizes[0],bit8size,sizes[2],0,mediaid,error);
|
||||
// Check Mscdex, if it worked out...
|
||||
|
|
|
@ -1 +1 @@
|
|||
EXTRA_DIST = unistd.h config.h ntddcdrm.h
|
||||
EXTRA_DIST = unistd.h config.h
|
||||
|
|
|
@ -1,320 +0,0 @@
|
|||
/*
|
||||
* ntddcdrm.h
|
||||
*
|
||||
* CDROM IOCTL interface.
|
||||
*
|
||||
* This file is part of the w32api package.
|
||||
*
|
||||
* Contributors:
|
||||
* Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
*
|
||||
* THIS SOFTWARE IS NOT COPYRIGHTED
|
||||
*
|
||||
* This source code is offered for use in the public domain. You may
|
||||
* use, modify or distribute it freely.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful but
|
||||
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
|
||||
* DISCLAIMED. This includes but is not limited to warranties of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NTDDCDRM_H
|
||||
#define __NTDDCDRM_H
|
||||
|
||||
#if __GNUC__ >=3
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#pragma pack(push,4)
|
||||
|
||||
#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
|
||||
|
||||
#define IOCTL_CDROM_CHECK_VERIFY \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0200, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_FIND_NEW_DEVICES \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0206, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_GET_CONTROL \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x000D, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_GET_DRIVE_GEOMETRY \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_GET_LAST_SESSION \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x000E, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_GET_VOLUME \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0005, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_PAUSE_AUDIO \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_PLAY_AUDIO_MSF \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0006, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_RAW_READ \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x000F, METHOD_OUT_DIRECT, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_READ_Q_CHANNEL \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x000B, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_READ_TOC \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0000, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_READ_TOC_EX \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0015, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_RESUME_AUDIO \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_SEEK_AUDIO_MSF \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_SET_VOLUME \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x000A, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_SIMBAD \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x1003, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
#define IOCTL_CDROM_STOP_AUDIO \
|
||||
CTL_CODE(IOCTL_CDROM_BASE, 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
|
||||
#define MAXIMUM_NUMBER_TRACKS 100
|
||||
#define MAXIMUM_CDROM_SIZE 804
|
||||
#define MINIMUM_CDROM_READ_TOC_EX_SIZE 2
|
||||
|
||||
typedef struct _TRACK_DATA {
|
||||
UCHAR Reserved;
|
||||
UCHAR Control : 4;
|
||||
UCHAR Adr : 4;
|
||||
UCHAR TrackNumber;
|
||||
UCHAR Reserved1;
|
||||
UCHAR Address[4];
|
||||
} TRACK_DATA, *PTRACK_DATA;
|
||||
|
||||
/* CDROM_DISK_DATA.DiskData flags */
|
||||
#define CDROM_DISK_AUDIO_TRACK 0x00000001
|
||||
#define CDROM_DISK_DATA_TRACK 0x00000002
|
||||
|
||||
typedef struct _CDROM_DISK_DATA {
|
||||
ULONG DiskData;
|
||||
} CDROM_DISK_DATA, *PCDROM_DISK_DATA;
|
||||
|
||||
typedef struct _CDROM_PLAY_AUDIO_MSF {
|
||||
UCHAR StartingM;
|
||||
UCHAR StartingS;
|
||||
UCHAR StartingF;
|
||||
UCHAR EndingM;
|
||||
UCHAR EndingS;
|
||||
UCHAR EndingF;
|
||||
} CDROM_PLAY_AUDIO_MSF, *PCDROM_PLAY_AUDIO_MSF;
|
||||
|
||||
/* CDROM_READ_TOC_EX.Format constants */
|
||||
#define CDROM_READ_TOC_EX_FORMAT_TOC 0x00
|
||||
#define CDROM_READ_TOC_EX_FORMAT_SESSION 0x01
|
||||
#define CDROM_READ_TOC_EX_FORMAT_FULL_TOC 0x02
|
||||
#define CDROM_READ_TOC_EX_FORMAT_PMA 0x03
|
||||
#define CDROM_READ_TOC_EX_FORMAT_ATIP 0x04
|
||||
#define CDROM_READ_TOC_EX_FORMAT_CDTEXT 0x05
|
||||
|
||||
typedef struct _CDROM_READ_TOC_EX {
|
||||
UCHAR Format : 4;
|
||||
UCHAR Reserved1 : 3;
|
||||
UCHAR Msf : 1;
|
||||
UCHAR SessionTrack;
|
||||
UCHAR Reserved2;
|
||||
UCHAR Reserved3;
|
||||
} CDROM_READ_TOC_EX, *PCDROM_READ_TOC_EX;
|
||||
|
||||
typedef struct _CDROM_SEEK_AUDIO_MSF {
|
||||
UCHAR M;
|
||||
UCHAR S;
|
||||
UCHAR F;
|
||||
} CDROM_SEEK_AUDIO_MSF, *PCDROM_SEEK_AUDIO_MSF;
|
||||
|
||||
/* CDROM_SUB_Q_DATA_FORMAT.Format constants */
|
||||
#define IOCTL_CDROM_SUB_Q_CHANNEL 0x00
|
||||
#define IOCTL_CDROM_CURRENT_POSITION 0x01
|
||||
#define IOCTL_CDROM_MEDIA_CATALOG 0x02
|
||||
#define IOCTL_CDROM_TRACK_ISRC 0x03
|
||||
|
||||
typedef struct _CDROM_SUB_Q_DATA_FORMAT {
|
||||
UCHAR Format;
|
||||
UCHAR Track;
|
||||
} CDROM_SUB_Q_DATA_FORMAT, *PCDROM_SUB_Q_DATA_FORMAT;
|
||||
|
||||
typedef struct _CDROM_TOC {
|
||||
UCHAR Length[2];
|
||||
UCHAR FirstTrack;
|
||||
UCHAR LastTrack;
|
||||
TRACK_DATA TrackData[MAXIMUM_NUMBER_TRACKS];
|
||||
} CDROM_TOC, *PCDROM_TOC;
|
||||
|
||||
#define CDROM_TOC_SIZE sizeof(CDROM_TOC)
|
||||
|
||||
typedef struct _CDROM_TOC_ATIP_DATA_BLOCK {
|
||||
UCHAR CdrwReferenceSpeed : 3;
|
||||
UCHAR Reserved3 : 1;
|
||||
UCHAR WritePower : 3;
|
||||
UCHAR True1 : 1;
|
||||
UCHAR Reserved4 : 6;
|
||||
UCHAR UnrestrictedUse : 1;
|
||||
UCHAR Reserved5 : 1;
|
||||
UCHAR A3Valid : 1;
|
||||
UCHAR A2Valid : 1;
|
||||
UCHAR A1Valid : 1;
|
||||
UCHAR Reserved6 : 3;
|
||||
UCHAR IsCdrw : 1;
|
||||
UCHAR True2 : 1;
|
||||
UCHAR Reserved7;
|
||||
UCHAR LeadInMsf[3];
|
||||
UCHAR Reserved8;
|
||||
UCHAR LeadOutMsf[3];
|
||||
UCHAR Reserved9;
|
||||
UCHAR A1Values[3];
|
||||
UCHAR Reserved10;
|
||||
UCHAR A2Values[3];
|
||||
UCHAR Reserved11;
|
||||
UCHAR A3Values[3];
|
||||
UCHAR Reserved12;
|
||||
} CDROM_TOC_ATIP_DATA_BLOCK, *PCDROM_TOC_ATIP_DATA_BLOCK;
|
||||
|
||||
/* CDROM_TOC_CD_TEXT_DATA_BLOCK.PackType constants */
|
||||
#define CDROM_CD_TEXT_PACK_ALBUM_NAME 0x80
|
||||
#define CDROM_CD_TEXT_PACK_PERFORMER 0x81
|
||||
#define CDROM_CD_TEXT_PACK_SONGWRITER 0x82
|
||||
#define CDROM_CD_TEXT_PACK_COMPOSER 0x83
|
||||
#define CDROM_CD_TEXT_PACK_ARRANGER 0x84
|
||||
#define CDROM_CD_TEXT_PACK_MESSAGES 0x85
|
||||
#define CDROM_CD_TEXT_PACK_DISC_ID 0x86
|
||||
#define CDROM_CD_TEXT_PACK_GENRE 0x87
|
||||
#define CDROM_CD_TEXT_PACK_TOC_INFO 0x88
|
||||
#define CDROM_CD_TEXT_PACK_TOC_INFO2 0x89
|
||||
#define CDROM_CD_TEXT_PACK_UPC_EAN 0x8e
|
||||
#define CDROM_CD_TEXT_PACK_SIZE_INFO 0x8f
|
||||
|
||||
typedef struct _CDROM_TOC_CD_TEXT_DATA_BLOCK {
|
||||
UCHAR PackType;
|
||||
UCHAR TrackNumber : 7;
|
||||
UCHAR ExtensionFlag : 1;
|
||||
UCHAR SequenceNumber;
|
||||
UCHAR CharacterPosition : 4;
|
||||
UCHAR BlockNumber : 3;
|
||||
UCHAR Unicode : 1;
|
||||
union {
|
||||
UCHAR Text[12];
|
||||
WCHAR WText[6];
|
||||
};
|
||||
UCHAR CRC[2];
|
||||
} CDROM_TOC_CD_TEXT_DATA_BLOCK, *PCDROM_TOC_CD_TEXT_DATA_BLOCK;
|
||||
|
||||
/* CDROM_TOC_FULL_TOC_DATA_BLOCK.Adr constants */
|
||||
#define ADR_NO_MODE_INFORMATION 0x0
|
||||
#define ADR_ENCODES_CURRENT_POSITION 0x1
|
||||
#define ADR_ENCODES_MEDIA_CATALOG 0x2
|
||||
#define ADR_ENCODES_ISRC 0x3
|
||||
|
||||
typedef struct _CDROM_TOC_FULL_TOC_DATA_BLOCK {
|
||||
UCHAR SessionNumber;
|
||||
UCHAR Control : 4;
|
||||
UCHAR Adr : 4;
|
||||
UCHAR Reserved1;
|
||||
UCHAR Point;
|
||||
UCHAR MsfExtra[3];
|
||||
UCHAR Zero;
|
||||
UCHAR Msf[3];
|
||||
} CDROM_TOC_FULL_TOC_DATA_BLOCK, *PCDROM_TOC_FULL_TOC_DATA_BLOCK;
|
||||
|
||||
/* SUB_Q_HEADER.AudioStatus constants */
|
||||
#define AUDIO_STATUS_NOT_SUPPORTED 0x00
|
||||
#define AUDIO_STATUS_IN_PROGRESS 0x11
|
||||
#define AUDIO_STATUS_PAUSED 0x12
|
||||
#define AUDIO_STATUS_PLAY_COMPLETE 0x13
|
||||
#define AUDIO_STATUS_PLAY_ERROR 0x14
|
||||
#define AUDIO_STATUS_NO_STATUS 0x15
|
||||
|
||||
typedef struct _SUB_Q_HEADER {
|
||||
UCHAR Reserved;
|
||||
UCHAR AudioStatus;
|
||||
UCHAR DataLength[2];
|
||||
} SUB_Q_HEADER, *PSUB_Q_HEADER;
|
||||
|
||||
typedef struct _SUB_Q_MEDIA_CATALOG_NUMBER {
|
||||
SUB_Q_HEADER Header;
|
||||
UCHAR FormatCode;
|
||||
UCHAR Reserved[3];
|
||||
UCHAR Reserved1 : 7;
|
||||
UCHAR Mcval :1;
|
||||
UCHAR MediaCatalog[15];
|
||||
} SUB_Q_MEDIA_CATALOG_NUMBER, *PSUB_Q_MEDIA_CATALOG_NUMBER;
|
||||
|
||||
typedef struct _SUB_Q_TRACK_ISRC {
|
||||
SUB_Q_HEADER Header;
|
||||
UCHAR FormatCode;
|
||||
UCHAR Reserved0;
|
||||
UCHAR Track;
|
||||
UCHAR Reserved1;
|
||||
UCHAR Reserved2 : 7;
|
||||
UCHAR Tcval : 1;
|
||||
UCHAR TrackIsrc[15];
|
||||
} SUB_Q_TRACK_ISRC, *PSUB_Q_TRACK_ISRC;
|
||||
|
||||
typedef struct _SUB_Q_CURRENT_POSITION {
|
||||
SUB_Q_HEADER Header;
|
||||
UCHAR FormatCode;
|
||||
UCHAR Control : 4;
|
||||
UCHAR ADR : 4;
|
||||
UCHAR TrackNumber;
|
||||
UCHAR IndexNumber;
|
||||
UCHAR AbsoluteAddress[4];
|
||||
UCHAR TrackRelativeAddress[4];
|
||||
} SUB_Q_CURRENT_POSITION, *PSUB_Q_CURRENT_POSITION;
|
||||
|
||||
typedef union _SUB_Q_CHANNEL_DATA {
|
||||
SUB_Q_CURRENT_POSITION CurrentPosition;
|
||||
SUB_Q_MEDIA_CATALOG_NUMBER MediaCatalog;
|
||||
SUB_Q_TRACK_ISRC TrackIsrc;
|
||||
} SUB_Q_CHANNEL_DATA, *PSUB_Q_CHANNEL_DATA;
|
||||
|
||||
/* CDROM_AUDIO_CONTROL.LbaFormat constants */
|
||||
#define AUDIO_WITH_PREEMPHASIS 0x1
|
||||
#define DIGITAL_COPY_PERMITTED 0x2
|
||||
#define AUDIO_DATA_TRACK 0x4
|
||||
#define TWO_FOUR_CHANNEL_AUDIO 0x8
|
||||
|
||||
typedef struct _CDROM_AUDIO_CONTROL {
|
||||
UCHAR LbaFormat;
|
||||
USHORT LogicalBlocksPerSecond;
|
||||
} CDROM_AUDIO_CONTROL, *PCDROM_AUDIO_CONTROL;
|
||||
|
||||
typedef struct _VOLUME_CONTROL {
|
||||
UCHAR PortVolume[4];
|
||||
} VOLUME_CONTROL, *PVOLUME_CONTROL;
|
||||
|
||||
typedef enum _TRACK_MODE_TYPE {
|
||||
YellowMode2,
|
||||
XAForm2,
|
||||
CDDA
|
||||
} TRACK_MODE_TYPE, *PTRACK_MODE_TYPE;
|
||||
|
||||
typedef struct __RAW_READ_INFO {
|
||||
LARGE_INTEGER DiskOffset;
|
||||
ULONG SectorCount;
|
||||
TRACK_MODE_TYPE TrackMode;
|
||||
} RAW_READ_INFO, *PRAW_READ_INFO;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __NTDDCDRM_H */
|
|
@ -153,7 +153,6 @@
|
|||
<ClCompile Include="..\src\dosbox.cpp" />
|
||||
<ClCompile Include="..\src\dos\cdrom.cpp" />
|
||||
<ClCompile Include="..\src\dos\cdrom_image.cpp" />
|
||||
<ClCompile Include="..\src\dos\cdrom_ioctl_win32.cpp" />
|
||||
<ClCompile Include="..\src\dos\dos.cpp" />
|
||||
<ClCompile Include="..\src\dos\dos_classes.cpp" />
|
||||
<ClCompile Include="..\src\dos\dos_devices.cpp" />
|
||||
|
|
Loading…
Add table
Reference in a new issue