- the win32 version now uses the READ TOC function for files. This is a hack

and works okay with one rom track only. We still have to implement reading
  the real TOC on win32.
- in function GetCDCapacity(): type of variable 'buf[8]' must be 'unsigned char'
- in function capacity(): win32 version returned the number of bytes, but it
  should return the number of blocks (ASPI blocksize is 2352)
- description of the function capacity() fixed (it always returns blocks)
This commit is contained in:
Volker Ruppert 2002-07-31 05:21:46 +00:00
parent 2b2369a049
commit e3f378505d

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: cdrom.cc,v 1.36 2002-07-30 06:25:57 vruppert Exp $
// $Id: cdrom.cc,v 1.37 2002-07-31 05:21:46 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -159,7 +159,7 @@ int GetCDCapacity(unsigned int hid, unsigned int tid, unsigned int lun)
HANDLE hEventSRB;
SRB_ExecSCSICmd srb;
DWORD dwStatus;
char buf[8];
unsigned char buf[8];
hEventSRB = CreateEvent(NULL, TRUE, FALSE, NULL);
@ -210,7 +210,7 @@ cdrom_interface::cdrom_interface(char *dev)
void
cdrom_interface::init(void) {
BX_DEBUG(("Init $Id: cdrom.cc,v 1.36 2002-07-30 06:25:57 vruppert Exp $"));
BX_DEBUG(("Init $Id: cdrom.cc,v 1.37 2002-07-31 05:21:46 vruppert Exp $"));
BX_INFO(("file = '%s'",path));
}
@ -409,7 +409,11 @@ cdrom_interface::read_toc(uint8* buf, int* length, bool msf, int start_track)
BX_PANIC(("cdrom: read_toc: file not open."));
}
#ifdef WIN32
if (1) { // This is a hack and works okay if there's one rom track only
#else
if (using_file) {
#endif
if ((start_track != 1) && (start_track != 0xaa))
return false;
@ -646,7 +650,7 @@ cdrom_interface::read_toc(uint8* buf, int* length, bool msf, int start_track)
cdrom_interface::capacity()
{
// Return CD-ROM capacity. I believe you want to return
// the number of bytes of capacity the actual media has.
// the number of blocks of capacity the actual media has.
#if !defined WIN32
// win32 has its own way of doing this
@ -796,10 +800,10 @@ cdrom_interface::capacity()
#elif defined WIN32
{
if(bUseASPI) {
return GetCDCapacity(hid, tid, lun);
return (GetCDCapacity(hid, tid, lun) / 2352);
} else {
unsigned long FileSize;
return (GetFileSize(hFile, &FileSize));
return (GetFileSize(hFile, &FileSize) / 2048);
}
}
#else