mirror of https://github.com/PCSX2/pcsx2.git
Tray code once more:
Added the tray state variable to the cdvd struct, making it safer and taking care of a previously unhandled situation. Surprisingly this didn't break old savestate compatibility. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4786 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
f25d317460
commit
e789cc84e2
|
@ -505,7 +505,7 @@ s32 cdvdCtrlTrayClose()
|
||||||
DevCon.WriteLn( Color_Green, L"Close virtual disk tray");
|
DevCon.WriteLn( Color_Green, L"Close virtual disk tray");
|
||||||
cdvd.Status = CDVD_STATUS_PAUSE;
|
cdvd.Status = CDVD_STATUS_PAUSE;
|
||||||
cdvd.Ready = CDVD_READY1;
|
cdvd.Ready = CDVD_READY1;
|
||||||
|
cdvd.TrayTimeout = 0; // Reset so it can't get closed twice by cdvdVsync()
|
||||||
return 0; // needs to be 0 for success according to homebrew test "CDVD"
|
return 0; // needs to be 0 for success according to homebrew test "CDVD"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -933,21 +933,18 @@ static uint cdvdStartSeek( uint newsector, CDVD_MODE_TYPE mode )
|
||||||
u8 monthmap[13] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
u8 monthmap[13] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||||
|
|
||||||
void cdvdVsync() {
|
void cdvdVsync() {
|
||||||
static u8 timeout = 0; // For closing the disk tray
|
|
||||||
cdvd.RTCcount++;
|
cdvd.RTCcount++;
|
||||||
if (cdvd.RTCcount < ((gsRegionMode == Region_NTSC) ? 60 : 50)) return;
|
if (cdvd.RTCcount < ((gsRegionMode == Region_NTSC) ? 60 : 50)) return;
|
||||||
cdvd.RTCcount = 0;
|
cdvd.RTCcount = 0;
|
||||||
|
|
||||||
if ( cdvd.Status == CDVD_STATUS_TRAY_OPEN )
|
if ( cdvd.Status == CDVD_STATUS_TRAY_OPEN )
|
||||||
{
|
{
|
||||||
// Fixme: Hacky and unsafe (rama)
|
cdvd.TrayTimeout++;
|
||||||
timeout++;
|
|
||||||
//Console.Warning( "timeout = %d",timeout );
|
|
||||||
}
|
}
|
||||||
if (timeout > 2)
|
if (cdvd.TrayTimeout > 3)
|
||||||
{
|
{
|
||||||
cdvdCtrlTrayClose();
|
cdvdCtrlTrayClose();
|
||||||
timeout = 0;
|
cdvd.TrayTimeout = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cdvd.RTC.second++;
|
cdvd.RTC.second++;
|
||||||
|
|
|
@ -126,6 +126,7 @@ struct cdvdStruct {
|
||||||
u8 mg_kbit[16];//last BIT key 'seen'
|
u8 mg_kbit[16];//last BIT key 'seen'
|
||||||
u8 mg_kcon[16];//last content key 'seen'
|
u8 mg_kcon[16];//last content key 'seen'
|
||||||
|
|
||||||
|
u8 TrayTimeout;
|
||||||
u8 Action; // the currently scheduled emulated action
|
u8 Action; // the currently scheduled emulated action
|
||||||
u32 SeekToSector; // Holds the destination sector during seek operations.
|
u32 SeekToSector; // Holds the destination sector during seek operations.
|
||||||
u32 ReadTime; // Avg. time to read one block of data (in Iop cycles)
|
u32 ReadTime; // Avg. time to read one block of data (in Iop cycles)
|
||||||
|
|
Loading…
Reference in New Issue