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/AX: Set state to WaitingForCmdListSize when switching uCodes #10991

Merged

Conversation

Pokechu22
Copy link
Contributor

Fixes https://bugs.dolphin-emu.org/issues/13017. With uCode switching, the existing instance of AXUCode is re-activated when GBAUCode is done, but if the state remains as WaitingForNextTask, it won't be able to do anything. Instead, it needs to be in WaitingForCmdListSize.

(When the AX uCode is resumed, startpc is set to 0x0030, at least for 0x07f88145; this is the same location as MAIL_RESUME jumps to, so DSP_RESUME should be sent when the resuming happens; that's already handled by AXUCode::Update.)

The Zelda uCode already handled this, as it already tracked states prior to #10768:

case MAIL_NEW_UCODE:
m_cmd_can_execute = true;
RunPendingCommands();
NOTICE_LOG_FMT(DSPHLE, "UCode being replaced.");
m_upload_setup_in_progress = true;
SetMailState(MailState::WAITING);
break;

I don't actually have a game that uses uCode switching with the GBA uCode (the only game I have that uses the GBA uCode is the Preview Disc, as both Doubutsu no Mori e+ and Pokémon Channel use the CPU for GBA encryption. I instead tested this using my experimental CARD uCode implementation, which had the same issue (since both the GBA uCode and CARD uCode use uCode switching). (I actually have Rogue Squadron III, which apparently supports GBAs; I haven't tested that yet.)

Fixes https://bugs.dolphin-emu.org/issues/13017. With uCode switching, the existing instance of AXUCode is re-activated when GBAUCode is done, but if the state remains as WaitingForNextTask, it won't be able to do anything. Instead, it needs to be in WaitingForCmdListSize.

(When the AX uCode is resumed, startpc is set to 0x0030, at least for 0x07f88145; this is the same location as MAIL_RESUME jumps to, so DSP_RESUME should be sent when the resuming happens; that's already handled by AXUCode::Update.)
Copy link
Contributor

@AdmiralCurtiss AdmiralCurtiss left a comment

Choose a reason for hiding this comment

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

Fixes FFCC.

@Pokechu22
Copy link
Contributor Author

I tested Rogue Squadron 3 (which uses the AX uCode), and prior to this PR if there was a GBA in slot 3 or 4 no audio would play (though the game would still run, or at least get to the title screen). Now audio plays and the GBAs can be connected.

@lioncash lioncash merged commit 39aa5f2 into dolphin-emu:master Aug 18, 2022
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants