summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author 987123879113 <63495610+987123879113@users.noreply.github.com>2021-02-27 02:47:39 +0900
committer GitHub <noreply@github.com>2021-02-27 04:47:39 +1100
commit7651de2840252eb80f882772d257b39ed6674ad9 (patch)
tree095570604162cd7e6da0c4f325b811b19ddd8a59
parent2f02c96baffbe8a628ab2d4bbc325efe945100d7 (diff)
machine/t10mmc.cpp: Added CD media type check for special LBA 0 case. (#7822)
The special case of setting m_lba to 150 when m_lba is 0 is only applicable to data and mixed mode media CDs.
-rw-r--r--src/devices/machine/t10mmc.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/devices/machine/t10mmc.cpp b/src/devices/machine/t10mmc.cpp
index 1e062f2bd43..3d22129e3f4 100644
--- a/src/devices/machine/t10mmc.cpp
+++ b/src/devices/machine/t10mmc.cpp
@@ -224,10 +224,15 @@ void t10mmc::ExecCommand()
m_lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5];
m_blocks = SCSILengthFromUINT16( &command[7] );
- // special cases: lba of 0 means MSF of 00:02:00
if (m_lba == 0)
{
- m_lba = 150;
+ // A request for LBA 0 will return something different depending on the type of media being played.
+ // For data and mixed media, LBA 0 is assigned to MSF 00:02:00 (= LBA 150).
+ // For audio media, LBA 0 is assigned to the actual starting address of track 1.
+ if (cdrom_get_track_type(m_cdrom, 0) == CD_TRACK_AUDIO)
+ m_lba = cdrom_get_track_start(m_cdrom, 0);
+ else
+ m_lba = 150;
}
else if (m_lba == 0xffffffff)
{
@@ -258,10 +263,12 @@ void t10mmc::ExecCommand()
m_lba = (command[5] % 75) + ((command[4] * 75) % (60*75)) + (command[3] * (75*60));
m_blocks = (command[8] % 75) + ((command[7] * 75) % (60*75)) + (command[6] * (75*60)) - m_lba;
- // special cases: lba of 0 means MSF of 00:02:00
if (m_lba == 0)
{
- m_lba = 150;
+ if (cdrom_get_track_type(m_cdrom, 0) == CD_TRACK_AUDIO)
+ m_lba = cdrom_get_track_start(m_cdrom, 0);
+ else
+ m_lba = 150;
}
else if (m_lba == 0xffffffff)
{
@@ -373,10 +380,12 @@ void t10mmc::ExecCommand()
m_lba = command[2]<<24 | command[3]<<16 | command[4]<<8 | command[5];
m_blocks = command[6]<<24 | command[7]<<16 | command[8]<<8 | command[9];
- // special cases: lba of 0 means MSF of 00:02:00
if (m_lba == 0)
{
- m_lba = 150;
+ if (cdrom_get_track_type(m_cdrom, 0) == CD_TRACK_AUDIO)
+ m_lba = cdrom_get_track_start(m_cdrom, 0);
+ else
+ m_lba = 150;
}
else if (m_lba == 0xffffffff)
{