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

nn/uds: Add initial headers #387

Merged
merged 2 commits into from
Jun 20, 2024
Merged

Conversation

DaniElectra
Copy link
Contributor

This is an initial implementation of nn::uds, which can be used for communicating with nearby 3DS devices locally using local Wi-Fi. Not every function has been added on this PR due to either it being a low level function (such as making Ioctlv calls directly) or missing research. I would like suggestions as to whether the headers are well organized or how to improve them, these have also been organized in a way for future-proofing a nn::dlp implementation in the future, due to header dependencies.

Technical details

nn::uds is essentially a C++ wrapper around the /dev/udscntrl IOSU, which only exposes the needed functionality for hosting a network. A lot of the concepts and structures are the same as on the 3DS implementation, to the extent where most the Ioctlv commands share the same value as the IPC command IDs on the 3DS. For this reason, most of the research and documentation has been inherited from libctru and 3dbrew.

Not everything has been imported though. For example, the broadcast flag on SendTo from the 3DS hasn't been included here due to lack of testing, and the fact that Receive(From) does include a flag argument, whereas on the 3DS doesn't, and thus creating uncertainty as to whether this flag works on here too.

The Initialize function takes a "work memory" buffer (I chose that name based on similar cases on other Wii U libraries), similar to the 3DS "shared memory". It has been observed on various games that the size of 0x14000 was used when allocating this work memory, so I put that as recommendation. If there is a better way to handle this, please let me know!

It should be noted that the Wii U version of UDS only allows hosting networks, you cannot connect to other networks.

Research note: It is unknown whether the /dev/udscntrl IOSU exposes the functionality to connect to networks, and while it may be possible given the similarities on the command IDs, that is considered out of scope.

Testing

This PR has been tested successfully against the 3DS example of UDS, the source code for this (rushed up) test can be found here: https://github.com/DaniElectra/uds-wiiu-test

Copy link
Contributor

@GaryOderNichts GaryOderNichts left a comment

Choose a reason for hiding this comment

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

Thanks a lot for looking into this! I appreciate all of the added documentation.
Looks good overall, just some small nitpicks.

include/nn/uds/Cafe.h Show resolved Hide resolved
include/nn/uds/Cafe.h Outdated Show resolved Hide resolved
include/nn/uds/Cafe.h Outdated Show resolved Hide resolved
include/nn/uds/NodeInformation.h Outdated Show resolved Hide resolved
@GaryOderNichts GaryOderNichts merged commit 4933211 into devkitPro:master Jun 20, 2024
1 check passed
@GaryOderNichts
Copy link
Contributor

Thanks!

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