CDROM: GetTN should return first_track, last_track

Fixes CDDA playback in Street Sk8er, Jellyfish - The Healing Friend,
probably others.
This commit is contained in:
Connor McLaughlin 2020-03-30 00:06:06 +10:00
parent 7ecac6dbcf
commit 3a31282fe6
2 changed files with 5 additions and 3 deletions

View File

@ -173,6 +173,8 @@ public:
u32 GetTrackCount() const { return static_cast<u32>(m_tracks.size()); } u32 GetTrackCount() const { return static_cast<u32>(m_tracks.size()); }
LBA GetTrackStartPosition(u8 track) const; LBA GetTrackStartPosition(u8 track) const;
Position GetTrackStartMSFPosition(u8 track) const; Position GetTrackStartMSFPosition(u8 track) const;
u32 GetFirstTrackNumber() const { return m_tracks.front().track_number; }
u32 GetLastTrackNumber() const { return m_tracks.back().track_number; }
// Seek to data LBA. // Seek to data LBA.
bool Seek(LBA lba); bool Seek(LBA lba);

View File

@ -881,8 +881,8 @@ void CDROM::ExecuteCommand()
m_reader.WaitForReadToComplete(); m_reader.WaitForReadToComplete();
m_response_fifo.Push(m_secondary_status.bits); m_response_fifo.Push(m_secondary_status.bits);
m_response_fifo.Push(BinaryToBCD(Truncate8(m_reader.GetMedia()->GetTrackNumber()))); m_response_fifo.Push(BinaryToBCD(Truncate8(m_reader.GetMedia()->GetFirstTrackNumber())));
m_response_fifo.Push(BinaryToBCD(Truncate8(m_reader.GetMedia()->GetTrackCount()))); m_response_fifo.Push(BinaryToBCD(Truncate8(m_reader.GetMedia()->GetLastTrackNumber())));
SetInterrupt(Interrupt::ACK); SetInterrupt(Interrupt::ACK);
} }
else else
@ -1396,8 +1396,8 @@ void CDROM::DoSectorRead()
if (m_play_track_number_bcd == 0) if (m_play_track_number_bcd == 0)
{ {
// track number was not specified, but we've found the track now // track number was not specified, but we've found the track now
Log_DebugPrintf("Setting playing track number to %u", m_play_track_number_bcd);
m_play_track_number_bcd = subq.track_number_bcd; m_play_track_number_bcd = subq.track_number_bcd;
Log_DebugPrintf("Setting playing track number to %u", m_play_track_number_bcd);
} }
else if (m_mode.auto_pause && subq.track_number_bcd != m_play_track_number_bcd) else if (m_mode.auto_pause && subq.track_number_bcd != m_play_track_number_bcd)
{ {