Merge pull request #514 from Nekokabu/master

Support Shiren 64 Save
This commit is contained in:
zilmar 2015-06-22 15:19:52 +10:00
commit 2f4b4681d0
2 changed files with 32 additions and 1 deletions

View File

@ -213,6 +213,18 @@ void CDMA::PI_DMA_WRITE()
*(RDRAM+((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM+((g_Reg->PI_CART_ADDR_REG + i) ^ 3));
}
}
else if (g_Reg->PI_CART_ADDR_REG >= g_Rom->GetRomSize())
{
DWORD cart = g_Reg->PI_CART_ADDR_REG - g_Rom->GetRomSize();
while (cart >= g_Rom->GetRomSize())
{
cart -= g_Rom->GetRomSize();
}
for (i = 0; i < PI_WR_LEN_REG; i++)
{
*(RDRAM + ((g_Reg->PI_DRAM_ADDR_REG + i) ^ 3)) = *(ROM + ((cart + i) ^ 3));
}
}
else
{
DWORD Len;

View File

@ -2622,7 +2622,15 @@ bool CMipsMemoryVM::LW_NonMemory(DWORD PAddr, DWORD* Value)
{
g_System->m_SaveUsing = SaveChip_FlashRam;
}
if (g_System->m_SaveUsing != SaveChip_FlashRam)
if (g_System->m_SaveUsing == SaveChip_Sram)
{
//Load Sram
BYTE 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;
@ -3321,6 +3329,17 @@ bool CMipsMemoryVM::SW_NonMemory(DWORD PAddr, DWORD Value)
}
break;
case 0x08000000:
if (g_System->m_SaveUsing == SaveChip_Sram)
{
//Store Sram
BYTE tmp[4] = "";
tmp[0] = 0xFF & (Value);
tmp[1] = 0xFF & (Value >> 8);
tmp[2] = 0xFF & (Value >> 16);
tmp[3] = 0xFF & (Value >> 24);
DmaFromSram(tmp, PAddr - 0x08000000, 4);
return true;
}
if (PAddr != 0x08010000)
{
return false;