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

Add support for the 3DS #86

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

zoeyjodon
Copy link
Contributor

@zoeyjodon zoeyjodon commented Jan 4, 2024

Summary

Adds support for 3DS-specific functionality. So far, I have been able to connect to both NVIDIA gamestream and Sunshine, but the connection is unstable and slow. I'm currently looking into optimizations, but the main functionality ought to be worth upstreaming in the meantime.

Issue

Resolves #33

Changelog

  • Prevents wildcard UDP port binding on the 3DS (the bind function fails with a 22 error if you try to wildcard bind)
  • Adds 3DS-specific function calls for platform threads
  • Adds 3DS-specific function calls for platform sockets

src/ControlStream.c Outdated Show resolved Hide resolved
src/PlatformSockets.c Outdated Show resolved Hide resolved
#ifdef __3DS__
// binding to wildcard port is broken on the 3DS, so we need to define a port manually
struct sockaddr_in *n3ds_addr = &bindAddr;
n3ds_addr->sin_port = n3ds_udp_port++;
Copy link
Member

Choose a reason for hiding this comment

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

sin_port is expected to be in network byte order, so you should use htons() here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

src/SdpGenerator.c Outdated Show resolved Hide resolved
src/PlatformSockets.c Outdated Show resolved Hide resolved
Copy link
Member

@cgutman cgutman left a comment

Choose a reason for hiding this comment

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

The changes look good to me. Can you squash these commits into one or a few logical changes?

Prevent wildcard port binding on the 3DS
Add 3DS threading logic
Add 3DS socket logic
Bump the connection timeout to 60s for the 3DS
@zoeyjodon
Copy link
Contributor Author

Changes have been squashed!

@cgutman cgutman merged commit c104a97 into moonlight-stream:master Jan 19, 2024
3 checks passed
@cgutman
Copy link
Member

cgutman commented Jan 19, 2024

Merged, 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.

3ds port
2 participants