summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2023-03-09 23:26:03 -0500
committer AJR <ajrhacker@users.noreply.github.com>2023-03-09 23:26:49 -0500
commit888b387e54b4cf8db7b995d3c2298a7b9b9f9783 (patch)
treeb885f02e5e75a7513e40658fff7e38ddacce26d9 /src/lib
parent22aa30448f4f1c999b1c89339db284f91c14f50c (diff)
Add vendor-specific Read TOC command for Apple SCSI CD-ROM drive
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/cdrom.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp
index 2771e0f5478..750ed0f8eba 100644
--- a/src/lib/util/cdrom.cpp
+++ b/src/lib/util/cdrom.cpp
@@ -422,7 +422,7 @@ std::error_condition cdrom_file::read_partial_sector(void *dest, uint32_t lbasec
sourcefileoffset += chdsector * bytespersector + startoffs;
if (EXTRA_VERBOSE)
- printf("Reading sector %d from track %d at offset %lu\n", chdsector, tracknum, (unsigned long)sourcefileoffset);
+ printf("Reading %u bytes from sector %d from track %d at offset %lu\n", (unsigned)length, chdsector, tracknum + 1, (unsigned long)sourcefileoffset);
size_t actual;
result = srcfile.seek(sourcefileoffset, SEEK_SET);
@@ -438,9 +438,7 @@ std::error_condition cdrom_file::read_partial_sector(void *dest, uint32_t lbasec
uint8_t *buffer = (uint8_t *)dest - startoffs;
for (int swapindex = startoffs; swapindex < 2352; swapindex += 2 )
{
- int swaptemp = buffer[ swapindex ];
- buffer[ swapindex ] = buffer[ swapindex + 1 ];
- buffer[ swapindex + 1 ] = swaptemp;
+ std::swap(buffer[ swapindex ], buffer[ swapindex + 1 ]);
}
}
return result;
@@ -485,6 +483,7 @@ bool cdrom_file::read_data(uint32_t lbasector, void *buffer, uint32_t datatype,
if ((datatype == tracktype) || (datatype == CD_TRACK_RAW_DONTCARE))
{
+ assert(cdtoc.tracks[tracknum].datasize != 0);
return !read_partial_sector(buffer, lbasector, chdsector, tracknum, 0, cdtoc.tracks[tracknum].datasize, phys);
}
else