Skip to content

Commit 05617a3

Browse files
authored
dmae: Implement 16bit endian swap for DMAECopyMem (#1564)
1 parent caef34f commit 05617a3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Cafe/OS/libs/dmae/dmae.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ void dmaeExport_DMAECopyMem(PPCInterpreter_t* hCPU)
3636
dstBuffer[i] = _swapEndianU32(srcBuffer[i]);
3737
}
3838
}
39+
else if( hCPU->gpr[6] == DMAE_ENDIAN_16 )
40+
{
41+
// swap per uint16
42+
uint16* srcBuffer = (uint16*)memory_getPointerFromVirtualOffset(hCPU->gpr[4]);
43+
uint16* dstBuffer = (uint16*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]);
44+
for(uint32 i=0; i<hCPU->gpr[5]*2; i++)
45+
{
46+
dstBuffer[i] = _swapEndianU16(srcBuffer[i]);
47+
}
48+
}
3949
else
4050
{
4151
cemuLog_logDebug(LogType::Force, "DMAECopyMem(): Unsupported endian swap\n");

0 commit comments

Comments
 (0)