diff options
| author | comex <comexk@gmail.com> | 2015-05-05 16:20:04 -0400 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2015-05-05 16:20:04 -0400 |
| commit | 6414cdabb2ae7762f2d98427b9ff024af07bb959 (patch) | |
| tree | 5362ae99777fc494d6c2b059b0bd63a6bb296b97 /Source/Core/DiscIO/FileSystemGCWii.cpp | |
| parent | 430e8b7adeb5b3adb12ef50ce7961562463b0fa0 (diff) | |
| parent | df8e768b77b551832ace0d552ec10c1b062c55f3 (diff) | |
Merge pull request #2286 from JosJuice/wii-opening-bnr
Read opening.bnr to get names from Wii discs
Diffstat (limited to 'Source/Core/DiscIO/FileSystemGCWii.cpp')
| -rw-r--r-- | Source/Core/DiscIO/FileSystemGCWii.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/DiscIO/FileSystemGCWii.cpp b/Source/Core/DiscIO/FileSystemGCWii.cpp index 381d1bdbd4..e23a8cb177 100644 --- a/Source/Core/DiscIO/FileSystemGCWii.cpp +++ b/Source/Core/DiscIO/FileSystemGCWii.cpp @@ -63,7 +63,7 @@ const std::string CFileSystemGCWii::GetFileName(u64 _Address) return ""; } -u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size_t _MaxBufferSize) +u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, u64 _MaxBufferSize, u64 _OffsetInFile) { if (!m_Initialized) InitFileSystem(); @@ -72,14 +72,16 @@ u64 CFileSystemGCWii::ReadFile(const std::string& _rFullPath, u8* _pBuffer, size if (pFileInfo == nullptr) return 0; - if (pFileInfo->m_FileSize > _MaxBufferSize) + if (_OffsetInFile >= pFileInfo->m_FileSize) return 0; - DEBUG_LOG(DISCIO, "Filename: %s. Offset: %" PRIx64 ". Size: %" PRIx64, _rFullPath.c_str(), - pFileInfo->m_Offset, pFileInfo->m_FileSize); + u64 read_length = std::min(_MaxBufferSize, pFileInfo->m_FileSize - _OffsetInFile); - m_rVolume->Read(pFileInfo->m_Offset, pFileInfo->m_FileSize, _pBuffer, m_Wii); - return pFileInfo->m_FileSize; + DEBUG_LOG(DISCIO, "Reading %" PRIx64 " bytes at %" PRIx64 " from file %s. Offset: %" PRIx64 " Size: %" PRIx64, + read_length, _OffsetInFile, _rFullPath.c_str(), pFileInfo->m_Offset, pFileInfo->m_FileSize); + + m_rVolume->Read(pFileInfo->m_Offset + _OffsetInFile, read_length, _pBuffer, m_Wii); + return read_length; } bool CFileSystemGCWii::ExportFile(const std::string& _rFullPath, const std::string& _rExportFilename) |
