From 04828db09194e025623a709e17974b0ccd15c7e5 Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Thu, 8 Jul 2010 20:40:55 +0000 Subject: [PATCH] CDVD: - 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 --- pcsx2/CDVD/CDVD.cpp | 15 +++++++++++---- pcsx2/CDVD/CDVD_internal.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 32f977cc06..75f89f3890 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -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; diff --git a/pcsx2/CDVD/CDVD_internal.h b/pcsx2/CDVD/CDVD_internal.h index 1639fefccf..274343bff8 100644 --- a/pcsx2/CDVD/CDVD_internal.h +++ b/pcsx2/CDVD/CDVD_internal.h @@ -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"};