mirror of
https://github.com/holub/mame
synced 2025-04-20 15:32:45 +03:00
atapihle.cpp: try to fix a problem when m_buffer_size is not a multiple of sector size (nw)
When reading sectors using the packet command, if the "Byte count limit" is not a multiple of the sector size, only a subset of the data will be transferred. It happens sometimes with the xbox.
This commit is contained in:
parent
43c5d3509a
commit
da0c958f2b
@ -97,9 +97,13 @@ void atapi_hle_device::fill_buffer()
|
||||
{
|
||||
m_buffer_size = m_data_size;
|
||||
}
|
||||
else if (m_buffer_size & 1)
|
||||
else
|
||||
{
|
||||
m_buffer_size--;
|
||||
if (m_buffer_size & 1)
|
||||
m_buffer_size--;
|
||||
// if it is transferring less than the remaining data, make sure the size is a multiple of the sector size, otherwise data will be lost
|
||||
if (m_buffer_size % m_sector_bytes)
|
||||
m_buffer_size = m_buffer_size - (m_buffer_size % m_sector_bytes);
|
||||
}
|
||||
|
||||
m_cylinder_low = m_buffer_size & 0xff;
|
||||
|
Loading…
Reference in New Issue
Block a user