Merge pull request #3293 from JosJuice/volumedirectory-plainfilereader

DiscIO: Don't use PlainFileReader in VolumeDirectory
This commit is contained in:
Scott Mansell 2015-11-28 22:32:12 +13:00
commit 4b4b753cc4
1 changed files with 6 additions and 5 deletions

View File

@ -17,7 +17,6 @@
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "DiscIO/Blob.h" #include "DiscIO/Blob.h"
#include "DiscIO/FileBlob.h"
#include "DiscIO/FileMonitor.h" #include "DiscIO/FileMonitor.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeDirectory.h" #include "DiscIO/VolumeDirectory.h"
@ -124,11 +123,11 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt
u64 fileOffset = _Offset - fileIter->first; u64 fileOffset = _Offset - fileIter->first;
const std::string fileName = fileIter->second; const std::string fileName = fileIter->second;
std::unique_ptr<PlainFileReader> reader(PlainFileReader::Create(fileName)); File::IOFile file(fileName, "rb");
if (reader == nullptr) if (!file)
return false; return false;
u64 fileSize = reader->GetDataSize(); u64 fileSize = file.GetSize();
FileMon::CheckFile(fileName, fileSize); FileMon::CheckFile(fileName, fileSize);
@ -138,7 +137,9 @@ bool CVolumeDirectory::Read(u64 _Offset, u64 _Length, u8* _pBuffer, bool decrypt
if (_Length < fileBytes) if (_Length < fileBytes)
fileBytes = _Length; fileBytes = _Length;
if (!reader->Read(fileOffset, fileBytes, _pBuffer)) if (!file.Seek(fileOffset, SEEK_SET))
return false;
if (!file.ReadBytes(_pBuffer, fileBytes))
return false; return false;
_Length -= fileBytes; _Length -= fileBytes;