DSPHLE: Don't restore the last UCode when the crc doesn't match

This commit is contained in:
Bonta-kun 2021-03-25 14:06:37 +01:00
parent fa04e5a7d3
commit b7f62b7a37
1 changed files with 6 additions and 5 deletions

View File

@ -79,15 +79,16 @@ void DSPHLE::SwapUCode(u32 crc)
{
m_mail_handler.Clear();
if (m_last_ucode == nullptr)
if (m_last_ucode && UCodeInterface::GetCRC(m_last_ucode.get()) == crc)
{
m_last_ucode = std::move(m_ucode);
m_ucode = UCodeFactory(crc, this, m_wii);
m_ucode->Initialize();
m_ucode = std::move(m_last_ucode);
}
else
{
m_ucode = std::move(m_last_ucode);
if (!m_last_ucode)
m_last_ucode = std::move(m_ucode);
m_ucode = UCodeFactory(crc, this, m_wii);
m_ucode->Initialize();
}
}