Tweaks to Zelda-HLE to allow multiple GBA connections #5376
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
RFC because I have really no idea what I'm doing with DSP code, and found this fix through a combination of scattered printfs and a small dose of "well, it looks right."
This fixes two bugs when running The Legend of Zelda: Four Swords Adventures with DSP-HLE:
I first noticed that Four Swords' background music cuts out after connecting a GBA, and Dolphin logs the following error messages:
The Zelda ucode gets only momentarily swapped out for the GBA one, but then stops replying to all mail! That probably shouldn't be happening.
I added some printf statements, and got the list of all mail sent to the Zelda ucode after it's swapped back in:
The first few messages look like a three-command-write, which is only valid in
MailState::WAITING, so I changed Zelda-HLE to set itself to that when swapping. That made the first few messages be accepted, but then a new error appeared:I was stumped here, so starting looking through the larger stream of messages Four Swords' was sending to the DSP. Every hundred messages or so, a pattern seemed to repeat itself:
This is practically identical to the messages when a GBA is connected, except that the trigger to switch to GBA-HLE is
cdd10001. Running the logic forcdd10003—which runs pending commands—before switching to GBA-HLE fixes all of the remaining errors.