Commit Graph
1087 Commits
Author SHA1 Message Date
fidoboy e80a786afe Handle ENet disconnects with short headers 2026-11-03 01:26:25 -06:00
Cameron Gutman ee160c9193 Correctly parse padded STUN attributes 2026-11-03 01:23:49 -06:00
Cameron Gutman 2e18599b26 Validate the STUN message length field 2026-11-03 01:09:25 -06:00
Cameron Gutman 7bf16de8e2 Verify source addresses for STUN responses 2026-11-03 00:49:12 -06:00
Cameron Gutman 134eee49e0 Wait for a valid STUN response to stop sending
We previously would stop on any received message, including a STUN
binding error response or even a non-STUN garbage message.
2026-11-03 00:10:17 -06:00
Cameron Gutman f462147ffd Fix format string mismatch 2026-11-02 23:26:35 -06:00
Cameron Gutman 41d6c1db74 Fix unused parameter 2026-11-02 23:25:50 -06:00
Cameron Gutman f050b13b6a Add explicit cast to make MSVC happy 2026-11-01 15:11:58 -06:00
Cameron Gutman 7d61e2d95f Don't provide ENet backpressure when sending large payloads 2026-11-01 15:07:59 -06:00
Cameron Gutman 4853e70489 Add jumbo control stream messages for larger than 16-bit payloads 2026-11-01 15:07:12 -06:00
Cameron Gutman c7dff22963 Add replay detection to RTSP and control streams
Replays can do very little harm in these contexts, but let's detect and prevent them anyways.

Fixes #165
Closes #170
2026-11-01 14:07:45 -06:00
Sergey Shunko 5d3c0ecca0 Add missing IDX_DS_ADAPTIVE_TRIGGERS sentinel to packetTypesGen3..7 2026-10-26 17:46:48 -05:00
Chris 41cedb89d6 Only intercept ENet disconnects addressed to our peer (#162)
ignoreDisconnectIntercept() runs on every datagram the control stream
socket receives, before ENet has validated the packet. It only checked
the length and command, so any 12-byte DISCONNECT from any source set
disconnectPending, which tears down the session about a second later.

Check that the header's peer ID and session ID match our peer and that
the packet came from the peer's current address before acting on it.
Anything else is passed to ENet unchanged, so a genuine disconnect that
does not match (for example from another address of a multi-homed
host) is still handled, just without the grace period.
2026-10-24 18:16:28 -05:00
dependabot[bot] 6d0f73e09b Bump nanors from b1e3c22 to a9b1636
Bumps [nanors](https://github.com/sleepybishop/nanors) from `b1e3c22` to `a9b1636`.
- [Commits](https://github.com/sleepybishop/nanors/compare/b1e3c22ca0cdc0bb83e3cd6ed1a2fc77869ed99a...a9b1636f9c98dbfdd0daeaf6982ccd24d1c30f29)

---
updated-dependencies:
- dependency-name: nanors
  dependency-version: a9b1636f9c98dbfdd0daeaf6982ccd24d1c30f29
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-24 12:28:13 -05:00
Cameron Gutman 421bd74e01 End mouse motion batches on mouse button events 2026-10-22 21:26:18 -05:00
Cameron Gutman f1cca2dd6b Fix a couple pen event batching issues 2026-10-22 21:16:11 -05:00
Cameron Gutman 970b0729c5 Fix use after free of queued controller packets
We could attempt to use a freed controller packet if
- The connection terminated with one still queued
- We hit the maximum input queue size limit

In either of those cases we could both fail to send
the desired input and cause memory corruption.
2026-10-22 20:44:37 -05:00
Cameron Gutman 448b2c6868 Latch mouse deltas before sending to prevent starvation
It's possible a client sending rapid relative mouse motion
could completely monopolize the input thread and prevent it
from exiting the loop.
2026-10-22 20:38:22 -05:00
Cameron Gutman 04053843c9 Pack NV_UNICODE_PACKET densely for Sunshine
This reduces overhead up to 32x for large text blocks and avoids
flooding the ENet connection with packets all at once.
2026-10-19 22:51:41 -05:00
Cameron Gutman 4a95eb35b2 Send UTF-8 events on the keyboard channel
This avoids racing with regular keyboard events that could affect the input.
2026-10-19 01:25:18 -05:00
Cameron Gutman 342b106bbb Perform control stream encryption in-place 2026-10-19 01:10:46 -05:00
Cameron Gutman aeba988e0a Rework RTSP parser to fix many spec compliance issues 2026-10-14 17:11:45 -05:00
Cameron Gutman 5ec839727a Fix memory leak if duplicate RTSP options are inserted 2026-10-14 01:25:49 -05:00
Cameron Gutman e2722dc837 Fix uninitialized stack data in the periodic ping payload 2026-10-12 23:31:33 -05:00
Cameron Gutman f900dd4767 Add MODIFIER_EXTENDED flag to indicate extended keys 2026-09-26 14:50:13 -05:00
Cameron Gutman 5a2632990f Add section 7 exception for app store distribution
Fixes #30
2026-09-26 13:27:15 -05:00
Cameron Gutman 62e066388f Don't speculatively report losses if RFI is disabled
Not only does it unnecessarily cause guaranteed loss of the target frame, it can lead to 120 consecutive frames dropped if we fully receive that frame since we've already triggered an IDR frame wait but didn't tell the depacketizer to request an IDR frame.

Closes #147
2026-09-08 23:25:43 -05:00
Cameron Gutman be438856af Fix handling of a partially dropped IDR frame 2026-09-08 22:58:14 -05:00
Cameron Gutman d85371cd8c Fix RFI after a multi-block frame loss 2026-09-08 22:48:59 -05:00
Drackrath 874ac9548f Add LI_CTYPE_STEAM controller type 2026-08-18 21:46:34 -05:00
Cameron Gutman 518b244152 Rewrite MbedTLS codepaths to use the modern PSA APIs
This also fixes an issue that caused audio decryption to fail on MbedTLS 3.x.

Closes #142
2026-08-18 21:37:13 -05:00
dependabot[bot] e41355ea01 Bump nanors from 17fc7d6 to b1e3c22 (#145)
Bumps [nanors](https://github.com/sleepybishop/nanors) from `17fc7d6` to `b1e3c22`.
- [Commits](https://github.com/sleepybishop/nanors/compare/17fc7d61afb2fdd9a9aff38fbd7d4f2ff73a4508...b1e3c22ca0cdc0bb83e3cd6ed1a2fc77869ed99a)

---
updated-dependencies:
- dependency-name: nanors
  dependency-version: b1e3c22ca0cdc0bb83e3cd6ed1a2fc77869ed99a
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-22 21:45:38 -05:00
dependabot[bot] 703a069468 Bump enet from 0eb84dc to aca8784 (#144)
Bumps [enet](https://github.com/cgutman/enet) from `0eb84dc` to `aca8784`.
- [Commits](https://github.com/cgutman/enet/compare/0eb84dcca830dcee950a12a48f63062d950d03d0...aca87840b57f045a1f7f9299e4b1b9b8e2a5e2f1)

---
updated-dependencies:
- dependency-name: enet
  dependency-version: aca87840b57f045a1f7f9299e4b1b9b8e2a5e2f1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-18 18:18:14 -05:00
Christopher Madrigal 82e2514854 Fix compilation for 3DS (#140)
* Changes to enhance support for 3DS

* Align helpers to correct type at compile

* explicity declare/initialize operational val where used
2026-07-11 22:47:14 -05:00
dependabot[bot] 2ea47752c3 Bump nanors from c3529fd to 17fc7d6
Bumps [nanors](https://github.com/sleepybishop/nanors) from `c3529fd` to `17fc7d6`.
- [Commits](https://github.com/sleepybishop/nanors/compare/c3529fda520f53cd007328ba30b6ad3f89947722...17fc7d61afb2fdd9a9aff38fbd7d4f2ff73a4508)

---
updated-dependencies:
- dependency-name: nanors
  dependency-version: 17fc7d61afb2fdd9a9aff38fbd7d4f2ff73a4508
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-05 16:30:34 -04:00
Cameron Gutman 1f764276e8 Switch to upstream nanors with native SIMD and GFNI runtime dispatching 2026-07-04 15:32:12 -04:00
Cameron Gutman 99c45d35ad Fix compatibility with GCC versions that lack __has_builtin() 2026-07-03 13:17:00 -05:00
Cameron Gutman 1fddbcb7c6 Don't leak rswrapper into our headers 2026-07-03 13:09:27 -05:00
ReenigneArcher 47b4d338b1 Skip Reed-Solomon SIMD variants for NXDK 2026-06-23 21:22:27 -05:00
ReenigneArcher 40d87314d0 Add NXDK (Xbox) support 2026-06-23 17:58:10 -05:00
Cameron Gutman 2600beaf13 Add support for controllers with dual touchpads 2026-05-14 22:13:45 -05:00
foxirain 7b026e77be Harden RTSP handling for malformed Session headers and oversized responses 2026-03-30 08:32:12 -05:00
Cameron Gutman 7022b337a9 Refactor BSD socket errors for Win32 and add EMSGSIZE 2026-03-28 15:03:38 -05:00
dependabot[bot] 62687809b1 Bump enet from 78cc9b4 to c7353c0
Bumps [enet](https://github.com/cgutman/enet) from `78cc9b4` to `c7353c0`.
- [Commits](https://github.com/cgutman/enet/compare/78cc9b4b03bdd4f95c277391cac6e0951407072b...c7353c059373f8d3fc83d451f8f1a477be3dc94e)

---
updated-dependencies:
- dependency-name: enet
  dependency-version: c7353c059373f8d3fc83d451f8f1a477be3dc94e
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-23 19:56:44 -06:00
MrCreativ3001 3fa9191330 Use lowercase windows headers for easier cross-compilation 2026-02-20 19:33:13 -06:00
Cameron Gutman b187204769 Restore fallback scalar path for x86 2026-02-19 20:04:31 -06:00
Cameron Gutman 3872285d8c Fix incorrectly enabling SSSE3 on all x64 Windows platforms 2026-02-19 20:03:20 -06:00
Cameron Gutman a063522db4 Use the SIMDe 128-bit path for all non-x86 systems
SIMDe includes support for AltiVec, LSX, NEON, and more. It also includes fallbacks that are optimized for compiler autovectorization for other architectures (like RISC-V RVV)

Since there's no runtime dispatching for these, they will be selected depending on which instructions are enabled by the toolchain at compile-time.
2026-02-19 19:29:11 -06:00
Cameron Gutman 5551d29ba2 Use SIMDe for NEON acceleration 2026-02-19 00:14:42 -06:00
Andy Grundman de364b6ecd Use nanors for optimized Reed-Solomon FEC decoding (#125) 2026-02-18 23:36:52 -06:00