CDVD: Don't auto mount disc again if game ejects it.

This commit is contained in:
refractionpcsx2 2023-03-23 13:45:14 +00:00
parent caf8eedd76
commit 72b38ce712
4 changed files with 14 additions and 13 deletions

View File

@ -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;

View File

@ -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

View File

@ -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"};

View File

@ -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;
}