mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
Merge pull request #1700 from JosJuice/discio-clear-error
DiscIO: Clear error status when reading file
This commit is contained in:
commit
7b5b76caa4
@ -66,7 +66,10 @@ bool CISOFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
|||||||
u64 const file_off = CISO_HEADER_SIZE + m_ciso_map[block] * (u64)m_block_size + data_offset;
|
u64 const file_off = CISO_HEADER_SIZE + m_ciso_map[block] * (u64)m_block_size + data_offset;
|
||||||
|
|
||||||
if (!(m_file.Seek(file_off, SEEK_SET) && m_file.ReadArray(out_ptr, bytes_to_read)))
|
if (!(m_file.Seek(file_off, SEEK_SET) && m_file.ReadArray(out_ptr, bytes_to_read)))
|
||||||
|
{
|
||||||
|
m_file.Clear();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -25,8 +25,15 @@ PlainFileReader* PlainFileReader::Create(const std::string& filename)
|
|||||||
|
|
||||||
bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
bool PlainFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
||||||
{
|
{
|
||||||
m_file.Seek(offset, SEEK_SET);
|
if (m_file.Seek(offset, SEEK_SET) && m_file.ReadBytes(out_ptr, nbytes))
|
||||||
return m_file.ReadBytes(out_ptr, nbytes);
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_file.Clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -130,7 +130,11 @@ bool WbfsFileReader::Read(u64 offset, u64 nbytes, u8* out_ptr)
|
|||||||
File::IOFile& data_file = SeekToCluster(offset, &read_size);
|
File::IOFile& data_file = SeekToCluster(offset, &read_size);
|
||||||
read_size = (read_size > nbytes) ? nbytes : read_size;
|
read_size = (read_size > nbytes) ? nbytes : read_size;
|
||||||
|
|
||||||
data_file.ReadBytes(out_ptr, read_size);
|
if (!data_file.ReadBytes(out_ptr, read_size))
|
||||||
|
{
|
||||||
|
data_file.Clear();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
out_ptr += read_size;
|
out_ptr += read_size;
|
||||||
nbytes -= read_size;
|
nbytes -= read_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user