diff --git a/pcsx2/AsyncFileReader.h b/pcsx2/AsyncFileReader.h index 22a09f5bb2..1594b39eb0 100644 --- a/pcsx2/AsyncFileReader.h +++ b/pcsx2/AsyncFileReader.h @@ -31,8 +31,9 @@ public: virtual uint GetBlockCount(void) const=0; - virtual void SetBlockSize(uint bytes) {} - + virtual void SetBlockSize(uint bytes) {} + virtual void SetDataOffset(uint bytes) {} + uint GetBlockSize() const { return m_blocksize; } const wxString& GetFilename() const @@ -73,8 +74,9 @@ public: virtual void Close(void); virtual uint GetBlockCount(void) const; - - void SetBlockSize(uint bytes) { m_blocksize = bytes; } + + virtual void SetBlockSize(uint bytes) { m_blocksize = bytes; } + virtual void SetDataOffset(uint bytes) { m_dataoffset = bytes; } }; class MultipartFileReader : public AsyncFileReader @@ -110,7 +112,7 @@ public: virtual uint GetBlockCount(void) const; - void SetBlockSize(uint bytes); + virtual void SetBlockSize(uint bytes); static AsyncFileReader* DetectMultipart(AsyncFileReader* reader); }; diff --git a/pcsx2/CDVD/InputIsoFile.cpp b/pcsx2/CDVD/InputIsoFile.cpp index 4fccad37e8..126bbcb0e7 100644 --- a/pcsx2/CDVD/InputIsoFile.cpp +++ b/pcsx2/CDVD/InputIsoFile.cpp @@ -234,7 +234,8 @@ bool InputIsoFile::Open( const wxString& srcfile, bool testOnly ) if(!isBlockdump) { ReadUnit = MaxReadUnit; - + + m_reader->SetDataOffset(m_offset); m_reader->SetBlockSize(m_blocksize); // Returns the original reader if single-part or a Multipart reader otherwise @@ -277,7 +278,8 @@ bool InputIsoFile::tryIsoType(u32 _size, s32 _offset, s32 _blockofs) m_blocksize = _size; m_offset = _offset; m_blockofs = _blockofs; - + + m_reader->SetDataOffset(_offset); m_reader->SetBlockSize(_size); if(ReadSync(buf, 16) < 0) @@ -331,6 +333,7 @@ bool InputIsoFile::Detect( bool readType ) m_blockofs = 0; m_type = ISOTYPE_AUDIO; + m_reader->SetDataOffset(m_offset); m_reader->SetBlockSize(m_blocksize); //BUG: This also detects a memory-card-file as a valid Audio-CD ISO... -avih diff --git a/pcsx2/Linux/LnxFlatFileReader.cpp b/pcsx2/Linux/LnxFlatFileReader.cpp index 798ca567d4..5c9d5f6c64 100644 --- a/pcsx2/Linux/LnxFlatFileReader.cpp +++ b/pcsx2/Linux/LnxFlatFileReader.cpp @@ -34,7 +34,7 @@ int FlatFileReader::ReadSync(void* pBuffer, uint sector, uint count) void FlatFileReader::BeginRead(void* pBuffer, uint sector, uint count) { u64 offset; - offset = sector * (u64)m_blocksize; + offset = sector * (u64)m_blocksize + m_dataoffset; u32 bytesToRead = count * m_blocksize; diff --git a/pcsx2/windows/FlatFileReaderWindows.cpp b/pcsx2/windows/FlatFileReaderWindows.cpp index 8e0c908c1b..f590923987 100644 --- a/pcsx2/windows/FlatFileReaderWindows.cpp +++ b/pcsx2/windows/FlatFileReaderWindows.cpp @@ -51,7 +51,7 @@ int FlatFileReader::ReadSync(void* pBuffer, uint sector, uint count) void FlatFileReader::BeginRead(void* pBuffer, uint sector, uint count) { LARGE_INTEGER offset; - offset.QuadPart = sector * (__int64)m_blocksize; + offset.QuadPart = sector * (s64)m_blocksize + m_dataoffset; DWORD bytesToRead = count * m_blocksize;