From 16667ec4f9d9e792dc2f12fb73fb05bf6efffba3 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Tue, 11 Jan 2022 22:03:56 +0100 Subject: [PATCH] [Core] Proper Dezaemon 3D SRAM 96KB save support (#2165) --- Source/Project64-core/N64System/Mips/Dma.cpp | 2 +- Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp | 4 ++-- Source/Project64/UserInterface/Debugger/DebugMMU.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/Dma.cpp b/Source/Project64-core/N64System/Mips/Dma.cpp index 677eb8100..ac100a575 100644 --- a/Source/Project64-core/N64System/Mips/Dma.cpp +++ b/Source/Project64-core/N64System/Mips/Dma.cpp @@ -146,7 +146,7 @@ void CDMA::PI_DMA_READ() return; } - if (g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG <= 0x08010000) + if (g_Reg->PI_CART_ADDR_REG >= 0x08000000 && g_Reg->PI_CART_ADDR_REG < 0x08088000) { if (g_System->m_SaveUsing == SaveChip_Auto) { diff --git a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp index cf43f562a..9361c5a3b 100755 --- a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp +++ b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp @@ -1349,7 +1349,7 @@ void CMipsMemoryVM::Load32CartridgeDomain2Address1(void) void CMipsMemoryVM::Load32CartridgeDomain2Address2(void) { uint32_t offset = (m_MemLookupAddress & 0x1FFFFFFF) - 0x08000000; - if (offset > 0x10000) + if (offset > 0x88000) { m_MemLookupValue.UW[0] = ((offset & 0xFFFF) << 16) | (offset & 0xFFFF); return; @@ -1919,7 +1919,7 @@ void CMipsMemoryVM::Write32CartridgeDomain2Address1(void) void CMipsMemoryVM::Write32CartridgeDomain2Address2(void) { uint32_t offset = (m_MemLookupAddress & 0x1FFFFFFF) - 0x08000000; - if (g_System->m_SaveUsing == SaveChip_Sram && offset < 0x8000) + if (g_System->m_SaveUsing == SaveChip_Sram && offset < 0x88000) { // Store SRAM uint8_t tmp[4] = ""; diff --git a/Source/Project64/UserInterface/Debugger/DebugMMU.cpp b/Source/Project64/UserInterface/Debugger/DebugMMU.cpp index 6b379008d..e3fbe2111 100644 --- a/Source/Project64/UserInterface/Debugger/DebugMMU.cpp +++ b/Source/Project64/UserInterface/Debugger/DebugMMU.cpp @@ -183,7 +183,7 @@ bool CDebugMMU::GetPhysicalByte(uint32_t paddr, uint8_t* value) { uint32_t saveOffset = paddr & 0x000FFFFF; - if (g_System->m_SaveUsing == SaveChip_Sram && saveOffset <= 0x7FFF) // SRAM + if (g_System->m_SaveUsing == SaveChip_Sram && saveOffset < 0x88000 && (saveOffset & 0x3FFFF) < 0x8000) // SRAM { uint32_t wordpaddr = paddr & ~3; uint8_t data[4]; @@ -257,7 +257,7 @@ bool CDebugMMU::SetPhysicalByte(uint32_t paddr, uint8_t value) { uint32_t saveOffset = paddr & 0x000FFFFF; - if (g_System->m_SaveUsing == SaveChip_Sram && saveOffset <= 0x7FFF) + if (g_System->m_SaveUsing == SaveChip_Sram && saveOffset < 0x88000 && (saveOffset & 0x3FFFF) < 0x8000) { uint32_t wordpaddr = paddr & ~3; uint8_t data[4];