mirror of https://github.com/PCSX2/pcsx2.git
CDVD: Improve Break/Abort handling
This commit is contained in:
parent
602769b9d0
commit
a7bafb60e9
|
@ -102,6 +102,7 @@ static void CDVD_INT(int eCycle)
|
|||
static void cdvdSetIrq(uint id = (1 << Irq_CommandComplete))
|
||||
{
|
||||
cdvd.IntrStat |= id;
|
||||
cdvd.AbortRequested = false;
|
||||
iopIntcIrq(2);
|
||||
psxSetNextBranchDelta(20);
|
||||
}
|
||||
|
@ -1093,19 +1094,6 @@ __fi void cdvdActionInterrupt()
|
|||
cdvd.Sector = 0;
|
||||
cdvdUpdateStatus(CDVD_STATUS_STOP);
|
||||
break;
|
||||
|
||||
case cdvdAction_Break:
|
||||
// Make sure the cdvd action state is pretty well cleared:
|
||||
DevCon.WriteLn("CDVD Break Call");
|
||||
if ((cdvd.Ready & 0x80))
|
||||
cdvd.Error = 1; // Abort
|
||||
|
||||
cdvd.Reading = 0;
|
||||
cdvd.Readed = 0;
|
||||
cdvd.Ready = CDVD_DRIVE_READY | CDVD_DRIVE_DEV9CON | CDVD_DRIVE_ERROR; // should be CDVD_READY1 or something else?
|
||||
cdvdUpdateStatus(CDVD_STATUS_PAUSE);
|
||||
cdvd.RErr = 0;
|
||||
break;
|
||||
}
|
||||
cdvd.Action = cdvdAction_None;
|
||||
|
||||
|
@ -1149,6 +1137,19 @@ __fi void cdvdReadInterrupt()
|
|||
CDVD_LOG("Cdvd Seek Complete at iopcycle=%8.8x.", psxRegs.cycle);
|
||||
}
|
||||
|
||||
if (cdvd.AbortRequested)
|
||||
{
|
||||
if (!cdvdIsDVD() || !(cdvd.Sector & 0xF))
|
||||
{
|
||||
Console.Warning("Read Abort");
|
||||
cdvd.Error = 0x1; // Abort Error
|
||||
cdvd.Ready = CDVD_DRIVE_READY | CDVD_DRIVE_DEV9CON | CDVD_DRIVE_ERROR;
|
||||
cdvdUpdateStatus(CDVD_STATUS_PAUSE);
|
||||
cdvd.WaitingDMA = false;
|
||||
cdvdSetIrq();
|
||||
}
|
||||
}
|
||||
|
||||
if (cdvd.Sector > cdvd.MaxSector)
|
||||
{
|
||||
DevCon.Warning("Read past end of disc Sector %d Max Sector %d", cdvd.Sector, cdvd.MaxSector);
|
||||
|
@ -1689,6 +1690,7 @@ static void cdvdWrite04(u8 rt)
|
|||
}
|
||||
|
||||
cdvd.nCommand = rt;
|
||||
cdvd.AbortRequested = false;
|
||||
|
||||
if (!cdvdCommandErrorHandler())
|
||||
{
|
||||
|
@ -2131,23 +2133,12 @@ static __fi void cdvdWrite07(u8 rt) // BREAK
|
|||
CDVD_LOG("cdvdWrite07(Break) %x", rt);
|
||||
|
||||
// If we're already in a Ready state or already Breaking, then do nothing:
|
||||
if (!(cdvd.Ready & CDVD_DRIVE_BUSY) || (cdvd.Action == cdvdAction_Break))
|
||||
if (!(cdvd.Ready & CDVD_DRIVE_BUSY) || cdvd.AbortRequested)
|
||||
return;
|
||||
|
||||
DbgCon.WriteLn("*PCSX2*: CDVD BREAK %x", rt);
|
||||
|
||||
// Aborts any one of several CD commands:
|
||||
// Pause, Seek, Read, Status, Standby, and Stop
|
||||
|
||||
psxRegs.interrupt &= ~((1 << IopEvt_Cdvd) | (1 << IopEvt_CdvdRead));
|
||||
|
||||
cdvd.Action = cdvdAction_Break;
|
||||
CDVD_INT(64);
|
||||
|
||||
// Clear the cdvd status:
|
||||
cdvd.Readed = 0;
|
||||
cdvd.Reading = 0;
|
||||
cdvdUpdateStatus(CDVD_STATUS_PAUSE);
|
||||
cdvd.AbortRequested = true;
|
||||
}
|
||||
|
||||
static __fi void cdvdWrite08(u8 rt)
|
||||
|
|
|
@ -157,6 +157,7 @@ struct cdvdStruct
|
|||
bool Spinning; // indicates if the Cdvd is spinning or needs a spinup delay
|
||||
cdvdTrayTimer Tray;
|
||||
u8 nextSectorsBuffered;
|
||||
bool AbortRequested;
|
||||
};
|
||||
|
||||
extern cdvdStruct cdvd;
|
||||
|
|
|
@ -111,7 +111,6 @@ enum cdvdActions
|
|||
cdvdAction_Seek,
|
||||
cdvdAction_Standby,
|
||||
cdvdAction_Stop,
|
||||
cdvdAction_Break,
|
||||
cdvdAction_Read // note: not used yet.
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue