mirror of
https://github.com/libretro/Play-.git
synced 2025-02-15 00:57:18 +00:00
Added SIFDMAREG struct.
This commit is contained in:
parent
e180b67368
commit
3c898bd839
@ -2226,16 +2226,8 @@ void CPS2OS::sc_SifDmaStat()
|
||||
//77
|
||||
void CPS2OS::sc_SifSetDma()
|
||||
{
|
||||
struct DMAREG
|
||||
{
|
||||
uint32 srcAddr;
|
||||
uint32 dstAddr;
|
||||
uint32 size;
|
||||
uint32 flags;
|
||||
};
|
||||
|
||||
uint32 xferAddress = m_ee.m_State.nGPR[SC_PARAM0].nV[0] & (PS2::EE_RAM_SIZE - 1);
|
||||
DMAREG* xfer = reinterpret_cast<DMAREG*>(m_ram + xferAddress);
|
||||
auto xfer = reinterpret_cast<SIFDMAREG*>(m_ram + xferAddress);
|
||||
uint32 count = m_ee.m_State.nGPR[SC_PARAM1].nV[0];
|
||||
|
||||
//Returns count
|
||||
|
@ -11,6 +11,15 @@ enum CONST_SIF_CMD
|
||||
SIF_CMD_OTHERDATA = 0x8000000C,
|
||||
};
|
||||
|
||||
struct SIFDMAREG
|
||||
{
|
||||
uint32 srcAddr;
|
||||
uint32 dstAddr;
|
||||
uint32 size;
|
||||
uint32 flags;
|
||||
};
|
||||
static_assert(sizeof(SIFDMAREG) == 0x10, "sizeof(SIFDMAREG) must be 16 bytes.");
|
||||
|
||||
struct SIFCMDHEADER
|
||||
{
|
||||
uint32 size;
|
||||
|
@ -263,11 +263,11 @@ uint32 CSifCmd::SifSendCmd(uint32 commandId, uint32 packetPtr, uint32 packetSize
|
||||
assert(srcExtraPtr != 0);
|
||||
assert(dstExtraPtr != 0);
|
||||
|
||||
uint32* dmaRegStruct = reinterpret_cast<uint32*>(m_ram + m_sendCmdExtraStructAddr);
|
||||
dmaRegStruct[0] = srcExtraPtr;
|
||||
dmaRegStruct[1] = dstExtraPtr;
|
||||
dmaRegStruct[2] = sizeExtra;
|
||||
dmaRegStruct[3] = 0;
|
||||
auto dmaReg = reinterpret_cast<SIFDMAREG*>(m_ram + m_sendCmdExtraStructAddr);
|
||||
dmaReg->srcAddr = srcExtraPtr;
|
||||
dmaReg->dstAddr = dstExtraPtr;
|
||||
dmaReg->size = sizeExtra;
|
||||
dmaReg->flags = 0;
|
||||
|
||||
m_sifMan.SifSetDma(m_sendCmdExtraStructAddr, 1);
|
||||
}
|
||||
|
@ -56,25 +56,17 @@ uint32 CSifManPs2::SifSetDma(uint32 structAddr, uint32 count)
|
||||
{
|
||||
CSifMan::SifSetDma(structAddr, count);
|
||||
|
||||
struct DMAREG
|
||||
{
|
||||
uint32 nSrcAddr;
|
||||
uint32 nDstAddr;
|
||||
uint32 nSize;
|
||||
uint32 nFlags;
|
||||
};
|
||||
|
||||
if(structAddr == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
DMAREG* pXfer = reinterpret_cast<DMAREG*>(m_iopRam + structAddr);
|
||||
auto dmaReg = reinterpret_cast<SIFDMAREG*>(m_iopRam + structAddr);
|
||||
for(unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
uint8* src = m_iopRam + pXfer[i].nSrcAddr;
|
||||
uint8* dst = m_eeRam + pXfer[i].nDstAddr;
|
||||
memcpy(dst, src, pXfer[i].nSize);
|
||||
uint8* src = m_iopRam + dmaReg[i].srcAddr;
|
||||
uint8* dst = m_eeRam + dmaReg[i].dstAddr;
|
||||
memcpy(dst, src, dmaReg[i].size);
|
||||
}
|
||||
|
||||
return count;
|
||||
|
Loading…
x
Reference in New Issue
Block a user