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

Multiplayer CMD/REPLY packets don't behave like on hardware #2282

Open
AntonioND opened this issue Feb 25, 2025 · 5 comments
Open

Multiplayer CMD/REPLY packets don't behave like on hardware #2282

AntonioND opened this issue Feb 25, 2025 · 5 comments

Comments

@AntonioND
Copy link
Contributor

I've been working on the fork of DSWifi of BlocksDS adding local multiplayer support, and I've noticed that melonDS doesn't treat them the same way as hardware. I have created a test ROM that you can use to test the issues I mention.

mptest.zip

With this ROM, press X on one DS to enter host mode, and Y to enter client mode on the other one. Press A on the client to connect to the host. You can send raw data packets from the host with up/down, and from the client with X. Those ones are received correctly.

However, you can send CMD packets with L from the host, and they are received 4 times on the client. You can prepare REPLY packets with Y on the client, but they are never received on the host. This all works correctly on hardware (DSi and DS lite), where one CMD packet is received and the REPLY is sent to the host correctly.

Some more useful information:

@AntonioND
Copy link
Contributor Author

I've just released version 1.8.0 of BlocksDS (https://github.com/blocksds/sdk/releases/tag/v1.8.0, thanks to @Arisotura for the melonDS forum WiFi notes!), which includes the new version of DSWifi and the examples. This means that now it's easier for other people to build them.

This example is the cleaned-up version of what I posted in the first post, which doesn't work correctly (CMD/REPLY packets fail, data packets work): https://github.com/blocksds/sdk/tree/6a664546baa2bdfc18b213d31e2f528201f8ec97/examples/dswifi/multiplayer_packets

However, funnily enough, this other example that uses CMD/REPLY packets works! https://github.com/blocksds/sdk/tree/6a664546baa2bdfc18b213d31e2f528201f8ec97/examples/dswifi/local_multiplayer

@Arisotura
Copy link
Member

would be interesting to see how the frames themselves are built -- maybe something is wrong in there.

@AntonioND
Copy link
Contributor Author

AntonioND commented Mar 7, 2025

CMD: https://github.com/blocksds/dswifi/blob/ea5b2540ae40539397c8a2794ddd2c53a754096a/source/arm9/rx_tx_queue.c#L101-L170

REPLY: https://github.com/blocksds/dswifi/blob/ea5b2540ae40539397c8a2794ddd2c53a754096a/source/arm9/rx_tx_queue.c#L172-L240

I don't think this is the reason, though, I spent quite a bit of time debugging why my frames didn't work so I compared my frames with the frames of an official game using Wireshark and the addresses and other information were the same (my issue was using the non-CF frame types, if you're curious).

My guess is something to do with the timings of the counter and the status values in the TX header in the MAC RAM.

@Arisotura
Copy link
Member

Arisotura commented Mar 7, 2025 via email

@AntonioND
Copy link
Contributor Author

Oh, sorry, I didn't mean that this specific issue was due to the frame types, I mean that I checked the frame headers for a long time until I realized that my types were wrong, so the addresses and other details should be okay.

The bug I've reported here happens even with the current version of my DSWifi library, which works well on hardware. Also, I don't think the frame headers are wrong because of the other example I've mentioned here #2282 (comment), which works fine using the same library.

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

No branches or pull requests

2 participants