| 1587 | } |
| 1588 | |
| 1589 | void cdvdUpdateTrayState() |
| 1590 | { |
| 1591 | if (cdvd.Tray.cdvdActionSeconds > 0) |
| 1592 | { |
| 1593 | if (--cdvd.Tray.cdvdActionSeconds == 0) |
| 1594 | { |
| 1595 | switch (cdvd.Tray.trayState) |
| 1596 | { |
| 1597 | case CDVD_DISC_OPEN: |
| 1598 | cdvdCtrlTrayOpen(); |
| 1599 | if (cdvd.DiscType > 0 || CDVDsys_GetSourceType() == CDVD_SourceType::NoDisc) |
| 1600 | { |
| 1601 | cdvd.Tray.cdvdActionSeconds = 3; |
| 1602 | cdvd.Tray.trayState = CDVD_DISC_EJECT; |
| 1603 | DevCon.WriteLn(Color_Green, "Simulating ejected media"); |
| 1604 | } |
| 1605 | |
| 1606 | break; |
| 1607 | case CDVD_DISC_EJECT: |
| 1608 | cdvdCtrlTrayClose(); |
| 1609 | break; |
| 1610 | case CDVD_DISC_DETECTING: |
| 1611 | DevCon.WriteLn(Color_Green, "Seeking new disc"); |
| 1612 | cdvd.Tray.trayState = CDVD_DISC_SEEKING; |
| 1613 | cdvdUpdateStatus(CDVD_STATUS_SEEK); |
| 1614 | cdvd.Tray.cdvdActionSeconds = 2; |
| 1615 | break; |
| 1616 | case CDVD_DISC_SEEKING: |
| 1617 | cdvd.Spinning = true; |
| 1618 | [[fallthrough]]; |
| 1619 | case CDVD_DISC_ENGAGED: |
| 1620 | cdvd.Tray.trayState = CDVD_DISC_ENGAGED; |
| 1621 | cdvdUpdateReady(CDVD_DRIVE_READY); |
| 1622 | cdvdUpdateStatus(CDVD_STATUS_PAUSE); |
| 1623 | if (CDVDsys_GetSourceType() != CDVD_SourceType::NoDisc) |
| 1624 | { |
| 1625 | DevCon.WriteLn(Color_Green, "Media ready to use"); |
| 1626 | } |
| 1627 | break; |
| 1628 | } |
| 1629 | } |
| 1630 | } |
| 1631 | } |
| 1632 | |
| 1633 | void cdvdVsync() |
| 1634 | { |
no test coverage detected