Merge pull request #9608 from Bonta0/swapucode

DSPHLE: Don't restore the last UCode when the crc doesn't match
This commit is contained in:
Léo Lam 2021-03-27 01:02:47 +01:00 committed by GitHub
commit cd6ee13320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();
}
}