diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 4c7ff49307..9dc281e7b5 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -681,20 +681,11 @@ s32 cdvdCtrlTrayOpen() } cdvdDetectDisk(); - - DiscSwapTimerSeconds = cdvd.RTC.second; // remember the PS2 time when this happened cdvdUpdateStatus(CDVD_STATUS_TRAY_OPEN); cdvdUpdateReady(0); cdvd.Spinning = false; cdvdSetIrq(1 << Irq_Eject); - if (cdvd.Type > 0 || CDVDsys_GetSourceType() == CDVD_SourceType::NoDisc) - { - cdvd.Tray.cdvdActionSeconds = 3; - cdvd.Tray.trayState = CDVD_DISC_EJECT; - DevCon.WriteLn(Color_Green, "Simulating ejected media"); - } - return 0; // needs to be 0 for success according to homebrew test "CDVD" } @@ -1446,6 +1437,16 @@ void cdvdUpdateTrayState() { switch (cdvd.Tray.trayState) { + case CDVD_DISC_OPEN: + cdvdCtrlTrayOpen(); + if (cdvd.Type > 0 || CDVDsys_GetSourceType() == CDVD_SourceType::NoDisc) + { + cdvd.Tray.cdvdActionSeconds = 3; + cdvd.Tray.trayState = CDVD_DISC_EJECT; + DevCon.WriteLn(Color_Green, "Simulating ejected media"); + } + + break; case CDVD_DISC_EJECT: cdvdCtrlTrayClose(); break; diff --git a/pcsx2/CDVD/CDVD.h b/pcsx2/CDVD/CDVD.h index 95afd78a94..575b120371 100644 --- a/pcsx2/CDVD/CDVD.h +++ b/pcsx2/CDVD/CDVD.h @@ -81,7 +81,8 @@ enum TrayStates CDVD_DISC_ENGAGED, CDVD_DISC_DETECTING, CDVD_DISC_SEEKING, - CDVD_DISC_EJECT + CDVD_DISC_EJECT, + CDVD_DISC_OPEN }; struct cdvdTrayTimer diff --git a/pcsx2/CDVD/CDVD_internal.h b/pcsx2/CDVD/CDVD_internal.h index 0fd748b1bb..ab3ee5d91f 100644 --- a/pcsx2/CDVD/CDVD_internal.h +++ b/pcsx2/CDVD/CDVD_internal.h @@ -170,7 +170,6 @@ static const uint DVD_MAX_ROTATION_X1 = 1515; static const uint Cdvd_FullSeek_Cycles = (PSXCLK * 100) / 1000; // average number of cycles per fullseek (100ms) static const uint Cdvd_FastSeek_Cycles = (PSXCLK * 30) / 1000; // average number of cycles per fastseek (37ms) -short DiscSwapTimerSeconds = 0; bool trayState = 0; // Used to check if the CD tray status has changed since the last time static const char* mg_zones[8] = {"Japan", "USA", "Europe", "Oceania", "Asia", "Russia", "China", "Mexico"}; diff --git a/pcsx2/VMManager.cpp b/pcsx2/VMManager.cpp index 2e5738af09..5cc7ee61a1 100644 --- a/pcsx2/VMManager.cpp +++ b/pcsx2/VMManager.cpp @@ -1522,8 +1522,8 @@ bool VMManager::ChangeDisc(CDVD_SourceType source, std::string path) DoCDVDopen(); } } - - cdvdCtrlTrayOpen(); + cdvd.Tray.cdvdActionSeconds = 1; + cdvd.Tray.trayState = CDVD_DISC_OPEN; return result; }