From 487ed8b54d2a807e96924dda4b8e6fe35c7eff5d Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 16 May 2022 15:33:36 +0930 Subject: [PATCH] Core: If SMM_PIDMA, clear physical memory code before doing the dma --- Source/Project64-core/N64System/Mips/Dma.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/Dma.cpp b/Source/Project64-core/N64System/Mips/Dma.cpp index a992087c7..014382936 100644 --- a/Source/Project64-core/N64System/Mips/Dma.cpp +++ b/Source/Project64-core/N64System/Mips/Dma.cpp @@ -302,6 +302,11 @@ void CDMA::PI_DMA_WRITE() if (PI_CART_ADDR_REG >= 0x10000000 && PI_CART_ADDR_REG <= 0x1FFFFFFF) { + if (g_Recompiler && g_System->bSMM_PIDMA()) + { + g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG, CRecompiler::Remove_DMA); + } + uint32_t i; uint8_t * ROM = g_Rom->GetRomAddress(); @@ -400,10 +405,6 @@ void CDMA::PI_DMA_WRITE() g_System->SetDmaUsed(true); OnFirstDMA(); } - if (g_Recompiler && g_System->bSMM_PIDMA()) - { - g_Recompiler->ClearRecompCode_Phys(g_Reg->PI_DRAM_ADDR_REG, g_Reg->PI_WR_LEN_REG, CRecompiler::Remove_DMA); - } if(g_System->bRandomizeSIPIInterrupts()) {