fix miscalculated offset, implement shygoo's recommendation for open bus read

This commit is contained in:
KrimtonZ 2019-12-18 19:51:47 -06:00
parent 58d66635df
commit dd076add39
1 changed files with 4 additions and 4 deletions

View File

@ -1507,10 +1507,10 @@ void CMipsMemoryVM::Load32CartridgeDomain2Address1(void)
void CMipsMemoryVM::Load32CartridgeDomain2Address2(void) void CMipsMemoryVM::Load32CartridgeDomain2Address2(void)
{ {
uint32_t PAddr = m_MemLookupAddress & 0x1FFFFFFF; uint32_t offset = (m_MemLookupAddress & 0x1FFFFFFF) - 0x08000000;
if (PAddr >= 0x10000) if (offset >= 0x10000)
{ {
m_MemLookupValue.UW[0] = rand(); m_MemLookupValue.UW[0] = ((offset & 0xFFFF) << 16) | (offset & 0xFFFF);
return; return;
} }
if (g_System->m_SaveUsing == SaveChip_Auto) if (g_System->m_SaveUsing == SaveChip_Auto)
@ -1521,7 +1521,7 @@ void CMipsMemoryVM::Load32CartridgeDomain2Address2(void)
{ {
//Load Sram //Load Sram
uint8_t tmp[4] = ""; uint8_t tmp[4] = "";
g_MMU->DmaFromSram(tmp, (m_MemLookupAddress & 0x1FFFFFFF) - 0x08000000, 4); g_MMU->DmaFromSram(tmp, offset, 4);
m_MemLookupValue.UW[0] = tmp[3] << 24 | tmp[2] << 16 | tmp[1] << 8 | tmp[0]; m_MemLookupValue.UW[0] = tmp[3] << 24 | tmp[2] << 16 | tmp[1] << 8 | tmp[0];
} }
else if (g_System->m_SaveUsing != SaveChip_FlashRam) else if (g_System->m_SaveUsing != SaveChip_FlashRam)