mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-22 16:33:17 +00:00
Fix block size handling (512 bytes) for CDs (#316)
* Replaced code that assumes CDs having 2048 bytes per sector * Comment update * Logging update * Logging update * Set sector size before calling Open()
This commit is contained in:
parent
dd5cad616f
commit
be090de0cc
@ -247,7 +247,7 @@ void SCSIDEV::Execute()
|
||||
lun = (ctrl.cmd[1] >> 5) & 0x07;
|
||||
|
||||
if (!ctrl.unit[lun]) {
|
||||
LOGINFO("Invalid LUN %d for ID %d", lun, GetSCSIID());
|
||||
LOGDEBUG("Invalid LUN %d for ID %d", lun, GetSCSIID());
|
||||
|
||||
Error(ERROR_CODES::sense_key::ILLEGAL_REQUEST, ERROR_CODES::asc::INVALID_LUN);
|
||||
return;
|
||||
|
@ -307,6 +307,9 @@ void SCSICD::Open(const Filepath& path)
|
||||
throw file_not_found_exception("Can't open CD-ROM file");
|
||||
}
|
||||
|
||||
// Default sector size is 2048 bytes
|
||||
SetSectorSizeInBytes(GetConfiguredSectorSize() ? GetConfiguredSectorSize() : 2048, false);
|
||||
|
||||
// Close and transfer for physical CD access
|
||||
if (path.GetPath()[0] == _T('\\')) {
|
||||
// Close
|
||||
@ -341,9 +344,6 @@ void SCSICD::Open(const Filepath& path)
|
||||
// Successful opening
|
||||
ASSERT(GetBlockCount() > 0);
|
||||
|
||||
// Default sector size is 2048 bytes
|
||||
SetSectorSizeInBytes(GetConfiguredSectorSize() ? GetConfiguredSectorSize() : 2048, false);
|
||||
|
||||
Disk::Open(path);
|
||||
FileSupport::SetPath(path);
|
||||
|
||||
@ -420,7 +420,7 @@ void SCSICD::OpenIso(const Filepath& path)
|
||||
fio.Close();
|
||||
|
||||
if (rawfile) {
|
||||
// Size must be a multiple of 2536 and less than 700MB
|
||||
// Size must be a multiple of 2536
|
||||
if (size % 2536) {
|
||||
stringstream error;
|
||||
error << "Raw ISO CD-ROM file size must be a multiple of 2536 bytes but is " << size << " bytes";
|
||||
@ -431,7 +431,7 @@ void SCSICD::OpenIso(const Filepath& path)
|
||||
SetBlockCount((DWORD)(size / 0x930));
|
||||
} else {
|
||||
// Set the number of blocks
|
||||
SetBlockCount((DWORD)(size >> 11));
|
||||
SetBlockCount((DWORD)(size >> GetSectorSize()));
|
||||
}
|
||||
|
||||
// Create only one data track
|
||||
@ -472,7 +472,7 @@ void SCSICD::OpenPhysical(const Filepath& path)
|
||||
}
|
||||
|
||||
// Set the number of blocks
|
||||
SetBlockCount((DWORD)(size >> 11));
|
||||
SetBlockCount((DWORD)(size >> GetSectorSize()));
|
||||
|
||||
// Create only one data track
|
||||
ASSERT(!track[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user