mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-02-17 03:15:39 +00:00
CDROM: Implement motor on command
This commit is contained in:
parent
c15822d745
commit
a1ed2d1d77
|
@ -512,8 +512,8 @@ void CDROM::Execute(TickCount ticks)
|
||||||
{
|
{
|
||||||
switch (m_drive_state)
|
switch (m_drive_state)
|
||||||
{
|
{
|
||||||
case DriveState::Initializing:
|
case DriveState::SpinningUp:
|
||||||
DoInitComplete();
|
DoSpinUpComplete();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DriveState::Seeking:
|
case DriveState::Seeking:
|
||||||
|
@ -750,8 +750,11 @@ void CDROM::ExecuteCommand()
|
||||||
Log_DebugPrintf("CDROM init command");
|
Log_DebugPrintf("CDROM init command");
|
||||||
SendACKAndStat();
|
SendACKAndStat();
|
||||||
|
|
||||||
m_drive_state = DriveState::Initializing;
|
m_secondary_status.ClearActiveBits();
|
||||||
m_drive_remaining_ticks = 8000;
|
m_mode.bits = 0;
|
||||||
|
|
||||||
|
m_drive_state = DriveState::SpinningUp;
|
||||||
|
m_drive_remaining_ticks = 80000;
|
||||||
m_system->SetDowncount(m_drive_remaining_ticks);
|
m_system->SetDowncount(m_drive_remaining_ticks);
|
||||||
|
|
||||||
EndCommand();
|
EndCommand();
|
||||||
|
@ -759,6 +762,27 @@ void CDROM::ExecuteCommand()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Command::MotorOn:
|
||||||
|
{
|
||||||
|
Log_DebugPrintf("CDROM motor on command");
|
||||||
|
if (m_secondary_status.motor_on)
|
||||||
|
{
|
||||||
|
SendErrorResponse(0x20);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendACKAndStat();
|
||||||
|
|
||||||
|
m_drive_state = DriveState::SpinningUp;
|
||||||
|
m_drive_remaining_ticks = 80000;
|
||||||
|
m_system->SetDowncount(m_drive_remaining_ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
EndCommand();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Command::Mute:
|
case Command::Mute:
|
||||||
{
|
{
|
||||||
Log_DebugPrintf("CDROM mute command");
|
Log_DebugPrintf("CDROM mute command");
|
||||||
|
@ -945,12 +969,10 @@ void CDROM::BeginSeeking()
|
||||||
m_system->SetDowncount(m_drive_remaining_ticks);
|
m_system->SetDowncount(m_drive_remaining_ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDROM::DoInitComplete()
|
void CDROM::DoSpinUpComplete()
|
||||||
{
|
{
|
||||||
m_drive_state = DriveState::Idle;
|
m_drive_state = DriveState::Idle;
|
||||||
|
|
||||||
m_mode.bits = 0;
|
|
||||||
m_secondary_status.bits = 0;
|
|
||||||
m_secondary_status.motor_on = true;
|
m_secondary_status.motor_on = true;
|
||||||
|
|
||||||
m_async_response_fifo.Clear();
|
m_async_response_fifo.Clear();
|
||||||
|
@ -1326,7 +1348,7 @@ void CDROM::DrawDebugWindow()
|
||||||
if (ImGui::CollapsingHeader("Status/Mode", ImGuiTreeNodeFlags_DefaultOpen))
|
if (ImGui::CollapsingHeader("Status/Mode", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
{
|
{
|
||||||
static constexpr std::array<const char*, 8> drive_state_names = {
|
static constexpr std::array<const char*, 8> drive_state_names = {
|
||||||
{"Idle", "Initializing", "Seeking", "Reading ID", "Reading", "Playing", "Pausing", "Stopping"}};
|
{"Idle", "Spinning Up", "Seeking", "Reading ID", "Reading", "Playing", "Pausing", "Stopping"}};
|
||||||
|
|
||||||
ImGui::Columns(3);
|
ImGui::Columns(3);
|
||||||
|
|
||||||
|
|
|
@ -109,13 +109,13 @@ private:
|
||||||
enum class DriveState : u8
|
enum class DriveState : u8
|
||||||
{
|
{
|
||||||
Idle,
|
Idle,
|
||||||
Initializing,
|
SpinningUp,
|
||||||
Seeking,
|
Seeking,
|
||||||
ReadingID,
|
ReadingID,
|
||||||
Reading,
|
Reading,
|
||||||
Playing,
|
Playing,
|
||||||
Pausing,
|
Pausing,
|
||||||
Stopping,
|
Stopping
|
||||||
};
|
};
|
||||||
|
|
||||||
union StatusRegister
|
union StatusRegister
|
||||||
|
@ -195,7 +195,7 @@ private:
|
||||||
void ExecuteCommand();
|
void ExecuteCommand();
|
||||||
void ExecuteTestCommand(u8 subcommand);
|
void ExecuteTestCommand(u8 subcommand);
|
||||||
void BeginReading(bool cdda);
|
void BeginReading(bool cdda);
|
||||||
void DoInitComplete();
|
void DoSpinUpComplete();
|
||||||
void DoSeekComplete();
|
void DoSeekComplete();
|
||||||
void DoPauseComplete();
|
void DoPauseComplete();
|
||||||
void DoStopComplete();
|
void DoStopComplete();
|
||||||
|
|
Loading…
Reference in a new issue