[Project64] Add Load32CartridgeDomain2Address2

This commit is contained in:
zilmar 2015-12-22 08:03:14 +11:00
parent f8619bb6e4
commit 78af6b08a2
2 changed files with 52 additions and 29 deletions

View File

@ -2547,29 +2547,12 @@ bool CMipsMemoryVM::LW_NonMemory(uint32_t PAddr, uint32_t* Value)
*Value = m_MemLookupValue.UW[0]; *Value = m_MemLookupValue.UW[0];
break; break;
case 0x05000000: case 0x05000000:
*Value = PAddr & 0xFFFF; Load32CartridgeDomain2Address1();
*Value = (*Value << 16) | *Value; *Value = m_MemLookupValue.UW[0];
return false; break;
case 0x08000000: case 0x08000000:
if (g_System->m_SaveUsing == SaveChip_Auto) Load32CartridgeDomain2Address2();
{ *Value = m_MemLookupValue.UW[0];
g_System->m_SaveUsing = SaveChip_FlashRam;
}
if (g_System->m_SaveUsing == SaveChip_Sram)
{
//Load Sram
uint8_t tmp[4] = "";
DmaFromSram(tmp, PAddr - 0x08000000, 4);
*Value = tmp[3] << 24 | tmp[2] << 16 | tmp[1] << 8 | tmp[0];
return true;
}
else if (g_System->m_SaveUsing != SaveChip_FlashRam)
{
*Value = PAddr & 0xFFFF;
*Value = (*Value << 16) | *Value;
return false;
}
*Value = ReadFromFlashStatus(PAddr);
break; break;
case 0x1FC00000: case 0x1FC00000:
if (PAddr < 0x1FC007C0) if (PAddr < 0x1FC007C0)
@ -2636,10 +2619,10 @@ bool CMipsMemoryVM::SB_NonMemory(uint32_t PAddr, uint8_t Value)
break; break;
default: default:
return false; return false;
} }
return true; return true;
} }
bool CMipsMemoryVM::SH_NonMemory(uint32_t PAddr, uint16_t Value) bool CMipsMemoryVM::SH_NonMemory(uint32_t PAddr, uint16_t Value)
{ {
@ -2676,10 +2659,10 @@ bool CMipsMemoryVM::SH_NonMemory(uint32_t PAddr, uint16_t Value)
break; break;
default: default:
return false; return false;
} }
return true; return true;
} }
bool CMipsMemoryVM::SW_NonMemory(uint32_t PAddr, uint32_t Value) bool CMipsMemoryVM::SW_NonMemory(uint32_t PAddr, uint32_t Value)
{ {
@ -3079,7 +3062,7 @@ bool CMipsMemoryVM::SW_NonMemory(uint32_t PAddr, uint32_t Value)
break; break;
default: default:
return false; return false;
} }
break; break;
case 0x04400000: case 0x04400000:
switch (PAddr) switch (PAddr)
@ -3293,10 +3276,10 @@ bool CMipsMemoryVM::SW_NonMemory(uint32_t PAddr, uint32_t Value)
default: default:
return false; return false;
break; break;
} }
return true; return true;
} }
void CMipsMemoryVM::UpdateHalfLine() void CMipsMemoryVM::UpdateHalfLine()
{ {
@ -5708,3 +5691,41 @@ void CMipsMemoryVM::Load32SerialInterface(void)
} }
} }
} }
void CMipsMemoryVM::Load32CartridgeDomain2Address1(void)
{
m_MemLookupValue.UW[0] = m_MemLookupAddress & 0xFFFF;
m_MemLookupValue.UW[0] = (m_MemLookupValue.UW[0] << 16) | m_MemLookupValue.UW[0];
if (bHaveDebugger())
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
}
void CMipsMemoryVM::Load32CartridgeDomain2Address2(void)
{
if (g_System->m_SaveUsing == SaveChip_Auto)
{
g_System->m_SaveUsing = SaveChip_FlashRam;
}
if (g_System->m_SaveUsing == SaveChip_Sram)
{
//Load Sram
uint8_t tmp[4] = "";
g_MMU->DmaFromSram(tmp, (m_MemLookupAddress & 0x1FFFFFFF) - 0x08000000, 4);
m_MemLookupValue.UW[0] = tmp[3] << 24 | tmp[2] << 16 | tmp[1] << 8 | tmp[0];
}
else if (g_System->m_SaveUsing != SaveChip_FlashRam)
{
if (bHaveDebugger())
{
g_Notify->BreakPoint(__FILE__, __LINE__);
}
m_MemLookupValue.UW[0] = m_MemLookupAddress & 0xFFFF;
m_MemLookupValue.UW[0] = (m_MemLookupValue.UW[0] << 16) | m_MemLookupValue.UW[0];
}
else
{
m_MemLookupValue.UW[0] = g_MMU->ReadFromFlashStatus(m_MemLookupAddress & 0x1FFFFFFF);
}
}

View File

@ -191,6 +191,8 @@ private:
static void Load32PeripheralInterface(void); static void Load32PeripheralInterface(void);
static void Load32RDRAMInterface(void); static void Load32RDRAMInterface(void);
static void Load32SerialInterface(void); static void Load32SerialInterface(void);
static void Load32CartridgeDomain2Address1(void);
static void Load32CartridgeDomain2Address2(void);
CMipsMemory_CallBack * const m_CBClass; CMipsMemory_CallBack * const m_CBClass;