From cad9249b79dd1d653ed2ac4e824ec2482286c87a Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Sat, 9 Jul 2011 23:47:12 +0000 Subject: [PATCH] Fix for Endgame which tries to do 0 sector CDVD reads. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4802 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/CDVD/CDVD.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 5844d7a97a..45340dcf56 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -834,21 +834,24 @@ __fi void cdvdReadInterrupt() pxAssume( cdvd.RErr == 0 ); } - if (cdvdReadSector() == -1) + if (cdvd.nSectors > 0) { - // This means that the BCR/DMA hasn't finished yet, and rather than fire off the - // sector-finished notice too early (which might overwrite game data) we delay a - // bit and try to read the sector again later. - // An arbitrary delay of some number of cycles probably makes more sense here, - // but for now it's based on the cdvd.ReadTime value. -- air + if (cdvdReadSector() == -1) + { + // This means that the BCR/DMA hasn't finished yet, and rather than fire off the + // sector-finished notice too early (which might overwrite game data) we delay a + // bit and try to read the sector again later. + // An arbitrary delay of some number of cycles probably makes more sense here, + // but for now it's based on the cdvd.ReadTime value. -- air - pxAssume((int)cdvd.ReadTime > 0 ); - CDVDREAD_INT(cdvd.ReadTime/4); - return; + pxAssume((int)cdvd.ReadTime > 0 ); + CDVDREAD_INT(cdvd.ReadTime/4); + return; + } + + cdvd.Sector++; } - cdvd.Sector++; - if (--cdvd.nSectors <= 0) { cdvd.PwOff |= 1<