- Disc swapping should work in most games. It's easy to break though and the code is all over the place :p

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3435 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-07-08 20:40:55 +00:00
parent 740d286c8f
commit 04828db091
2 changed files with 12 additions and 4 deletions

View File

@ -478,20 +478,23 @@ s32 cdvdReadSubQ(s32 lsn, cdvdSubQ* subq)
void openVirtualTray()
{
trayState = 1;
DiscSwapTimerSeconds = cdvd.RTC.second;
cdvd.Status = CDVD_STATUS_TRAY_OPEN;
cdvd.Ready = CDVD_NOTREADY;
}
// Only trayState is needed right now.
s32 cdvdCtrlTrayOpen()
{
trayState = 1;
s32 ret = CDVD->ctrlTrayOpen();
if (ret == -1) ret = 0x80;
return ret;
}
// Only trayState is needed right now.
s32 cdvdCtrlTrayClose()
{
trayState = 0;
s32 ret = CDVD->ctrlTrayClose();
if (ret == -1) ret = 0x80;
return ret;
@ -499,6 +502,8 @@ s32 cdvdCtrlTrayClose()
// Modified by (efp) - 16/01/2006
// checks if tray was opened since last call to this func
// Outdated and not doing anything.. much.. I hope (rama)
s32 cdvdGetTrayStatus()
{
s32 ret = CDVD->getTrayStatus();
@ -928,6 +933,7 @@ void cdvdVsync() {
if ( cdvd.RTC.second != DiscSwapTimerSeconds)
{
Console.Warning("Close virtual disk tray");
trayState = 0;
cdvd.Status = CDVD_STATUS_PAUSE;
cdvd.Ready = CDVD_READY1;
}
@ -1010,8 +1016,8 @@ u8 cdvdRead(u8 key)
case 0x0B: // TRAY-STATE (if tray has been opened)
{
u8 tray = cdvdGetTrayStatus();
CDVD_LOG("cdvdRead0B(Tray) %x", tray);
return tray;
CDVD_LOG("cdvdRead0B(Tray) %x HLE flag = %x ", tray, trayState);
return /*tray*/ trayState;
break;
}
case 0x0C: // CRT MINUTE
@ -1455,6 +1461,7 @@ static void cdvdWrite16(u8 rt) // SCOMMAND
break;
case 0x05: // CdTrayReqState (0:1) - resets the tray open detection
trayState = 0;
SetResultSize(1);
cdvd.Result[0] = 0;
break;

View File

@ -137,6 +137,7 @@ static const uint PSX_DVD_READSPEED = 1382400 + 256000; // normal is 1 Byte Time
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"};