mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-29 19:15:38 +00:00
CDROM: Implement stop command
This commit is contained in:
parent
6e60991fd0
commit
c15822d745
|
@ -524,6 +524,10 @@ void CDROM::Execute(TickCount ticks)
|
||||||
DoPauseComplete();
|
DoPauseComplete();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DriveState::Stopping:
|
||||||
|
DoStopComplete();
|
||||||
|
break;
|
||||||
|
|
||||||
case DriveState::ReadingID:
|
case DriveState::ReadingID:
|
||||||
DoIDRead();
|
DoIDRead();
|
||||||
break;
|
break;
|
||||||
|
@ -727,6 +731,20 @@ void CDROM::ExecuteCommand()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case Command::Stop:
|
||||||
|
{
|
||||||
|
const bool was_motor_on = m_secondary_status.motor_on;
|
||||||
|
Log_DebugPrintf("CDROM stop command");
|
||||||
|
SendACKAndStat();
|
||||||
|
|
||||||
|
m_drive_state = DriveState::Stopping;
|
||||||
|
m_drive_remaining_ticks = was_motor_on ? (m_mode.double_speed ? 25000000 : 13000000) : 7000;
|
||||||
|
m_system->SetDowncount(m_drive_remaining_ticks);
|
||||||
|
|
||||||
|
EndCommand();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
case Command::Init:
|
case Command::Init:
|
||||||
{
|
{
|
||||||
Log_DebugPrintf("CDROM init command");
|
Log_DebugPrintf("CDROM init command");
|
||||||
|
@ -981,6 +999,19 @@ void CDROM::DoPauseComplete()
|
||||||
SetAsyncInterrupt(Interrupt::INT2);
|
SetAsyncInterrupt(Interrupt::INT2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDROM::DoStopComplete()
|
||||||
|
{
|
||||||
|
Log_DebugPrintf("Stop complete");
|
||||||
|
m_drive_state = DriveState::Idle;
|
||||||
|
m_secondary_status.ClearActiveBits();
|
||||||
|
m_secondary_status.motor_on = false;
|
||||||
|
m_sector_buffer.clear();
|
||||||
|
|
||||||
|
m_async_response_fifo.Clear();
|
||||||
|
m_async_response_fifo.Push(m_secondary_status.bits);
|
||||||
|
SetAsyncInterrupt(Interrupt::INT2);
|
||||||
|
}
|
||||||
|
|
||||||
void CDROM::DoIDRead()
|
void CDROM::DoIDRead()
|
||||||
{
|
{
|
||||||
// TODO: This should depend on the disc type/region...
|
// TODO: This should depend on the disc type/region...
|
||||||
|
@ -1294,8 +1325,8 @@ void CDROM::DrawDebugWindow()
|
||||||
|
|
||||||
if (ImGui::CollapsingHeader("Status/Mode", ImGuiTreeNodeFlags_DefaultOpen))
|
if (ImGui::CollapsingHeader("Status/Mode", ImGuiTreeNodeFlags_DefaultOpen))
|
||||||
{
|
{
|
||||||
static constexpr std::array<const char*, 7> drive_state_names = {
|
static constexpr std::array<const char*, 8> drive_state_names = {
|
||||||
{"Idle", "Initializing", "Seeking", "Reading ID", "Reading", "Playing", "Pausing"}};
|
{"Idle", "Initializing", "Seeking", "Reading ID", "Reading", "Playing", "Pausing", "Stopping"}};
|
||||||
|
|
||||||
ImGui::Columns(3);
|
ImGui::Columns(3);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,8 @@ private:
|
||||||
ReadingID,
|
ReadingID,
|
||||||
Reading,
|
Reading,
|
||||||
Playing,
|
Playing,
|
||||||
Pausing
|
Pausing,
|
||||||
|
Stopping,
|
||||||
};
|
};
|
||||||
|
|
||||||
union StatusRegister
|
union StatusRegister
|
||||||
|
@ -197,6 +198,7 @@ private:
|
||||||
void DoInitComplete();
|
void DoInitComplete();
|
||||||
void DoSeekComplete();
|
void DoSeekComplete();
|
||||||
void DoPauseComplete();
|
void DoPauseComplete();
|
||||||
|
void DoStopComplete();
|
||||||
void DoIDRead();
|
void DoIDRead();
|
||||||
void DoSectorRead();
|
void DoSectorRead();
|
||||||
void ProcessDataSector(const u8* raw_sector);
|
void ProcessDataSector(const u8* raw_sector);
|
||||||
|
|
Loading…
Reference in a new issue