CDROM: Play command track should be BCD

Fixes tracks >= 10 in BIOS CD player, maybe games?
This commit is contained in:
Connor McLaughlin 2020-12-28 01:17:39 +10:00
parent 8bb5ff47eb
commit c04d6f9ef8

View file

@ -936,8 +936,8 @@ void CDROM::ExecuteCommand()
case Command::Play: case Command::Play:
{ {
u8 track = m_param_fifo.IsEmpty() ? 0 : m_param_fifo.Peek(0); const u8 track_bcd = m_param_fifo.IsEmpty() ? 0 : PackedBCDToBinary(m_param_fifo.Peek(0));
Log_DebugPrintf("CDROM play command, track=%u", track); Log_DebugPrintf("CDROM play command, track=%u", track_bcd);
if (!CanReadMedia()) if (!CanReadMedia())
{ {
@ -947,7 +947,7 @@ void CDROM::ExecuteCommand()
{ {
SendACKAndStat(); SendACKAndStat();
if (track == 0 && (!m_setloc_pending || m_setloc_position.ToLBA() == GetNextSectorToBeRead()) && if (track_bcd == 0 && (!m_setloc_pending || m_setloc_position.ToLBA() == GetNextSectorToBeRead()) &&
(m_drive_state == DriveState::Playing || (IsSeeking() && m_play_after_seek))) (m_drive_state == DriveState::Playing || (IsSeeking() && m_play_after_seek)))
{ {
Log_DevPrintf("Ignoring play command with no/same setloc, already playing/playing after seek"); Log_DevPrintf("Ignoring play command with no/same setloc, already playing/playing after seek");
@ -958,7 +958,7 @@ void CDROM::ExecuteCommand()
if (IsSeeking()) if (IsSeeking())
UpdatePositionWhileSeeking(); UpdatePositionWhileSeeking();
BeginPlaying(track); BeginPlaying(track_bcd);
} }
} }