mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
Bus: Handle unaligned writes to DMA
This commit is contained in:
parent
68883168cd
commit
65c9dfa4fd
|
@ -451,14 +451,41 @@ bool Bus::DoWriteSPU(MemoryAccessSize size, u32 offset, u32 value)
|
|||
|
||||
bool Bus::DoReadDMA(MemoryAccessSize size, u32 offset, u32& value)
|
||||
{
|
||||
Assert(size == MemoryAccessSize::Word);
|
||||
switch (size)
|
||||
{
|
||||
case MemoryAccessSize::Byte:
|
||||
case MemoryAccessSize::HalfWord:
|
||||
{
|
||||
if ((offset & u32(0xF0)) >= 7 || (offset & u32(0x0F)) != 0x4)
|
||||
FixupUnalignedWordAccessW32(offset, value);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
value = m_dma->ReadRegister(offset);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Bus::DoWriteDMA(MemoryAccessSize size, u32 offset, u32 value)
|
||||
{
|
||||
Assert(size == MemoryAccessSize::Word);
|
||||
switch (size)
|
||||
{
|
||||
case MemoryAccessSize::Byte:
|
||||
case MemoryAccessSize::HalfWord:
|
||||
{
|
||||
// zero extend length register
|
||||
if ((offset & u32(0xF0)) < 7 && (offset & u32(0x0F)) == 0x4)
|
||||
value = ZeroExtend32(value);
|
||||
else
|
||||
FixupUnalignedWordAccessW32(offset, value);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_dma->WriteRegister(offset, value);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue