mirror of https://github.com/PCSX2/pcsx2.git
Revert previous mistake.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5487 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
d2f3b4a7fc
commit
4a27edc8a3
|
@ -674,7 +674,6 @@ typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
|
||||||
typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
|
typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
|
||||||
typedef s32 (CALLBACK* _CDVDreadSector)(u8* buffer, u32 lsn, int mode);
|
typedef s32 (CALLBACK* _CDVDreadSector)(u8* buffer, u32 lsn, int mode);
|
||||||
typedef s32 (CALLBACK* _CDVDgetDualInfo)(s32* dualType, u32* _layer1start);
|
typedef s32 (CALLBACK* _CDVDgetDualInfo)(s32* dualType, u32* _layer1start);
|
||||||
typedef void (CALLBACK* _CDVDnotifyReadLength)(s32 readLength);
|
|
||||||
|
|
||||||
typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
|
typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,12 @@
|
||||||
class AsyncFileReader
|
class AsyncFileReader
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
AsyncFileReader(void) { m_nextExpectedRead = -1; }
|
AsyncFileReader(void) {}
|
||||||
|
|
||||||
wxString m_filename;
|
wxString m_filename;
|
||||||
|
|
||||||
uint m_blocksize;
|
uint m_blocksize;
|
||||||
|
|
||||||
uint m_nextExpectedRead;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~AsyncFileReader(void) {};
|
virtual ~AsyncFileReader(void) {};
|
||||||
|
|
||||||
|
@ -35,8 +33,6 @@ public:
|
||||||
|
|
||||||
virtual void SetBlockSize(uint bytes) {}
|
virtual void SetBlockSize(uint bytes) {}
|
||||||
|
|
||||||
uint GetReadAheadHint() const { return m_nextExpectedRead; }
|
|
||||||
|
|
||||||
uint GetBlockSize() const { return m_blocksize; }
|
uint GetBlockSize() const { return m_blocksize; }
|
||||||
|
|
||||||
const wxString& GetFilename() const
|
const wxString& GetFilename() const
|
||||||
|
|
|
@ -600,10 +600,7 @@ void SaveStateBase::cdvdFreeze()
|
||||||
// seek is in progress!)
|
// seek is in progress!)
|
||||||
|
|
||||||
if( cdvd.Reading )
|
if( cdvd.Reading )
|
||||||
{
|
|
||||||
DoCDVDnotifyReadLength(cdvd.nSectors);
|
|
||||||
cdvd.RErr = DoCDVDreadTrack( cdvd.Readed ? cdvd.Sector : cdvd.SeekToSector, cdvd.ReadMode);
|
cdvd.RErr = DoCDVDreadTrack( cdvd.Readed ? cdvd.Sector : cdvd.SeekToSector, cdvd.ReadMode);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1222,8 +1219,6 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
||||||
cdvd.ReadTime = cdvdBlockReadTime( MODE_CDROM );
|
cdvd.ReadTime = cdvdBlockReadTime( MODE_CDROM );
|
||||||
CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector,MODE_CDROM ) );
|
CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector,MODE_CDROM ) );
|
||||||
|
|
||||||
DoCDVDnotifyReadLength(cdvd.nSectors);
|
|
||||||
|
|
||||||
// Read-ahead by telling the plugin about the track now.
|
// Read-ahead by telling the plugin about the track now.
|
||||||
// This helps improve performance on actual from-cd emulation
|
// This helps improve performance on actual from-cd emulation
|
||||||
// (ie, not using the hard drive)
|
// (ie, not using the hard drive)
|
||||||
|
@ -1272,8 +1267,6 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
||||||
cdvd.ReadTime = cdvdBlockReadTime( MODE_CDROM );
|
cdvd.ReadTime = cdvdBlockReadTime( MODE_CDROM );
|
||||||
CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector, MODE_CDROM ) );
|
CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector, MODE_CDROM ) );
|
||||||
|
|
||||||
DoCDVDnotifyReadLength(cdvd.nSectors);
|
|
||||||
|
|
||||||
// Read-ahead by telling the plugin about the track now.
|
// Read-ahead by telling the plugin about the track now.
|
||||||
// This helps improve performance on actual from-cd emulation
|
// This helps improve performance on actual from-cd emulation
|
||||||
// (ie, not using the hard drive)
|
// (ie, not using the hard drive)
|
||||||
|
@ -1310,8 +1303,6 @@ static void cdvdWrite04(u8 rt) { // NCOMMAND
|
||||||
cdvd.ReadTime = cdvdBlockReadTime( MODE_DVDROM );
|
cdvd.ReadTime = cdvdBlockReadTime( MODE_DVDROM );
|
||||||
CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector, MODE_DVDROM ) );
|
CDVDREAD_INT( cdvdStartSeek( cdvd.SeekToSector, MODE_DVDROM ) );
|
||||||
|
|
||||||
DoCDVDnotifyReadLength(cdvd.nSectors);
|
|
||||||
|
|
||||||
// Read-ahead by telling the plugin about the track now.
|
// Read-ahead by telling the plugin about the track now.
|
||||||
// This helps improve performance on actual from-cd emulation
|
// This helps improve performance on actual from-cd emulation
|
||||||
// (ie, not using the hard drive)
|
// (ie, not using the hard drive)
|
||||||
|
|
|
@ -419,11 +419,6 @@ s32 DoCDVDreadSector(u8* buffer, u32 lsn, int mode)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoCDVDnotifyReadLength(s32 length)
|
|
||||||
{
|
|
||||||
CDVD->notifyReadLength(length);
|
|
||||||
}
|
|
||||||
|
|
||||||
s32 DoCDVDreadTrack(u32 lsn, int mode)
|
s32 DoCDVDreadTrack(u32 lsn, int mode)
|
||||||
{
|
{
|
||||||
CheckNullCDVD();
|
CheckNullCDVD();
|
||||||
|
|
|
@ -51,7 +51,6 @@ struct CDVD_API
|
||||||
_CDVDreadSector readSector;
|
_CDVDreadSector readSector;
|
||||||
_CDVDgetBuffer2 getBuffer2;
|
_CDVDgetBuffer2 getBuffer2;
|
||||||
_CDVDgetDualInfo getDualInfo;
|
_CDVDgetDualInfo getDualInfo;
|
||||||
_CDVDnotifyReadLength notifyReadLength;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -81,4 +80,3 @@ extern s32 DoCDVDgetBuffer(u8* buffer);
|
||||||
extern s32 DoCDVDdetectDiskType();
|
extern s32 DoCDVDdetectDiskType();
|
||||||
extern void DoCDVDresetDiskTypeCache();
|
extern void DoCDVDresetDiskTypeCache();
|
||||||
|
|
||||||
extern void DoCDVDnotifyReadLength(s32 length);
|
|
||||||
|
|
|
@ -475,11 +475,6 @@ void CALLBACK ISOnewDiskCB(void(* /* callback */)())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CALLBACK ISOnotifyReadLength(s32 readLength)
|
|
||||||
{
|
|
||||||
iso.NotifyReadLength(readLength);
|
|
||||||
}
|
|
||||||
|
|
||||||
CDVD_API CDVDapi_Iso =
|
CDVD_API CDVDapi_Iso =
|
||||||
{
|
{
|
||||||
ISOclose,
|
ISOclose,
|
||||||
|
@ -501,5 +496,4 @@ CDVD_API CDVDapi_Iso =
|
||||||
ISOreadSector,
|
ISOreadSector,
|
||||||
ISOgetBuffer2,
|
ISOgetBuffer2,
|
||||||
ISOgetDualInfo,
|
ISOgetDualInfo,
|
||||||
ISOnotifyReadLength
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,18 +50,6 @@ int InputIsoFile::ReadSync(u8* dst, uint lsn)
|
||||||
|
|
||||||
void InputIsoFile::BeginRead2(uint lsn)
|
void InputIsoFile::BeginRead2(uint lsn)
|
||||||
{
|
{
|
||||||
if(m_read_inprogress)
|
|
||||||
{
|
|
||||||
if(lsn >= m_read_lsn && lsn < (m_read_lsn+m_read_count))
|
|
||||||
{
|
|
||||||
// read already in progress
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FinishRead3(NULL, 0);
|
|
||||||
m_is_reading_ahead = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lsn > m_blocks)
|
if (lsn > m_blocks)
|
||||||
{
|
{
|
||||||
FastFormatUnicode msg;
|
FastFormatUnicode msg;
|
||||||
|
@ -110,23 +98,13 @@ int InputIsoFile::FinishRead3(u8* dst, uint mode)
|
||||||
|
|
||||||
if(m_read_inprogress)
|
if(m_read_inprogress)
|
||||||
{
|
{
|
||||||
if(dst)
|
ret = m_reader->FinishRead();
|
||||||
ret = m_reader->FinishRead();
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_reader->CancelRead();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_read_inprogress = false;
|
m_read_inprogress = false;
|
||||||
|
|
||||||
if(ret < 0)
|
if(ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!dst)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case CDVD_MODE_2352:
|
case CDVD_MODE_2352:
|
||||||
|
@ -175,22 +153,6 @@ int InputIsoFile::FinishRead3(u8* dst, uint mode)
|
||||||
dst[diff - 9] = 2;
|
dst[diff - 9] = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_expected_sequential_remaining > 0)
|
|
||||||
m_expected_sequential_remaining --;
|
|
||||||
|
|
||||||
if(m_read_ahead > 0 && (m_expected_sequential_remaining > 0 || m_read_length > 1))
|
|
||||||
{
|
|
||||||
uint lsn = (m_expected_sequential_remaining > 0) ?
|
|
||||||
m_read_lsn + 1 :
|
|
||||||
m_reader->GetReadAheadHint();
|
|
||||||
|
|
||||||
if(lsn >= 0)
|
|
||||||
{
|
|
||||||
m_is_reading_ahead = true;
|
|
||||||
BeginRead2(lsn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,11 +179,6 @@ void InputIsoFile::_init()
|
||||||
m_read_inprogress = false;
|
m_read_inprogress = false;
|
||||||
m_read_count = 0;
|
m_read_count = 0;
|
||||||
m_read_lsn = -1;
|
m_read_lsn = -1;
|
||||||
|
|
||||||
m_read_length = 0;
|
|
||||||
m_expected_sequential_remaining = 0;
|
|
||||||
|
|
||||||
m_is_reading_ahead = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests the specified filename to see if it is a supported ISO type. This function typically
|
// Tests the specified filename to see if it is a supported ISO type. This function typically
|
||||||
|
@ -262,8 +219,6 @@ bool InputIsoFile::Open( const wxString& srcfile, bool testOnly )
|
||||||
m_reader = bdr;
|
m_reader = bdr;
|
||||||
|
|
||||||
ReadUnit = 1;
|
ReadUnit = 1;
|
||||||
|
|
||||||
m_read_ahead = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool detected = Detect();
|
bool detected = Detect();
|
||||||
|
@ -284,8 +239,6 @@ bool InputIsoFile::Open( const wxString& srcfile, bool testOnly )
|
||||||
|
|
||||||
// Returns the original reader if single-part or a Multipart reader otherwise
|
// Returns the original reader if single-part or a Multipart reader otherwise
|
||||||
m_reader = MultipartFileReader::DetectMultipart(m_reader);
|
m_reader = MultipartFileReader::DetectMultipart(m_reader);
|
||||||
|
|
||||||
m_read_ahead = MaxReadAhead;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_blocks = m_reader->GetBlockCount();
|
m_blocks = m_reader->GetBlockCount();
|
||||||
|
|
|
@ -37,8 +37,7 @@ class InputIsoFile
|
||||||
{
|
{
|
||||||
DeclareNoncopyableObject( InputIsoFile );
|
DeclareNoncopyableObject( InputIsoFile );
|
||||||
|
|
||||||
static const uint MaxReadUnit = 1;
|
static const uint MaxReadUnit = 128;
|
||||||
static const uint MaxReadAhead = 1;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint ReadUnit;
|
uint ReadUnit;
|
||||||
|
@ -65,12 +64,6 @@ protected:
|
||||||
uint m_read_count;
|
uint m_read_count;
|
||||||
u8 m_readbuffer[MaxReadUnit * CD_FRAMESIZE_RAW];
|
u8 m_readbuffer[MaxReadUnit * CD_FRAMESIZE_RAW];
|
||||||
|
|
||||||
uint m_read_ahead;
|
|
||||||
uint m_read_length;
|
|
||||||
|
|
||||||
bool m_is_reading_ahead;
|
|
||||||
uint m_expected_sequential_remaining;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputIsoFile();
|
InputIsoFile();
|
||||||
virtual ~InputIsoFile() throw();
|
virtual ~InputIsoFile() throw();
|
||||||
|
@ -96,8 +89,6 @@ public:
|
||||||
void BeginRead2(uint lsn);
|
void BeginRead2(uint lsn);
|
||||||
int FinishRead3(u8* dest, uint mode);
|
int FinishRead3(u8* dest, uint mode);
|
||||||
|
|
||||||
void NotifyReadLength(s32 length) { m_expected_sequential_remaining = m_read_length = length; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _init();
|
void _init();
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,16 @@ bool FlatFileReader::Open(const wxString& fileName)
|
||||||
|
|
||||||
int FlatFileReader::ReadSync(void* pBuffer, uint sector, uint count)
|
int FlatFileReader::ReadSync(void* pBuffer, uint sector, uint count)
|
||||||
{
|
{
|
||||||
|
//LARGE_INTEGER offset;
|
||||||
|
//offset.QuadPart = sector * (__int64)m_blocksize;
|
||||||
|
//
|
||||||
|
//DWORD bytesToRead = count * m_blocksize;
|
||||||
|
//DWORD bytes;
|
||||||
|
|
||||||
|
//if(!ReadFile(hOverlappedFile, pBuffer, bytesToRead, &bytes, NULL))
|
||||||
|
// return -1;
|
||||||
|
|
||||||
|
//return bytes;
|
||||||
BeginRead(pBuffer, sector, count);
|
BeginRead(pBuffer, sector, count);
|
||||||
return FinishRead();
|
return FinishRead();
|
||||||
}
|
}
|
||||||
|
@ -52,8 +62,6 @@ void FlatFileReader::BeginRead(void* pBuffer, uint sector, uint count)
|
||||||
|
|
||||||
ReadFile(hOverlappedFile, pBuffer, bytesToRead, NULL, &asyncOperationContext);
|
ReadFile(hOverlappedFile, pBuffer, bytesToRead, NULL, &asyncOperationContext);
|
||||||
asyncInProgress = true;
|
asyncInProgress = true;
|
||||||
|
|
||||||
m_nextExpectedRead = sector + count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int FlatFileReader::FinishRead(void)
|
int FlatFileReader::FinishRead(void)
|
||||||
|
|
Loading…
Reference in New Issue