Backport the NRG fix to trunk.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5490 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2012-12-28 13:41:43 +00:00
parent 4a27edc8a3
commit 2fed2964f5
4 changed files with 14 additions and 9 deletions

View File

@ -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);
};

View File

@ -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

View File

@ -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;

View File

@ -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;