Skip to content

Wifi: fix MP CMD reply timeout - #2809

Open
lwu309 wants to merge 5 commits into
melonDS-emu:masterfrom
TeamHabiliTAS:wifi-mp-reply-timer-fix
Open

lwu309 wants to merge 5 commits into
melonDS-emu:masterfrom
TeamHabiliTAS:wifi-mp-reply-timer-fix

Conversation

@lwu309

@lwu309 lwu309 commented Nov 21, 2026

Copy link
Copy Markdown

The MP host used 16 + PreambleLen (about 112 us) as the timeout for the first client reply and cleared the client from MPClientMask at that point. GBATEK specifies that the hardware waits 16 + ((10 + W_CMD_REPLYTIME) * client_count) before sending the CMD ACK, so large CMDs could be marked as failed before the client had time to reply. The host then retransmitted the same CMD, filled the client's receive queue, and eventually disconnected.

Poll replies non-blocking throughout the documented reply window, keep the CMD timestamp fixed for the stale check, and use the full timeout. Process the first client's reply as soon as it arrives instead of waiting for the timeout to expire.

@Arisotura

Copy link
Copy Markdown
Member

mh, I need to look deeper into this, but this could be a legit good fix

have you encountered instances where this fixes problems?

@lwu309

lwu309 commented Nov 21, 2026 •

Copy link
Copy Markdown
Author

have you encountered instances where this fixes problems?

I was testing Soma Bringer multiplayer game with 2 instances, finding that the connection would fail if the host started the game too quickly right after a client entered the party. This commit effectively fixes the problem.

I will try to produce a video capture to demonstrate the disconnection problem.

@lwu309

lwu309 commented Nov 21, 2026

Copy link
Copy Markdown
Author

Here are the video captures.


Before the fix:

buggy.mp4

After the fix:

fixed.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants