mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-14 14:45:46 -04:00
CDROM: Implement GetTN command
This commit is contained in:
@ -407,6 +407,13 @@ void CDROM::PushStatResponse(Interrupt interrupt /*= Interrupt::ACK*/)
|
||||
SetInterrupt(interrupt);
|
||||
}
|
||||
|
||||
void CDROM::SendErrorResponse(u8 reason /*= 0x80*/)
|
||||
{
|
||||
m_response_fifo.Push(m_secondary_status.bits | 0x01);
|
||||
m_response_fifo.Push(reason);
|
||||
SetInterrupt(Interrupt::INT5);
|
||||
}
|
||||
|
||||
void CDROM::UpdateStatusRegister()
|
||||
{
|
||||
m_status.ADPBUSY = false;
|
||||
@ -755,6 +762,25 @@ void CDROM::ExecuteCommand()
|
||||
}
|
||||
break;
|
||||
|
||||
case Command::GetTN:
|
||||
{
|
||||
Log_DebugPrintf("CDROM GetTN command");
|
||||
if (m_media)
|
||||
{
|
||||
m_response_fifo.Push(m_secondary_status.bits);
|
||||
m_response_fifo.Push(DecimalToBCD(Truncate8(m_media->GetTrackNumber())));
|
||||
m_response_fifo.Push(DecimalToBCD(Truncate8(m_media->GetTrackCount())));
|
||||
SetInterrupt(Interrupt::ACK);
|
||||
}
|
||||
else
|
||||
{
|
||||
SendErrorResponse(0x80);
|
||||
}
|
||||
|
||||
EndCommand();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
Panic("Unknown command");
|
||||
break;
|
||||
|
@ -170,6 +170,7 @@ private:
|
||||
bool HasPendingInterrupt() const { return m_interrupt_flag_register != 0; }
|
||||
void SetInterrupt(Interrupt interrupt);
|
||||
void PushStatResponse(Interrupt interrupt = Interrupt::ACK);
|
||||
void SendErrorResponse(u8 reason = 0x80);
|
||||
void UpdateStatusRegister();
|
||||
|
||||
u32 GetAckDelayForCommand() const;
|
||||
|
Reference in New Issue
Block a user