mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-10 14:39:01 +01:00
DiscIO: use std::min() in WBFS
This commit is contained in:
parent
c8382cca83
commit
b1100e4aa0
@ -102,7 +102,7 @@ bool WbfsFileReader::ReadHeader()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_blocks_per_disc = (WII_SECTOR_COUNT * WII_SECTOR_SIZE) / m_wbfs_sector_size;
|
m_blocks_per_disc = (WII_SECTOR_COUNT * WII_SECTOR_SIZE) / m_wbfs_sector_size;
|
||||||
m_disc_info_size = align(WII_DISC_HEADER_SIZE + m_blocks_per_disc * 2, m_hd_sector_size);
|
m_disc_info_size = align(WII_DISC_HEADER_SIZE + m_blocks_per_disc * sizeof(u16), m_hd_sector_size);
|
||||||
|
|
||||||
// Read disc table
|
// Read disc table
|
||||||
m_files[0]->file.Seek(2, SEEK_CUR);
|
m_files[0]->file.Seek(2, SEEK_CUR);
|
||||||
@ -122,7 +122,7 @@ 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);
|
||||||
if (read_size == 0)
|
if (read_size == 0)
|
||||||
return false;
|
return false;
|
||||||
read_size = (read_size > nbytes) ? nbytes : read_size;
|
read_size = std::min(read_size, nbytes);
|
||||||
|
|
||||||
if (!data_file.ReadBytes(out_ptr, read_size))
|
if (!data_file.ReadBytes(out_ptr, read_size))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user