Skip to content

Commit

Permalink
[Core] Proper Dezaemon 3D SRAM 96KB save support (#2165)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuigiBlood committed Jan 11, 2022
1 parent 7452dd4 commit 16667ec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Source/Project64-core/N64System/Mips/Dma.cpp
Expand Up @@ -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)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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] = "";
Expand Down
4 changes: 2 additions & 2 deletions Source/Project64/UserInterface/Debugger/DebugMMU.cpp
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit 16667ec

Please sign in to comment.