Core: have MemoryValue32 be able to read from rom

This commit is contained in:
zilmar 2022-05-16 11:00:20 +09:30
parent 718d7e0359
commit 1fe8fd1299
2 changed files with 15 additions and 1 deletions

View File

@ -43,7 +43,8 @@ CMipsMemoryVM::CMipsMemoryVM(CN64System & System, bool SavesReadOnly) :
m_TLB_WriteMap(nullptr),
m_RDRAM(nullptr),
m_DMEM(nullptr),
m_IMEM(nullptr)
m_IMEM(nullptr),
m_Rom(*g_Rom)
{
g_Settings->RegisterChangeCB(Game_RDRamSize, this, (CSettings::SettingChangedFunc)RdramChanged);
}
@ -343,6 +344,18 @@ bool CMipsMemoryVM::MemoryValue32(uint32_t VAddr, uint32_t& Value)
Value = *(uint32_t*)(m_IMEM + (PAddr - 0x04001000));
return true;
}
if (PAddr >= 0x10000000 && PAddr < 0x16000000)
{
if ((PAddr & 0xFFFFFFF) < m_Rom.GetRomSize())
{
Value = *(uint32_t *)&m_Rom.GetRomAddress()[(PAddr & 0xFFFFFFF)];
}
else
{
Value = (PAddr << 16) | (PAddr & 0xFFFF);
}
return true;
}
g_Notify->BreakPoint(__FILE__, __LINE__);
return false;
}

View File

@ -184,6 +184,7 @@ private:
VideoInterfaceHandler m_VideoInterfaceHandler;
uint8_t * m_RDRAM, *m_DMEM, *m_IMEM;
uint32_t m_AllocatedRdramSize;
CN64Rom & m_Rom;
mutable char m_strLabelName[100];
uint32_t * m_TLB_ReadMap;