CDImage: Support reading MODE1 sectors
This commit is contained in:
parent
173405be22
commit
185ea7e3f1
|
@ -267,8 +267,25 @@ u32 CDImage::Read(ReadMode read_mode, u32 sector_count, void* buffer)
|
|||
switch (read_mode)
|
||||
{
|
||||
case ReadMode::DataOnly:
|
||||
std::memcpy(buffer_ptr, raw_sector + 24, DATA_SECTOR_SIZE);
|
||||
{
|
||||
const SectorHeader* header = reinterpret_cast<const SectorHeader*>(raw_sector + SECTOR_SYNC_SIZE);
|
||||
if (header->sector_mode == 1)
|
||||
{
|
||||
std::memcpy(buffer_ptr, raw_sector + SECTOR_SYNC_SIZE + MODE1_HEADER_SIZE, DATA_SECTOR_SIZE);
|
||||
}
|
||||
else if (header->sector_mode == 2)
|
||||
{
|
||||
std::memcpy(buffer_ptr, raw_sector + SECTOR_SYNC_SIZE + MODE2_HEADER_SIZE, DATA_SECTOR_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG("Invalid sector mode {} at LBA {}", header->sector_mode,
|
||||
m_current_index->start_lba_on_disc + m_position_in_track);
|
||||
break;
|
||||
}
|
||||
|
||||
buffer_ptr += DATA_SECTOR_SIZE;
|
||||
}
|
||||
break;
|
||||
|
||||
case ReadMode::RawNoSync:
|
||||
|
|
|
@ -30,6 +30,8 @@ public:
|
|||
DATA_SECTOR_SIZE = 2048,
|
||||
SECTOR_SYNC_SIZE = 12,
|
||||
SECTOR_HEADER_SIZE = 4,
|
||||
MODE1_HEADER_SIZE = 4,
|
||||
MODE2_HEADER_SIZE = 12,
|
||||
FRAMES_PER_SECOND = 75, // "sectors", or "timecode frames" (not "channel frames")
|
||||
SECONDS_PER_MINUTE = 60,
|
||||
FRAMES_PER_MINUTE = FRAMES_PER_SECOND * SECONDS_PER_MINUTE,
|
||||
|
|
Loading…
Reference in New Issue