Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Mar 27, 2021

Conversation

Bonta0
Copy link
Contributor

@Bonta0 Bonta0 commented Mar 26, 2021

This performs a sanity check in case that assumption proves to be wrong, which can happen when connecting multiple GBAs simultaneously

@JMC47
Copy link
Contributor

JMC47 commented Mar 26, 2021

@dolphin-emu-bot rebuild

@@ -79,9 +79,10 @@ 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, maybe invert the conditional to avoid the extra negations

Suggested change
if (!m_last_ucode || UCodeInterface::GetCRC(m_last_ucode.get()) != crc)
if (m_last_ucode && UCodeInterface::GetCRC(m_last_ucode.get()) == crc)
{
m_ucode = std::move(m_last_ucode);
}
...

@leoetlino leoetlino merged commit cd6ee13 into dolphin-emu:master Mar 27, 2021
10 checks passed
@@ -79,15 +79,16 @@ void DSPHLE::SwapUCode(u32 crc)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as the comment above states, this was always kinda hacky. Now the behavior doesn't really match the comment, either. Maybe a list should be kept (instead of implicit 2-entry list)?

@Bonta0 Bonta0 deleted the swapucode branch May 19, 2021 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants