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

DSP LLE Recompiler: Fix LOOP and BLOOP when the counter is between 0x8001 and 0xFFFF #10723

Merged

Conversation

Pokechu22
Copy link
Contributor

The loop ends when the counter reaches 0, and the counter is unsigned; before, it was doing a signed 16-bit comparison if the value was less than or equal to 0 after subtracting 1 from the value.

This wasn't caught by #10716 because the saturation results in a value of 0x7fff or 0x8000, neither of which trigger the bug.

I ran into this when investigating the CARD uCode, as it ends up using BLOOP with a counter set to 0xFFFF if the input length is set to 0. (This isn't something that happens in practice (as far as I can tell the input length is always 8 normally), nor is it behavior that seems intended, but it confused me because the interpreter and recompiler were giving different results.)

@AdmiralCurtiss
Copy link
Contributor

I dunno what the hardware does but this looks right with regards to matching the recompiler to the interpreter.

@AdmiralCurtiss AdmiralCurtiss merged commit f441e3a into dolphin-emu:master Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants