Add basic support for audio cds only when dealing with images.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2982
This commit is contained in:
parent
d44511abce
commit
0382a13bd3
4 changed files with 56 additions and 8 deletions
|
@ -169,6 +169,7 @@ public:
|
|||
bool ReadSectors (PhysPt buffer, bool raw, unsigned long sector, unsigned long num);
|
||||
bool LoadUnloadMedia (bool unload);
|
||||
bool ReadSector (Bit8u *buffer, bool raw, unsigned long sector);
|
||||
bool HasDataTrack (void);
|
||||
|
||||
static CDROM_Interface_Image* images[26];
|
||||
|
||||
|
@ -202,6 +203,7 @@ static struct imagePlayer {
|
|||
|
||||
static int refCount;
|
||||
std::vector<Track> tracks;
|
||||
typedef std::vector<Track>::iterator track_it;
|
||||
std::string mcn;
|
||||
Bit8u subUnit;
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: cdrom_image.cpp,v 1.16 2007-06-12 20:22:08 c2woody Exp $ */
|
||||
/* $Id: cdrom_image.cpp,v 1.17 2007-08-22 11:54:35 qbix79 Exp $ */
|
||||
|
||||
#include <cctype>
|
||||
#include <cmath>
|
||||
|
@ -261,7 +261,7 @@ bool CDROM_Interface_Image::ReadSectors(PhysPt buffer, bool raw, unsigned long s
|
|||
|
||||
MEM_BlockWrite(buffer, buf, buflen);
|
||||
delete[] buf;
|
||||
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ bool CDROM_Interface_Image::ReadSector(Bit8u *buffer, bool raw, unsigned long se
|
|||
if (tracks[track].sectorSize != RAW_SECTOR_SIZE && raw) return false;
|
||||
if (tracks[track].sectorSize == RAW_SECTOR_SIZE && !tracks[track].mode2 && !raw) seek += 16;
|
||||
if (tracks[track].mode2 && !raw) seek += 24;
|
||||
|
||||
|
||||
return tracks[track].file->read(buffer, seek, length);
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ bool CDROM_Interface_Image::LoadCueSheet(char *cuefile)
|
|||
track.length = 0;
|
||||
track.file = NULL;
|
||||
if(!AddTrack(track, shift, 0, totalPregap, 0)) return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -575,6 +575,16 @@ bool CDROM_Interface_Image::AddTrack(Track &curr, int &shift, int prestart, int
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CDROM_Interface_Image::HasDataTrack(void)
|
||||
{
|
||||
//Data track has attribute 0x40
|
||||
for(track_it it = tracks.begin(); it != tracks.end(); it++) {
|
||||
if ((*it).attr == 0x40) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CDROM_Interface_Image::GetRealFileName(string &filename, string &pathname)
|
||||
{
|
||||
// check if file exists
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: drive_iso.cpp,v 1.20 2007-06-15 19:05:48 c2woody Exp $ */
|
||||
/* $Id: drive_iso.cpp,v 1.21 2007-08-22 11:54:35 qbix79 Exp $ */
|
||||
|
||||
#include <cctype>
|
||||
#include <cstring>
|
||||
|
@ -182,7 +182,36 @@ isoDrive::isoDrive(char driveLetter, const char *fileName, Bit8u mediaid, int &e
|
|||
//Remove trailing dot.
|
||||
if((labelPos > 0) && (discLabel[labelPos - 1] == '.'))
|
||||
discLabel[labelPos - 1] = 0;
|
||||
} else error = 6;
|
||||
} else if (CDROM_Interface_Image::images[subUnit]->HasDataTrack() == false) { //Audio only cdrom
|
||||
strcpy(info, "isoDrive ");
|
||||
strcat(info, fileName);
|
||||
this->driveLetter = driveLetter;
|
||||
this->mediaid = mediaid;
|
||||
char buffer[32] = { 0 };
|
||||
strcpy(buffer, "Audio CD");
|
||||
|
||||
//Code Copied from drive_cache. (convert mscdex label to a dos 8.3 file)
|
||||
Bitu togo = 8;
|
||||
Bitu bufPos = 0;
|
||||
Bitu labelPos = 0;
|
||||
bool point = false;
|
||||
while (togo>0) {
|
||||
if (buffer[bufPos]==0) break;
|
||||
if (!point && (buffer[bufPos]=='.')) { togo=4; point=true; }
|
||||
discLabel[labelPos] = toupper(buffer[bufPos]);
|
||||
labelPos++; bufPos++;
|
||||
togo--;
|
||||
if ((togo==0) && !point) {
|
||||
if (buffer[bufPos]=='.') bufPos++;
|
||||
discLabel[labelPos]='.'; labelPos++; point=true; togo=3;
|
||||
}
|
||||
};
|
||||
discLabel[labelPos]=0;
|
||||
//Remove trailing dot.
|
||||
if((labelPos > 0) && (discLabel[labelPos - 1] == '.'))
|
||||
discLabel[labelPos - 1] = 0;
|
||||
|
||||
} else error = 6; //Corrupt image
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,13 +559,19 @@ int isoDrive :: readDirEntry(isoDirEntry *de, Bit8u *data)
|
|||
bool isoDrive :: loadImage()
|
||||
{
|
||||
isoPVD pvd;
|
||||
dataCD = false;
|
||||
readSector((Bit8u*)(&pvd), ISO_FIRST_VD);
|
||||
if (pvd.type != 1 || strncmp((char*)pvd.standardIdent, "CD001", 5) || pvd.version != 1) return false;
|
||||
return (readDirEntry(&this->rootEntry, pvd.rootEntry)>0);
|
||||
if (readDirEntry(&this->rootEntry, pvd.rootEntry)>0) {
|
||||
dataCD = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isoDrive :: lookup(isoDirEntry *de, const char *path)
|
||||
{
|
||||
if (!dataCD) return false;
|
||||
*de = this->rootEntry;
|
||||
if (!strcmp(path, "")) return true;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: drives.h,v 1.37 2007-06-14 08:23:46 qbix79 Exp $ */
|
||||
/* $Id: drives.h,v 1.38 2007-08-22 11:54:35 qbix79 Exp $ */
|
||||
|
||||
#ifndef _DRIVES_H__
|
||||
#define _DRIVES_H__
|
||||
|
@ -357,6 +357,7 @@ private:
|
|||
Bit8u data[ISO_FRAMESIZE];
|
||||
} sectorHashEntries[ISO_MAX_HASH_TABLE_SIZE];
|
||||
|
||||
bool dataCD;
|
||||
isoDirEntry rootEntry;
|
||||
Bit8u mediaid;
|
||||
char fileName[CROSS_LEN];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue