From c959424957a2427a7b30284e1f0e6e9ebb80210a Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Wed, 27 Jan 2016 22:23:23 +0100 Subject: [PATCH] dmac: limit address to the scratch pad memory Help dma tests --- pcsx2/ps2/LegacyDmac.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pcsx2/ps2/LegacyDmac.cpp b/pcsx2/ps2/LegacyDmac.cpp index 3f6a7f0a7e..12e62e953d 100644 --- a/pcsx2/ps2/LegacyDmac.cpp +++ b/pcsx2/ps2/LegacyDmac.cpp @@ -374,13 +374,27 @@ __fi bool dmacWrite32( u32 mem, mem32_t& value ) return false; } + icase(fromSPR_SADR) + { + // Address must be QW aligned and fit in the 16K range of SPR + psHu32(mem) = value & 0x3FF0; + return false; + } + + icase(toSPR_SADR) + { + // Address must be QW aligned and fit in the 16K range of SPR + psHu32(mem) = value & 0x3FF0; + return false; + } + icase(D9_CHCR) // dma9 - toSPR { DMA_LOG("SPR1dma EXECUTE (toSPR), value=0x%x", value); DmaExec(dmaSPR1, mem, value); return false; } - + icase(DMAC_CTRL) { u32 oldvalue = psHu32(mem); @@ -420,6 +434,7 @@ __fi bool dmacWrite32( u32 mem, mem32_t& value ) cpuTestDMACInts(); return false; } + icase(DMAC_STAT) { HW_LOG("DMAC_STAT Write 32bit %x", value); @@ -451,8 +466,8 @@ __fi bool dmacWrite32( u32 mem, mem32_t& value ) // DMA Writes are invalid to everything except the STR on CHCR when it is busy // There's timing problems with many games. Gamefix time! if( CHECK_DMABUSYHACK && (mem & 0xf0) ) - { - if((psHu32(mem & ~0xff) & 0x100) && dmacRegs.ctrl.DMAE && !psHu8(DMAC_ENABLER+2)) + { + if((psHu32(mem & ~0xff) & 0x100) && dmacRegs.ctrl.DMAE && !psHu8(DMAC_ENABLER+2)) { DevCon.Warning("Gamefix: Write to DMA addr %x while STR is busy! Ignoring", mem); return false;