Compare commits

...
527 Commits
Author SHA1 Message Date
Cameron Gutman b100e674dd HACK: Wait longer before rendering a frame 2026-07-12 22:45:07 -05:00
Cameron Gutman c0c4d60565 Update AppImage libva to 2.24.1 2026-07-08 23:58:15 -05:00
Cameron Gutman 8b18d58aa0 Add workaround for interoperability issue with out-of-tree FFmpeg zero-copy v4l2m2m patches and libplacebo
Fixes #1786
2026-07-08 23:40:08 -05:00
dependabot[bot] 5e1ac6df87 Bump moonlight-common-c/moonlight-common-c from 1f76427 to 2ea4775
Bumps [moonlight-common-c/moonlight-common-c](https://github.com/moonlight-stream/moonlight-common-c) from `1f76427` to `2ea4775`.
- [Commits](https://github.com/moonlight-stream/moonlight-common-c/compare/1f764276e848ae2ec7815ef90d1c1748272e074a...2ea47752c3051d72a64bcca190024e8b354fa1ef)

---
updated-dependencies:
- dependency-name: moonlight-common-c/moonlight-common-c
  dependency-version: 2ea47752c3051d72a64bcca190024e8b354fa1ef
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-05 16:52:09 -04:00
Cameron Gutman 0c8970364c Switch to upstream nanors with native SIMD and GFNI runtime dispatching 2026-07-05 00:14:34 -04:00
Cameron Gutman 1516464f82 Modernize ASAN flags for MSVC 2026-07-04 15:37:21 -04:00
Cameron Gutman fd34a1fd28 Disable the text outline when line wrapping is required 2026-07-01 23:43:40 -05:00
Cameron Gutman 9067db8915 Switch to UTF-8 for overlay text rendering 2026-07-01 23:24:31 -05:00
MiraandCameron Gutman 177f845183 Add outline to stream overlay text (#1887)
Co-authored-by: Cameron Gutman <aicommander@gmail.com>
2026-07-01 23:03:45 -05:00
Cameron Gutman c9b03f80f8 Partially revert "Use GL_NEAREST when possible without degrading quality"
The changes to GL_NEAREST for overlay textures and disabling alpha blending in SDL renderer are left intact.

This reverts commit 0f49dca4c0.
2026-07-01 21:56:54 -05:00
Cameron Gutman a27589fe35 Update SDL to 3.4.12 2026-07-01 21:47:49 -05:00
Cameron Gutman 561d824814 Move HDR toggle into the Basic Settings panel 2026-07-01 21:41:05 -05:00
Cameron Gutman b2d77f48f8 Rerun lrelease 2026-06-28 17:00:34 -05:00
Cameron Gutman 872731ceeb Fix a few more incorrect translation strings 2026-06-28 16:59:41 -05:00
Cameron Gutman 6cad296138 Remove all vanished translations 2026-06-28 16:52:52 -05:00
Cameron Gutman 444c6ccf06 Remove the experimental tag from HDR, AV1, and YUV 4:4:4 2026-06-28 16:51:58 -05:00
Cameron Gutman d35532b03e Rerun lupdate 2026-06-28 16:51:34 -05:00
Cameron Gutman 1e0110b0f4 Fix broken translation format strings 2026-06-28 16:41:05 -05:00
Cameron Gutman e5353d9758 Remove some translations that contained typos or incorrect grammar 2026-06-28 16:37:32 -05:00
Cameron Gutman f7c660129b Merge remote-tracking branch 'origin/weblate' 2026-06-28 16:26:37 -05:00
Cameron Gutman cdacb3d28d Loosen applist XML validation to accept empty app names
This matches the behavior of the Android and iOS clients.

Fixes #1921
2026-06-28 12:18:42 -05:00
Cameron Gutman 5034a324b4 Fix manual address being clobbered when using the CLI
Fixes #1920
2026-06-28 11:48:09 -05:00
Cameron Gutman e223bf9a1b Use libplacebo renderer on macOS 2026-06-25 22:30:03 -05:00
Cameron Gutman 6e231778a2 Fix blocking during rendering rather than in waitToRender() on MoltenVK
MoltenVK does a lazy fetch of the drawable only when it's being modified, so waitToRender() is completely ineffective as is. Rendering a small empty overlay in waitToRender() forces the next drawable wait to happen in waitToRender(), before we pick the current frame to render. This removes one display refresh period of latency when using V-sync.
2026-06-25 20:01:29 -05:00
Cameron Gutman d997a0d0c8 Dynamically adjust libplacebo swapchain depth on macOS
Direct-to-display mode on some Macs (M4 Mac Mini) can retain our drawables, which cuts the frame rate in half if we're in double-buffered mode.

We don't want to use triple-buffered mode all the time because it increases latency when used if not required, so detect delayed presentation and enable it on the fly if needed.
2026-06-23 21:09:20 -05:00
Cameron Gutman 06bd8a730b Force sRGB Vulkan swapchain on macOS to fix washed out colors 2026-06-23 19:19:56 -05:00
Cameron Gutman faa39875b6 Remove outdated comment 2026-06-21 15:19:44 -05:00
Cameron Gutman 170801ba9f Send the real client UID for non-GFE hosts
This allows non-GFE hosts to perform their own custom session
management while allowing all clients to share the same session
with GFE.
2026-06-21 15:18:12 -05:00
Cameron Gutman 1be234e96a Load the UID during initialization to avoid races loading it later 2026-06-21 15:14:58 -05:00
Cameron Gutman 50364fd522 Don't set VK lock/unlock queue functions past libavutil 62
They are scheduled for removal at that ABI bump.
2026-06-21 14:01:47 -05:00
Cameron Gutman bea5355c66 Fix unused parameter warning on Windows and Linux 2026-06-21 14:01:47 -05:00
Damglador c6820d8f5d Translated using Weblate (Ukrainian)
Currently translated at 86.8% (218 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/uk/
2026-06-21 03:01:18 +02:00
Damglador f58ae9cf56 Translated using Weblate (Ukrainian)
Currently translated at 54.1% (136 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/uk/
2026-06-19 17:01:18 +00:00
Cameron Gutman ca7d61f528 Prefer libplacebo on macOS when available 2026-06-14 19:27:01 -05:00
Cameron Gutman 2b5388e941 Fix non-EGL frontend renderers when compiled without EGL support 2026-06-14 19:16:16 -05:00
Cameron Gutman a9ad048252 Fix HDR rendering in libplacebo on macOS 2026-06-14 18:58:22 -05:00
Cameron Gutman 51cc5a8537 Remove libplacebo workaround for FFmpeg compiled without Vulkan support 2026-06-14 18:57:46 -05:00
Cameron Gutman 8c6b422040 Implement libplacebo on MoltenVK 2026-06-14 15:45:38 -05:00
Cameron Gutman ec75f0d8de Refactor libplacebo renderer to handle non-Vulkan hwcontexts 2026-06-14 12:20:54 -05:00
Cameron Gutman f2a512d3aa Update libplacebo, sdl2-compat, OpenSSL, and SDL3 2026-06-12 00:13:18 -05:00
ssantos 6ccd91d942 Translated using Weblate (Portuguese)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/pt/
2026-06-09 19:01:17 +02:00
Cameron Gutman 02004bac3f Allow toggling through combo box options using left/right on gamepads/keyboards 2026-06-07 15:14:29 -05:00
kynoptic 7c93aaf659 Force Tab focus to reach all controls on macOS
macOS defaults keyboard navigation to text fields and lists only, so Tab
(and the gamepad navigation that synthesizes it) can't move focus between
controls on the settings page. Other platforms already default to this.
2026-06-07 14:22:42 -05:00
Cameron Gutman 534ce02756 Track keyboard grab state internally rather than using SDL
Versions of sdl2-compat prior to 2.32.64 (and native SDL3) won't
set the grab flag if grabbing the keyboard fails, even though the
compositor still may be exclusively passing system keys to us via
some external configuration by the user. This causes the super key
to not be sent to the host, because we think the client OS will
consume it and don't want to duplicate the input.

Fixes #1900
2026-06-06 16:11:37 -05:00
Cameron Gutman 19d77704ba Update SDL and libplacebo 2026-06-02 02:03:10 -05:00
Cameron Gutman a2ef7a4a0c Enable LTO for FFmpeg 2026-05-27 23:21:56 -05:00
Cameron Gutman dc6c0d3315 Update prebuilts 2026-05-27 02:24:43 -05:00
Cameron Gutman cd5853c6ca Update Windows and macOS prebuilt dependencies
- Enable LTO/LTCG
- Update SDL3
2026-05-26 22:55:32 -05:00
Cameron Gutman e6da6fa11f Enable LTO for AppImage builds 2026-05-26 21:55:58 -05:00
Cameron Gutman 81f20cdb66 Move LTCG/LTO enablement into the build scripts 2026-05-26 21:46:58 -05:00
Cameron Gutman adfc972371 Enable LTCG/LTO for release builds 2026-05-26 01:23:09 -05:00
Cameron Gutman 53a14eda1c Update MSVC redistributable in installer bundle 2026-05-26 00:49:48 -05:00
Cameron Gutman 2eb6715be5 Disable WM-dependent hotkeys on LinuxFB too 2026-05-24 15:23:19 -05:00
Cameron Gutman 29294553bb Add Ctrl+Alt+Shift+K combo to toggle system key grab
Fixes #1637
2026-05-24 15:13:23 -05:00
Cameron Gutman 97240cd5f2 Add workaround for libplacebo crash with Raspbian FFmpeg
Fixes #1409
2026-05-24 14:43:02 -05:00
Cameron Gutman 8cc001768c Use UTF-16 literals for XML processing on Qt 6 2026-05-23 21:56:40 -05:00
Cameron Gutman d94b92e247 Use SDL_utf8strlcpy() to avoid MSVC secure CRT warnings 2026-05-23 19:50:32 -05:00
Cameron Gutman d9eca42311 Remove redundant QString construction 2026-05-23 19:28:28 -05:00
Cameron Gutman 63c48be6d4 Improve handling of malformed XML responses 2026-05-23 19:16:14 -05:00
Cameron Gutman 459dcd7b2c Fix incorrect error print 2026-05-16 16:10:47 -05:00
Cameron Gutman b33a252739 Fix incorrect apply() return value for legacy DRM clients 2026-05-16 16:09:57 -05:00
Cameron Gutman 1eb76bbdb0 Deep copy the BIO's backing memory for the QSslKey
This doesn't appear to be a problem in practice, but the docs don't say
that Qt couldn't retain this QByteArray for later, which would result in
a UAF with the current code.
2026-05-16 16:08:02 -05:00
Cameron Gutman bba2faa602 Fix broken horizontal scroll inversion 2026-05-16 15:45:13 -05:00
Cameron Gutman 87c3179f77 Fix incorrect failure check 2026-05-15 23:23:36 -05:00
Cameron Gutman 073f892bb1 Update Windows and macOS prebuilt dependencies
- Reverted to SDL 3.4.x to fix GCMouse issues

Fixes #1882
2026-05-15 19:16:33 -05:00
Cameron Gutman 815db2b0d7 Enable Segment Heap for improved performance and memory usage 2026-05-15 18:37:52 -05:00
Cameron Gutman a8a66bfc3d Enable Per Monitor v2 DPI awareness
Qt 6 has supported this forever, but our manifest forced PMv1.
2026-05-15 18:13:46 -05:00
Cameron Gutman 8fe279c91b Add support for controllers with dual touchpads 2026-05-14 22:14:50 -05:00
Cameron Gutman dedb0c0327 Disable text input before creating windows 2026-05-14 21:45:22 -05:00
Cameron Gutman 9cbba106ad Use the Metal renderer by default on all Macs
Whatever dGPU/eGPU rendering issues existed at the time I wrote that check seem to no longer happen on my RX 480 eGPU test setup running Ventura (our oldest supported OS).

It seems safe enough to enable now, especially since 7d6ce0b4c should catch broken systems and transparently fall back to AVSampleBufferDisplayLayer.

Fixes #1885
2026-05-14 00:45:57 -05:00
Cameron Gutman 7d6ce0b4cc Implement testRenderFrame() for the VTMetal renderer
This can be used to (hopefully) detect cases where importing the decoded frames onto the target GPU fails.

See #1885
2026-05-14 00:34:32 -05:00
Cameron Gutman 92fb7f3b71 Use the (hopefully faster) ARM64 Tahoe runner 2026-05-13 23:49:32 -05:00
Cameron Gutman b0ac3713f2 Update macOS CI runner to Tahoe 2026-05-13 23:33:30 -05:00
Cameron Gutman 96a211be11 Update Windows and macOS CI builds to Qt 6.11.1 2026-05-13 23:31:14 -05:00
Cameron Gutman 4cf498b09d Use queued audio duration instead of queued frame count to constrain latency
This avoids latency explosion when we negotiate 10 ms instead of 5 ms audio packets.
2026-05-10 21:53:09 -05:00
Cameron Gutman c21affd15a Switch to linuxdeploy for AppImages 2026-05-10 16:56:34 -05:00
dependabot[bot] 7de4e74829 Bump app/SDL_GameControllerDB from 16ac3e5 to 1fc89ca
Bumps [app/SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) from `16ac3e5` to `1fc89ca`.
- [Commits](https://github.com/gabomdq/SDL_GameControllerDB/compare/16ac3e553e23068e26819971f2cc6cd088a7f2f6...1fc89ca5787f4b8279e6c793cf3007657d9bb35c)

---
updated-dependencies:
- dependency-name: app/SDL_GameControllerDB
  dependency-version: 1fc89ca5787f4b8279e6c793cf3007657d9bb35c
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-09 13:21:38 -05:00
Cameron Gutman 9d6218d1ff Don't capture the cursor by default in windowed mode
Closes #1872
2026-05-09 13:11:45 -05:00
Cameron Gutman 8cc3b30642 Update Windows, macOS, and AppImage dependencies 2026-05-03 22:36:08 -05:00
Cameron Gutman d77e2cc913 Update upload-artifact for Node.js 24 2026-05-03 21:06:42 -05:00
Cameron Gutman 453435f916 Switch to downloading prebuilt release artifacts instead of a submodule 2026-05-03 21:04:06 -05:00
Cameron Gutman f222aa7985 Use aspect ratio preserving scaling for slow GPUs on non-KDE desktops 2026-04-26 23:15:02 -05:00
Cameron Gutman 5faa5fece8 Don't manually override v4l2m2m buffer counts
This causes POLLERR when decoding from meson-vdec on the Libre
Computer Alta (and likely other Amlogic boards). Our requried buffer
counts were already lower than the default 16/20 configuration that
FFmpeg uses, so overriding them was just a memory usage optimization.
2026-04-20 00:25:21 -05:00
Cameron Gutman 51f86caac3 Fix assert on exit using KMSDRM on AMDGPU
AMDGPU disallows commits that would leave a CRTC active without
the primary plane enabled. Instead of disabling the primary plane,
simply restore the original state of the plane to avoid this.
2026-04-19 23:17:28 -05:00
Cameron Gutman 5d813ed3df Fix clamping of signed range properties 2026-04-19 22:17:37 -05:00
Cameron Gutman d17575d47c Fix deadlock in Vulkan renderer using KMSDRM on AMDGPU 2026-04-19 21:16:45 -05:00
Cameron Gutman 0e50a9d457 Only enable D3D11/DXGI debug layer if Graphics Tools are installed
Closes #1857
2026-04-13 20:06:24 -05:00
Cameron Gutman ed029f194f Propagate CFLAGS/CXXFLAGS/LDFLAGS environment variables to QMake
Closes #1602
2026-04-12 15:51:42 -05:00
Cameron Gutman 569153220a Enable Brazilian Portuguese now that it is fully translated 2026-04-12 15:27:38 -05:00
Cameron Gutman e0367d05ae Rerun lupdate and lrelease 2026-04-12 15:21:18 -05:00
Cameron Gutman 53e0c2534d Merge remote-tracking branch 'origin/weblate' 2026-04-12 15:19:45 -05:00
Cameron Gutman a766c9cafc Disable texture sharing on Qualcomm GPUs
See #1857
2026-04-11 20:14:14 -05:00
Cameron Gutman c685021f21 Update SDL3, dav1d, FFmpeg, and OpenSSL
SDL3 -> 3.4.4 (Windows only)
dav1d -> 1.5.3
FFmpeg -> 8.1
OpenSSL -> 3.6.2

Fixes #1394
2026-04-10 20:58:23 -05:00
Cameron Gutman af03f57e08 Fix Vulkan decoder probing on Nvidia using KMSDRM 2026-04-09 22:11:08 -05:00
Cameron Gutman 1fc1122c65 Consolidate test window creation code 2026-04-09 21:43:35 -05:00
Cameron Gutman 94d47e95fe Fix non-determinism during Vulkan decoder probing on KMSDRM 2026-04-09 21:37:25 -05:00
Tak-attack 1cffa7b350 Translated using Weblate (Japanese)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ja/
2026-04-09 13:09:49 +02:00
dependabot[bot] fae1cd3dee Bump moonlight-common-c/moonlight-common-c from b187204 to 6268780
Bumps [moonlight-common-c/moonlight-common-c](https://github.com/moonlight-stream/moonlight-common-c) from `b187204` to `6268780`.
- [Commits](https://github.com/moonlight-stream/moonlight-common-c/compare/b187204769974b9af9d2a3c3bca83ad40e4f1ac9...62687809b1f7410c3db4be2527503a54ae408d70)

---
updated-dependencies:
- dependency-name: moonlight-common-c/moonlight-common-c
  dependency-version: 62687809b1f7410c3db4be2527503a54ae408d70
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-08 21:51:17 -05:00
Cameron Gutman 2160f029d2 Bump aqtinstall to a later commit to pick up Qt 6.11 deployment fix 2026-04-08 21:39:37 -05:00
Cameron Gutman 1ec1a3d7ad Move ifdef guards to fix unused variable warning 2026-04-08 21:26:33 -05:00
Cameron Gutman eb3d8ad92c Update Windows and macOS to Qt 6.11.0 2026-04-08 20:54:36 -05:00
Cameron Gutman 07b00a6987 Update to WiX v7 2026-04-08 20:49:46 -05:00
Cameron Gutman 4ec682dc72 Remove errant assert to fix software decoding on Xe 2026-04-06 21:12:00 -05:00
Cameron Gutman a9a1ea0a0b Update AppImage dependencies 2026-04-06 20:04:05 -05:00
Cameron Gutman c8d18f8a8e Bring back DRM atomic test commit using new DRM master lock
The DRM master lock avoids race conditions between Qt taking master
to draw the GUI and the DRM renderer performing a test commit.
2026-04-06 19:25:03 -05:00
Cameron Gutman 9c11dca454 Move DRM master state cleanup into cleanupRenderContext() 2026-04-06 19:24:04 -05:00
Cameron Gutman 9496c25271 Add a lock to synchronize DRM master ownership between Qt and SDL 2026-04-04 14:47:57 -05:00
Cameron Gutman 6ff3309677 Don't warn about KMSDRM atomic on unsupported platforms 2026-04-04 14:24:35 -05:00
Cameron Gutman e4c211b987 Automatically set SDL_KMSDRM_ATOMIC=0 on older SDL3 versions
Fixes #1824
2026-04-04 14:13:21 -05:00
Luís Otávio cac3bb28d7 Translated using Weblate (Portuguese (Brazil))
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/pt_BR/
2026-04-03 13:09:51 +00:00
Cameron Gutman 78bc2141f6 Fix getSdlFdEntryIndex() for FD 0 2026-04-02 21:20:33 -05:00
Cameron Gutman effac744c7 Fix handling close(0) in our DRM master hooks
Prior to this fix, we would become out of sync and fail to promote
Qt and SDL FDs to master when required, causing Qt's mouse to
disappear and the SDL video subsystem to fail initialization when
trying to stream.
2026-04-02 21:01:46 -05:00
Cameron Gutman 5676a076fd Fix overlay plane selection on drivers without zpos properties 2026-04-01 22:37:12 -05:00
Cameron Gutman b6407492c7 Move refreshDisplay() after test window creation
SDL invalidates cached display modes after a window creation, so this avoids paying a second mode enumeration cost when the user enters the settings page.
2026-03-28 22:01:15 -05:00
Cameron Gutman 91ce7a41e5 Cache the result of SDL_GetNumDisplayModes()
It's not free when using SDL2-compat.
2026-03-28 21:57:51 -05:00
Cameron Gutman 89c8462e9e Leave the video subsystem initialized on Windows
It significantly reduces settings page load latency.
2026-03-28 20:46:03 -05:00
Cameron Gutman 53a7680a38 Fix incorrect autoselection of SW AV1 over HW H.264 for SDR content 2026-03-28 20:19:11 -05:00
Cameron Gutman 88b4a17fe1 Use AV_CODEC_RECEIVE_FRAME_FLAG_SYNCHRONOUS for decoder probing on FFmpeg 8.1 2026-03-28 16:30:28 -05:00
Cameron Gutman 8326223220 Revert "Use EOS to force decoder test frame output"
It causes hangs on defective v4l2m2m decoders, and it's not always
well-supported by out-of-tree decoders either.

This reverts commit 66a30c66f3.
2026-03-28 16:24:20 -05:00
Cameron Gutman 4aa5ad71c0 Use av_vk_get_optional_device_extensions() on FFmpeg 8.1 2026-03-28 16:17:59 -05:00
Cameron Gutman e785be03c2 Add support for building with OpenSSL 4.0 2026-03-28 00:56:34 -05:00
தமிழ்நேரம் db294fe4ae Translated using Weblate (Tamil)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ta/
2026-03-02 10:09:47 +00:00
Cameron Gutman 2e9fbecfea Disable SDL3 raw keyboard/mouse hotplug support 2026-02-20 22:40:50 -06:00
Cameron Gutman 7c066485f3 Update SDL, sdl2-compat, and libplacebo for AppImage 2026-02-20 22:19:21 -06:00
Cameron Gutman 11d51e121a Update libplacebo and SDL3
libplacebo -> v7.360.0
SDL3 -> 3.4.2

Fixes #1661
Fixes #1617
2026-02-20 21:57:46 -06:00
Cameron Gutman 09675bf56d Update moonlight-common-c with vectorized FEC for non-ARMv8/x64 platforms
Also remove the workaround for Steam Link since vectorization is enabled by compiler flags now.
2026-02-19 20:09:38 -06:00
Cameron Gutman 8f994dd113 Enable NEON FEC optimizations on Steam Link 2026-02-19 00:54:49 -06:00
Cameron Gutman e596c2dcdc Update moonlight-common-c with SIMD acceleration for FEC 2026-02-19 00:38:52 -06:00
Cameron Gutman 209511b2dc Revert Pinyin IME workaround which is ineffective on SDL3
The underlying SDL bug is now fixed upstream for SDL 3.4.2.
2026-02-16 15:00:30 -06:00
Cameron Gutman efa67fec1e Disable VBlank virtualization with dynamic refresh rates 2026-02-14 12:39:01 -06:00
Ferrer be0aeb6cc2 Translated using Weblate (Spanish)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/es/
2026-02-11 13:09:44 +00:00
Cameron Gutman 8d5072533f Fix polish() loop in the quit dialog
Fixes #1816
2026-02-07 22:01:26 -06:00
Cameron Gutman 4c14a24960 Change nightly builds to use the non-portable profile by default
Fixes #1790
2026-02-07 17:26:23 -06:00
Cameron Gutman e3702dbab7 Don't deploy icuuc.dll into the application folder 2026-02-07 16:46:12 -06:00
Cameron Gutman e4325b8736 Update Windows ARM64 CI to Qt 6.10.2 2026-02-07 16:46:12 -06:00
Cameron Gutman eb294e63f4 Revert "Temporarily revert Windows ARM64 to Qt 6.10.0"
This reverts commit 6313129603.
2026-02-07 16:46:12 -06:00
Cameron Gutman 9d597a666b Use aqtinstall version compatible with Qt 6.10.1+ ARM64 2026-02-07 16:46:12 -06:00
Jakub SygnowskiandCameron Gutman 33e0b08699 Add Docker section to README (#1791)
* Add Docker section to README

Added information on moonlight-packaging to building section of README.

Co-authored-by: Cameron Gutman <aicommander@gmail.com>
2026-02-06 23:59:28 -06:00
Cameron Gutman 31898bbab4 Update moonlight-common-c to fix BSDs 2026-02-06 23:26:41 -06:00
Cameron Gutman 34c9e01a96 Exclude Windows and macOS systems from the slow GPU heuristic
It's targeted at SBCs, which don't run Windows or macOS.
2026-02-06 22:37:33 -06:00
Cameron Gutman ddc6675dc8 Fix macOS and Steam Link build 2026-02-06 22:27:57 -06:00
Cameron Gutman f0626e8cae Exit immediately on repeated SIGINT/SIGTERM without progress 2026-02-05 23:55:02 -06:00
Cameron Gutman 6f4ced5ed6 Assume GPUs on non-x86 platforms are slow by default
This can be overriden with GL_IS_SLOW=0 at runtime
for systems with a fast GPU, though it doesn't make
much difference either way for non-KMSDRM cases.

For slower GPUs, this enables important scaling and
rendering optimizations that can substantially
improve performance (especially on fillrate-limited
GPUs common in SBCs).
2026-02-05 23:17:23 -06:00
Cameron Gutman 0a2b134d49 Disable the DRM master hooks when EGLFS isn't used 2026-02-05 22:36:31 -06:00
Cameron Gutman f6a9e7694a Update moonlight-common-c 2026-02-05 22:33:51 -06:00
Cameron Gutman 8795fb54f4 Fix double-free in Vulkan renderer when an overlay is disabled
Also a drive-by fix to avoid pl_tex copying
2026-02-04 23:05:01 -06:00
Cameron Gutman 092eb1b117 Enable SDL3 fast parameter checks 2026-02-04 22:42:58 -06:00
Cameron Gutman 179857f17d Remove more unused Qt 6 styles 2026-01-31 17:12:29 -06:00
Cameron Gutman d878447413 Fix Windows ARM64 builds on x64 on Qt 6.10.1+ 2026-01-31 17:11:56 -06:00
Cameron Gutman 60fd840d7a Remove _USE_MATH_DEFINES workaround for SDL2 2026-01-31 13:51:59 -06:00
Cameron Gutman 5020fc6f48 Do not reset the renderer on SDL_RENDER_TARGETS_RESET
We only need to do this on a SDL_RENDER_DEVICE_RESET where we lose the whole device.

This also reverts a56efe5 since this change is not needed when handling the reset events properly.
2026-01-31 13:00:23 -06:00
Cameron Gutman a2122e17c6 Explicitly request linear sampling in StretchRect() 2026-01-31 12:48:03 -06:00
Cameron Gutman 6bb7c8bf2a Fix blurriness of DXVA2 overlay
Also make a drive-by fix for D3DTSS_COLOROP since we don't use vertex colors.
2026-01-31 12:44:50 -06:00
Cameron Gutman 2dda65078f Remove D3D9Ex focus loss hint workaround
SDL3 doesn't suffer this bug and keeping the default SDL3 auto behavior (minimize iff in exclusive mode) is a better UX.
2026-01-30 21:07:01 -06:00
Cameron Gutman 2914ff678d Update OpenSSL and libplacebo for Windows and macOS
OpenSSL -> 3.6.1
libplacebo -> 9bffcaf
2026-01-30 20:54:01 -06:00
Cameron Gutman a56efe5c36 Fix infinite renderer resets on SDL3 using direct3d renderer 2026-01-30 20:39:53 -06:00
Cameron Gutman b7a05d73b9 Update SDLRenderer capabilities to match SDL3 behavior 2026-01-30 20:38:53 -06:00
Cameron Gutman 6d5b9e4706 Remove Windows dark mode hack since SDL3 supports it natively 2026-01-30 19:57:11 -06:00
Cameron Gutman 9813932c1b Switch to SDL3+SDL2-compat 2026-01-30 19:44:29 -06:00
Cameron Gutman d4d4ab5b06 Only use the libssl.so linking hack for AppImages 2026-01-27 22:22:29 -06:00
Cameron Gutman 402ac59390 Fix forcing X11 SDL video driver on XWayland when not built with Wayland 2026-01-27 22:22:29 -06:00
Cameron Gutman c33c49e6fa Update libplacebo and drop old Gamescope workaround 2026-01-27 22:22:29 -06:00
Cameron Gutman e1bbf8144e Switch AppImage to SDL3+SDL2-compat 2026-01-27 22:22:20 -06:00
Cameron Gutman f4712718cb Allow focus to move up to the toolbar from the PC/app grid 2026-01-27 00:24:29 -06:00
Cameron Gutman d040bd24d1 Add keyboard/gamepad focus navigation to dialog buttons 2026-01-27 00:13:47 -06:00
Cameron Gutman 6d40c61850 Only set initial MenuItem focus if not activating via mouse
Having an initially highlighted item when using mouse navigation
doesn't adhere to UX norms and also can lead to a janky feeling
when the focus flip-flops from the item under the user's cursor
to the first item as the Menu opens.
2026-01-26 23:46:57 -06:00
Cameron Gutman b4a5d21f97 Fix focusing after closing a dialog 2026-01-26 23:20:38 -06:00
Cameron Gutman 792f762c15 Standardize on QString::toUtf8() 2026-01-26 21:49:08 -06:00
Cameron Gutman 8c9c799f81 Fix Clazy non-pod-global-static warnings 2026-01-26 21:49:08 -06:00
Cameron Gutman 4eaf037c75 Fix Clazy readlock-detaching warning 2026-01-26 21:49:08 -06:00
Cameron Gutman b732b58807 Fix Clazy returning-data-from-temporary warnings 2026-01-26 21:49:08 -06:00
Cameron Gutman d484ec3ac8 Fix Clazy range-loop-detach warnings 2026-01-26 21:49:08 -06:00
Cameron Gutman f5f06ae44e Remove handling for Windows versions that are no longer supported 2026-01-26 20:04:15 -06:00
Cameron Gutman d2fa488979 Move heavy SystemProperties loads to an opt-in model
This avoids heavyweight operations when we're not actually running config checks.
2026-01-26 19:46:49 -06:00
Cameron Gutman cd9aceb62c Disable D3D11VA texture sharing on known broken GPUs 2026-01-26 19:37:43 -06:00
Cameron Gutman d5b7ef0c58 Don't pump events in SdlGamepadKeyNavigation
This can cause reentrancy issues by invoking Qt-based event
processing while in the context of SDL (via libdecor's GTK loop).

Fixes #1802
2026-01-26 18:19:55 -06:00
Cameron Gutman e4be57db5d Remove superfluous Session checks in prepareToRender()
prepareToRender() is only called with a live Session.
2026-01-26 18:17:14 -06:00
Artyom Rybakov 1b0c657864 Translated using Weblate (Russian)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ru/
2026-01-26 06:53:01 +01:00
Cameron Gutman 64fea80ac9 Create the SystemProperties test window on the main thread 2026-01-25 17:10:04 -06:00
therealmate 990804fe6b Translated using Weblate (Hungarian)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/hu/
2026-01-25 21:50:51 +01:00
Cameron Gutman 05ef938e2c Add support for LTR ACK control messages 2026-01-20 21:54:14 -06:00
Cameron Gutman 1e825c85e5 Optimize render to decode fence usage to reduce pipeline bubbles 2026-01-19 18:38:38 -06:00
Cameron Gutman a0a4c1ea83 Use decoder texture binding by default when using separate devices
This significantly improves performance on Ryzen 3300U and should generally perform equal or better everywhere.

This decoder->SRV path has been prone to driver bugs, so we may need to adjust this logic if driver issues crop up.
2026-01-19 16:46:50 -06:00
Cameron Gutman b5e7dec378 Fix D2R fence initial value
Fixes synchronization of the first decoded frame
2026-01-19 16:10:02 -06:00
Cameron Gutman adbd19e6fa Remove the previous frame rendered fence
- Waiting on this fence prior to rendering introduces pipeline bubbles which can impact rendering performance on low-end GPUs
- Pacer simply waiting to release the previous frame until after the current frame is rendered already means any decoder stall should be very short
2026-01-19 16:01:50 -06:00
Cameron Gutman 02a86167da Disable separate decoder devices for non-Intel FL11.0 GPUs 2026-01-19 15:08:14 -06:00
Cameron Gutman a739c1cef8 Fix D3D11 fence sharing without monitored fence support 2026-01-19 14:53:23 -06:00
Cameron Gutman f6e08f8a43 Use separate render and decode D3D11Devices
See #1424
2026-01-19 14:25:08 -06:00
Cameron Gutman 218ffc2d55 Set explicit scaling mode for all SDL textures 2026-01-17 02:34:54 -06:00
Cameron Gutman 0f49dca4c0 Use GL_NEAREST when possible without degrading quality 2026-01-17 02:23:28 -06:00
Cameron Gutman 30274f3ae8 Don't keep the dummy renderer alive for EGLRenderer's lifetime
At best, it doesn't do anything other than some queue some viewport
changes via SDL_RendererEventWatch(). At worst, it can race with
the render thread and cause trouble.
2026-01-17 01:06:41 -06:00
Jhony Minetto Araújo c696ae7a7e Translated using Weblate (Portuguese (Brazil))
Currently translated at 28.2% (71 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/pt_BR/
2026-01-16 09:01:47 +00:00
Cameron Gutman 66a30c66f3 Use EOS to force decoder test frame output 2026-01-16 01:08:51 -06:00
Cameron Gutman 198a208b44 Clamp property values when restoring them 2026-01-14 23:26:46 -06:00
Jan Astrup 21ce23e377 Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.6% (250 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nb_NO/
2026-01-14 10:39:52 +01:00
Jhony Minetto Araújo cd4ae1c0ed Translated using Weblate (Portuguese (Brazil))
Currently translated at 27.4% (69 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/pt_BR/
2026-01-14 10:39:51 +01:00
Cameron Gutman d865c77975 Crop the incoming frames if they deviate slightly from the expected size
Fixes #1466
2026-01-11 20:58:48 -06:00
Cameron Gutman cd13910e6c Add support for YUV 4:4:4 in DXVA2
We get it basically for free now that we let FFmpeg handle the heavy lifting.
2026-01-11 20:55:46 -06:00
Cameron Gutman b8e9262b1b Replace deprecated DXVA2 initialization with standard hwaccel init
- Avoids requiring a hardcoded number of frames (and creating surfaces ourselves)
- Removes a ton of unnecessary code that's duplicated in FFmpeg
- Supports dynamic frame sizes, formats, and color conversion
- Supports frame cropping in FFmpeg
2026-01-11 17:46:13 -06:00
Cameron Gutman c14ebb1ad7 Adjust buffer count for hwaccel and v4l2m2m decoders
- For hwaccel decoders, don't depend on FFmpeg's 4 working surfaces.
  The decoders might need one or more of them internally.

- For V4L2M2M decoders, adjust the buffer counts to match our needs
  and requirements regarding Pacer-held frames.
2026-01-11 14:18:22 -06:00
Cameron Gutman d3957b3cbb Fix race condition where a separate test decoder could ingest a real frame 2026-01-11 13:41:12 -06:00
Cameron Gutman a8e8efb17b Don't blend the source surface when blitting 2026-01-11 12:35:55 -06:00
Cameron Gutman 75adc22d05 Blit the new overlay in one shot if it entirely covers the old one 2026-01-11 12:28:22 -06:00
Cameron Gutman 2549efc8b3 Fix pthread_attr leak 2026-01-11 01:47:11 -06:00
Cameron Gutman 6f8e517ce1 Remove unused field 2026-01-11 01:46:17 -06:00
Cameron Gutman 09f8e7117b Fix incorrect src pixel offset in overlay composition
Currently harmless because no overlay has a non-zero X coordinate.
2026-01-11 01:40:32 -06:00
Cameron Gutman 88719cc8bf Use FB_DAMAGE_CLIPS instead of drmModeDirtyFB() 2026-01-11 01:15:28 -06:00
Cameron Gutman 3ea62c0800 Call drmModeDirtyFB() for the modified composition regions 2026-01-10 23:53:07 -06:00
Cameron Gutman 7643cc929e Implement DRM overlay composition
This allows overlays to work on drivers that only have one usable
overlay plane and when we are using the primary plane (which often
must be exactly CRTC-sized) to overlay on top of a video underlay.
2026-01-10 23:40:12 -06:00
Cameron Gutman a58d3cfe39 Fix D3D11 copy path 2026-01-10 19:11:25 -06:00
Cameron Gutman b41c4022ea Ensure there are enough hwframes for Pacer 2026-01-10 18:13:49 -06:00
Cameron Gutman 788675ad59 Handle window size and display changes in D3D11Renderer 2026-01-10 17:48:28 -06:00
Cameron Gutman be9f465008 Remove manual hwframes creation in D3D11VARenderer
This way we aren't always allocating the worst-case possible number of frames
2026-01-10 16:36:35 -06:00
Cameron Gutman 8b6ad55c9b Enable DXGI_CREATE_FACTORY_DEBUG for debug builds 2026-01-10 16:01:03 -06:00
Cameron Gutman 92b68a40d1 Use a D3D11Fence to force sync between video and 3D engines when binding output textures 2026-01-10 14:52:27 -06:00
Cameron Gutman a931161923 Reset client caps before rendering in case SDL changed them 2026-01-08 22:03:44 -06:00
Cameron Gutman 37b9b6ed9e Don't run configuration checks for CLI launches 2026-01-08 19:10:50 -06:00
Cameron Gutman fad197fdce Move heavy SystemProperties initialization operations off the main thread
This dramatically improves startup performance on slow devices.
2026-01-08 19:09:54 -06:00
Cameron Gutman cda65ab58d Use a D3D11Fence to wait to start the next frame until the previous frame is finished 2026-01-07 19:04:15 -06:00
Cameron Gutman 9ffe5218d5 Hoist the logic to keep an AVFrame reference up to Pacer 2026-01-07 17:50:43 -06:00
Cameron Gutman ed98f256e8 Fix typo 2026-01-06 02:14:45 -06:00
Cameron Gutman 8aec35a650 Allow primary planes to be overlays for video underlays 2026-01-06 02:12:32 -06:00
Cameron Gutman a3237b741c Support underlay planes by turning off unused active planes 2026-01-06 01:59:34 -06:00
Cameron Gutman 377409f313 Fix oversized DRM dumb buffer for 4:2:0 uploads 2026-01-06 00:49:49 -06:00
Cameron Gutman 80ddd5ba13 Fix software upload for DRM renderer with non-720p resolutions
The buffer allocated for the 720p test frame was left around
and we would attempt to reuse it even if the stream had frames
of a different size.
2026-01-06 00:35:36 -06:00
Cameron Gutman 4a547eb05e Add fourcc_mod_is_vendor() definition for older headers 2026-01-05 23:00:31 -06:00
Cameron Gutman 1c6ed8f390 Remove atomic test-only commit
This is currently race-prone because nothing is synchronizing
between other Qt and SDL uses of DRM master, so it can cause
false negatives if we can't retake master ourselves.
2026-01-05 21:50:31 -06:00
Cameron Gutman 0a58af4fa1 Allow plane selection overrides using environment variables 2026-01-05 21:27:52 -06:00
Cameron Gutman 50a094c917 Fix percentage math 2026-01-05 21:01:23 -06:00
Cameron Gutman d14cf984f4 Print flip stats after the DrmRenderer is destroyed 2026-01-05 20:52:53 -06:00
Cameron Gutman 13d9d79fe3 Implement support for adjusting zpos to make planes visible 2026-01-05 20:39:12 -06:00
Cameron Gutman 70d4f24455 Fix pending frame leak on destruction 2026-01-05 19:15:58 -06:00
Cameron Gutman 705cd3ddc4 Allow rendering to a cursor plane via opt-in
This is required for some Rockchip devices running vendor kernels.
2026-01-05 19:08:22 -06:00
Cameron Gutman ea5b062da3 Set VRR, BPC, and content type properties 2026-01-05 18:58:21 -06:00
Cameron Gutman e6f41f5574 Improve DRM renderer plane compatibility testing
For atomic drivers, use a test-only commit to fully exercise the
path that we will be using when rendering.

For legacy drivers, mask the variable portion of Broadcom modifiers
before matching with IN_FORMATS.
2026-01-05 18:20:39 -06:00
Cameron Gutman 9af6222039 Update moonlight-common-c to fix leak 2026-01-05 00:24:16 -06:00
Cameron Gutman 476414ea71 Fix a rare race where an overlay surface can leak 2026-01-04 22:29:12 -06:00
Cameron Gutman 83d770cdba Prefer BT2020_YCC to allow chroma subsampling 2026-01-04 22:16:52 -06:00
Cameron Gutman 25e2d39e26 Fix copy-paste mistake in 8726c1 2026-01-04 21:52:12 -06:00
Cameron Gutman bd32370b6d Fix libdrm return value vs errno confusion
libdrm is inconsistent between returning -1 with an errno set
and just returning -errno as the return value. Figuring out which
behavior a given libdrm function has require reading the source :/
2026-01-04 21:50:40 -06:00
Cameron Gutman 8726c1c7d0 Bring back atomic async page flip support
Now that we're referencing the AVFrame to keep the buffers from
being reused during scanout, this should hopefully work better.
2026-01-04 19:34:13 -06:00
Cameron Gutman 34881599f5 Reference the AVFrame while the backing DMA-BUFs are used for scanout
This prevents tearing and other artifacts caused by the decoder
writing to a DMA-BUF that is currently being displayed.
2026-01-04 18:47:00 -06:00
Cameron Gutman de0fb72424 av_buffer_create() copies the pointer not the data 2026-01-04 18:24:20 -06:00
Cameron Gutman 46c76534bc Use AVBufferRefs to keep EGLImages and DRM FDs around for the lifetime of the frame 2026-01-04 18:06:24 -06:00
Cameron Gutman 67cba9e397 Add branding colors to appstream metadata 2026-01-04 00:38:54 -06:00
Cameron Gutman 2ab72375c6 Fix additional appstream metadata linter warnings 2026-01-04 00:16:20 -06:00
Sabri Ünal d3118bd677 metadata: Tidy up
- Drop categories that are already provided by the desktop file
- Group important information together
- Add vcs-browser URL to point to the source code repository
2026-01-03 23:56:03 -06:00
Cameron Gutman b8c3658c42 Skip modifier check if the frame doesn't have any modifiers 2026-01-03 02:53:44 -06:00
Cameron Gutman d3fb52c5a0 Check modifiers support in IN_FORMATS property
As it turns out, there *are* in fact hardware vendors dumb enough
to ship V4L2 decoders that output buffers which are unsupported by
any plane on their display hardware. By checking modifiers, we can
still fall back to GLES on GL_IS_SLOW=1 builds in this case.
2026-01-03 02:43:15 -06:00
Cameron Gutman 7924a5b6a7 Reduce mDNS log spam from hosts with many addresses 2026-01-03 01:14:50 -06:00
Cameron Gutman 2972022ced Remove async and non-blocking page flip support
It doesn't work well in practice for a few major reasons:
- It can result in the decoder writing on DMA-BUFs being used by the display
- It can generate page flip events that collide with Qt/SDL
- It can stall the decoder if the DMA-BUF has a fence on it from the display driver
2026-01-03 00:41:14 -06:00
Cameron Gutman c0846155c3 Fix page flipping bugs 2026-01-02 20:01:54 -06:00
Cameron Gutman ac6dadffc6 Use page flip events to correctly synchronize with async flips 2026-01-02 19:47:43 -06:00
Cameron Gutman 745ac34b15 Improve page flipping and modifier handling in DrmRenderer 2026-01-02 18:44:18 -06:00
Cameron Gutman 5f89636ed7 Improve robustness of DRM property value handling 2026-01-02 02:06:11 -06:00
Cameron Gutman 46d58e55a3 Add macro for printing FourCC values 2026-01-02 01:46:20 -06:00
Cameron Gutman be460970a8 Remove use of DMA_BUF_IOCTL_SYNC
It's only necessary on "real" DMA-BUFs, not dumb buffers.
2026-01-02 01:30:03 -06:00
Cameron Gutman d50ba06321 Implement DRM atomic renderer with overlay support
Fixes #1733
2026-01-02 01:24:35 -06:00
Cameron Gutman b108684edc Handle missing bitstream restrictions element in H.264 SPS fixup
NVENC on the 591.59 driver seems to not include the bitstream
restrictions element, which renders our attempt to set the
max_dec_frame_buffering value ineffective. Handle this by
providing inserting default bitstream restrictions if one
is not present.
2025-12-30 17:12:37 -06:00
Cameron Gutman b6d10a34c8 Update blocking swap buffer opt-out comment 2025-12-30 15:43:31 -06:00
Cameron Gutman 232ff0b3c6 Revert "Remove opt-out of blocking swap buffers logic for KMSDRM"
This significantly hurts performance on slower GPUs by preventing
the pipelining required when frametimes exceed the video frame
interval.

This reverts commit c26e437f40.
2025-12-30 15:39:47 -06:00
Cameron Gutman c5960c3e15 Always use display scaling with the KMSDRM video driver 2025-12-30 15:39:32 -06:00
Cameron Gutman b48cbd76f5 Fix implicit fallthrough warning 2025-12-30 15:32:15 -06:00
Cameron Gutman ceef792f04 Use display scaling to improve performance on slow GPUs
This dramatically improves performance for lower resolution
streams on slow GPUs when using the GL and Vulkan renderers.
2025-12-30 15:00:47 -06:00
Cameron Gutman f3f1d56e8d Fix EGLFS detection when a compositor is running on wayland-0 in another VT 2025-12-30 00:04:55 -06:00
Cameron Gutman 39e24e9c8c Add qt6-wayland to list of required Debian packages 2025-12-29 22:57:35 -06:00
Cameron Gutman c26e437f40 Remove opt-out of blocking swap buffers logic for KMSDRM
We don't set SDL_HINT_VIDEO_DOUBLE_BUFFER since b1c77ff.
2025-12-29 16:51:03 -06:00
Cameron Gutman e89f63b8fb Skip unnecessary glClear() on X11 2025-12-29 16:50:15 -06:00
bkpiaskun cf8251b9e6 Translated using Weblate (Polish)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/pl/
2025-12-29 19:00:21 +01:00
Oğuz Ersen d6c9beffc1 Translated using Weblate (Turkish)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/tr/
2025-12-29 19:00:20 +01:00
Cameron Gutman 93dc6d6b60 Convert Metal shaders to FP16 2025-12-29 01:45:49 -06:00
Cameron Gutman 8ee82421b3 Remove non-compliant float suffix in NV12 fragment shader
The 'f' suffix isn't supported until ESSL 3.0.
2025-12-28 22:58:21 -06:00
Cameron Gutman 31c65e0863 Optimize EGLRenderer overlay texture swizzle 2025-12-28 22:57:59 -06:00
Cameron Gutman 3e5aa9b127 Simplify EGLImageFactory and remove caching logic for now
The platforms that would most benefit (embedded V4L2 decoders)
either don't use frame pooling or don't synchronize with
modified DMA-BUFs unless eglCreateImage() is called each time.
2025-12-28 17:54:31 -06:00
Cameron Gutman 085480e9f4 Add EGLImage caching to improve performance 2025-12-28 17:08:45 -06:00
Cameron Gutman c3ce0918b3 Optimize blending in DXVA2 and D3D11VA renderers 2025-12-28 13:53:13 -06:00
Cameron Gutman c5b7a9c679 Optimize EGLRenderer with overlay VAOs and reduced GL_BLEND usage 2025-12-28 13:14:16 -06:00
Cameron Gutman f1451a0db3 Fix UB due to missing shader attribute location binding
Mesa drivers seem to generally bind attributes in order, but the
proprietary PowerVR driver (pvr) doesn't and renders incorrectly
as a result.
2025-12-27 23:56:17 -06:00
Cameron Gutman 8a5f34fb01 Remove logic to force the OpenGL ES library to load
This isn't necessary now that we turn on EGL everywhere,
and it breaks OpenGL ES 2.0 support too.
2025-12-27 23:11:53 -06:00
Cameron Gutman d1f43ca258 Use ESSL 1.0 for EGLRenderer shaders
We still ostensibly support GLES 2.0 GPUs.
2025-12-27 22:56:20 -06:00
Cameron Gutman 249c29b74c Allow GL_IS_SLOW and VULKAN_IS_SLOW to be overridden at runtime 2025-12-27 21:40:32 -06:00
Cameron Gutman 1cf207de07 Allow overriding FFmpeg AVOptions via environment variable 2025-12-27 21:07:04 -06:00
Cameron Gutman 4f08d52754 Enable DRM_PRIME frames for the TH1520 2025-12-27 15:40:59 -06:00
Cameron Gutman 41ad3c0938 Add environment variable override helper function
This allows FORCE_QT_GLES and SEPARATE_TEST_DECODER to override both true and false.
2025-12-27 15:33:39 -06:00
Cameron Gutman 21fb2832e1 Fix CLI exit after unexpected stream termination
Fixes #939
2025-12-27 13:33:46 -06:00
dependabot[bot] f0bb1031d8 Bump app/SDL_GameControllerDB from e40b891 to 16ac3e5
Bumps [app/SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) from `e40b891` to `16ac3e5`.
- [Commits](https://github.com/gabomdq/SDL_GameControllerDB/compare/e40b8910f859cd988124def50dcdb63b2f2ff48b...16ac3e553e23068e26819971f2cc6cd088a7f2f6)

---
updated-dependencies:
- dependency-name: app/SDL_GameControllerDB
  dependency-version: 16ac3e553e23068e26819971f2cc6cd088a7f2f6
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-23 11:38:47 -06:00
Cameron Gutman b80d2a00c0 Fix SIGTERM unexpectedly quitting the host app 2025-12-23 01:09:21 -06:00
Cameron Gutman 85ea28287e Add workaround for AV1 reinit bug and quiet some debug output 2025-12-23 00:59:19 -06:00
Cameron Gutman a6f8901a18 Reuse the test decoder to improve startup performance 2025-12-23 00:32:36 -06:00
Cameron Gutman d501a627f0 Test all renderers before use
Every renderer except SDL had opted-in for testing due to various
quirks discovered over the years, so just do away with this option
and test all renderers.
2025-12-22 23:58:26 -06:00
Cameron Gutman 526d815930 Don't fall back to the generic hwaccel for DRM_PRIME formats 2025-12-22 15:06:20 -06:00
Cameron Gutman b448e5bbd7 Update AppImage dependencies 2025-12-22 10:54:50 -06:00
Cameron Gutman 741e360024 Fix GLES compatibility check on VF2 pvr driver 2025-12-21 22:15:29 -06:00
Cameron Gutman 7edbede95d Force Qt to use GLES if desktop GL is not available
Some platforms like the VisionFive 2 don't have working desktop GL,
so they must use GLES to be able to render at all. Qt doesn't try
to fall back if it fails to find a compatible EGL config, so we must
do so ourselves.
2025-12-21 21:13:22 -06:00
Cameron Gutman 7f54662160 Autoselect AV1 over H.264 on RK3588 2025-12-21 14:59:08 -06:00
Cameron Gutman f66285ddba Fix spurious HEVC software decode warning if AV1 is forced without HEVC hardware decoding 2025-12-21 14:36:22 -06:00
detiam bf250a4edb Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/zh_Hans/
2025-12-21 19:00:22 +00:00
Cameron Gutman bdfadb1cdc Let the streaming session handle exiting on SIGTERM 2025-12-14 19:11:13 -06:00
Cameron Gutman 63a381a882 Fix macOS build 2025-12-14 19:07:50 -06:00
Cameron Gutman 4a591069ac Add custom signal handlers to arbitrate between Qt and SDL
Fixes #1496
2025-12-14 18:57:26 -06:00
Cameron Gutman c71b513bc4 Pump the Qt event loop before creating the SDL window 2025-12-14 18:09:20 -06:00
Cameron Gutman 700655c051 Remove the fixed delay for starting the connection
The StreamSegue already handles delaying to allow the warnings to be visible.
2025-12-14 17:57:20 -06:00
Cameron Gutman 3425fec33d Use EGL+GLES workaround for Nvidia X11
We can avoid disabling EGL entirely by forcing Qt to use GLES,
which is not impacted by the black window issue. This lets us
simplify back to EGL everywhere.
2025-12-14 16:21:32 -06:00
Cameron Gutman de844f2a0c Deprioritize the Nvidia VAAPI driver if Vulkan or CUDA are available 2025-12-11 20:13:14 -06:00
Cameron Gutman 54163e30d0 Disable EGL on Nvidia XWayland environments too
It renders a black window, just like native X11.
2025-12-11 20:13:14 -06:00
Cameron Gutman bd6a1d9a9b Replace NVDEC with Vulkan Video in Flatpak metadata
NVDEC has been disabled by default since e6e91ca8
2025-12-10 21:54:07 -06:00
Cameron Gutman b25801ff7d Update VCRedist 2025-12-10 21:47:31 -06:00
Cameron Gutman bc5e9917cd Fix PS script for compatibility with KB5074596 2025-12-10 21:46:44 -06:00
Cameron Gutman d8eb817ed9 Rerun lupdate and lrelease 2025-12-09 00:47:21 -06:00
Cameron Gutman c1e5b0bf66 Merge remote-tracking branch 'origin/weblate' 2025-12-09 00:45:35 -06:00
Cameron Gutman 26f96a20a9 Fix implicit fall-through warnings 2025-12-07 18:58:25 -06:00
Cameron Gutman dbcc6a9089 Improve initialization performance when using Vulkan Video decoding 2025-12-07 17:57:22 -06:00
Cameron Gutman 9c6d2bab19 Use EGL_VENDOR instead of NV-CONTROL for Nvidia detection
The latter will still match on a hybrid system when the iGPU's EGL
implementation is in use. This scenario works properly with EGL
rendering in Qt and SDL, so we want to allow that.
2025-12-06 11:20:03 -06:00
Cameron Gutman c92dc2495e Don't use vaPutSurface() if there are no valid subpicture formats 2025-12-05 23:52:41 -06:00
Cameron Gutman 1c24aada0a Never use X11 EGL on Nvidia proprietary drivers
Fixes #1751
2025-12-05 23:10:31 -06:00
Cameron Gutman 58f9b2a83b Use opaque black in ClearRenderTargetView()
Intel's old Gen9 performance guide says it's a little faster.
2025-12-01 22:39:28 -06:00
Cameron Gutman 5feb331c46 Improve QT_QPA_EGLFS_KMS_CONFIG temporary file handling
- Close it before handing it to the QPA plugin to read
- Put the temporary file in TMPDIR instead of the current directory
2025-12-01 00:36:59 -06:00
Cameron Gutman 9d5f25f828 Don't use separate threads for querying SDL video info
This is no longer necessary now that we force Qt and SDL to use EGL.
2025-11-30 23:18:38 -06:00
Cameron Gutman d3c23b55dc Disable the VAAPI RFI latency workaround by default
I can no longer reproduce this issue on the same system running
Ubuntu 24.04 with the core22-based edge channel snap anymore.
2025-11-30 22:23:09 -06:00
Cameron Gutman 80b7a69cd2 Revert "Use the default Qt render loop"
This seems to cause 10+ second hangs at the StreamSegue spinner
when using the Qt5-based Snap on Ubuntu 24.04's Wayland session.

It's unclear if this is still an issue on Qt 6, but let's be
conservative and just revert it for now.

This reverts commit f57257cbfd.
2025-11-30 22:00:33 -06:00
dependabot[bot] 296387345d Bump moonlight-common-c/moonlight-common-c from 2d984f4 to b126e48
Bumps [moonlight-common-c/moonlight-common-c](https://github.com/moonlight-stream/moonlight-common-c) from `2d984f4` to `b126e48`.
- [Commits](https://github.com/moonlight-stream/moonlight-common-c/compare/2d984f4b0dfab5ea2cff0f262abe1a056946a7c1...b126e481a195fdc7152d211def17190e3434bcce)

---
updated-dependencies:
- dependency-name: moonlight-common-c/moonlight-common-c
  dependency-version: b126e481a195fdc7152d211def17190e3434bcce
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-26 21:06:38 -06:00
Cameron Gutman 42bf87753f Remove the installer check for MpsSvc
The firewall custom action has ignored failures since a6e549471c, so this pre-check is no longer necessary.

Fixes #1736
2025-11-26 21:06:06 -06:00
Cameron Gutman d262e5d1f6 Recompile D3D11 shaders for Shader Model 5.0
We already require FL 11.0+ GPUs anyway, so compiling them for an older shader model didn't provide any benefit.
2025-11-24 19:02:20 -06:00
Cameron Gutman f0821d9543 Use D3D11_COPY_DISCARD when updating our video texture
This ensures the driver knows it doesn't have to synchronize with the previous texture data.
2025-11-24 18:49:19 -06:00
Cameron Gutman 4164a222ae Consolidate D3D11 constant buffers now that all shaders need a CSC constant buffer 2025-11-24 18:47:14 -06:00
Cameron Gutman 245cd7f1a8 Don't trim the alignment padding with CopySubresourceRegion()
The shader already handles trimming for the bound output texture case.
2025-11-24 01:44:51 -06:00
Cameron Gutman 62816a6b2a Prioritize AV1 over H.264 if HEVC is unavailable on Windows
Some Windows PCs are shipping with HEVC disabled in firmware, even though they support AV1.
2025-11-24 00:06:40 -06:00
Cameron Gutman f5ef201905 Create a separate X11 Display object for libva
Sharing these directly is fraught with concurrency issues that
require extreme care on both sides to avoid spurious X11 errors,
hangs, and other nasty stuff. We can't necessarily depend on SDL,
libva, or the underlying VA drivers to do the right thing here.

Using a new Display (as FFmpeg does for VAAPI and VDPAU) avoids
all these problems.
2025-11-23 13:26:46 -06:00
Cameron Gutman 01288be937 Use the same X display name for VDPAU that SDL is using 2025-11-23 13:20:36 -06:00
Cameron Gutman f57257cbfd Use the default Qt render loop
Since we stopped pumping the event loop manually and switched to EGL
on X11, the default threaded render loop seems to work fine now.
2025-11-22 20:12:46 -06:00
Cameron Gutman d40999ce06 Don't reset Qt's OpenGL state
We're using a different EGL context for SDL, so it's unnecessary.
2025-11-22 19:47:52 -06:00
Cameron Gutman cb6d770b92 Restore the tooltip timeout-based hiding
The fade-out animation doesn't run on Linux when the window is
hidden, so the tooltips will reappear and fade on the app grid
which is ugly.
2025-11-22 19:35:23 -06:00
Cameron Gutman 4d6196c3d3 Use EGL for all X11 GL context creation in Qt and SDL
Using a mix of GLX and EGL can cause interoperability issues when
our EGLRenderer tries to bind an EGL context while Qt already has
a GLX context bound on the same thread. This was the source of a
number of confusing EGLRenderer failures over the years.
2025-11-22 18:51:32 -06:00
Cameron Gutman 54283ce0a1 Rework session initialization to return to the Qt event loop while connecting
We also display multiple launch warnings at the same time
2025-11-22 17:09:16 -06:00
Cameron Gutman 6313129603 Temporarily revert Windows ARM64 to Qt 6.10.0
aqtinstall needs a fix to handle Qt 6.10.1's new host/target qmake split.
2025-11-20 00:55:24 -06:00
Cameron Gutman 84d7a22638 Update CI builds to Qt 6.10.1 2025-11-20 00:22:22 -06:00
Cameron Gutman f0aff0b0fb Update VCRedist for VS 2026 2025-11-20 00:02:05 -06:00
Cameron Gutman be358e9503 Update common-c with rewritten gamepad batching logic 2025-11-15 13:35:23 -06:00
Cameron Gutman 379d5ca376 Fix some compiler warnings 2025-11-15 13:34:11 -06:00
Cameron Gutman 8ed7144751 Disable bitrate reporting until FEC accuracy issues are resolved 2025-11-15 12:22:51 -06:00
Andy Grundman 66b96e75af Convert all time-based stats to be microsecond-based, improving accuracy of very fast events. Add bitrate average/peak. 2025-11-15 12:17:59 -06:00
Cameron Gutman 1160f40655 Recombine the YUV420 shader source
We don't build shaders with hardcoded CSC constants anymore.
2025-11-08 11:40:06 -06:00
dependabot[bot] d5abf568c6 Bump moonlight-common-c/moonlight-common-c from e95feaf to 5f22801
Bumps [moonlight-common-c/moonlight-common-c](https://github.com/moonlight-stream/moonlight-common-c) from `e95feaf` to `5f22801`.
- [Commits](https://github.com/moonlight-stream/moonlight-common-c/compare/e95feaf4951b8dc774671a5d6a1c31d76d78e3ac...5f2280183cb62cba1052894d76e64e5f4153377d)

---
updated-dependencies:
- dependency-name: moonlight-common-c/moonlight-common-c
  dependency-version: 5f2280183cb62cba1052894d76e64e5f4153377d
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-06 20:53:50 -06:00
Cameron Gutman 8324f61db0 Reduce per-frame GL calls in EGLRenderer
Uniforms are attached to the program object, so they don't need to
be set each time we swap between the YUV shader and the overlay
shader.

Since 0 overlays is by far the most common case and > 1 is highly
unlikely, move the glViewport() call into renderOverlay() to let
us skip it in the common case (and be no worse than today in the
2nd most common case of 1 overlay).
2025-11-06 17:52:30 -06:00
Cameron Gutman 9106f2c420 Disable the depth and stencil buffers
We don't have any need for either in our renderers.
2025-11-06 17:44:01 -06:00
Cameron Gutman a2670dd568 Use hasFrameFormatChanged() in DRMRenderer 2025-11-06 00:04:08 -06:00
Cameron Gutman c54e6e4459 Use hasFrameFormatChanged() in VDPAU 2025-11-05 23:58:51 -06:00
Cameron Gutman dd6f1c5873 Use hasFrameFormatChanged() in SDLRenderer 2025-11-05 23:51:51 -06:00
Cameron Gutman 7fab5007a8 Switch Metal to the shared functions for CSC matrix generation and chroma co-siting 2025-11-05 23:22:15 -06:00
Cameron Gutman 7f7cc89e61 Switch EGLRenderer to the shared functions for CSC matrix generation and chroma co-siting 2025-11-05 22:27:31 -06:00
Cameron Gutman 7116efd8de Switch D3D11VA to the shared functions for CSC matrix generation and chroma co-siting 2025-11-05 22:26:27 -06:00
Cameron Gutman 229f5e4cea Add functions for color matrix generation and chroma co-siting in the renderer interface 2025-11-05 21:59:13 -06:00
ns6089 af37002a60 Select correct color matrix for 10-bit SDR 2025-11-05 00:13:25 -06:00
Cameron Gutman 181dba5864 Use correct chroma co-siting offsets in Metal 2025-11-04 23:51:39 -06:00
ns6089 fd314db27e Use correct chroma co-siting offsets in D3D11
Introduced in f67272b153
2025-11-04 23:50:27 -06:00
Cameron Gutman f67272b153 Handle chroma co-siting in the D3D11 shaders 2025-11-01 22:42:51 -05:00
Cameron Gutman 9b3050514b Handle chroma co-siting in the Metal shaders 2025-11-01 21:57:13 -05:00
Cameron Gutman 2c12ad297f Fix accuracy issues in YUV to RGB conversion of 10-bit content in Metal
See #1667 for details.
2025-11-01 19:19:19 -05:00
Cameron Gutman 50223dbdb8 Fix accuracy issues in YUV to RGB conversion of 10-bit content in D3D11VA
See #1667 for details.
2025-11-01 18:45:02 -05:00
dependabot[bot] beadf7819b Bump app/SDL_GameControllerDB from 38fc811 to e40b891
Bumps [app/SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) from `38fc811` to `e40b891`.
- [Commits](https://github.com/gabomdq/SDL_GameControllerDB/compare/38fc811c715365e963a6942092cae147eddddc90...e40b8910f859cd988124def50dcdb63b2f2ff48b)

---
updated-dependencies:
- dependency-name: app/SDL_GameControllerDB
  dependency-version: e40b8910f859cd988124def50dcdb63b2f2ff48b
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-27 22:11:10 -05:00
ReenigneArcher 7d829ac0c4 ci: refactor workflows to use reusable workflow calls
Updated build workflows to use workflow_call triggers and accept ci_version as input, removing inline CI version generation. Upgraded all actions to v5 and added a new build.yml workflow to orchestrate builds for AppImage, Steam Link, and Windows/macOS using reusable workflows. This improves maintainability and consistency across CI jobs.
2025-10-27 21:54:59 -05:00
arrhteeime 2f6e7608f8 Translated using Weblate (Russian)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ru/
2025-10-27 17:02:42 +00:00
Cameron Gutman 5244313b30 Improve archiving of Windows CI builds 2025-10-26 22:17:21 -05:00
Cameron Gutman c13e6b08c1 Remove unused AppVeyor CI files 2025-10-26 21:55:58 -05:00
Cameron Gutman 151f5dd678 Switch to GitHub Actions for AppImage builds 2025-10-26 21:15:41 -05:00
Cameron Gutman a34d40e3ee Switch to GitHub Actions for Steam Link builds 2025-10-26 16:06:09 -05:00
Cameron Gutman 68aa04926e Switch to GitHub Actions for Windows and macOS builds 2025-10-26 15:09:57 -05:00
Cameron Gutman 7d544c1ce4 Move audio capabilities out of the renderer classes
Since the removal of libsoundio, all renderers support arbitrary audio duration, so we can avoid having to start an audio session just to query capabilities.
2025-10-25 19:17:38 -05:00
Cameron Gutman ac7696ea8f Rebuild FFmpeg for macOS and OpenSSL for Windows
- Fixes unexpected Homebrew library dependency in macOS FFmpeg build
- Adds CFG and EHCont mitigations in Windows OpenSSL build
- Remove unused Windows avformat binaries

https://github.com/cgutman/moonlight-deps/commit/d3a3222573f1deefa175ade600702f17f56192fa
2025-10-25 18:13:13 -05:00
Daniel Nylander e79bf664dd Translated using Weblate (Swedish)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/sv/
2025-10-25 17:02:42 +02:00
Cameron Gutman 4d303cebee Consolidate all writes to the log stream in LoggerTask
This avoids some thread-safety issues when switching log modes or reaching the log size limit.
2025-10-25 00:33:02 -05:00
Cameron Gutman bd6235efba Use async logging while streaming only
The benefits of reliable output outweigh performance concerns during non-streaming activities.
2025-10-25 00:18:34 -05:00
Cameron Gutman b1232e0ed4 Fix memory corruption due to concurrent QString operations 2025-10-24 23:38:07 -05:00
Cameron Gutman c35f7086a0 Block the Bandicam Vulkan layer from loading into Moonlight
It installs a buggy vkDestroySwapchainKHR() hook that causes Moonlight to crash deterministically on startup.

Fixes #1425
2025-10-24 23:17:03 -05:00
Cameron Gutman c7bc76325f Revert macOS audio buffer size workaround
This causes excessive glitching and needs to be fixed by Apple (if it hasn't already in the 2 years since the report).
2025-10-23 21:42:44 -05:00
Cameron Gutman ccaca68570 Don't use CAMetalDisplayLink on Intel Macs
When in Direct mode, skipping a frame will cause the display to flash black on Tahoe.
2025-10-23 21:16:53 -05:00
Cameron Gutman 57db20016a Rewrite frame pacing mechanism for VTMetalRenderer
This should hopefully improve performance and avoid performance issues on Tahoe.
2025-10-23 19:43:10 -05:00
Cameron Gutman bdb6d02dac Add (currently harmless) missing break 2025-10-22 23:21:07 -05:00
Cameron Gutman 9bcc6291be Auto-lock the cursor in single display borderless windowed scenarios 2025-10-22 23:13:03 -05:00
Brad Smith 4ec549650d Add fast AES detection for FreeBSD/OpenBSD on ARM/AArch64 using elf_aux_info() 2025-10-22 18:40:20 -05:00
Cameron Gutman 14027f3c74 Limit the IME workaround to Windows only 2025-10-20 23:37:31 -05:00
Qian23333 fb9a164111 feat: disable text input when window gains focus 2025-10-20 23:33:10 -05:00
Cameron Gutman 200cab9d17 Attach EDR metadata to Metal layer
This improves the accuracy of HDR streaming and enables HDR->SDR tonemapping.
2025-10-20 22:28:27 -05:00
Brad Smith c52a57f0ec build: Fix building on *BSD/riscv64 2025-10-20 21:21:00 -05:00
Cameron Gutman b4dc7ca7cb Build AppImage with Qt 6 2025-10-20 20:51:51 -05:00
Cameron Gutman 00c1dd0d0d Fix missing svg module in AppImage 2025-10-20 01:01:25 -05:00
therealmate ecfc24c5d4 Translated using Weblate (Hungarian)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/hu/
2025-10-20 06:50:44 +02:00
Cameron Gutman e6e91ca88b Disable CUDA by default in favor of Vulkan and VDPAU
All of our official releases (Flatpak and AppImage) already do this, so this just makes it official.

This can be overridden by running qmake with CONFIG+=enable-cuda.
2025-10-19 21:24:29 -05:00
Cameron Gutman 260a0e0ae2 Use Ubuntu Jammy base OS for AppImage 2025-10-19 21:11:34 -05:00
Cameron Gutman 3f8f4744c5 Reduce CPU usage from background PC polling 2025-10-19 20:50:29 -05:00
Cameron Gutman 4bbd02fb2d Reduce the priority of background polling threads 2025-10-19 17:31:33 -05:00
Cameron Gutman c5ca672865 Don't set pix_fmt for hwaccel decoders
This works around a bug in the AV1 Vulkan decoding code in FFmpeg
that causes it to incorrectly skip hwaccel init.

Fixes #1511
2025-10-19 16:16:06 -05:00
Cameron Gutman 4688f3650c Handle IPv6 literals without URL escaping too
Fixes #1547
2025-10-19 13:31:27 -05:00
celeresxandCameron Gutman 2550f416f4 Clarify Steam Link hardware limitations in README (fixes #1558) (#1612)
Co-authored-by: Cameron Gutman <aicommander@gmail.com>
2025-10-19 12:58:16 -05:00
Cameron Gutman 579ad25a01 Add CONFIG+=disable-masterhooks QMake option
This allows disabling the DRM master hooks for environments where
getting DRM master is impossible (such as sandboxes like Flatpak),
but leave the DRM renderer itself enabled for usecases like V4L2
which require the DRM renderer to export DMA-BUFs to EGL.
2025-10-12 23:03:53 -05:00
Cameron Gutman 1144dbccb3 Don't call dlsym() in our DRM master hooks
Not only is it faster to cache the function pointers, calling
dlsym() inside open()/close() can lead to deadlocks when using
Vulkan Video decoding on top of the Nvidia driver.
2025-10-12 22:49:29 -05:00
Cameron Gutman ff81f74391 Enable D3D12VA hwaccels in FFmpeg 2025-10-12 15:56:10 -05:00
Cameron Gutman c0d38ee78f Switch the decoder lock to a mutex
It can be held for non-trivial amounts of time.
2025-10-12 15:47:09 -05:00
Cameron Gutman c9cb64f90b Fix StreamSegue BusyIndicator running after streaming
See #1695
2025-10-11 15:50:45 -05:00
Eval EXEC 93e597a93f Stop hidden BusyIndicators from burning CPU 2025-10-11 15:34:55 -05:00
Cameron Gutman 82b33c033a Update and rebuild all prebuilt libraries 2025-10-11 14:41:03 -05:00
Cameron Gutman be266d3349 Disable toolbar icon scaling
Closes #1192
2025-10-11 12:55:54 -05:00
Cameron Gutman c618a0b5df Use native QML icon support 2025-10-11 12:52:37 -05:00
Cameron Gutman a20d429bc1 Remove usage of deprecated Metal API 2025-10-11 11:41:28 -05:00
Cameron Gutman 2b3e0803de Increase Qt requirement to 5.12 and remove pre-5.12 workarounds 2025-10-11 11:03:33 -05:00
Cameron Gutman 4189903233 Remove libsoundio audio backend
SDL has been the default audio backend for years now, and libsoundio has
not been well-maintained upstream.
2025-10-11 10:35:31 -05:00
Любомир Василев 1a0dd56bb9 Translated using Weblate (Bulgarian)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2025-10-11 16:07:31 +02:00
Philip Goto 3aa3bfa403 Translated using Weblate (Dutch)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nl/
2025-10-11 16:07:30 +02:00
sanhoe aa9a716bd5 Translated using Weblate (Korean)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ko/
2025-10-11 16:07:28 +02:00
Jorys Paulin 6fd2b73e6b Translated using Weblate (French)
Currently translated at 100.0% (251 of 251 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/fr/
2025-10-11 16:07:25 +02:00
Cameron Gutman 06b5c4631f Fix warning for unnecessary .desktop suffix passed to setDesktopFileName() 2025-10-11 00:36:54 -05:00
Cameron Gutman 997c4aa0ae Fix unchecked return value warnings using QIODevice::Open() 2025-10-11 00:24:02 -05:00
dependabot[bot] f4343c5f29 Bump app/SDL_GameControllerDB from 7979e7b to 38fc811
Bumps [app/SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) from `7979e7b` to `38fc811`.
- [Commits](https://github.com/gabomdq/SDL_GameControllerDB/compare/7979e7b29261c11ebce2deabc41ed081b6691398...38fc811c715365e963a6942092cae147eddddc90)

---
updated-dependencies:
- dependency-name: app/SDL_GameControllerDB
  dependency-version: 38fc811c715365e963a6942092cae147eddddc90
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-11 00:13:38 -05:00
Cameron Gutman 3cdea6b039 Update VC redistributable in installer bundle 2025-10-11 00:12:19 -05:00
Cameron Gutman ac2e10c712 Update to WiX v6.0.2 2025-10-11 00:11:09 -05:00
Simon Pawlowski 61fa45ad21 Fixed translation (#1669)
MBps is used for megabytes, even in German. Mbps is the correct translation.
2025-10-10 00:49:25 -05:00
Cameron Gutman f362e76127 Sync AppImage dependency versions with moonlight-deps 2025-10-10 00:45:58 -05:00
Cameron Gutman 749c69fc76 Build Windows against Qt 6.9 in CI 2025-10-10 00:41:48 -05:00
Cameron Gutman 5dca30def1 Rerun lupdate and lrelease 2025-10-10 00:35:37 -05:00
Cameron Gutman 502783a86b Merge remote-tracking branch 'origin/weblate' 2025-10-10 00:33:55 -05:00
Cameron Gutman 45989fdd6e Fix incorrect toolbar color on Qt 6.9+
Fixes #1685
2025-10-09 20:47:58 -05:00
Cameron Gutman 490aa5082f Don't use SDL locking functions in our open()/close() hooks
Other shared library constructors can invoke open()/close() before
SDL2-compat's constructor runs to load SDL3 and populate the SDL3
function table. This causes SDL_AtomicLock()/SDL_AtomicUnlock()
to jump to 0.

See #1707
2025-10-09 20:03:19 -05:00
Taylor Lineman ae1c65805c Enable Game Mode on Apple Platforms (#1709) 2025-10-09 18:10:44 -05:00
Cameron Gutman 9cb4105aec Fix incorrect getToggleOptionValue behavior 2025-08-31 15:15:24 -05:00
armin-25689 1fd545ae1f build: fix no <linux/dma-buf.h> for BSDs 2025-08-31 15:05:03 -05:00
Daniel Nylander 3194cb09d8 Translated using Weblate (Swedish)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/sv/
2025-08-31 08:05:47 +02:00
Cameron Gutman f9bb45579b Enable CFG, EHCont, and CET for Windows builds 2025-08-24 20:42:37 -05:00
grgergo f7b2edc8e3 Translated using Weblate (Hungarian)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/hu/
2025-08-13 20:02:11 +02:00
veldenb c9a3946d80 Translated using Weblate (Dutch)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nl/
2025-07-29 01:43:50 +02:00
Laszlo Racz 0c8354336b Fix: Improve stream window resizing logic 2025-07-27 14:23:12 -05:00
Cameron Gutman 1bf86f52d3 Deregister logging callbacks before destroying the logger 2025-07-04 15:56:11 -05:00
dependabot[bot] 504d42865d Bump app/SDL_GameControllerDB from e5a5fa2 to 7979e7b
Bumps [app/SDL_GameControllerDB](https://github.com/gabomdq/SDL_GameControllerDB) from `e5a5fa2` to `7979e7b`.
- [Commits](https://github.com/gabomdq/SDL_GameControllerDB/compare/e5a5fa2ac6e645d72c619ea99520a3a4586ee005...7979e7b29261c11ebce2deabc41ed081b6691398)

---
updated-dependencies:
- dependency-name: app/SDL_GameControllerDB
  dependency-version: 7979e7b29261c11ebce2deabc41ed081b6691398
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-07-04 15:05:05 -05:00
Odizinne 65c04fd560 Added option to disable pre launch warning and delay 2025-07-04 15:04:10 -05:00
Cameron Gutman 11dc244857 Create dependabot.yml for submodule updates 2025-07-04 14:46:44 -05:00
FrogTheFrog b9cab4cac5 fix outdated app list printing via cli 2025-07-04 14:32:47 -05:00
6690 65647a32f4 Translated using Weblate (Chinese (Traditional Han script))
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/zh_Hant/
2025-06-26 22:59:02 +02:00
therealmate 777502b495 Translated using Weblate (Hungarian)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/hu/
2025-06-24 07:01:47 +00:00
தமிழ்நேரம் ce4309694f Translated using Weblate (Tamil)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ta/
2025-06-23 05:16:19 +02:00
therealmate ccc64a5629 Translated using Weblate (Hungarian)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/hu/
2025-06-23 05:16:19 +02:00
Batıkan Ökten 25f6c020b6 Translated using Weblate (Turkish)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/tr/
2025-06-03 01:23:26 +02:00
caviaz 6a95742a92 Translated using Weblate (Dutch)
Currently translated at 84.4% (211 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nl/
2025-05-27 09:01:44 +02:00
FrogTheFrog 1dbdcb5279 Prevent double printing app list via cli 2025-05-07 18:27:00 -05:00
GOGOsu 9ce0537587 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/zh_Hans/
2025-05-07 11:01:44 +02:00
arrhteeime 76d03f015d Translated using Weblate (Russian)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ru/
2025-05-02 15:02:58 +02:00
aga_90 edbc24fa3e Translated using Weblate (Hungarian)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/hu/
2025-05-01 01:09:49 +02:00
Nicolas Xavier Herrera Medina d4fd50b973 Translated using Weblate (Spanish)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/es/
2025-04-25 10:12:30 +02:00
sanhoe d5ab795b36 Translated using Weblate (Korean)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ko/
2025-04-20 10:06:37 +02:00
Jorys Paulin c5fc5220f3 Translated using Weblate (French)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/fr/
2025-04-18 13:00:11 +02:00
Alex 28dea31533 Translated using Weblate (German)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/de/
2025-04-16 02:21:21 +02:00
Любомир Василев 8ce6a9585f Translated using Weblate (Bulgarian)
Currently translated at 100.0% (250 of 250 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2025-04-08 05:36:27 +02:00
Cameron Gutman 47452371db Rerun lupdate and lrelease 2025-04-05 20:29:24 -05:00
Cameron Gutman 4001b05fca Add new languages 2025-04-05 20:29:09 -05:00
Cameron Gutman 75e917622e Merge remote-tracking branch 'origin/weblate' 2025-04-05 20:15:30 -05:00
Cameron Gutman 75359bb1c4 Fix tooltip layout with Qt 6.9 2025-04-05 00:27:50 -05:00
Cameron Gutman c93f7e7385 Output CLI error/info messages to the console on Windows
Fixes #1554
2025-04-04 22:23:17 -05:00
Cameron Gutman 48bcd725c9 Use static QRegularExpressions as recommended by Clazy 2025-04-04 22:13:45 -05:00
MoreOrLessSoftware e807a52cfa Add bitrate auto-adjustment toggle and reset button
This change adds a 'Use Default' button next to the bitrate slider that resets the bitrate to the default value for the current resolution/FPS. It also implements an autoAdjustBitrate setting that controls whether the bitrate is automatically updated when resolution/FPS/YUV444 settings change.

- When the user manually adjusts the bitrate slider, autoAdjustBitrate is set to false
- When the user clicks the 'Use Default' button, autoAdjustBitrate is set to true
- Bitrate is only updated automatically when settings change if autoAdjustBitrate is true
2025-04-02 22:02:09 -05:00
James Poje 9c9bfd8428 Add quit-app-and-exit shortcut Ctrl+Alt+Shift+E
Add a shortcut to quit the current app and exit Moonlight entirely.
2025-04-02 21:55:38 -05:00
Jorys Paulin 29b1304337 feat: hide hw acceleration warning when using forced software decoding 2025-04-02 21:46:11 -05:00
Jorys Paulin cc0b574bb1 feat: add message when host doesn't show any apps 2025-04-02 21:45:23 -05:00
Cameron Gutman 7a769172a1 Fix null window on Qt 6.9 2025-04-02 21:14:22 -05:00
ABeltramo d9c7a245ef DualSense adaptive trigger support (#1561) 2025-04-01 21:45:25 -05:00
Serdar Sağlam 469a5c78f1 Translated using Weblate (Turkish)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/tr/
2025-03-27 04:15:37 +01:00
rinsuki fabb4fdadc Fix INTERNATIONAL keys wouldn't work properly
since those keys aren't exist in US keyboard, we shouldn't treat (and convert) as a US keyboard keycodes (on Sunshine).
2025-02-19 22:18:34 -06:00
rinsuki 9491884cb4 Add some key definitions to support Japanese Keyboard Layout
Tested environment:

Moonlight on macOS 15.3 w/ MacBook Pro Internal Keyboard
Sunshine 2025.122.141614 w/ Windows 11 24H2
2025-02-19 22:18:34 -06:00
Cameron Gutman bf51577787 Fix macOS build 2025-02-18 19:52:33 -06:00
Cameron Gutman 4c5bcee8dc Give up immediately if the backend fails to initialize 2025-02-18 19:46:29 -06:00
Cameron Gutman fd70865026 Avoid retrying renderer init if we know the error was not transient 2025-02-18 19:02:12 -06:00
Cameron Gutman 351aaa6759 Add an enum type for each renderer 2025-02-18 18:58:04 -06:00
Philip Goto 59bc625cc7 Translated using Weblate (Dutch)
Currently translated at 84.6% (210 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nl/
2025-02-15 23:14:56 +01:00
GOGOsu b2f765e8ef Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/zh_Hans/
2025-02-11 07:01:57 +01:00
Kolja bdd9a3a994 Add Network and RemoteAccess categories 2025-02-07 20:21:56 -06:00
Philip Goto 2ecafabcab Translated using Weblate (Dutch)
Currently translated at 83.4% (207 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nl/
2025-02-05 14:01:58 +00:00
Cameron Gutman dd2a99a96b Prepare for SDL3 support 2025-01-25 16:20:20 -06:00
தமிழ்நேரம் 9ff2ac0974 Translated using Weblate (Tamil)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ta/
2025-01-19 10:34:48 +01:00
தமிழ்நேரம் 5760d08c33 Added translation using Weblate (Tamil) 2025-01-18 14:02:22 +01:00
Cameron Gutman edd7a134d8 Fix MSVC binary path in CI for Qt 6.8 2025-01-13 20:11:06 -06:00
Cameron Gutman ffa87c5f01 Update Windows AppVeyor builds to Qt 6.8 2025-01-13 19:48:47 -06:00
ZerOriSama ff7e61c6d9 Translated using Weblate (Chinese (Simplified Han script))
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/zh_Hans/
2025-01-06 00:01:23 +00:00
Любомир Василев 6ad96fba42 Translated using Weblate (Bulgarian)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2024-12-30 13:18:25 +01:00
Любомир Василев 85856114b2 Translated using Weblate (Bulgarian)
Currently translated at 97.9% (243 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2024-12-23 10:43:01 +01:00
Любомир Василев 7decfae792 Translated using Weblate (Bulgarian)
Currently translated at 87.5% (217 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2024-12-22 09:00:43 +00:00
Любомир Василев b6008b15dc Translated using Weblate (Bulgarian)
Currently translated at 53.6% (133 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2024-12-21 09:00:36 +01:00
Любомир Василев 260ec3d80d Translated using Weblate (Bulgarian)
Currently translated at 38.7% (96 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2024-12-20 08:25:55 +01:00
Любомир Василев 7ec2e50334 Translated using Weblate (Bulgarian)
Currently translated at 13.7% (34 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/bg/
2024-12-15 14:06:34 +01:00
Любомир Василев e532b9167a Added translation using Weblate (Bulgarian) 2024-12-14 13:07:53 +01:00
Moritz Schirmer 52d5890372 Translated using Weblate (German)
Currently translated at 97.1% (241 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/de/
2024-12-06 06:59:09 +01:00
Dark Space f34d11994f Translated using Weblate (Italian)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/it/
2024-11-23 13:00:19 +01:00
Rouvr 359c92340d Translated using Weblate (Czech)
Currently translated at 86.6% (215 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/cs/
2024-11-13 20:00:25 +01:00
Cameron Gutman 15e337fff8 Only call SDL_NumJoysticks() once per loop
It does non-trivial work when using sdl2-compat.
2024-11-12 23:52:31 -06:00
Cameron Gutman 707dd3cb83 Checkout libs submodule for Steam Link too 2024-11-08 21:32:32 -06:00
Cameron Gutman 98f6a09991 Use a Ne10-optimized libopus build for Steam Link
Steam Link is an incredibly CPU-constrained platform, so it needs
all the help it can get to avoid audio underruns.
2024-11-08 21:26:45 -06:00
Jorys Paulin f1d0e97681 Translated using Weblate (French)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/fr/
2024-11-03 12:00:23 +01:00
Cameron Gutman 103f988dbf Move logging into a separate thread 2024-10-20 21:52:15 -05:00
Cameron Gutman 2257cb0cef Update Windows, macOS, and AppImage libraries
SDL -> 86fd4ed
FFmpeg -> 7.1 (87ccf995c)
dav1d -> 1.5.0
2024-10-20 13:46:05 -05:00
Cameron Gutman b6a3369243 Rework window focus tracking for gamepad navigation 2024-10-18 21:20:56 -05:00
Cameron Gutman 4af9623727 Replace C++ VLAs with std::vector 2024-10-15 22:41:21 -05:00
Cameron Gutman 515db03fe5 Add missing stdbool.h include 2024-10-15 22:38:06 -05:00
Matthias Küch e44d097683 Add stderr log for Steam Link 2024-10-12 00:14:51 -05:00
Jorys Paulin 208d048358 Translated using Weblate (French)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/fr/
2024-10-08 14:15:38 +02:00
Cameron Gutman 9936085aee Fix incorrect selection if pix_fmt is overridden before ffGetFormat()
The DRM renderer does this for the out-of-tree v4l2m2m patches to ensure
we get NV12 buffers, but it ends up clobbering our own preference for
DRM_PRIME frames in the process.
2024-10-03 20:28:51 -05:00
Cameron Gutman 3279d9c3f6 Fix QML component versioning error on Qt 5 2024-10-03 00:15:53 -05:00
phlostically e571d5833c Translated using Weblate (Esperanto)
Currently translated at 9.2% (23 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/eo/
2024-10-02 23:16:22 +02:00
Cameron Gutman 3531fe0a4f Fix typo in version check for new Vulkan queue API 2024-10-02 00:37:22 -05:00
phlostically 286676e5c1 Added translation using Weblate (Esperanto) 2024-10-01 22:36:26 +02:00
Cameron Gutman 6ce02616f0 Use new Vulkan queue API in FFmpeg 7.1 2024-09-29 23:04:23 -05:00
Cameron Gutman 13880353d8 Use new avcodec_get_supported_config() API in FFmpeg 7.1 2024-09-29 22:23:37 -05:00
Cameron Gutman ec69dad8d7 Fix import incorrectly removed by 2a63ad5 2024-09-28 00:09:21 -05:00
Cameron Gutman 72ae324d71 Fix unused parameter warnings 2024-09-28 00:08:35 -05:00
Cameron Gutman 901cbd255c Disable Vulkan debug layers by default
The vast majority of Vulkan code running in Moonlight
is part of FFmpeg or libplacebo, so the debug layers
really just slow things down without finding any bugs
in our code.

Additionally, there are some overzealous checks firing
constantly on libplacebo and FFmpeg with certain Vulkan
drivers that we can't do anything about.
2024-09-28 00:05:17 -05:00
Cameron Gutman 2a63ad53d7 Don't poll gamepad input when the GUI is not focused/visible 2024-09-26 19:24:29 -05:00
Cameron Gutman 9b3d4c1ad7 Free the old CRTC connectors array 2024-09-23 22:25:51 -05:00
Cameron Gutman 054e334066 Allow Qt to borrow DRM master from SDL to update the UI 2024-09-23 22:15:31 -05:00
Cameron Gutman 6d023c2dfa Defer launch warnings until after launch validation
We need to destroy the SDL window before we can be sure that Qt
can draw to the screen if we used KMSDRM.
2024-09-23 21:48:43 -05:00
Cameron Gutman 0e2d5bf441 Fix EGLFS state restoration after Vulkan rendering 2024-09-23 21:32:09 -05:00
Cameron Gutman 023b6b2772 Fix DRM FD leak with Vulkan windows 2024-09-21 21:41:43 -05:00
Cameron Gutman 6f39d120cb Unify handling of DRM devices between DRM and VAAPI
SDL may not be able to give us a DRM FD for Vulkan windows.
2024-09-21 20:46:11 -05:00
Cameron Gutman 9cf305865b Add support for managing multiple SDL DRM FDs
This is required for Vulkan+KMSDRM rendering.
2024-09-21 20:41:43 -05:00
Patrick Sletvold 6d47287b60 Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.1% (246 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nb_NO/
2024-09-21 11:40:45 +00:00
Cameron Gutman 6b11f43302 Don't set the output rect until after modesetting
It's possible that modesetting will also change the resolution
not just the refresh rate. This can happen in cases where the
CRTC is currently set to 4K 30 Hz and we choose 1080p 60 Hz as
a better mode match for displaying a 1080p 60 FPS stream.
2024-09-19 22:43:34 -05:00
Tomonobu Terakubo 60fb6881b2 Translated using Weblate (Japanese)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ja/
2024-09-20 01:40:49 +02:00
Артём Журин b79c116bd9 Translated using Weblate (Russian)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ru/
2024-09-20 01:40:48 +02:00
Patrick Sletvold 895d0a6bf3 Translated using Weblate (Norwegian Bokmål)
Currently translated at 71.3% (177 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/nb_NO/
2024-09-20 01:40:48 +02:00
Cameron Gutman 5a1ef55767 Update README.md
Add note about YUV 4:4:4 and update build requirements
2024-09-18 22:16:33 -05:00
Matt Tannahill 76deafbd7b Fix build for Xcode < 14 2024-09-18 22:12:04 -05:00
Tomonobu Terakubo ae2693a860 Translated using Weblate (Japanese)
Currently translated at 95.9% (238 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ja/
2024-09-18 13:40:50 +00:00
Артём Журин 0783b28ba6 Translated using Weblate (Russian)
Currently translated at 100.0% (248 of 248 strings)

Translation: Moonlight Game Streaming/moonlight-qt
Translate-URL: https://hosted.weblate.org/projects/moonlight/moonlight-qt/ru/
2024-09-18 13:40:50 +00:00
229 changed files with 20883 additions and 12896 deletions
+9
View File
@@ -0,0 +1,9 @@
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "gitsubmodule"
directory: "/"
schedule:
interval: "daily"
+165
View File
@@ -0,0 +1,165 @@
---
name: Build - Linux AppImage
permissions:
contents: read
on:
workflow_call:
inputs:
ci_version:
required: true
type: string
jobs:
build:
env:
CI_VERSION: ${{ inputs.ci_version }}
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v5
with:
submodules: 'recursive'
fetch-depth: 1
- name: Setup environment
run: |
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.4.313-jammy.list https://packages.lunarg.com/vulkan/1.4.313/lunarg-vulkan-1.4.313-jammy.list
sudo apt update
sudo apt install -y qt6-base-dev qt6-declarative-dev libqt6svg6-dev qml6-module-qtquick-controls qml6-module-qtquick-templates qml6-module-qtquick-layouts \
qml6-module-qtqml-workerscript qml6-module-qtquick-window qml6-module-qtquick python3-pip nasm libgbm-dev libdrm-dev libfreetype-dev libasound2-dev \
libdbus-1-dev libegl1-mesa-dev libgl1-mesa-dev libgles2-mesa-dev libglu1-mesa-dev libibus-1.0-dev libpulse-dev libudev-dev libx11-dev libxcursor-dev \
libxext-dev libxi-dev libxinerama-dev libxkbcommon-dev libxrandr-dev libxss-dev libxt-dev libxv-dev libxxf86vm-dev libxcb-dri3-dev libx11-xcb-dev \
libxfixes-dev libxtst-dev wayland-protocols libopus-dev libvdpau-dev libgl-dev libpipewire-0.3-dev liburing-dev vulkan-sdk cmake
sudo pip3 install meson
mkdir -p dep_root/{bin,include,lib}
echo "DEP_ROOT=$PWD/dep_root" >> "${GITHUB_ENV}"
echo "$PWD/dep_root/bin" >> "${GITHUB_PATH}"
- name: Checkout SDL3
uses: actions/checkout@v5
with:
repository: libsdl-org/SDL
ref: release-3.4.12
path: deps/SDL
- name: Build SDL3
working-directory: deps/SDL
run: |
cmake -DSDL_KMSDRM=OFF -DSDL_TEST_LIBRARY=OFF -DSDL_INSTALL_DOCS=OFF -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -S . -B build
cmake --build build -j
sudo cmake --install build
- name: Checkout sdl2-compat
uses: actions/checkout@v5
with:
repository: libsdl-org/sdl2-compat
ref: release-2.32.70
path: deps/sdl2-compat
- name: Build sdl2-compat
working-directory: deps/sdl2-compat
run: |
cmake -DSDL2COMPAT_TESTS=OFF -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -S . -B build
cmake --build build -j
sudo cmake --install build
- name: Checkout SDL_ttf
uses: actions/checkout@v5
with:
repository: libsdl-org/SDL_ttf
ref: a883e490e30fb44a5336ea3dcb990c6982c5216f
path: deps/SDL_ttf
submodules: 'recursive'
- name: Build SDL_ttf
working-directory: deps/SDL_ttf
run: |
./autogen.sh
./configure
make -j$(nproc)
sudo make install
- name: Checkout libva
uses: actions/checkout@v5
with:
repository: intel/libva
ref: 2.24.1
path: deps/libva
- name: Build libva
working-directory: deps/libva
run: |
./autogen.sh
./configure --enable-x11
make -j$(nproc)
sudo make install
- name: Checkout libplacebo
uses: actions/checkout@v5
with:
repository: haasn/libplacebo
ref: 2d0979fb54e025e904c7372666fffbf5dae40f66
path: deps/libplacebo
submodules: 'recursive'
- name: Build libplacebo
working-directory: deps/libplacebo
run: |
meson setup build -Dvulkan=enabled -Dopengl=disabled -Ddemos=false
ninja -C build
sudo ninja install -C build
- name: Build dav1d
working-directory: deps
env:
DAV1D_VER: 1.5.3
run: |
git clone --branch $DAV1D_VER --depth 1 https://code.videolan.org/videolan/dav1d.git
pushd dav1d
meson setup build -Ddefault_library=static -Dbuildtype=release -Denable_tools=false -Denable_tests=false
ninja -C build
sudo ninja install -C build
popd
- name: Checkout FFmpeg
uses: actions/checkout@v5
with:
repository: FFmpeg/FFmpeg
ref: n8.1.1
path: deps/FFmpeg
- name: Build FFmpeg
working-directory: deps/FFmpeg
run: |
./configure --enable-pic --enable-lto --disable-static --enable-shared --disable-all --disable-autodetect \
--enable-avcodec --enable-avformat --enable-swscale \
--enable-decoder=h264 --enable-decoder=hevc --enable-decoder=av1 \
--enable-vaapi --enable-hwaccel=h264_vaapi --enable-hwaccel=hevc_vaapi --enable-hwaccel=av1_vaapi \
--enable-vdpau --enable-hwaccel=h264_vdpau --enable-hwaccel=hevc_vdpau --enable-hwaccel=av1_vdpau \
--enable-libdrm --enable-vulkan --enable-hwaccel=h264_vulkan --enable-hwaccel=hevc_vulkan --enable-hwaccel=av1_vulkan \
--enable-libdav1d --enable-decoder=libdav1d
make -j$(nproc)
sudo make install
- name: Install linuxdeploy
working-directory: dep_root/bin
run: |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
- name: Build Binaries
run: |
sudo ldconfig
scripts/build-appimage.sh
- name: Upload Binaries
uses: actions/upload-artifact@v6
with:
name: Moonlight-LinuxAppImage-${{ env.CI_VERSION }}
path: build/installer-release/Moonlight-${{ env.CI_VERSION }}-x86_64.AppImage
compression-level: 0
if-no-files-found: error
+41
View File
@@ -0,0 +1,41 @@
---
name: Build - Steam Link
permissions:
contents: read
on:
workflow_call:
inputs:
ci_version:
required: true
type: string
jobs:
build:
env:
CI_VERSION: ${{ inputs.ci_version }}
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@v5
with:
submodules: 'recursive'
fetch-depth: 1
- name: Checkout Steam Link SDK
uses: actions/checkout@v5
with:
repository: ValveSoftware/steamlink-sdk
path: steamlink-sdk
fetch-depth: 1
- name: Build binaries
run: STEAMLINK_SDK_PATH=$PWD/steamlink-sdk scripts/build-steamlink-app.sh
- name: Upload Binaries
uses: actions/upload-artifact@v6
with:
name: Moonlight-SteamLink-${{ env.CI_VERSION }}
path: build/deploy-release/*
if-no-files-found: error
+125
View File
@@ -0,0 +1,125 @@
---
name: Build - Windows and macOS
permissions:
contents: read
on:
workflow_call:
inputs:
ci_version:
required: true
type: string
jobs:
build:
env:
CI_VERSION: ${{ inputs.ci_version }}
strategy:
fail-fast: false
matrix:
include:
# Windows
- os: windows-2025
qt_version: 6.11.1
# macOS
- os: macos-26
qt_version: 6.11.1
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5
with:
submodules: 'recursive'
fetch-depth: 1
- name: Download dependencies (Windows)
if: runner.os == 'Windows'
run: powershell ./setup-deps.ps1
- name: Install create-dmg (macOS)
if: runner.os == 'macOS'
run: |
brew install node
npm install --global create-dmg
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
cache: true
set-env: ${{ runner.os != 'Windows' }}
add-tools-to-path: ${{ runner.os != 'Windows' }}
version: ${{ matrix.qt_version }}
aqtsource: 'git+https://github.com/miurahr/aqtinstall.git@073e34d7c2ab4ae6961ed7cca690b3abd5ba5a7e'
- name: Install Qt ARM64 (Windows)
if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v4
with:
cache: true
set-env: false
add-tools-to-path: false
arch: win64_msvc2022_arm64_cross_compiled
version: ${{ matrix.qt_version }}
- name: Build x64 binaries (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
set "PATH=%QT_PATH%;%PATH%"
scripts\build-arch.bat Release x64
env:
QT_PATH: ${{ runner.workspace }}\Qt\${{ matrix.qt_version }}\msvc2022_64\bin
- name: Build ARM64 binaries (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
set "PATH=%QT_PATH%;%PATH%"
scripts\build-arch.bat Release arm64
env:
QT_PATH: ${{ runner.workspace }}\Qt\${{ matrix.qt_version }}\msvc2022_arm64\bin
- name: Build Package
shell: pwsh
run: |
if ($Env:RUNNER_OS -eq "Windows") {
cmd /c scripts\generate-bundle.bat Release
} else {
bash scripts/generate-dmg.sh Release
}
- name: Upload Binaries (Windows x64)
uses: actions/upload-artifact@v6
if: runner.os == 'Windows'
with:
name: Moonlight-${{ runner.os }}-x64-${{ env.CI_VERSION }}
path: build/deploy-x64-release/*
if-no-files-found: error
- name: Upload Binaries (Windows arm64)
uses: actions/upload-artifact@v6
if: runner.os == 'Windows'
with:
name: Moonlight-${{ runner.os }}-arm64-${{ env.CI_VERSION }}
path: build/deploy-arm64-release/*
if-no-files-found: error
- name: Upload Binaries (macOS)
uses: actions/upload-artifact@v6
if: runner.os == 'macOS'
with:
name: Moonlight-${{ runner.os }}-${{ env.CI_VERSION }}
path: build/installer-Release/*.dmg
compression-level: 0
if-no-files-found: error
- name: Upload Symbols
uses: actions/upload-artifact@v6
with:
name: zDevDbgSyms-${{ runner.os }}-${{ env.CI_VERSION }}
path: |
build/installer-*/*.dsym/*
build/symbols-*/*.pdb
if-no-files-found: error
+45
View File
@@ -0,0 +1,45 @@
---
name: Build
permissions:
contents: read
on:
push:
pull_request:
branches:
- master
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
runs-on: ubuntu-latest
outputs:
ci_version: ${{ steps.set-ci-version.outputs.ci_version }}
steps:
- name: Set CI version
id: set-ci-version
shell: bash
run: |
CI_VERSION=`echo ${GITHUB_SHA} | cut -c1-6`
echo "ci_version=${CI_VERSION}" >> "${GITHUB_OUTPUT}"
build-appimage:
needs: setup
uses: ./.github/workflows/build-appimage.yml
with:
ci_version: ${{ needs.setup.outputs.ci_version }}
build-steamlink:
needs: setup
uses: ./.github/workflows/build-steamlink.yml
with:
ci_version: ${{ needs.setup.outputs.ci_version }}
build-windows-macos:
needs: setup
uses: ./.github/workflows/build-win-mac.yml
with:
ci_version: ${{ needs.setup.outputs.ci_version }}
+2
View File
@@ -2,6 +2,8 @@
**/.vs/
.vscode/
build/
libs/
config.tests/*/.qmake.stash
config.tests/*/Makefile
-7
View File
@@ -7,13 +7,6 @@
[submodule "app/SDL_GameControllerDB"]
path = app/SDL_GameControllerDB
url = https://github.com/gabomdq/SDL_GameControllerDB.git
[submodule "soundio/libsoundio"]
path = soundio/libsoundio
url = https://github.com/cgutman/libsoundio.git
[submodule "h264bitstream/h264bitstream"]
path = h264bitstream/h264bitstream
url = https://github.com/aizvorski/h264bitstream.git
[submodule "libs"]
path = libs
url = https://github.com/cgutman/moonlight-qt-prebuilts.git
shallow = true
+22
View File
@@ -207,6 +207,28 @@ private:
// Since the RTSS OSD doesn't even work with DXVA2, we'll just block the hooks entirely.
L"RTSSHooks.dll",
L"RTSSHooks64.dll",
// Bandicam's Vulkan layer DLL crashes during destruction of the Vulkan swapchain
// bdcamvk64+0x10b73:
// 00007ffa`be3b0b73 498b5630 mov rdx,qword ptr [r14+30h] ds:00000000`00000030=????????????????
//
// bdcamvk64+0x10b73
// libplacebo_357!vk_sw_destroy+0x14f [D:\a\moonlight-deps\moonlight-deps\libplacebo\src\vulkan\swapchain.c @ 460]
// libplacebo_357!pl_swapchain_destroy+0x1a [D:\a\moonlight-deps\moonlight-deps\libplacebo\src\swapchain.c @ 30]
// Moonlight!PlVkRenderer::~PlVkRenderer+0x159 [D:\a\moonlight-qt\app\streaming\video\ffmpeg-renderers\plvk.cpp @ 140]
// Moonlight!PlVkRenderer::`scalar deleting destructor'+0x17
// Moonlight!FFmpegVideoDecoder::reset+0x203 [D:\a\moonlight-qt\app\streaming\video\ffmpeg.cpp @ 301]
// Moonlight!FFmpegVideoDecoder::~FFmpegVideoDecoder+0x22 [D:\a\moonlight-qt\app\streaming\video\ffmpeg.cpp @ 257]
// Moonlight!FFmpegVideoDecoder::`scalar deleting destructor'+0x17
// Moonlight!Session::getDecoderInfo+0x19a [D:\a\moonlight-qt\app\streaming\session.cpp @ 415]
// Moonlight!SystemProperties::querySdlVideoInfoInternal+0x134 [D:\a\moonlight-qt\app\backend\systemproperties.cpp @ 161]
// Moonlight!SystemProperties::querySdlVideoInfo+0x97 [D:\a\moonlight-qt\app\backend\systemproperties.cpp @ 123]
// Moonlight!SystemProperties::SystemProperties+0x4bf [D:\a\moonlight-qt\app\backend\systemproperties.cpp @ 75]
//
// https://github.com/moonlight-stream/moonlight-qt/issues/1425
// https://github.com/moonlight-stream/moonlight-qt/issues/1579
L"bdcamvk32.dll",
L"bdcamvk64.dll",
};
};
+28 -9
View File
@@ -6,13 +6,14 @@ Moonlight also has mobile versions for [Android](https://github.com/moonlight-st
You can follow development on our [Discord server](https://moonlight-stream.org/discord) and help translate Moonlight into your language on [Weblate](https://hosted.weblate.org/projects/moonlight/moonlight-qt/).
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/glj5cxqwy2w3bglv/branch/master?svg=true)](https://ci.appveyor.com/project/cgutman/moonlight-qt/branch/master)
[![Build](https://img.shields.io/github/actions/workflow/status/moonlight-stream/moonlight-qt/build.yml?branch=master)](https://github.com/moonlight-stream/moonlight-qt/actions/workflows/build.yml?query=branch%3Amaster)
[![Downloads](https://img.shields.io/github/downloads/moonlight-stream/moonlight-qt/total)](https://github.com/moonlight-stream/moonlight-qt/releases)
[![Translation Status](https://hosted.weblate.org/widgets/moonlight/-/moonlight-qt/svg-badge.svg)](https://hosted.weblate.org/projects/moonlight/moonlight-qt/)
## Features
- Hardware accelerated video decoding on Windows, Mac, and Linux
- H.264, HEVC, and AV1 codec support (AV1 requires Sunshine and a supported host GPU)
- YUV 4:4:4 support (Sunshine only)
- HDR streaming support
- 7.1 surround sound audio support
- 10-point multitouch support (Sunshine only)
@@ -30,6 +31,9 @@ You can follow development on our [Discord server](https://moonlight-stream.org/
- [Experimental RISC-V Debian packages](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-RISC%E2%80%90V-Single-Board-Computers)
- [NVIDIA Jetson and Nintendo Switch (Ubuntu L4T)](https://github.com/moonlight-stream/moonlight-docs/wiki/Installing-Moonlight-Qt-on-Linux4Tegra-(L4T)-Ubuntu)
### Nightly Builds
- [Downloads](https://nightly.link/moonlight-stream/moonlight-qt/workflows/build/master)
#### Special Thanks
[![Hosted By: Cloudsmith](https://img.shields.io/badge/OSS%20hosting%20by-cloudsmith-blue?logo=cloudsmith&style=flat-square)](https://cloudsmith.com)
@@ -39,7 +43,7 @@ Hosting for Moonlight's Debian and L4T package repositories is graciously provid
## Building
### Windows Build Requirements
* Qt 5.15 SDK or later. Qt 6 is also supported for x64 and ARM64 builds.
* Qt 6.7 SDK or later (earlier versions may work but are not officially supported)
* [Visual Studio 2022](https://visualstudio.microsoft.com/downloads/) (Community edition is fine)
* Select **MSVC** option during Qt installation. MinGW is not supported.
* [7-Zip](https://www.7-zip.org/) (only if building installers for non-development PCs)
@@ -48,18 +52,18 @@ Hosting for Moonlight's Debian and L4T package repositories is graciously provid
* Alternatively, run `dism /online /add-capability /capabilityname:Tools.Graphics.DirectX~~~~0.0.1.0` and reboot.
### macOS Build Requirements
* Qt 6.4 SDK or later
* Xcode 13 or later
* Qt 6.7 SDK or later (earlier versions may work but are not officially supported)
* Xcode 14 or later (earlier versions may work but are not officially supported)
* [create-dmg](https://github.com/sindresorhus/create-dmg) (only if building DMGs for use on non-development Macs)
### Linux/Unix Build Requirements
* Qt 6 is recommended, but Qt 5.9 or later is also supported (replace `qmake6` with `qmake` when using Qt 5).
* Qt 6 is recommended, but Qt 5.12 or later is also supported (replace `qmake6` with `qmake` when using Qt 5).
* GCC or Clang
* FFmpeg 4.0 or later
* Install the required packages:
* Debian/Ubuntu:
* Base Requirements: `libegl1-mesa-dev libgl1-mesa-dev libopus-dev libsdl2-dev libsdl2-ttf-dev libssl-dev libavcodec-dev libavformat-dev libswscale-dev libva-dev libvdpau-dev libxkbcommon-dev wayland-protocols libdrm-dev`
* Qt 6 (Recommended): `qt6-base-dev qt6-declarative-dev libqt6svg6-dev qml6-module-qtquick-controls qml6-module-qtquick-templates qml6-module-qtquick-layouts qml6-module-qtqml-workerscript qml6-module-qtquick-window qml6-module-qtquick`
* Qt 6 (Recommended): `qt6-base-dev qt6-declarative-dev libqt6svg6-dev qt6-wayland qml6-module-qtquick-controls qml6-module-qtquick-templates qml6-module-qtquick-layouts qml6-module-qtqml-workerscript qml6-module-qtquick-window qml6-module-qtquick`
* Qt 5: `qtbase5-dev qt5-qmake qtdeclarative5-dev qtquickcontrols2-5-dev qml-module-qtquick-controls2 qml-module-qtquick-layouts qml-module-qtquick-window2 qml-module-qtquick2 qtwayland5`
* RedHat/Fedora (RPM Fusion repo required):
* Base Requirements: `openssl-devel SDL2-devel SDL2_ttf-devel ffmpeg-devel libva-devel libvdpau-devel opus-devel pulseaudio-libs-devel alsa-lib-devel libdrm-devel`
@@ -71,18 +75,33 @@ Hosting for Moonlight's Debian and L4T package repositories is graciously provid
* [Steam Link SDK](https://github.com/ValveSoftware/steamlink-sdk) cloned on your build system
* STEAMLINK_SDK_PATH environment variable set to the Steam Link SDK path
**Steam Link Hardware Limitations**
Moonlight builds for Steam Link are subject to hardware limitations of the Steam Link device:
* Maximum resolution: **1080p (1920x1080)**
* Maximum framerate: **60 FPS**
* Maximum video bitrate: **40 Mbps**
* **HDR streaming is not supported** on the original hardware
### Docker containers
If you want to use Docker for building, look at [this repo](https://github.com/cgutman/moonlight-packaging) containing canonical containers
for different architectures, which handle building deps and extra linking for you.
### Build Setup Steps
1. Install the latest Qt SDK (and optionally, the Qt Creator IDE) from https://www.qt.io/download
* You can install Qt via Homebrew on macOS, but you will need to use `brew install qt --with-debug` to be able to create debug builds of Moonlight.
* You may also use your Linux distro's package manager for the Qt SDK as long as the packages are Qt 5.9 or later.
* You may also use your Linux distro's package manager for the Qt SDK as long as the packages are Qt 5.12 or later.
* This step is not required for building on Steam Link, because the Steam Link SDK includes Qt 5.14.
2. Run `git submodule update --init --recursive` from within `moonlight-qt/`
2. Download submodules and dependencies
* Run `git submodule update --init --recursive` from within `moonlight-qt/`.
* On Windows and macOS, you must also run `setup-deps.ps1` (Windows) or `setup-deps.py` (macOS).
* Perform these steps each time you pull new changes from the Git repository.
3. Open the project in Qt Creator or build from qmake on the command line.
* To build a binary for use on non-development machines, use the scripts in the `scripts` folder.
* For Windows builds, use `scripts\build-arch.bat` and `scripts\generate-bundle.bat`. Execute these scripts from the root of the repository within a Qt command prompt. Ensure 7-Zip binary directory is on your `%PATH%`.
* For macOS builds, use `scripts/generate-dmg.sh`. Execute this script from the root of the repository and ensure Qt's `bin` folder is in your `$PATH`.
* For Steam Link builds, run `scripts/build-steamlink-app.sh` from the root of the repository.
* To build from the command line for development use on macOS or Linux, run `qmake6 moonlight-qt.pro` then `make debug` or `make release`
* To build from the command line for development use on macOS or Linux, run `qmake6 moonlight-qt.pro` then `make debug` or `make release`.
* The final binary will be placed in `app/moonlight`.
* To create an embedded build for a single-purpose device, use `qmake6 "CONFIG+=embedded" moonlight-qt.pro` and build normally.
* This build will lack windowed mode, Discord/Help links, and other features that don't make sense on an embedded device.
* For platforms with poor GPU performance, add `"CONFIG+=gpuslow"` to prefer direct KMSDRM rendering over GL/Vulkan renderers. Direct KMSDRM rendering can use dedicated YUV/RGB conversion and scaling hardware rather than slower GPU shaders for these operations.
+6
View File
@@ -2,8 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>GCSupportsGameMode</key>
<true/>
<key>CFBundleExecutable</key>
<string>Moonlight</string>
<key>LSSupportsGameMode</key>
<true/>
<key>CFBundleGetInfoString</key>
<string>Stream games and other applications from another PC</string>
<key>CFBundleIconFile</key>
@@ -44,5 +48,7 @@
<string>VERSION</string>
<key>CFBundleDisplayName</key>
<string>Moonlight</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
</dict>
</plist>
+2 -1
View File
@@ -11,7 +11,8 @@
<asmv3:application>
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitor</dpiAwareness>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2, permonitor</dpiAwareness>
<heapType xmlns="http://schemas.microsoft.com/SMI/2020/WindowsSettings">SegmentHeap</heapType>
</asmv3:windowsSettings>
</asmv3:application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+67
View File
@@ -0,0 +1,67 @@
//
// Compatibility header for older version of SDL.
// Include this instead of SDL.h directly.
//
#pragma once
#include <SDL.h>
// SDL_FRect wasn't added until 2.0.10
#if !SDL_VERSION_ATLEAST(2, 0, 10)
typedef struct SDL_FRect
{
float x;
float y;
float w;
float h;
} SDL_FRect;
#endif
#ifndef SDL_HINT_VIDEO_X11_FORCE_EGL
#define SDL_HINT_VIDEO_X11_FORCE_EGL "SDL_VIDEO_X11_FORCE_EGL"
#endif
#ifndef SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER
#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER"
#endif
#ifndef SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED
#define SDL_HINT_ALLOW_ALT_TAB_WHILE_GRABBED "SDL_ALLOW_ALT_TAB_WHILE_GRABBED"
#endif
#ifndef SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE
#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE"
#endif
#ifndef SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE
#define SDL_HINT_JOYSTICK_HIDAPI_PS5_RUMBLE "SDL_JOYSTICK_HIDAPI_PS5_RUMBLE"
#endif
#ifndef SDL_HINT_WINDOWS_USE_D3D9EX
#define SDL_HINT_WINDOWS_USE_D3D9EX "SDL_WINDOWS_USE_D3D9EX"
#endif
#ifndef SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS
#define SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS "SDL_GAMECONTROLLER_USE_BUTTON_LABELS"
#endif
#ifndef SDL_HINT_MOUSE_RELATIVE_SCALING
#define SDL_HINT_MOUSE_RELATIVE_SCALING "SDL_MOUSE_RELATIVE_SCALING"
#endif
#ifndef SDL_HINT_AUDIO_DEVICE_APP_NAME
#define SDL_HINT_AUDIO_DEVICE_APP_NAME "SDL_AUDIO_DEVICE_APP_NAME"
#endif
#ifndef SDL_HINT_APP_NAME
#define SDL_HINT_APP_NAME "SDL_APP_NAME"
#endif
#ifndef SDL_HINT_MOUSE_AUTO_CAPTURE
#define SDL_HINT_MOUSE_AUTO_CAPTURE "SDL_MOUSE_AUTO_CAPTURE"
#endif
#ifndef SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP
#define SDL_HINT_VIDEO_WAYLAND_EMULATE_MOUSE_WARP "SDL_VIDEO_WAYLAND_EMULATE_MOUSE_WARP"
#endif
+48 -47
View File
@@ -1,5 +1,5 @@
QT += core quick network quickcontrols2 svg
CONFIG += c++11
CONFIG += c++17
unix:!macx {
TARGET = moonlight
@@ -36,40 +36,39 @@ DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
win32 {
contains(QT_ARCH, i386) {
LIBS += -L$$PWD/../libs/windows/lib/x86
INCLUDEPATH += $$PWD/../libs/windows/include/x86
!exists($$PWD/../libs/windows) {
error("Missing dependencies. Please run 'powershell .\setup-deps.ps1' to fetch prebuilt libraries.")
}
contains(QT_ARCH, x86_64) {
LIBS += -L$$PWD/../libs/windows/lib/x64
INCLUDEPATH += $$PWD/../libs/windows/include/x64
INCLUDEPATH += $$PWD/../libs/windows/include/x64 $$PWD/../libs/windows/include/x64/SDL2
}
contains(QT_ARCH, arm64) {
LIBS += -L$$PWD/../libs/windows/lib/arm64
INCLUDEPATH += $$PWD/../libs/windows/include/arm64
INCLUDEPATH += $$PWD/../libs/windows/include/arm64 $$PWD/../libs/windows/include/arm64/SDL2
}
INCLUDEPATH += $$PWD/../libs/windows/include
LIBS += ws2_32.lib winmm.lib dxva2.lib ole32.lib gdi32.lib user32.lib d3d9.lib dwmapi.lib dbghelp.lib
# Work around a conflict with math.h inclusion between SDL and Qt 6
DEFINES += _USE_MATH_DEFINES
}
macx:!disable-prebuilts {
INCLUDEPATH += $$PWD/../libs/mac/include
INCLUDEPATH += $$PWD/../libs/mac/Frameworks/SDL2.framework/Versions/A/Headers
INCLUDEPATH += $$PWD/../libs/mac/Frameworks/SDL2_ttf.framework/Versions/A/Headers
LIBS += -L$$PWD/../libs/mac/lib -F$$PWD/../libs/mac/Frameworks
!exists($$PWD/../libs/mac) {
error("Missing dependencies. Please run 'python3 setup-deps.py' to fetch prebuilt libraries.")
}
# QMake doesn't handle framework-style includes correctly on its own
QMAKE_CFLAGS += -F$$PWD/../libs/mac/Frameworks
QMAKE_CXXFLAGS += -F$$PWD/../libs/mac/Frameworks
QMAKE_OBJECTIVE_CFLAGS += -F$$PWD/../libs/mac/Frameworks
INCLUDEPATH += $$PWD/../libs/mac/include $$PWD/../libs/mac/include/SDL2
LIBS += -L$$PWD/../libs/mac/lib
}
unix:if(!macx|disable-prebuilts) {
CONFIG += link_pkgconfig
PKGCONFIG += openssl sdl2 SDL2_ttf opus
PKGCONFIG += openssl sdl2 SDL2_ttf
# We have our own optimized libopus.a for Steam Link
if(!config_SL|disable-prebuilts) {
PKGCONFIG += opus
}
!disable-ffmpeg {
packagesExist(libavcodec) {
@@ -117,7 +116,9 @@ unix:if(!macx|disable-prebuilts) {
}
}
!disable-cuda {
# Disabled by default due to reliability issues. See #1314.
# CUDA interop is superseded by VDPAU and Vulkan Video.
enable-cuda {
packagesExist(ffnvcodec) {
PKGCONFIG += ffnvcodec
CONFIG += cuda
@@ -152,20 +153,16 @@ win32 {
CONFIG += ffmpeg libplacebo
}
win32:!winrt {
CONFIG += soundio discord-rpc
CONFIG += discord-rpc
}
macx {
!disable-prebuilts {
LIBS += -lssl.3 -lcrypto.3 -lavcodec.61 -lavutil.59 -lswscale.8 -lopus -framework SDL2 -framework SDL2_ttf
CONFIG += discord-rpc
LIBS += -lssl.3 -lcrypto.3 -lavcodec.62 -lavutil.60 -lswscale.9 -lopus.0 -lSDL2 -lSDL2_ttf -lplacebo
CONFIG += discord-rpc libplacebo
}
LIBS += -lobjc -framework VideoToolbox -framework AVFoundation -framework CoreVideo -framework CoreGraphics -framework CoreMedia -framework AppKit -framework Metal -framework QuartzCore
# For libsoundio
LIBS += -framework CoreAudio -framework AudioUnit
CONFIG += ffmpeg soundio
CONFIG += ffmpeg
}
SOURCES += \
@@ -199,6 +196,7 @@ SOURCES += \
streaming/audio/renderers/sdlaud.cpp \
gui/computermodel.cpp \
gui/appmodel.cpp \
streaming/bandwidth.cpp \
streaming/streamutils.cpp \
backend/autoupdatechecker.cpp \
path.cpp \
@@ -209,6 +207,7 @@ SOURCES += \
wm.cpp
HEADERS += \
SDL_compat.h \
backend/nvaddress.h \
backend/nvapp.h \
cli/pair.h \
@@ -235,6 +234,7 @@ HEADERS += \
gui/computermodel.h \
gui/appmodel.h \
streaming/video/decoder.h \
streaming/bandwidth.h \
streaming/streamutils.h \
backend/autoupdatechecker.h \
path.h \
@@ -323,9 +323,12 @@ libdrm {
HEADERS += streaming/video/ffmpeg-renderers/drm.h
linux {
message(Master hooks enabled)
SOURCES += masterhook.c masterhook_internal.c
LIBS += -ldl
!disable-masterhooks {
message(Master hooks enabled)
DEFINES += HAVE_DRM_MASTER_HOOKS
SOURCES += masterhook.c masterhook_internal.c
LIBS += -ldl -pthread
}
}
}
cuda {
@@ -347,6 +350,10 @@ libplacebo {
streaming/video/ffmpeg-renderers/plvk_c.c
HEADERS += \
streaming/video/ffmpeg-renderers/plvk.h
macx {
SOURCES += streaming/video/ffmpeg-renderers/plvk_objc.mm
}
}
config_EGL {
message(EGL renderer selected)
@@ -364,6 +371,13 @@ config_EGL {
config_SL {
message(Steam Link build configuration selected)
!disable-prebuilts {
# Link against our NEON-optimized libopus build
LIBS += -L$$PWD/../libs/steamlink/lib
INCLUDEPATH += $$PWD/../libs/steamlink/include
LIBS += -lopus -larmasm -lNE10
}
DEFINES += EMBEDDED_BUILD STEAM_LINK HAVE_SLVIDEO HAVE_SLAUDIO
LIBS += -lSLVideo -lSLAudio
@@ -401,13 +415,6 @@ macx {
HEADERS += \
streaming/video/ffmpeg-renderers/vt.h
}
soundio {
message(libsoundio audio renderer selected)
DEFINES += HAVE_SOUNDIO SOUNDIO_STATIC_LIBRARY
SOURCES += streaming/audio/renderers/soundioaudiorenderer.cpp
HEADERS += streaming/audio/renderers/soundioaudiorenderer.h
}
discord-rpc {
message(Discord integration enabled)
@@ -473,7 +480,10 @@ TRANSLATIONS += \
languages/qml_he.ts \
languages/qml_ckb.ts \
languages/qml_lt.ts \
languages/qml_et.ts
languages/qml_et.ts \
languages/qml_bg.ts \
languages/qml_eo.ts \
languages/qml_ta.ts
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
@@ -495,15 +505,6 @@ else:unix: LIBS += -L$$OUT_PWD/../qmdnsengine/ -lqmdnsengine
INCLUDEPATH += $$PWD/../qmdnsengine/qmdnsengine/src/include $$PWD/../qmdnsengine
DEPENDPATH += $$PWD/../qmdnsengine/qmdnsengine/src/include $$PWD/../qmdnsengine
soundio {
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../soundio/release/ -lsoundio
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../soundio/debug/ -lsoundio
else:unix: LIBS += -L$$OUT_PWD/../soundio/ -lsoundio
INCLUDEPATH += $$PWD/../soundio/libsoundio
DEPENDPATH += $$PWD/../soundio/libsoundio
}
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../h264bitstream/release/ -lh264bitstream
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../h264bitstream/debug/ -lh264bitstream
else:unix: LIBS += -L$$OUT_PWD/../h264bitstream/ -lh264bitstream
+2 -2
View File
@@ -58,7 +58,7 @@ void AutoUpdateChecker::start()
void AutoUpdateChecker::parseStringToVersionQuad(QString& string, QVector<int>& version)
{
QStringList list = string.split('.');
for (const QString& component : list) {
for (const QString& component : std::as_const(list)) {
version.append(component.toInt());
}
}
@@ -139,7 +139,7 @@ void AutoUpdateChecker::handleUpdateCheckRequestFinished(QNetworkReply* reply)
return;
}
for (QJsonValueRef updateEntry : array) {
for (const auto& updateEntry : std::as_const(array)) {
if (updateEntry.isObject()) {
QJsonObject updateObj = updateEntry.toObject();
if (!updateObj.contains("platform") ||
+63 -31
View File
@@ -9,8 +9,7 @@
#include <QThread>
#include <QThreadPool>
#include <QCoreApplication>
#include <random>
#include <QRandomGenerator>
#define SER_HOSTS "hosts"
#define SER_HOSTS_BACKUP "hostsbackup"
@@ -30,9 +29,9 @@ public:
}
private:
bool tryPollComputer(NvAddress address, bool& changed)
bool tryPollComputer(QNetworkAccessManager* nam, NvAddress address, bool& changed)
{
NvHTTP http(address, 0, m_Computer->serverCert);
NvHTTP http(address, 0, m_Computer->serverCert, !m_Computer->isNvidiaServerSoftware, nam);
QString serverInfo;
try {
@@ -53,9 +52,9 @@ private:
return true;
}
bool updateAppList(bool& changed)
bool updateAppList(QNetworkAccessManager* nam, bool& changed)
{
NvHTTP http(m_Computer);
NvHTTP http(m_Computer, nam);
QVector<NvApp> appList;
@@ -75,6 +74,21 @@ private:
void run() override
{
// Reduce the power and performance impact of our
// computer status polling while it's running.
setPriority(QThread::LowPriority);
#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
setServiceLevel(QThread::QualityOfService::Eco);
#endif
// Share the QNetworkAccessManager to conserve resources when polling.
// Each instance creates a worker thread, so sharing them ensures that
// we are not spamming a new thread for every single polling attempt.
//
// Since QThread inherit the priority of the current thread, this also
// ensures that the NAM's worker thread will inherit our lower priority.
QNetworkAccessManager nam;
// Always fetch the applist the first time
int pollsSinceLastAppListFetch = POLLS_PER_APPLIST_FETCH;
while (!isInterruptionRequested()) {
@@ -87,7 +101,7 @@ private:
return;
}
if (tryPollComputer(address, stateChanged)) {
if (tryPollComputer(&nam, address, stateChanged)) {
if (!wasOnline) {
qInfo() << m_Computer->name << "is now online at" << m_Computer->activeAddress.toString();
}
@@ -118,7 +132,7 @@ private:
stateChanged = false;
}
if (updateAppList(stateChanged)) {
if (updateAppList(&nam, stateChanged)) {
pollsSinceLastAppListFetch = 0;
}
}
@@ -217,17 +231,17 @@ ComputerManager::~ComputerManager()
m_MdnsBrowser = nullptr;
// Interrupt polling
for (ComputerPollingEntry* entry : m_PollEntries) {
for (ComputerPollingEntry* entry : std::as_const(m_PollEntries)) {
entry->interrupt();
}
// Delete all polling entries (and associated threads)
for (ComputerPollingEntry* entry : m_PollEntries) {
for (ComputerPollingEntry* entry : std::as_const(m_PollEntries)) {
delete entry;
}
// Destroy all NvComputer objects now that polling is halted
for (NvComputer* computer : m_KnownHosts) {
for (NvComputer* computer : std::as_const(m_KnownHosts)) {
delete computer;
}
}
@@ -254,7 +268,7 @@ void DelayedFlushThread::run() {
// Update the last serialized hosts map under the delayed flush mutex
m_ComputerManager->m_LastSerializedHosts.clear();
for (const NvComputer* computer : m_ComputerManager->m_KnownHosts) {
for (const NvComputer* computer : std::as_const(m_ComputerManager->m_KnownHosts)) {
// Copy the current state of the NvComputer to allow us to check later if we need
// to serialize it again when attribute updates occur.
QReadLocker computerLock(&computer->lock);
@@ -271,7 +285,7 @@ void DelayedFlushThread::run() {
{
QReadLocker lock(&m_ComputerManager->m_Lock);
int i = 0;
for (const NvComputer* computer : m_ComputerManager->m_KnownHosts) {
for (const NvComputer* computer : std::as_const(m_ComputerManager->m_KnownHosts)) {
settings.setArrayIndex(i++);
computer->serialize(settings, false);
}
@@ -284,7 +298,7 @@ void DelayedFlushThread::run() {
{
QReadLocker lock(&m_ComputerManager->m_Lock);
int i = 0;
for (const NvComputer* computer : m_ComputerManager->m_KnownHosts) {
for (const NvComputer* computer : std::as_const(m_ComputerManager->m_KnownHosts)) {
settings.setArrayIndex(i++);
computer->serialize(settings, true);
}
@@ -410,13 +424,15 @@ void ComputerManager::handleMdnsServiceResolved(MdnsPendingComputer* computer,
bool added = false;
// Add the host using the IPv4 address
for (const QHostAddress& address : addresses) {
for (const QHostAddress& address : std::as_const(addresses)) {
if (address.protocol() == QAbstractSocket::IPv4Protocol) {
// NB: We don't just call addNewHost() here with v6Global because the IPv6
// address may not be reachable (if the user hasn't installed the IPv6 helper yet
// or if this host lacks outbound IPv6 capability). We want to add IPv6 even if
// it's not currently reachable.
addNewHost(NvAddress(address, computer->port()), true, NvAddress(v6Global, computer->port()));
addNewHost(NvAddress(address, computer->port()),
true, computer->hostname(),
NvAddress(v6Global, computer->port()));
added = true;
break;
}
@@ -424,13 +440,15 @@ void ComputerManager::handleMdnsServiceResolved(MdnsPendingComputer* computer,
if (!added) {
// If we get here, there wasn't an IPv4 address so we'll do it v6-only
for (const QHostAddress& address : addresses) {
for (const QHostAddress& address : std::as_const(addresses)) {
if (address.protocol() == QAbstractSocket::IPv6Protocol) {
// Use a link-local or site-local address for the "local address"
if (address.isInSubnet(QHostAddress("fe80::"), 10) ||
address.isInSubnet(QHostAddress("fec0::"), 10) ||
address.isInSubnet(QHostAddress("fc00::"), 7)) {
addNewHost(NvAddress(address, computer->port()), true, NvAddress(v6Global, computer->port()));
addNewHost(NvAddress(address, computer->port()),
true, computer->hostname(),
NvAddress(v6Global, computer->port()));
break;
}
}
@@ -551,7 +569,7 @@ void ComputerManager::handleAboutToQuit()
// Interrupt polling threads immediately, so they
// avoid making additional requests while quitting
for (ComputerPollingEntry* entry : m_PollEntries) {
for (ComputerPollingEntry* entry : std::as_const(m_PollEntries)) {
entry->interrupt();
}
}
@@ -703,7 +721,7 @@ void ComputerManager::stopPollingAsync()
m_MdnsServer.reset();
// Interrupt all threads, but don't wait for them to terminate
for (ComputerPollingEntry* entry : m_PollEntries) {
for (ComputerPollingEntry* entry : std::as_const(m_PollEntries)) {
entry->interrupt();
}
}
@@ -715,6 +733,10 @@ void ComputerManager::addNewHostManually(QString address)
// If there wasn't a port specified, use the default
addNewHost(NvAddress(url.host(), url.port(DEFAULT_HTTP_PORT)), false);
}
else if (QHostAddress(address).protocol() == QAbstractSocket::IPv6Protocol) {
// The user specified an IPv6 literal without URL escaping, so use the default port
addNewHost(NvAddress(address, DEFAULT_HTTP_PORT), false);
}
else {
emit computerAddCompleted(false, false);
}
@@ -725,8 +747,9 @@ class PendingAddTask : public QObject, public QRunnable
Q_OBJECT
public:
PendingAddTask(ComputerManager* computerManager, NvAddress address, NvAddress mdnsIpv6Address, bool mdns)
PendingAddTask(ComputerManager* computerManager, QString name, NvAddress address, NvAddress mdnsIpv6Address, bool mdns)
: m_ComputerManager(computerManager),
m_Name(name),
m_Address(address),
m_MdnsIpv6Address(mdnsIpv6Address),
m_Mdns(mdns),
@@ -802,9 +825,21 @@ private:
void run()
{
NvHTTP http(m_Address, 0, QSslCertificate());
// Use the placeholder UID for the initial poll, then we'll switch to the real one if it's not GFE
NvHTTP http(m_Address, 0, QSslCertificate(), false);
qInfo() << "Processing new PC at" << m_Address.toString() << "from" << (m_Mdns ? "mDNS" : "user") << "with IPv6 address" << m_MdnsIpv6Address.toString();
if (m_Mdns) {
if (m_MdnsIpv6Address.isNull()) {
qInfo() << "Processing new PC" << m_Name << "from mDNS with local address" << m_Address.toString();
}
else {
qInfo() << "Processing new PC" << m_Name << "from mDNS with local address" << m_Address.toString()
<< "and IPv6 address" << m_MdnsIpv6Address.toString();
}
}
else {
qInfo() << "Processing new PC at" << m_Address.toString() << "from user";
}
// Perform initial serverinfo fetch over HTTP since we don't know which cert to use
QString serverInfo = fetchServerInfo(http);
@@ -819,6 +854,7 @@ private:
// Create initial newComputer using HTTP serverinfo with no pinned cert
NvComputer* newComputer = new NvComputer(http, serverInfo);
http.setTrueUid(!newComputer->isNvidiaServerSoftware);
// Check if we have a record of this host UUID to pull the pinned cert
NvComputer* existingComputer;
@@ -952,28 +988,24 @@ private:
}
ComputerManager* m_ComputerManager;
QString m_Name;
NvAddress m_Address;
NvAddress m_MdnsIpv6Address;
bool m_Mdns;
bool m_AboutToQuit;
};
void ComputerManager::addNewHost(NvAddress address, bool mdns, NvAddress mdnsIpv6Address)
void ComputerManager::addNewHost(NvAddress address, bool mdns, QString name, NvAddress mdnsIpv6Address)
{
// Punt to a worker thread to avoid stalling the
// UI while waiting for serverinfo query to complete
PendingAddTask* addTask = new PendingAddTask(this, address, mdnsIpv6Address, mdns);
PendingAddTask* addTask = new PendingAddTask(this, name, address, mdnsIpv6Address, mdns);
QThreadPool::globalInstance()->start(addTask);
}
// TODO: Use QRandomGenerator when we drop Qt 5.9 support
QString ComputerManager::generatePinString()
{
std::uniform_int_distribution<int> dist(0, 9999);
std::random_device rd;
std::mt19937 engine(rd());
return QString::asprintf("%04u", dist(engine));
return QString::asprintf("%04u", QRandomGenerator::system()->bounded(10000));
}
#include "computermanager.moc"
+2 -3
View File
@@ -90,7 +90,6 @@ private slots:
void handleResolvedAddress(const QHostAddress& address)
{
qInfo() << "Resolved" << hostname() << "to" << address;
m_Addresses.push_back(address);
}
@@ -151,7 +150,7 @@ public:
// interrupt() should have taken care of this
Q_ASSERT(m_ActiveThread == nullptr);
for (QThread* thread : m_InactiveList) {
for (QThread* thread : std::as_const(m_InactiveList)) {
thread->wait();
delete thread;
}
@@ -228,7 +227,7 @@ public:
Q_INVOKABLE void addNewHostManually(QString address);
void addNewHost(NvAddress address, bool mdns, NvAddress mdnsIpv6Address = NvAddress());
void addNewHost(NvAddress address, bool mdns, QString name = QString(), NvAddress mdnsIpv6Address = NvAddress());
QString generatePinString();
+27 -10
View File
@@ -7,10 +7,9 @@ ComputerSeeker::ComputerSeeker(ComputerManager *manager, QString computerName, Q
m_TimeoutTimer(new QTimer(this))
{
// If we know this computer, send a WOL packet to wake it up in case it is asleep.
for (NvComputer * computer: m_ComputerManager->getComputers()) {
if (this->matchComputer(computer)) {
computer->wake();
}
NvComputer* matchingComputer = findMatchingComputer();
if (matchingComputer) {
matchingComputer->wake();
}
m_TimeoutTimer->setSingleShot(true);
@@ -23,11 +22,16 @@ ComputerSeeker::ComputerSeeker(ComputerManager *manager, QString computerName, Q
void ComputerSeeker::start(int timeout)
{
m_TimeoutTimer->start(timeout);
// Seek desired computer by both connecting to it directly (this may fail
// if m_ComputerName is UUID, or the name that doesn't resolve to an IP
// address) and by polling it using mDNS, hopefully one of these methods
// would find the host
m_ComputerManager->addNewHostManually(m_ComputerName);
// If we don't know this computer by name, address, or UUID, try adding it
// manually and see if we can find it by address, hostname, or mDNS.
//
// NB: We don't do this unconditionally because it will wipe out the user's
// manual address if they pass another reachable hostname/address.
if (!findMatchingComputer()) {
m_ComputerManager->addNewHostManually(m_ComputerName);
}
m_ComputerManager->startPolling();
}
@@ -51,7 +55,8 @@ bool ComputerSeeker::matchComputer(NvComputer *computer) const
return true;
}
for (const NvAddress& addr : computer->uniqueAddresses()) {
const auto uniqueAddresses = computer->uniqueAddresses();
for (const NvAddress& addr : uniqueAddresses) {
if (addr.address().toLower() == value || addr.toString().toLower() == value) {
return true;
}
@@ -60,6 +65,18 @@ bool ComputerSeeker::matchComputer(NvComputer *computer) const
return false;
}
NvComputer* ComputerSeeker::findMatchingComputer() const
{
const auto computers = m_ComputerManager->getComputers();
for (NvComputer* computer : computers) {
if (this->matchComputer(computer)) {
return computer;
}
}
return nullptr;
}
bool ComputerSeeker::isOnline(NvComputer *computer) const
{
return computer->state == NvComputer::CS_ONLINE;
+1
View File
@@ -24,6 +24,7 @@ private slots:
private:
bool matchComputer(NvComputer *computer) const;
NvComputer* findMatchingComputer() const;
bool isOnline(NvComputer *computer) const;
private:
+28 -34
View File
@@ -31,6 +31,10 @@ void IdentityManager::createCredentials(QSettings& settings)
X509* cert = X509_new();
THROW_BAD_ALLOC_IF_NULL(cert);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_PKEY* pk = EVP_RSA_gen(2048);
THROW_BAD_ALLOC_IF_NULL(pk);
#else
EVP_PKEY_CTX* ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_RSA, NULL);
THROW_BAD_ALLOC_IF_NULL(ctx);
@@ -43,6 +47,7 @@ void IdentityManager::createCredentials(QSettings& settings)
EVP_PKEY_CTX_free(ctx);
THROW_BAD_ALLOC_IF_NULL(pk);
#endif
X509_set_version(cert, 2);
ASN1_INTEGER_set(X509_get_serialNumber(cert), 0);
@@ -50,28 +55,20 @@ void IdentityManager::createCredentials(QSettings& settings)
X509_gmtime_adj(X509_get_notBefore(cert), 0);
X509_gmtime_adj(X509_get_notAfter(cert), 60 * 60 * 24 * 365 * 20); // 20 yrs
#else
ASN1_TIME* before = ASN1_STRING_dup(X509_get0_notBefore(cert));
THROW_BAD_ALLOC_IF_NULL(before);
ASN1_TIME* after = ASN1_STRING_dup(X509_get0_notAfter(cert));
THROW_BAD_ALLOC_IF_NULL(after);
X509_gmtime_adj(before, 0);
X509_gmtime_adj(after, 60 * 60 * 24 * 365 * 20); // 20 yrs
X509_set1_notBefore(cert, before);
X509_set1_notAfter(cert, after);
ASN1_STRING_free(before);
ASN1_STRING_free(after);
X509_gmtime_adj(X509_getm_notBefore(cert), 0);
X509_gmtime_adj(X509_getm_notAfter(cert), 60 * 60 * 24 * 365 * 20); // 20 yrs
#endif
X509_set_pubkey(cert, pk);
X509_NAME* name = X509_get_subject_name(cert);
X509_NAME* name = X509_NAME_new();
THROW_BAD_ALLOC_IF_NULL(name);
X509_NAME_add_entry_by_txt(name, "CN", MBSTRING_ASC,
reinterpret_cast<unsigned char *>(const_cast<char*>("NVIDIA GameStream Client")),
-1, -1, 0);
X509_set_subject_name(cert, name);
X509_set_issuer_name(cert, name);
X509_NAME_free(name);
X509_sign(cert, pk, EVP_sha256());
@@ -136,6 +133,22 @@ IdentityManager::IdentityManager()
if (getSslKey().isNull()) {
qFatal("Private key is unreadable");
}
// Load the unique ID from settings
m_CachedUniqueId = settings.value(SER_UNIQUEID).toString();
if (!m_CachedUniqueId.isEmpty()) {
qInfo() << "Loaded unique ID from settings:" << m_CachedUniqueId;
}
else {
// Generate a new unique ID in base 16
uint64_t uid;
RAND_bytes(reinterpret_cast<unsigned char*>(&uid), sizeof(uid));
m_CachedUniqueId = QString::number(uid, 16);
qInfo() << "Generated new unique ID:" << m_CachedUniqueId;
settings.setValue(SER_UNIQUEID, m_CachedUniqueId);
}
}
QSslCertificate
@@ -173,7 +186,7 @@ IdentityManager::getSslKey()
BUF_MEM* mem;
BIO_get_mem_ptr(bio, &mem);
m_CachedSslKey = QSslKey(QByteArray::fromRawData(mem->data, (int)mem->length), QSsl::Rsa);
m_CachedSslKey = QSslKey(QByteArray(mem->data, (int)mem->length), QSsl::Rsa);
BIO_free(bio);
EVP_PKEY_free(pk);
@@ -193,25 +206,6 @@ IdentityManager::getSslConfig()
QString
IdentityManager::getUniqueId()
{
if (m_CachedUniqueId.isEmpty()) {
QSettings settings;
// Load the unique ID from settings
m_CachedUniqueId = settings.value(SER_UNIQUEID).toString();
if (!m_CachedUniqueId.isEmpty()) {
qInfo() << "Loaded unique ID from settings:" << m_CachedUniqueId;
}
else {
// Generate a new unique ID in base 16
uint64_t uid;
RAND_bytes(reinterpret_cast<unsigned char*>(&uid), sizeof(uid));
m_CachedUniqueId = QString::number(uid, 16);
qInfo() << "Generated new unique ID:" << m_CachedUniqueId;
settings.setValue(SER_UNIQUEID, m_CachedUniqueId);
}
}
return m_CachedUniqueId;
}
+3 -1
View File
@@ -25,7 +25,9 @@ public:
bool isInitialized()
{
return id != 0 && !name.isEmpty();
// We use isNull() instead of isEmpty() here because we want
// to detect cases where the name is unassigned, not empty.
return id != 0 && !name.isNull();
}
void
+13 -8
View File
@@ -99,7 +99,7 @@ void NvComputer::serialize(QSettings& settings, bool serializeApps) const
settings.beginWriteArray(SER_APPLIST);
for (int i = 0; i < appList.count(); i++) {
settings.setArrayIndex(i);
appList[i].serialize(settings);
appList.at(i).serialize(settings);
}
settings.endArray();
}
@@ -141,7 +141,7 @@ NvComputer::NvComputer(NvHTTP& http, QString serverInfo)
QString newMacString = NvHTTP::getXmlString(serverInfo, "mac");
if (newMacString != "00:00:00:00:00:00") {
QStringList macOctets = newMacString.split(':');
for (const QString& macOctet : macOctets) {
for (const QString& macOctet : std::as_const(macOctets)) {
this->macAddress.append((char) macOctet.toInt(nullptr, 16));
}
}
@@ -254,14 +254,16 @@ bool NvComputer::wake() const
// case the host has timed out in ARP entries.
QMap<QString, quint16> addressMap;
QSet<quint16> basePortSet;
for (const NvAddress& addr : uniqueAddresses()) {
const auto uniqueHostAddresses = uniqueAddresses();
for (const NvAddress& addr : uniqueHostAddresses) {
addressMap.insert(addr.address(), addr.port());
basePortSet.insert(addr.port());
}
addressMap.insert("255.255.255.255", 0);
// Try to broadcast on all available NICs
for (const QNetworkInterface& nic : QNetworkInterface::allInterfaces()) {
const auto allInterfaces = QNetworkInterface::allInterfaces();
for (const QNetworkInterface& nic : allInterfaces) {
// Ensure the interface is up and skip the loopback adapter
if ((nic.flags() & QNetworkInterface::IsUp) == 0 ||
(nic.flags() & QNetworkInterface::IsLoopBack) != 0) {
@@ -269,7 +271,8 @@ bool NvComputer::wake() const
}
QHostAddress allNodesMulticast("FF02::1");
for (const QNetworkAddressEntry& addr : nic.addressEntries()) {
const auto allInterfaceAddresses = nic.addressEntries();
for (const QNetworkAddressEntry& addr : allInterfaceAddresses) {
// Store the scope ID for this NIC if IPv6 is enabled
if (!addr.ip().scopeId().isEmpty()) {
allNodesMulticast.setScopeId(addr.ip().scopeId());
@@ -375,13 +378,15 @@ NvComputer::ReachabilityType NvComputer::getActiveAddressReachability() const
Q_ASSERT(!s.localAddress().isNull());
Q_ASSERT(!s.peerAddress().isNull());
for (const QNetworkInterface& nic : QNetworkInterface::allInterfaces()) {
const auto allInterfaces = QNetworkInterface::allInterfaces();
for (const QNetworkInterface& nic : allInterfaces) {
// Ensure the interface is up
if ((nic.flags() & QNetworkInterface::IsUp) == 0) {
continue;
}
for (const QNetworkAddressEntry& addr : nic.addressEntries()) {
const auto allInterfaceAddresses = nic.addressEntries();
for (const QNetworkAddressEntry& addr : allInterfaceAddresses) {
if (addr.ip() == s.localAddress()) {
qInfo() << "Found matching interface:" << nic.humanReadableName() << nic.hardwareAddress() << nic.flags();
@@ -463,7 +468,7 @@ bool NvComputer::updateAppList(QVector<NvApp> newAppList) {
}
// Propagate client-side attributes to the new app list
for (const NvApp& existingApp : appList) {
for (const NvApp& existingApp : std::as_const(appList)) {
for (NvApp& newApp : newAppList) {
if (existingApp.id == newApp.id) {
newApp.hidden = existingApp.hidden;
+72 -56
View File
@@ -18,8 +18,16 @@
#define RESUME_TIMEOUT_MS 30000
#define QUIT_TIMEOUT_MS 30000
NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert) :
m_ServerCert(serverCert)
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#define XML_NAME_EQUALS(x, y) ((x) == (y))
#else
#define XML_NAME_EQUALS(x, y) ((x) == (u##y))
#endif
NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert, bool useTrueUid, QNetworkAccessManager* nam) :
m_Nam(nam ? nam : new QNetworkAccessManager(this)),
m_ServerCert(serverCert),
m_UseTrueUid(useTrueUid)
{
m_BaseUrlHttp.setScheme("http");
m_BaseUrlHttps.setScheme("https");
@@ -29,15 +37,12 @@ NvHTTP::NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert
// Never use a proxy server
QNetworkProxy noProxy(QNetworkProxy::NoProxy);
m_Nam.setProxy(noProxy);
connect(&m_Nam, &QNetworkAccessManager::sslErrors, this, &NvHTTP::handleSslErrors);
m_Nam->setProxy(noProxy);
}
NvHTTP::NvHTTP(NvComputer* computer) :
NvHTTP(computer->activeAddress, computer->activeHttpsPort, computer->serverCert)
NvHTTP::NvHTTP(NvComputer* computer, QNetworkAccessManager* nam) :
NvHTTP(computer->activeAddress, computer->activeHttpsPort, computer->serverCert, !computer->isNvidiaServerSoftware, nam)
{
}
void NvHTTP::setServerCert(QSslCertificate serverCert)
@@ -62,6 +67,11 @@ void NvHTTP::setHttpsPort(uint16_t port)
m_BaseUrlHttps.setPort(port);
}
void NvHTTP::setTrueUid(bool useTrueUid)
{
m_UseTrueUid = useTrueUid;
}
NvAddress NvHTTP::address()
{
return m_Address;
@@ -110,7 +120,7 @@ NvHTTP::getCurrentGame(QString serverInfo)
// has the semantics that its name would indicate. To contain the effects of this change as much
// as possible, we'll force the current game to zero if the server isn't in a streaming session.
QString serverState = getXmlString(serverInfo, "state");
if (serverState != nullptr && serverState.endsWith("_SERVER_BUSY"))
if (serverState.endsWith("_SERVER_BUSY"))
{
return getXmlString(serverInfo, "currentgame").toInt();
}
@@ -267,17 +277,19 @@ NvHTTP::getDisplayModeList(QString serverInfo)
while (!xmlReader.atEnd()) {
while (xmlReader.readNextStartElement()) {
auto name = xmlReader.name();
if (name == QString("DisplayMode")) {
if (XML_NAME_EQUALS(name, "DisplayMode")) {
modes.append(NvDisplayMode());
}
else if (name == QString("Width")) {
modes.last().width = xmlReader.readElementText().toInt();
}
else if (name == QString("Height")) {
modes.last().height = xmlReader.readElementText().toInt();
}
else if (name == QString("RefreshRate")) {
modes.last().refreshRate = xmlReader.readElementText().toInt();
else if (!modes.isEmpty()) {
if (XML_NAME_EQUALS(name, "Width")) {
modes.last().width = xmlReader.readElementText().toInt();
}
else if (XML_NAME_EQUALS(name, "Height")) {
modes.last().height = xmlReader.readElementText().toInt();
}
else if (XML_NAME_EQUALS(name, "RefreshRate")) {
modes.last().refreshRate = xmlReader.readElementText().toInt();
}
}
}
}
@@ -300,26 +312,36 @@ NvHTTP::getAppList()
while (!xmlReader.atEnd()) {
while (xmlReader.readNextStartElement()) {
auto name = xmlReader.name();
if (name == QString("App")) {
if (XML_NAME_EQUALS(name, "App")) {
// We must have a valid app before advancing to the next one
if (!apps.isEmpty() && !apps.last().isInitialized()) {
qWarning() << "Invalid applist XML";
Q_ASSERT(false);
return QVector<NvApp>();
throw std::runtime_error("Invalid applist XML");
}
apps.append(NvApp());
}
else if (name == QString("AppTitle")) {
apps.last().name = xmlReader.readElementText();
}
else if (name == QString("ID")) {
apps.last().id = xmlReader.readElementText().toInt();
}
else if (name == QString("IsHdrSupported")) {
apps.last().hdrSupported = xmlReader.readElementText() == "1";
}
else if (name == QString("IsAppCollectorGame")) {
apps.last().isAppCollectorGame = xmlReader.readElementText() == "1";
else if (!apps.isEmpty()) {
if (XML_NAME_EQUALS(name, "AppTitle")) {
// If an app has no name, Sunshine may send us <AppTitle/>,
// which readElementText() returns as a null QString.
// We want to treat this as an empty QString instead, so we
// will explicitly convert it. An empty string will satisfy
// NvApp's isInitialized() check.
QString name = xmlReader.readElementText();
if (name.isNull()) {
name = "";
}
apps.last().name = name;
}
else if (XML_NAME_EQUALS(name, "ID")) {
apps.last().id = xmlReader.readElementText().toInt();
}
else if (XML_NAME_EQUALS(name, "IsHdrSupported")) {
apps.last().hdrSupported = xmlReader.readElementText() == "1";
}
else if (XML_NAME_EQUALS(name, "IsAppCollectorGame")) {
apps.last().isAppCollectorGame = xmlReader.readElementText() == "1";
}
}
}
}
@@ -334,7 +356,7 @@ NvHTTP::verifyResponseStatus(QString xml)
while (xmlReader.readNextStartElement())
{
if (xmlReader.name() == QString("root"))
if (XML_NAME_EQUALS(xmlReader.name(), "root"))
{
// Status code can be 0xFFFFFFFF in some rare cases on GFE 3.20.3, and
// QString::toInt() will fail in that case, so use QString::toUInt()
@@ -385,13 +407,7 @@ QByteArray
NvHTTP::getXmlStringFromHex(QString xml,
QString tagName)
{
QString str = getXmlString(xml, tagName);
if (str == nullptr)
{
return nullptr;
}
return QByteArray::fromHex(str.toLatin1());
return QByteArray::fromHex(getXmlString(xml, tagName).toUtf8());
}
QString
@@ -413,7 +429,7 @@ NvHTTP::getXmlString(QString xml,
}
}
return nullptr;
return QString();
}
void NvHTTP::handleSslErrors(QNetworkReply* reply, const QList<QSslError>& errors)
@@ -476,11 +492,9 @@ NvHTTP::openConnection(QUrl baseUrl,
QUrl url(baseUrl);
url.setPath("/" + command);
// Use a common UID for Moonlight clients to allow them to quit
// games for each other (otherwise GFE gets screwed up and it requires
// manual intervention to solve).
url.setQuery("uniqueid=0123456789ABCDEF&uuid=" +
QUuid::createUuid().toRfc4122().toHex() +
// Use a placeholder UID for GFE allow them to quit games for each other.
url.setQuery("uniqueid=" + (m_UseTrueUid ? IdentityManager::get()->getUniqueId() : "0123456789ABCDEF") +
"&uuid=" + QUuid::createUuid().toRfc4122().toHex() +
((arguments != nullptr) ? ("&" + arguments) : ""));
QNetworkRequest request(url);
@@ -493,15 +507,15 @@ NvHTTP::openConnection(QUrl baseUrl,
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, false);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) && QT_VERSION < QT_VERSION_CHECK(5, 15, 1) && !defined(QT_NO_BEARERMANAGEMENT)
// HACK: Set network accessibility to work around QTBUG-80947 (introduced in Qt 5.14.0 and fixed in Qt 5.15.1)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
m_Nam.setNetworkAccessible(QNetworkAccessManager::Accessible);
QT_WARNING_POP
#if QT_VERSION >= QT_VERSION_CHECK(6, 3, 0)
// Use fine-grained idle timeouts to avoid calling QNetworkAccessManager::clearAccessCache(),
// which tears down the NAM's global thread each time. We must not keep persistent connections
// or GFE will puke.
request.setAttribute(QNetworkRequest::ConnectionCacheExpiryTimeoutSecondsAttribute, 0);
#endif
QNetworkReply* reply = m_Nam.get(request);
auto sslErrorsConnection = connect(m_Nam, &QNetworkAccessManager::sslErrors, this, &NvHTTP::handleSslErrors);
QNetworkReply* reply = m_Nam->get(request);
// Run the request with a timeout if requested
QEventLoop loop;
@@ -524,9 +538,11 @@ NvHTTP::openConnection(QUrl baseUrl,
reply->abort();
}
// We must clear out cached authentication and connections or
// GFE will puke next time
m_Nam.clearAccessCache();
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
// If we couldn't use fine-grained connection idle timeouts, kill them all now
m_Nam->clearAccessCache();
#endif
disconnect(sslErrorsConnection);
// Handle error
if (reply->error() != QNetworkReply::NoError)
+15 -14
View File
@@ -33,19 +33,19 @@ class GfeHttpResponseException : public std::exception
public:
GfeHttpResponseException(int statusCode, QString message) :
m_StatusCode(statusCode),
m_StatusMessage(message)
m_StatusMessage(message.toUtf8())
{
}
const char* what() const throw()
{
return m_StatusMessage.toLatin1();
return m_StatusMessage.constData();
}
const char* getStatusMessage() const
{
return m_StatusMessage.toLatin1();
return m_StatusMessage.constData();
}
int getStatusCode() const
@@ -55,12 +55,12 @@ public:
QString toQString() const
{
return m_StatusMessage + " (Error " + QString::number(m_StatusCode) + ")";
return QString::fromUtf8(m_StatusMessage) + " (Error " + QString::number(m_StatusCode) + ")";
}
private:
int m_StatusCode;
QString m_StatusMessage;
QByteArray m_StatusMessage;
};
class QtNetworkReplyException : public std::exception
@@ -68,19 +68,19 @@ class QtNetworkReplyException : public std::exception
public:
QtNetworkReplyException(QNetworkReply::NetworkError error, QString errorText) :
m_Error(error),
m_ErrorText(errorText)
m_ErrorText(errorText.toUtf8())
{
}
const char* what() const throw()
{
return m_ErrorText.toLatin1();
return m_ErrorText.constData();
}
const char* getErrorText() const
{
return m_ErrorText.toLatin1();
return m_ErrorText.constData();
}
QNetworkReply::NetworkError getError() const
@@ -90,12 +90,12 @@ public:
QString toQString() const
{
return m_ErrorText + " (Error " + QString::number(m_Error) + ")";
return QString::fromUtf8(m_ErrorText) + " (Error " + QString::number(m_Error) + ")";
}
private:
QNetworkReply::NetworkError m_Error;
QString m_ErrorText;
QByteArray m_ErrorText;
};
class NvHTTP : public QObject
@@ -109,9 +109,9 @@ public:
NVLL_VERBOSE
};
explicit NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert);
explicit NvHTTP(NvAddress address, uint16_t httpsPort, QSslCertificate serverCert, bool useTrueUid, QNetworkAccessManager* nam = nullptr);
explicit NvHTTP(NvComputer* computer);
explicit NvHTTP(NvComputer* computer, QNetworkAccessManager* nam = nullptr);
static
int
@@ -142,9 +142,9 @@ public:
NvLogLevel logLevel = NvLogLevel::NVLL_VERBOSE);
void setServerCert(QSslCertificate serverCert);
void setAddress(NvAddress address);
void setHttpsPort(uint16_t port);
void setTrueUid(bool useTrueUid);
NvAddress address();
@@ -196,6 +196,7 @@ private:
NvLogLevel logLevel);
NvAddress m_Address;
QNetworkAccessManager m_Nam;
QNetworkAccessManager* m_Nam;
QSslCertificate m_ServerCert;
bool m_UseTrueUid;
};
+51 -34
View File
@@ -54,16 +54,18 @@ NvPairingManager::generateRandomBytes(int length)
QByteArray
NvPairingManager::encrypt(const QByteArray& plaintext, const QByteArray& key)
{
QByteArray ciphertext(plaintext.size(), 0);
EVP_CIPHER_CTX* cipher;
int ciphertextLen;
if (plaintext.isEmpty()) {
return QByteArray();
}
cipher = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX* cipher = EVP_CIPHER_CTX_new();
THROW_BAD_ALLOC_IF_NULL(cipher);
EVP_EncryptInit(cipher, EVP_aes_128_ecb(), reinterpret_cast<const unsigned char*>(key.data()), NULL);
EVP_CIPHER_CTX_set_padding(cipher, 0);
QByteArray ciphertext(plaintext.size(), 0);
int ciphertextLen;
EVP_EncryptUpdate(cipher,
reinterpret_cast<unsigned char*>(ciphertext.data()),
&ciphertextLen,
@@ -79,16 +81,18 @@ NvPairingManager::encrypt(const QByteArray& plaintext, const QByteArray& key)
QByteArray
NvPairingManager::decrypt(const QByteArray& ciphertext, const QByteArray& key)
{
QByteArray plaintext(ciphertext.size(), 0);
EVP_CIPHER_CTX* cipher;
int plaintextLen;
if (ciphertext.isEmpty()) {
return QByteArray();
}
cipher = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX* cipher = EVP_CIPHER_CTX_new();
THROW_BAD_ALLOC_IF_NULL(cipher);
EVP_DecryptInit(cipher, EVP_aes_128_ecb(), reinterpret_cast<const unsigned char*>(key.data()), NULL);
EVP_CIPHER_CTX_set_padding(cipher, 0);
QByteArray plaintext(ciphertext.size(), 0);
int plaintextLen;
EVP_DecryptUpdate(cipher,
reinterpret_cast<unsigned char*>(plaintext.data()),
&plaintextLen,
@@ -101,6 +105,29 @@ NvPairingManager::decrypt(const QByteArray& ciphertext, const QByteArray& key)
return plaintext;
}
QByteArray
NvPairingManager::getSignatureFromCert(X509* cert)
{
#if (OPENSSL_VERSION_NUMBER < 0x10002000L)
ASN1_BIT_STRING *asnSignature = cert->signature;
#elif (OPENSSL_VERSION_NUMBER < 0x10100000L)
ASN1_BIT_STRING *asnSignature;
X509_get0_signature(&asnSignature, NULL, cert);
#else
const ASN1_BIT_STRING *asnSignature;
X509_get0_signature(&asnSignature, NULL, cert);
#endif
return QByteArray(
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
reinterpret_cast<const char*>(ASN1_STRING_data(asnSignature)),
#else
reinterpret_cast<const char*>(ASN1_STRING_get0_data(asnSignature)),
#endif
ASN1_STRING_length(asnSignature)
);
}
QByteArray
NvPairingManager::getSignatureFromPemCert(const QByteArray& certificate)
{
@@ -114,18 +141,7 @@ NvPairingManager::getSignatureFromPemCert(const QByteArray& certificate)
X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr);
BIO_free_all(bio);
#if (OPENSSL_VERSION_NUMBER < 0x10002000L)
ASN1_BIT_STRING *asnSignature = cert->signature;
#elif (OPENSSL_VERSION_NUMBER < 0x10100000L)
ASN1_BIT_STRING *asnSignature;
X509_get0_signature(&asnSignature, NULL, cert);
#else
const ASN1_BIT_STRING *asnSignature;
X509_get0_signature(&asnSignature, NULL, cert);
#endif
QByteArray signature(reinterpret_cast<char*>(asnSignature->data), asnSignature->length);
QByteArray signature = getSignatureFromCert(cert);
X509_free(cert);
return signature;
@@ -184,7 +200,7 @@ NvPairingManager::signMessage(const QByteArray& message)
QByteArray
NvPairingManager::saltPin(const QByteArray& salt, QString pin)
{
return QByteArray().append(salt).append(pin.toLatin1());
return QByteArray().append(salt).append(pin.toUtf8());
}
NvPairingManager::PairState
@@ -227,8 +243,7 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
}
QByteArray serverCertStr = NvHTTP::getXmlStringFromHex(getCert, "plaincert");
if (serverCertStr == nullptr)
{
if (serverCertStr.isEmpty()) {
qCritical() << "Server likely already pairing";
m_Http.openConnectionToString(m_Http.m_BaseUrlHttp, "unpair", nullptr, REQUEST_TIMEOUT_MS);
return PairState::ALREADY_IN_PROGRESS;
@@ -263,22 +278,18 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
}
QByteArray challengeResponseData = decrypt(m_Http.getXmlStringFromHex(challengeXml, "challengeresponse"), aesKey);
if (challengeResponseData.size() < hashLength) {
qCritical() << "Invalid challengeresponse at stage #2";
m_Http.openConnectionToString(m_Http.m_BaseUrlHttp, "unpair", nullptr, REQUEST_TIMEOUT_MS);
return PairState::FAILED;
}
QByteArray clientSecretData = generateRandomBytes(16);
QByteArray challengeResponse;
QByteArray serverResponse(challengeResponseData.data(), hashLength);
#if (OPENSSL_VERSION_NUMBER < 0x10002000L)
ASN1_BIT_STRING *asnSignature = m_Cert->signature;
#elif (OPENSSL_VERSION_NUMBER < 0x10100000L)
ASN1_BIT_STRING *asnSignature;
X509_get0_signature(&asnSignature, NULL, m_Cert);
#else
const ASN1_BIT_STRING *asnSignature;
X509_get0_signature(&asnSignature, NULL, m_Cert);
#endif
challengeResponse.append(challengeResponseData.data() + hashLength, 16);
challengeResponse.append(reinterpret_cast<char*>(asnSignature->data), asnSignature->length);
challengeResponse.append(getSignatureFromCert(m_Cert));
challengeResponse.append(clientSecretData);
QByteArray paddedHash = QCryptographicHash::hash(challengeResponse, hashAlgo);
@@ -298,6 +309,12 @@ NvPairingManager::pair(QString appVersion, QString pin, QSslCertificate& serverC
}
QByteArray pairingSecret = NvHTTP::getXmlStringFromHex(respXml, "pairingsecret");
if (pairingSecret.size() <= 16) {
qCritical() << "Invalid pairingsecret at stage #3";
m_Http.openConnectionToString(m_Http.m_BaseUrlHttp, "unpair", nullptr, REQUEST_TIMEOUT_MS);
return PairState::FAILED;
}
QByteArray serverSecret = pairingSecret.left(16);
QByteArray serverSignature = pairingSecret.mid(16);
+3
View File
@@ -37,6 +37,9 @@ private:
QByteArray
decrypt(const QByteArray& ciphertext, const QByteArray& key);
QByteArray
getSignatureFromCert(X509* cert);
QByteArray
getSignatureFromPemCert(const QByteArray& certificate);
+107 -87
View File
@@ -12,6 +12,38 @@
#include <Windows.h>
#endif
class SystemPropertyQueryThread : public QThread
{
public:
SystemPropertyQueryThread(SystemProperties* properties)
: QThread(properties), m_Properties(properties)
{
setObjectName("System Properties Async Query Thread");
}
private:
void run() override
{
bool hasHardwareAcceleration;
bool rendererAlwaysFullScreen;
bool supportsHdr;
QSize maximumResolution;
Session::getDecoderInfo(m_Properties->testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, supportsHdr, maximumResolution);
// Propagate the decoder properties to the SystemProperties singleton and emit any change signals on the main thread
QMetaObject::invokeMethod(m_Properties, "updateDecoderProperties",
Qt::QueuedConnection,
Q_ARG(bool, hasHardwareAcceleration),
Q_ARG(bool, rendererAlwaysFullScreen),
Q_ARG(QSize, maximumResolution),
Q_ARG(bool, supportsHdr));
}
private:
SystemProperties* m_Properties;
};
SystemProperties::SystemProperties()
{
versionString = QString(VERSION_STR);
@@ -25,9 +57,8 @@ SystemProperties::SystemProperties()
{
USHORT processArch, machineArch;
// Use IsWow64Process2 on TH2 and later, because it supports ARM64
auto fnIsWow64Process2 = (decltype(IsWow64Process2)*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsWow64Process2");
if (fnIsWow64Process2 != nullptr && fnIsWow64Process2(GetCurrentProcess(), &processArch, &machineArch)) {
// Use IsWow64Process2() because it doesn't lie on ARM64
if (IsWow64Process2(GetCurrentProcess(), &processArch, &machineArch)) {
switch (machineArch) {
case IMAGE_FILE_MACHINE_I386:
nativeArch = "i386";
@@ -66,68 +97,86 @@ SystemProperties::SystemProperties()
hasDiscordIntegration = false;
#endif
unmappedGamepads = SdlInputHandler::getUnmappedGamepads();
// These will be queried asynchronously to avoid blocking the UI
hasHardwareAcceleration = true;
rendererAlwaysFullScreen = false;
supportsHdr = true;
maximumResolution = QSize(0, 0);
}
// Populate data that requires talking to SDL. We do it all in one shot
// and cache the results to speed up future queries on this data.
querySdlVideoInfo();
SystemProperties::~SystemProperties()
{
waitForAsyncLoad();
}
Q_ASSERT(!monitorRefreshRates.isEmpty());
Q_ASSERT(!monitorNativeResolutions.isEmpty());
Q_ASSERT(!monitorSafeAreaResolutions.isEmpty());
void SystemProperties::updateDecoderProperties(bool hasHardwareAcceleration, bool rendererAlwaysFullScreen, QSize maximumResolution, bool supportsHdr)
{
SDL_assert(testWindow);
if (hasHardwareAcceleration != this->hasHardwareAcceleration) {
this->hasHardwareAcceleration = hasHardwareAcceleration;
emit hasHardwareAccelerationChanged();
}
if (rendererAlwaysFullScreen != this->rendererAlwaysFullScreen) {
this->rendererAlwaysFullScreen = rendererAlwaysFullScreen;
emit rendererAlwaysFullScreenChanged();
}
if (maximumResolution != this->maximumResolution) {
this->maximumResolution = maximumResolution;
emit maximumResolutionChanged();
}
if (supportsHdr != this->supportsHdr) {
this->supportsHdr = supportsHdr;
emit supportsHdrChanged();
}
SDL_DestroyWindow(testWindow);
testWindow = nullptr;
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
QRect SystemProperties::getNativeResolution(int displayIndex)
{
// Returns default constructed QRect if out of bounds
Q_ASSERT(!monitorNativeResolutions.isEmpty());
return monitorNativeResolutions.value(displayIndex);
}
QRect SystemProperties::getSafeAreaResolution(int displayIndex)
{
// Returns default constructed QRect if out of bounds
Q_ASSERT(!monitorSafeAreaResolutions.isEmpty());
return monitorSafeAreaResolutions.value(displayIndex);
}
int SystemProperties::getRefreshRate(int displayIndex)
{
// Returns 0 if out of bounds
Q_ASSERT(!monitorRefreshRates.isEmpty());
return monitorRefreshRates.value(displayIndex);
}
class QuerySdlVideoThread : public QThread
void SystemProperties::startAsyncLoad()
{
public:
QuerySdlVideoThread(SystemProperties* me) :
QThread(nullptr),
m_Me(me) {}
void run() override
{
m_Me->querySdlVideoInfoInternal();
if (systemPropertyQueryThread) {
// Already started/completed
return;
}
SystemProperties* m_Me;
};
void SystemProperties::querySdlVideoInfo()
{
if (WMUtils::isRunningX11() || WMUtils::isRunningWayland()) {
// Use a separate thread to temporarily initialize SDL
// video to avoid stomping on Qt's X11 and OGL state.
QuerySdlVideoThread thread(this);
thread.start();
thread.wait();
// This isn't actually asynchronous (due to the need to synchronize with
// SdlGamepadKeyNavigation), but we don't query it in the constructor
// because it's expensive.
unmappedGamepads = SdlInputHandler::getUnmappedGamepads();
if (!unmappedGamepads.isEmpty()) {
emit unmappedGamepadsChanged();
}
else {
querySdlVideoInfoInternal();
}
}
void SystemProperties::querySdlVideoInfoInternal()
{
hasHardwareAcceleration = false;
// We initialize the video subsystem and test window on the main thread
// because some platforms (macOS) do not support window creation on
// non-main threads.
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"SDL_InitSubSystem(SDL_INIT_VIDEO) failed: %s",
@@ -135,64 +184,34 @@ void SystemProperties::querySdlVideoInfoInternal()
return;
}
// Update display related attributes (max FPS, native resolution, etc).
// We call the internal variant because we're already in a safe thread context.
refreshDisplaysInternal();
SDL_Window* testWindow = SDL_CreateWindow("", 0, 0, 1280, 720,
SDL_WINDOW_HIDDEN | StreamUtils::getPlatformWindowFlags());
testWindow = StreamUtils::createTestWindow();
if (!testWindow) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
"Failed to create test window with platform flags: %s",
SDL_GetError());
testWindow = SDL_CreateWindow("", 0, 0, 1280, 720, SDL_WINDOW_HIDDEN);
if (!testWindow) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Failed to create window for hardware decode test: %s",
SDL_GetError());
SDL_QuitSubSystem(SDL_INIT_VIDEO);
return;
}
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"Failed to create window for hardware decode test: %s",
SDL_GetError());
SDL_QuitSubSystem(SDL_INIT_VIDEO);
return;
}
Session::getDecoderInfo(testWindow, hasHardwareAcceleration, rendererAlwaysFullScreen, supportsHdr, maximumResolution);
// Update display related attributes (max FPS, native resolution, etc).
//
// NB: SDL3 will forcefully refresh displays when a window is created,
// so we place this after the window creation to ensure we don't pay
// the penalty for mode enumeration twice.
refreshDisplays();
SDL_DestroyWindow(testWindow);
SDL_QuitSubSystem(SDL_INIT_VIDEO);
systemPropertyQueryThread = new SystemPropertyQueryThread(this);
systemPropertyQueryThread->start();
}
class RefreshDisplaysThread : public QThread
void SystemProperties::waitForAsyncLoad()
{
public:
RefreshDisplaysThread(SystemProperties* me) :
QThread(nullptr),
m_Me(me) {}
void run() override
{
m_Me->refreshDisplaysInternal();
if (systemPropertyQueryThread) {
systemPropertyQueryThread->wait();
}
SystemProperties* m_Me;
};
}
void SystemProperties::refreshDisplays()
{
if (WMUtils::isRunningX11() || WMUtils::isRunningWayland()) {
// Use a separate thread to temporarily initialize SDL
// video to avoid stomping on Qt's X11 and OGL state.
RefreshDisplaysThread thread(this);
thread.start();
thread.wait();
}
else {
refreshDisplaysInternal();
}
}
void SystemProperties::refreshDisplaysInternal()
{
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
@@ -221,7 +240,8 @@ void SystemProperties::refreshDisplaysInternal()
// Start at desktop mode and work our way up
bestMode = desktopMode;
for (int i = 0; i < SDL_GetNumDisplayModes(displayIndex); i++) {
int numDisplayModes = SDL_GetNumDisplayModes(displayIndex);
for (int i = 0; i < numDisplayModes; i++) {
SDL_DisplayMode mode;
if (SDL_GetDisplayMode(displayIndex, i, &mode) == 0) {
if (mode.w == desktopMode.w && mode.h == desktopMode.h) {
+38 -18
View File
@@ -3,18 +3,19 @@
#include <QObject>
#include <QRect>
#include "SDL_compat.h"
class SystemProperties : public QObject
{
Q_OBJECT
friend class QuerySdlVideoThread;
friend class RefreshDisplaysThread;
friend class SystemPropertyQueryThread;
public:
SystemProperties();
~SystemProperties();
Q_PROPERTY(bool hasHardwareAcceleration MEMBER hasHardwareAcceleration CONSTANT)
Q_PROPERTY(bool rendererAlwaysFullScreen MEMBER rendererAlwaysFullScreen CONSTANT)
// Static properties queried synchronously during the constructor
Q_PROPERTY(bool isRunningWayland MEMBER isRunningWayland CONSTANT)
Q_PROPERTY(bool isRunningXWayland MEMBER isRunningXWayland CONSTANT)
Q_PROPERTY(bool isWow64 MEMBER isWow64 CONSTANT)
@@ -22,27 +23,40 @@ public:
Q_PROPERTY(bool hasDesktopEnvironment MEMBER hasDesktopEnvironment CONSTANT)
Q_PROPERTY(bool hasBrowser MEMBER hasBrowser CONSTANT)
Q_PROPERTY(bool hasDiscordIntegration MEMBER hasDiscordIntegration CONSTANT)
Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged)
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution CONSTANT)
Q_PROPERTY(QString versionString MEMBER versionString CONSTANT)
Q_PROPERTY(bool supportsHdr MEMBER supportsHdr CONSTANT)
Q_PROPERTY(bool usesMaterial3Theme MEMBER usesMaterial3Theme CONSTANT)
Q_PROPERTY(QString versionString MEMBER versionString CONSTANT)
Q_INVOKABLE void refreshDisplays();
// Properties queried asynchronously (startAsyncLoad() must be called!)
Q_PROPERTY(bool hasHardwareAcceleration MEMBER hasHardwareAcceleration NOTIFY hasHardwareAccelerationChanged)
Q_PROPERTY(bool rendererAlwaysFullScreen MEMBER rendererAlwaysFullScreen NOTIFY rendererAlwaysFullScreenChanged)
Q_PROPERTY(QString unmappedGamepads MEMBER unmappedGamepads NOTIFY unmappedGamepadsChanged)
Q_PROPERTY(QSize maximumResolution MEMBER maximumResolution NOTIFY maximumResolutionChanged)
Q_PROPERTY(bool supportsHdr MEMBER supportsHdr NOTIFY supportsHdrChanged)
// Either startAsyncLoad()+waitForAsyncLoad() or refreshDisplays() must be invoked first
Q_INVOKABLE QRect getNativeResolution(int displayIndex);
Q_INVOKABLE QRect getSafeAreaResolution(int displayIndex);
Q_INVOKABLE int getRefreshRate(int displayIndex);
Q_INVOKABLE void startAsyncLoad();
Q_INVOKABLE void waitForAsyncLoad();
Q_INVOKABLE void refreshDisplays();
signals:
void unmappedGamepadsChanged();
void hasHardwareAccelerationChanged();
void rendererAlwaysFullScreenChanged();
void maximumResolutionChanged();
void supportsHdrChanged();
private slots:
void updateDecoderProperties(bool hasHardwareAcceleration, bool rendererAlwaysFullScreen, QSize maximumResolution, bool supportsHdr);
private:
void querySdlVideoInfo();
void querySdlVideoInfoInternal();
void refreshDisplaysInternal();
QThread* systemPropertyQueryThread = nullptr;
SDL_Window* testWindow = nullptr;
bool hasHardwareAcceleration;
bool rendererAlwaysFullScreen;
// Properties set by the constructor
bool isRunningWayland;
bool isRunningXWayland;
bool isWow64;
@@ -50,13 +64,19 @@ private:
bool hasDesktopEnvironment;
bool hasBrowser;
bool hasDiscordIntegration;
QString unmappedGamepads;
QString versionString;
bool usesMaterial3Theme;
// Properties only set if startAsyncLoad() is called
bool hasHardwareAcceleration;
bool rendererAlwaysFullScreen;
QSize maximumResolution;
bool supportsHdr;
QString unmappedGamepads;
// Properties set by refreshDisplays()
QList<QRect> monitorNativeResolutions;
QList<QRect> monitorSafeAreaResolutions;
QList<int> monitorRefreshRates;
QString versionString;
bool supportsHdr;
bool usesMaterial3Theme;
};
+3 -10
View File
@@ -59,13 +59,6 @@ public:
void showMessage(QString message, MessageType type) const
{
#if defined(Q_OS_WIN32)
UINT flags = MB_OK | MB_TOPMOST | MB_SETFOREGROUND;
flags |= (type == Info ? MB_ICONINFORMATION : MB_ICONERROR);
QString title = "Moonlight";
MessageBoxW(nullptr, reinterpret_cast<const wchar_t *>(message.utf16()),
reinterpret_cast<const wchar_t *>(title.utf16()), flags);
#endif
message = message.endsWith('\n') ? message : message + '\n';
fputs(qPrintable(message), type == Info ? stdout : stderr);
}
@@ -113,7 +106,7 @@ public:
QPair<int,int> getResolutionOptionValue(QString name) const
{
QRegularExpression re("^(\\d+)x(\\d+)$", QRegularExpression::CaseInsensitiveOption);
static QRegularExpression re("^(\\d+)x(\\d+)$", QRegularExpression::CaseInsensitiveOption);
auto match = re.match(value(name));
if (!match.hasMatch()) {
showError(QString("Invalid %1 format: %2").arg(name, value(name)));
@@ -202,7 +195,7 @@ GlobalCommandLineParser::ParseResult GlobalCommandLineParser::parse(const QStrin
}
}
parser.showError(QString("Invalid action"));
parser.showError("Invalid action");
}
}
@@ -386,7 +379,7 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
parser.handleUnknownOptions();
// Resolve display's width and height
QRegularExpression resolutionRexExp("^(720|1080|1440|4K|resolution)$");
static QRegularExpression resolutionRexExp("^(720|1080|1440|4K|resolution)$");
QStringList resoOptions = parser.optionNames().filter(resolutionRexExp);
bool displaySet = !resoOptions.isEmpty();
if (displaySet) {
+19 -31
View File
@@ -5,10 +5,8 @@
#include "backend/computerseeker.h"
#include <QCoreApplication>
#include <QTimer>
#define COMPUTER_SEEK_TIMEOUT 30000
#define APP_SEEK_TIMEOUT 10000
namespace CliListApps
{
@@ -16,8 +14,7 @@ namespace CliListApps
enum State {
StateInit,
StateSeekComputer,
StateListApp,
StateSeekApp,
StateListApps,
StateFailure,
};
@@ -26,7 +23,6 @@ class Event
public:
enum Type {
ComputerFound,
ComputerUpdated,
ComputerSeekTimedout,
Executed,
};
@@ -66,9 +62,6 @@ public:
q, &Launcher::onComputerSeekTimeout);
m_ComputerSeeker->start(COMPUTER_SEEK_TIMEOUT);
q->connect(m_ComputerManager, &ComputerManager::computerStateChanged,
q, &Launcher::onComputerUpdated);
m_BoxArtManager = new BoxArtManager(q);
if (m_Arguments.isVerbose()) {
@@ -88,12 +81,28 @@ public:
case Event::ComputerFound:
if (m_State == StateSeekComputer) {
if (event.computer->pairState == NvComputer::PS_PAIRED) {
m_State = StateSeekApp;
m_State = StateListApps;
m_Computer = event.computer;
m_TimeoutTimer->start(APP_SEEK_TIMEOUT);
if (m_Arguments.isVerbose()) {
fprintf(stdout, "Loading app list...\n");
}
// To avoid race conditions where ComputerSeeker stops async polling, but
// ComputerManager is yet to update the app list, we will explicitly fetch the latest app list.
// Otherwise, it becomes complicated as we would have to guess whether ComputerManager
// would emit 1 signal (the list did not change) or 2 signals (indicating that the list has changed)
try {
NvHTTP http{m_Computer};
const auto appList = http.getAppList();
m_Arguments.isPrintCSV() ? printAppsCSV(appList) : printApps(appList);
QCoreApplication::exit(0);
} catch (std::exception& exception) {
fprintf(stderr, "%s\n", exception.what());
QCoreApplication::exit(1);
}
} else {
m_State = StateFailure;
fprintf(stderr, "%s\n", qPrintable(QObject::tr("Computer %1 has not been paired. "
@@ -104,14 +113,6 @@ public:
}
}
break;
// Occurs when a computer is updated
case Event::ComputerUpdated:
if (m_State == StateSeekApp) {
m_Arguments.isPrintCSV() ? printAppsCSV(m_Computer->appList) : printApps(m_Computer->appList);
QCoreApplication::exit(0);
}
break;
}
}
@@ -146,7 +147,6 @@ public:
BoxArtManager *m_BoxArtManager;
NvComputer *m_Computer;
State m_State;
QTimer *m_TimeoutTimer;
ListCommandLineParser m_Arguments;
};
@@ -157,11 +157,7 @@ Launcher::Launcher(QString computer, ListCommandLineParser arguments, QObject *p
Q_D(Launcher);
d->m_ComputerName = computer;
d->m_State = StateInit;
d->m_TimeoutTimer = new QTimer(this);
d->m_TimeoutTimer->setSingleShot(true);
d->m_Arguments = arguments;
connect(d->m_TimeoutTimer, &QTimer::timeout,
this, &Launcher::onComputerSeekTimeout);
}
Launcher::~Launcher()
@@ -197,12 +193,4 @@ void Launcher::onComputerSeekTimeout()
d->handleEvent(event);
}
void Launcher::onComputerUpdated(NvComputer *computer)
{
Q_D(Launcher);
Event event(Event::ComputerUpdated);
event.computer = computer;
d->handleEvent(event);
}
}
-1
View File
@@ -27,7 +27,6 @@ public:
private slots:
void onComputerFound(NvComputer *computer);
void onComputerUpdated(NvComputer *computer);
void onComputerSeekTimeout();
private:
+1 -1
View File
@@ -162,7 +162,7 @@ public:
QString getCurrentAppName() const
{
for (const NvApp& app : m_Computer->appList) {
for (const NvApp& app : std::as_const(m_Computer->appList)) {
if (m_Computer->currentGameId == app.id) {
return app.name;
}
@@ -1,40 +0,0 @@
From 78261eb6e2fe728fa5d3843b5b8962b1ca559b7e Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Sat, 16 Dec 2023 14:52:01 +0100
Subject: [PATCH] Vulkan: Don't try to reuse old swapchain
---
src/vulkan/swapchain.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/vulkan/swapchain.c b/src/vulkan/swapchain.c
index 0646e57c..c0b07ce4 100644
--- a/src/vulkan/swapchain.c
+++ b/src/vulkan/swapchain.c
@@ -612,13 +612,21 @@ static bool vk_sw_recreate(pl_swapchain sw, int w, int h)
}
#endif
+ {
+ pl_gpu_flush(gpu);
+ vk_wait_idle(vk);
+ for (int i = 0; i < vk->pool_graphics->num_queues; i++)
+ vk->QueueWaitIdle(vk->pool_graphics->queues[i]);
+ vk->DestroySwapchainKHR(vk->dev, p->swapchain, PL_VK_ALLOC);
+ }
+
// Calling `vkCreateSwapchainKHR` puts sinfo.oldSwapchain into a retired
// state whether the call succeeds or not, so we always need to garbage
// collect it afterwards - asynchronously as it may still be in use
- sinfo.oldSwapchain = p->swapchain;
+ /* sinfo.oldSwapchain = p->swapchain; */
p->swapchain = VK_NULL_HANDLE;
VkResult res = vk->CreateSwapchainKHR(vk->dev, &sinfo, PL_VK_ALLOC, &p->swapchain);
- vk_dev_callback(vk, VK_CB_FUNC(destroy_swapchain), vk, vk_wrap_handle(sinfo.oldSwapchain));
+ /* vk_dev_callback(vk, VK_CB_FUNC(destroy_swapchain), vk, vk_wrap_handle(sinfo.oldSwapchain)); */
PL_VK_ASSERT(res, "vk->CreateSwapchainKHR(...)");
// Get the new swapchain images
--
2.43.0
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<component type="desktop-application">
<id>com.moonlight_stream.Moonlight</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
@@ -10,7 +10,7 @@
<p>Moonlight can stream games and other applications from another PC with Sunshine or GeForce Experience software installed.</p>
<p>Features include:</p>
<ul>
<li>Hardware accelerated video decoding with VAAPI, VDPAU, and NVDEC support</li>
<li>Hardware accelerated video decoding with VAAPI, VDPAU, and Vulkan Video support</li>
<li>H.264, HEVC, and AV1 codec support</li>
<li>7.1 surround sound audio support</li>
<li>10-point multitouch support</li>
@@ -23,13 +23,30 @@
<url type="homepage">https://moonlight-stream.org</url>
<url type="bugtracker">https://github.com/moonlight-stream/moonlight-qt/issues</url>
<url type="help">https://github.com/moonlight-stream/moonlight-docs/wiki/Setup-Guide</url>
<url type="vcs-browser">https://github.com/moonlight-stream/moonlight-qt</url>
<developer id="org.moonlight-stream">
<name>Moonlight Game Streaming Team</name>
</developer>
<update_contact>cameron@moonlight-stream.org</update_contact>
<launchable type="desktop-id">com.moonlight_stream.Moonlight.desktop</launchable>
<provides>
<binary>moonlight</binary>
</provides>
<content_rating type="oars-1.1" />
<branding>
<color type="primary" scheme_preference="light">#710085</color>
<color type="primary" scheme_preference="dark">#55285d</color>
</branding>
<screenshots>
<screenshot type="default">
<image>https://moonlight-stream.org/appstream_resources/moonlight_screenshot_1.png</image>
<caption>Host selection page showing local PCs</caption>
</screenshot>
<screenshot>
<image>https://moonlight-stream.org/appstream_resources/moonlight_screenshot_2.png</image>
<caption>Settings page displaying streaming options</caption>
</screenshot>
</screenshots>
@@ -816,19 +833,4 @@
</release>
</releases>
<categories>
<category>Game</category>
<category>Qt</category>
</categories>
<developer_name>Moonlight Game Streaming Team</developer_name>
<update_contact>cameron@moonlight-stream.org</update_contact>
<launchable type="desktop-id">com.moonlight_stream.Moonlight.desktop</launchable>
<provides>
<binary>moonlight</binary>
</provides>
<content_rating type="oars-1.0" />
</component>
@@ -5,5 +5,5 @@ Exec=moonlight
Icon=moonlight
Terminal=false
Type=Application
Categories=Qt;Game;
Categories=Qt;Game;Network;RemoteAccess;
Keywords=nvidia;gamestream;stream;sunshine;remote play;
+1 -1
View File
@@ -14,4 +14,4 @@ renice -10 -p $(pidof PE_Single_CPU)
# Renice Moonlight itself to avoid preemption by background tasks
# Write output to a logfile in /tmp
exec nice -n -10 ./bin/moonlight > /tmp/moonlight.log
exec nice -n -10 ./bin/moonlight > /tmp/moonlight.log 2>&1
+30 -24
View File
@@ -38,7 +38,7 @@ CenteredGridView {
activated = true
// Highlight the first item if a gamepad is connected
if (currentIndex == -1 && SdlGamepadKeyNavigation.getConnectedGamepads() > 0) {
if (currentIndex === -1 && SdlGamepadKeyNavigation.getConnectedGamepads() > 0) {
currentIndex = 0
}
@@ -94,9 +94,9 @@ CenteredGridView {
// the image size checks if this is not an app collector game. We know the officially
// supported games all have box art, so this check is not required.
if (!model.isAppCollectorGame &&
((sourceSize.width == 130 && sourceSize.height == 180) || // GFE 2.0 placeholder image
(sourceSize.width == 628 && sourceSize.height == 888) || // GFE 3.0 placeholder image
(sourceSize.width == 200 && sourceSize.height == 266))) // Our no_app_image.png
((sourceSize.width === 130 && sourceSize.height === 180) || // GFE 2.0 placeholder image
(sourceSize.width === 628 && sourceSize.height === 888) || // GFE 3.0 placeholder image
(sourceSize.width === 200 && sourceSize.height === 266))) // Our no_app_image.png
{
isPlaceholder = true
}
@@ -123,20 +123,18 @@ CenteredGridView {
sourceComponent: Item {
RoundButton {
// Don't steal focus from the toolbar buttons
focusPolicy: Qt.NoFocus
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? -47 : 0
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : -60
anchors.centerIn: parent
implicitWidth: 85
implicitHeight: 85
Image {
source: "qrc:/res/play_arrow_FILL1_wght700_GRAD200_opsz48.svg"
anchors.centerIn: parent
sourceSize {
width: 75
height: 75
}
}
icon.source: "qrc:/res/play_arrow_FILL1_wght700_GRAD200_opsz48.svg"
icon.width: 75
icon.height: 75
onClicked: {
launchOrResumeSelectedApp(true)
@@ -151,20 +149,18 @@ CenteredGridView {
}
RoundButton {
// Don't steal focus from the toolbar buttons
focusPolicy: Qt.NoFocus
anchors.horizontalCenterOffset: appIcon.isPlaceholder ? 47 : 0
anchors.verticalCenterOffset: appIcon.isPlaceholder ? -75 : 60
anchors.centerIn: parent
implicitWidth: 85
implicitHeight: 85
Image {
source: "qrc:/res/stop_FILL1_wght700_GRAD200_opsz48.svg"
anchors.centerIn: parent
sourceSize {
width: 75
height: 75
}
}
icon.source: "qrc:/res/stop_FILL1_wght700_GRAD200_opsz48.svg"
icon.width: 75
icon.height: 75
onClicked: {
doQuitGame()
@@ -298,19 +294,17 @@ CenteredGridView {
asynchronous: true
sourceComponent: NavigableMenu {
id: appContextMenu
initiator: appContextMenuLoader.parent
NavigableMenuItem {
parentMenu: appContextMenu
text: model.running ? qsTr("Resume Game") : qsTr("Launch Game")
onTriggered: launchOrResumeSelectedApp(true)
}
NavigableMenuItem {
parentMenu: appContextMenu
text: qsTr("Quit Game")
onTriggered: doQuitGame()
visible: model.running
}
NavigableMenuItem {
parentMenu: appContextMenu
checkable: true
checked: model.directLaunch
text: qsTr("Direct Launch")
@@ -323,7 +317,6 @@ CenteredGridView {
ToolTip.visible: hovered
}
NavigableMenuItem {
parentMenu: appContextMenu
checkable: true
checked: model.hidden
text: qsTr("Hide Game")
@@ -339,6 +332,19 @@ CenteredGridView {
}
}
Row {
anchors.centerIn: parent
spacing: 5
visible: appGrid.count === 0
Label {
text: qsTr("This computer doesn't seem to have any applications or some applications are hidden")
font.pointSize: 20
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
}
}
NavigableMessageDialog {
id: quitAppDialog
property string appName : ""
+8
View File
@@ -50,4 +50,12 @@ ComboBox {
popup.onAboutToHide: {
SdlGamepadKeyNavigation.setUiNavMode(true)
}
Keys.onLeftPressed: {
decrementCurrentIndex()
}
Keys.onRightPressed: {
incrementCurrentIndex()
}
}
-18
View File
@@ -2,10 +2,6 @@ import QtQuick 2.9
import QtQuick.Controls 2.2
GridView {
// Detect Qt 5.11 or earlier using presence of synchronousDrag.
// Prior to 5.12, the leftMargin and rightMargin values did not work.
property bool hasBrokenMargins: this.synchronousDrag === undefined
property int minMargin: 10
property real availableWidth: (parent.width - 2 * minMargin)
property int itemsPerRow: availableWidth / cellWidth
@@ -15,11 +11,6 @@ GridView {
function updateMargins() {
leftMargin = horizontalMargin
rightMargin = horizontalMargin
if (hasBrokenMargins) {
anchors.leftMargin = leftMargin
anchors.rightMargin = rightMargin
}
}
onHorizontalMarginChanged: {
@@ -27,15 +18,6 @@ GridView {
}
Component.onCompleted: {
if (hasBrokenMargins) {
// This will cause an anchor conflict with the parent StackView
// which breaks animation, but otherwise the grid will not be
// centered in the window.
anchors.fill = parent
anchors.topMargin = topMargin
anchors.bottomMargin = bottomMargin
}
updateMargins()
}
+1 -5
View File
@@ -2,7 +2,6 @@ import QtQuick 2.0
import QtQuick.Controls 2.2
import ComputerManager 1.0
import SdlGamepadKeyNavigation 1.0
Item {
function onSearchingComputer() {
@@ -39,10 +38,6 @@ Item {
if (!launcher.isExecuted()) {
toolBar.visible = false
// Normally this is enabled by PcView, but we will won't
// load PcView when streaming from the command-line.
SdlGamepadKeyNavigation.enable()
launcher.searchingComputer.connect(onSearchingComputer)
launcher.pairing.connect(onPairing)
launcher.failed.connect(onFailed)
@@ -58,6 +53,7 @@ Item {
BusyIndicator {
id: stageSpinner
running: visible
}
Label {
+1
View File
@@ -34,6 +34,7 @@ Item {
BusyIndicator {
id: stageSpinner
running: visible
}
Label {
+1 -5
View File
@@ -2,7 +2,6 @@ import QtQuick 2.0
import QtQuick.Controls 2.2
import ComputerManager 1.0
import SdlGamepadKeyNavigation 1.0
Item {
function onSearchingComputer() {
@@ -38,10 +37,6 @@ Item {
if (!launcher.isExecuted()) {
toolBar.visible = false
// Normally this is enabled by PcView, but we will won't
// load PcView when streaming from the command-line.
SdlGamepadKeyNavigation.enable()
launcher.searchingComputer.connect(onSearchingComputer)
launcher.searchingApp.connect(onSearchingApp)
launcher.sessionCreated.connect(onSessionCreated)
@@ -57,6 +52,7 @@ Item {
BusyIndicator {
id: stageSpinner
running: visible
}
Label {
+6 -10
View File
@@ -1,17 +1,13 @@
import QtQuick 2.0
import QtQuick.Controls 2.2
import QtQuick.Controls 2.5
Dialog {
// We should use Overlay.overlay here but that's not available in Qt 5.9 :(
parent: ApplicationWindow.contentItem
modal: true
anchors.centerIn: Overlay.overlay
x: Math.round((parent.width - width) / 2)
y: Math.round((parent.height - height) / 2)
onAboutToHide: {
// We must force focus back to the last item for platforms without
// support for more than one active window like Steam Link. If
// we don't, gamepad and keyboard navigation will break after a
onClosed: {
// We must force focus back to the last item. If we don't,
// gamepad and keyboard navigation will break after a
// dialog appears.
stackView.forceActiveFocus()
}
+5
View File
@@ -17,6 +17,11 @@ ItemDelegate {
}
Keys.onUpPressed: {
grid.moveCurrentIndexUp()
// If we've reached the top of the grid, move focus to the toolbar
if (grid.currentItem === this) {
nextItemInFocusChain(false).forceActiveFocus(Qt.TabFocus)
}
}
Keys.onReturnPressed: {
clicked()
+11 -6
View File
@@ -2,13 +2,18 @@ import QtQuick 2.0
import QtQuick.Controls 2.2
Menu {
property var initiator
onOpened: {
// Give focus to the first visible and enabled menu item
for (var i = 0; i < count; i++) {
var item = itemAt(i)
if (item.visible && item.enabled) {
item.forceActiveFocus(Qt.TabFocusReason)
break
// If the initiating object currently has keyboard focus,
// give focus to the first visible and enabled menu item
if (initiator.focus) {
for (var i = 0; i < count; i++) {
var item = itemAt(i)
if (item.visible && item.enabled) {
item.forceActiveFocus(Qt.TabFocusReason)
break
}
}
}
}
+2 -6
View File
@@ -2,10 +2,6 @@ import QtQuick 2.0
import QtQuick.Controls 2.2
MenuItem {
// Qt 5.10 has a menu property, but we need to support 5.9
// so we must make our own.
property Menu parentMenu
// Ensure focus can't be given to an invisible item
enabled: visible
height: visible ? implicitHeight : 0
@@ -15,7 +11,7 @@ MenuItem {
// We must close the context menu first or
// it can steal focus from any dialogs that
// onTriggered may spawn.
parentMenu.close()
menu.close()
}
Keys.onReturnPressed: {
@@ -27,6 +23,6 @@ MenuItem {
}
Keys.onEscapePressed: {
parentMenu.close()
menu.close()
}
}
+13 -13
View File
@@ -15,7 +15,9 @@ NavigableDialog {
onOpened: {
// Force keyboard focus on the label so keyboard navigation works
dialogLabel.forceActiveFocus()
if (dialogButtonBox.count > 0) {
dialogButtonBox.itemAt(dialogButtonBox.count - 1).forceActiveFocus(Qt.TabFocus)
}
}
RowLayout {
@@ -24,6 +26,7 @@ NavigableDialog {
BusyIndicator {
id: dialogSpinner
visible: false
running: visible
}
Image {
@@ -51,18 +54,6 @@ NavigableDialog {
// will cause word wrap to kick in.
Layout.maximumWidth: 400
Layout.maximumHeight: 400
Keys.onReturnPressed: {
accept()
}
Keys.onEnterPressed: {
accept()
}
Keys.onEscapePressed: {
reject()
}
}
}
@@ -70,6 +61,15 @@ NavigableDialog {
id: dialogButtonBox
standardButtons: dialog.standardButtons
delegate: Button {
flat: true
Keys.onReturnPressed: clicked()
Keys.onEnterPressed: clicked()
Keys.onRightPressed: nextItemInFocusChain(true).forceActiveFocus(Qt.TabFocus)
Keys.onLeftPressed: nextItemInFocusChain(false).forceActiveFocus(Qt.TabFocus)
}
onHelpRequested: {
Qt.openUrlExternally(helpUrl)
close()
+3 -11
View File
@@ -7,17 +7,9 @@ ToolButton {
activeFocusOnTab: true
// FIXME: We're using an Image here rather than icon.source because
// icons don't work on Qt 5.9 LTS.
Image {
id: image
source: iconSource
anchors.centerIn: parent.background
sourceSize {
width: parent.background.width * 1.10
height: parent.background.height * 1.10
}
}
icon.source: iconSource
icon.width: background.width
icon.height: background.height
// This determines the size of the Material highlight. We increase it
// from the default because we use larger than normal icons for TV readability.
+4 -16
View File
@@ -34,13 +34,8 @@ CenteredGridView {
// Setup signals on CM
ComputerManager.computerAddCompleted.connect(addComplete)
// This is a bit of a hack to do this here as opposed to main.qml, but
// we need it enabled before calling getConnectedGamepads() and PcView
// is never destroyed, so it should be okay.
SdlGamepadKeyNavigation.enable()
// Highlight the first item if a gamepad is connected
if (currentIndex == -1 && SdlGamepadKeyNavigation.getConnectedGamepads() > 0) {
if (currentIndex === -1 && SdlGamepadKeyNavigation.getConnectedGamepads() > 0) {
currentIndex = 0
}
}
@@ -95,6 +90,7 @@ CenteredGridView {
BusyIndicator {
id: searchSpinner
visible: StreamingPreferences.enableMdns
running: visible
}
Label {
@@ -148,6 +144,7 @@ CenteredGridView {
width: 75
height: 75
visible: model.statusUnknown
running: visible
}
Label {
@@ -168,13 +165,13 @@ CenteredGridView {
asynchronous: true
sourceComponent: NavigableMenu {
id: pcContextMenu
initiator: pcContextMenuLoader.parent
MenuItem {
text: qsTr("PC Status: %1").arg(model.online ? qsTr("Online") : qsTr("Offline"))
font.bold: true
enabled: false
}
NavigableMenuItem {
parentMenu: pcContextMenu
text: qsTr("View All Apps")
onTriggered: {
var component = Qt.createComponent("AppView.qml")
@@ -184,13 +181,11 @@ CenteredGridView {
visible: model.online && model.paired
}
NavigableMenuItem {
parentMenu: pcContextMenu
text: qsTr("Wake PC")
onTriggered: computerModel.wakeComputer(index)
visible: !model.online && model.wakeable
}
NavigableMenuItem {
parentMenu: pcContextMenu
text: qsTr("Test Network")
onTriggered: {
computerModel.testConnectionForComputer(index)
@@ -199,7 +194,6 @@ CenteredGridView {
}
NavigableMenuItem {
parentMenu: pcContextMenu
text: qsTr("Rename PC")
onTriggered: {
renamePcDialog.pcIndex = index
@@ -208,7 +202,6 @@ CenteredGridView {
}
}
NavigableMenuItem {
parentMenu: pcContextMenu
text: qsTr("Delete PC")
onTriggered: {
deletePcDialog.pcIndex = index
@@ -217,7 +210,6 @@ CenteredGridView {
}
}
NavigableMenuItem {
parentMenu: pcContextMenu
text: qsTr("View Details")
onTriggered: {
showPcDetailsDialog.pcDetails = model.details
@@ -298,10 +290,6 @@ CenteredGridView {
NavigableMessageDialog {
id: pairDialog
// Pairing dialog must be modal to prevent double-clicks from triggering
// pairing twice
modal: true
closePolicy: Popup.CloseOnEscape
// don't allow edits to the rest of the window while open
+1
View File
@@ -60,6 +60,7 @@ Item {
BusyIndicator {
id: stageSpinner
running: visible
}
Label {
+129 -76
View File
@@ -281,11 +281,13 @@ Flickable {
StreamingPreferences.width = selectedWidth
StreamingPreferences.height = selectedHeight
StreamingPreferences.bitrateKbps = StreamingPreferences.getDefaultBitrate(StreamingPreferences.width,
StreamingPreferences.height,
StreamingPreferences.fps,
StreamingPreferences.enableYUV444);
slider.value = StreamingPreferences.bitrateKbps
if (StreamingPreferences.autoAdjustBitrate) {
StreamingPreferences.bitrateKbps = StreamingPreferences.getDefaultBitrate(StreamingPreferences.width,
StreamingPreferences.height,
StreamingPreferences.fps,
StreamingPreferences.enableYUV444);
slider.value = StreamingPreferences.bitrateKbps
}
}
lastIndexValue = currentIndex
@@ -447,11 +449,13 @@ Flickable {
if (StreamingPreferences.fps !== selectedFps) {
StreamingPreferences.fps = selectedFps
StreamingPreferences.bitrateKbps = StreamingPreferences.getDefaultBitrate(StreamingPreferences.width,
StreamingPreferences.height,
StreamingPreferences.fps,
StreamingPreferences.enableYUV444);
slider.value = StreamingPreferences.bitrateKbps
if (StreamingPreferences.autoAdjustBitrate) {
StreamingPreferences.bitrateKbps = StreamingPreferences.getDefaultBitrate(StreamingPreferences.width,
StreamingPreferences.height,
StreamingPreferences.fps,
StreamingPreferences.enableYUV444);
slider.value = StreamingPreferences.bitrateKbps
}
}
lastIndexValue = currentIndex
@@ -678,26 +682,47 @@ Flickable {
wrapMode: Text.Wrap
}
Slider {
id: slider
Row {
width: parent.width
spacing: 5
value: StreamingPreferences.bitrateKbps
Slider {
id: slider
stepSize: 500
from : 500
to: StreamingPreferences.unlockBitrate ? 500000 : 150000
value: StreamingPreferences.bitrateKbps
snapMode: "SnapOnRelease"
width: Math.min(bitrateDesc.implicitWidth, parent.width)
stepSize: 500
from : 500
to: StreamingPreferences.unlockBitrate ? 500000 : 150000
onValueChanged: {
bitrateTitle.text = qsTr("Video bitrate: %1 Mbps").arg(value / 1000.0)
StreamingPreferences.bitrateKbps = value
snapMode: "SnapOnRelease"
width: Math.min(bitrateDesc.implicitWidth, parent.width - (resetBitrateButton.visible ? resetBitrateButton.width + parent.spacing : 0))
onValueChanged: {
bitrateTitle.text = qsTr("Video bitrate: %1 Mbps").arg(value / 1000.0)
StreamingPreferences.bitrateKbps = value
}
onMoved: {
StreamingPreferences.autoAdjustBitrate = false
}
Component.onCompleted: {
// Refresh the text after translations change
languageChanged.connect(valueChanged)
}
}
Component.onCompleted: {
// Refresh the text after translations change
languageChanged.connect(valueChanged)
Button {
id: resetBitrateButton
text: qsTr("Use Default (%1 Mbps)").arg(StreamingPreferences.getDefaultBitrate(StreamingPreferences.width, StreamingPreferences.height, StreamingPreferences.fps, StreamingPreferences.enableYUV444) / 1000.0)
visible: StreamingPreferences.bitrateKbps !== StreamingPreferences.getDefaultBitrate(StreamingPreferences.width, StreamingPreferences.height, StreamingPreferences.fps, StreamingPreferences.enableYUV444)
onClicked: {
var defaultBitrate = StreamingPreferences.getDefaultBitrate(StreamingPreferences.width, StreamingPreferences.height, StreamingPreferences.fps, StreamingPreferences.enableYUV444)
StreamingPreferences.bitrateKbps = defaultBitrate
StreamingPreferences.autoAdjustBitrate = true
slider.value = defaultBitrate
}
}
}
@@ -787,38 +812,64 @@ Flickable {
ToolTip.text: qsTr("Fullscreen generally provides the best performance, but borderless windowed may work better with features like macOS Spaces, Alt+Tab, screenshot tools, on-screen overlays, etc.")
}
CheckBox {
id: vsyncCheck
Row {
spacing: 5
width: parent.width
hoverEnabled: true
text: qsTr("V-Sync")
font.pointSize: 12
checked: StreamingPreferences.enableVsync
onCheckedChanged: {
StreamingPreferences.enableVsync = checked
CheckBox {
id: vsyncCheck
hoverEnabled: true
text: qsTr("V-Sync")
font.pointSize: 12
checked: StreamingPreferences.enableVsync
onCheckedChanged: {
StreamingPreferences.enableVsync = checked
}
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Disabling V-Sync allows sub-frame rendering latency, but it can display visible tearing")
}
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Disabling V-Sync allows sub-frame rendering latency, but it can display visible tearing")
CheckBox {
id: framePacingCheck
hoverEnabled: true
text: qsTr("Frame pacing")
font.pointSize: 12
enabled: StreamingPreferences.enableVsync
checked: StreamingPreferences.enableVsync && StreamingPreferences.framePacing
onCheckedChanged: {
StreamingPreferences.framePacing = checked
}
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Frame pacing reduces micro-stutter by delaying frames that come in too early")
}
}
CheckBox {
id: framePacingCheck
id: enableHdr
width: parent.width
hoverEnabled: true
text: qsTr("Frame pacing")
font.pointSize: 12
enabled: StreamingPreferences.enableVsync
checked: StreamingPreferences.enableVsync && StreamingPreferences.framePacing
text: qsTr("Enable HDR")
font.pointSize: 12
enabled: SystemProperties.supportsHdr
checked: enabled && StreamingPreferences.enableHdr
onCheckedChanged: {
StreamingPreferences.framePacing = checked
StreamingPreferences.enableHdr = checked
}
// Updating StreamingPreferences.videoCodecConfig is handled above
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Frame pacing reduces micro-stutter by delaying frames that come in too early")
ToolTip.text: enabled ?
qsTr("The stream will be HDR-capable, but some games may require an HDR monitor on your host PC to enable HDR mode.")
:
qsTr("HDR streaming is not supported on this PC.")
}
}
}
@@ -1072,10 +1123,10 @@ Flickable {
text: "Português" // Portuguese
val: StreamingPreferences.LANG_PT
}
/* ListElement {
ListElement {
text: "Português do Brasil" // Brazilian Portuguese
val: StreamingPreferences.LANG_PT_BR
} */
}
ListElement {
text: "Ελληνικά" // Greek
val: StreamingPreferences.LANG_EL
@@ -1112,6 +1163,18 @@ Flickable {
text: "Eesti" // Estonian
val: StreamingPreferences.LANG_ET
} */
ListElement {
text: "Български" // Bulgarian
val: StreamingPreferences.LANG_BG
}
/* ListElement {
text: "Esperanto"
val: StreamingPreferences.LANG_EO
} */
ListElement {
text: "தமிழ்" // Tamil
val: StreamingPreferences.LANG_TA
}
}
// ::onActivated must be used, as it only listens for when the index is changed by a human
onActivated : {
@@ -1199,6 +1262,17 @@ Flickable {
}
}
CheckBox {
id: configurationWarningsCheck
width: parent.width
text: qsTr("Show configuration warnings")
font.pointSize: 12
checked: StreamingPreferences.configurationWarnings
onCheckedChanged: {
StreamingPreferences.configurationWarnings = checked
}
}
CheckBox {
visible: SystemProperties.hasDiscordIntegration
id: discordPresenceCheck
@@ -1570,7 +1644,7 @@ Flickable {
val: StreamingPreferences.VCC_FORCE_HEVC
}
ListElement {
text: qsTr("AV1 (Experimental)")
text: qsTr("AV1")
val: StreamingPreferences.VCC_FORCE_AV1
}
}
@@ -1582,33 +1656,10 @@ Flickable {
}
}
CheckBox {
id: enableHdr
width: parent.width
text: qsTr("Enable HDR (Experimental)")
font.pointSize: 12
enabled: SystemProperties.supportsHdr
checked: enabled && StreamingPreferences.enableHdr
onCheckedChanged: {
StreamingPreferences.enableHdr = checked
}
// Updating StreamingPreferences.videoCodecConfig is handled above
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: enabled ?
qsTr("The stream will be HDR-capable, but some games may require an HDR monitor on your host PC to enable HDR mode.")
:
qsTr("HDR streaming is not supported on this PC.")
}
CheckBox {
id: enableYUV444
width: parent.width
text: qsTr("Enable YUV 4:4:4 (Experimental)")
text: qsTr("Enable YUV 4:4:4")
font.pointSize: 12
checked: StreamingPreferences.enableYUV444
@@ -1616,11 +1667,13 @@ Flickable {
// This is called on init, so only reset to default bitrate when checked state changes.
if (StreamingPreferences.enableYUV444 != checked) {
StreamingPreferences.enableYUV444 = checked
StreamingPreferences.bitrateKbps = StreamingPreferences.getDefaultBitrate(StreamingPreferences.width,
StreamingPreferences.height,
StreamingPreferences.fps,
StreamingPreferences.enableYUV444);
slider.value = StreamingPreferences.bitrateKbps
if (StreamingPreferences.autoAdjustBitrate) {
StreamingPreferences.bitrateKbps = StreamingPreferences.getDefaultBitrate(StreamingPreferences.width,
StreamingPreferences.height,
StreamingPreferences.fps,
StreamingPreferences.enableYUV444);
slider.value = StreamingPreferences.bitrateKbps
}
}
}
+62 -35
View File
@@ -4,6 +4,7 @@ import QtQuick.Window 2.2
import SdlGamepadKeyNavigation 1.0
import Session 1.0
import SystemProperties 1.0
Item {
property Session session
@@ -48,18 +49,6 @@ Item {
console.error(text)
}
function displayLaunchWarning(text)
{
// This toast appears for 3 seconds, just shorter than how long
// Session will wait for it to be displayed. This gives it time
// to transition to invisible before continuing.
var toast = Qt.createQmlObject('import QtQuick.Controls 2.2; ToolTip {}', parent, '')
toast.text = text
toast.timeout = 3000
toast.visible = true
console.warn(text)
}
function quitStarting()
{
// Avoid the push transition animation
@@ -76,23 +65,19 @@ Item {
streamSegueErrorDialog.text += "\n\n" + qsTr("This PC's Internet connection is blocking Moonlight. Streaming over the Internet may not work while connected to this network.")
}
// Enable GUI gamepad usage now
// Re-enable GUI gamepad usage now
SdlGamepadKeyNavigation.enable()
if (quitAfter) {
if (streamSegueErrorDialog.text) {
// Quit when the error dialog is acknowledged
streamSegueErrorDialog.quitAfter = quitAfter
streamSegueErrorDialog.open()
}
else {
// Quit immediately
Qt.quit()
}
} else {
// Exit this view
// Pop the StreamSegue off the stack if this is a GUI-based app launch
if (!quitAfter) {
stackView.pop()
}
if (quitAfter && !streamSegueErrorDialog.text) {
// If this was a CLI launch without errors, exit now
Qt.quit()
}
else {
// Show the Qt window again after streaming
window.visible = true
@@ -119,7 +104,7 @@ Item {
// Show the toolbar again when popped off the stack
toolBar.visible = true
// Enable GUI gamepad usage now
// Re-enable GUI gamepad usage now
SdlGamepadKeyNavigation.enable()
}
@@ -132,11 +117,14 @@ Item {
session.stageFailed.connect(stageFailed)
session.connectionStarted.connect(connectionStarted)
session.displayLaunchError.connect(displayLaunchError)
session.displayLaunchWarning.connect(displayLaunchWarning)
session.quitStarting.connect(quitStarting)
session.sessionFinished.connect(sessionFinished)
session.readyForDeletion.connect(sessionReadyForDeletion)
// Ensure the SystemProperties async thread is finished,
// since it may currently be using the SDL video subsystem
SystemProperties.waitForAsyncLoad()
// Kick off the stream
spinnerTimer.start()
streamLoader.active = true
@@ -151,7 +139,20 @@ Item {
// middle of the animation on Windows, which looks very
// obviously broken.
interval: 100
onTriggered: stageSpinner.running = true
onTriggered: stageSpinner.visible = true
}
Timer {
id: startSessionTimer
onTriggered: {
// Garbage collect QML stuff before we start streaming,
// since we'll probably be streaming for a while and we
// won't be able to GC during the stream.
gc()
// Run the streaming session to completion
session.start()
}
}
Loader {
@@ -170,13 +171,38 @@ Item {
// Stop GUI gamepad usage now
SdlGamepadKeyNavigation.disable()
// Garbage collect QML stuff before we start streaming,
// since we'll probably be streaming for a while and we
// won't be able to GC during the stream.
gc()
// Initialize the session and probe for host/client capabilities
if (!session.initialize(window)) {
sessionFinished(0);
sessionReadyForDeletion();
return;
}
// Run the streaming session to completion
session.exec(Window.window)
// Don't wait unless we have toasts to display
startSessionTimer.interval = 0
// Display the toasts together in a vertical centered arrangement
var yOffset = 0
for (var i = 0; i < session.launchWarnings.length; i++) {
var text = session.launchWarnings[i]
console.warn(text)
// Show the tooltip for 3 seconds
var toast = Qt.createQmlObject('import QtQuick.Controls 2.2; ToolTip {}', parent, '')
toast.timeout = 3000
toast.text = text
toast.y += yOffset
toast.visible = true
// Offset the next toast below the previous one
yOffset = toast.y + toast.padding + toast.height
// Allow an extra 500 ms for the tooltip's fade-out animation to finish
startSessionTimer.interval = toast.timeout + 500;
}
// Start the timer to wait for toasts (or start the session immediately)
startSessionTimer.start()
}
sourceComponent: Item {}
@@ -188,7 +214,8 @@ Item {
BusyIndicator {
id: stageSpinner
running: false
running: visible
visible: false
}
Label {
+3 -3
View File
@@ -120,7 +120,7 @@ void AppModel::quitRunningApp()
bool AppModel::isAppCurrentlyVisible(const NvApp& app)
{
for (const NvApp& visibleApp : m_VisibleApps) {
for (const NvApp& visibleApp : std::as_const(m_VisibleApps)) {
if (app.id == visibleApp.id) {
return true;
}
@@ -156,7 +156,7 @@ void AppModel::updateAppList(QVector<NvApp> newList)
const NvApp& existingApp = m_VisibleApps.at(i);
bool found = false;
for (const NvApp& newApp : newVisibleList) {
for (const NvApp& newApp : std::as_const(newVisibleList)) {
if (existingApp.id == newApp.id) {
// If the data changed, update it in our list
if (existingApp != newApp) {
@@ -178,7 +178,7 @@ void AppModel::updateAppList(QVector<NvApp> newList)
}
// Process additions now
for (const NvApp& newApp : newVisibleList) {
for (const NvApp& newApp : std::as_const(newVisibleList)) {
int insertionIndex = m_VisibleApps.size();
bool found = false;
+51 -22
View File
@@ -22,7 +22,8 @@ ApplicationWindow {
width: 1280
height: 600
Component.onCompleted: {
// This function runs prior to creation of the initial StackView item
function doEarlyInit() {
// Override the background color to Material 2 colors for Qt 6.5+
// in order to improve contrast between GFE's placeholder box art
// and the background of the app grid.
@@ -30,6 +31,10 @@ ApplicationWindow {
Material.background = "#303030"
}
SdlGamepadKeyNavigation.enable()
}
Component.onCompleted: {
// Show the window according to the user's preferences
if (SystemProperties.hasDesktopEnvironment) {
if (StreamingPreferences.uiDisplayMode == StreamingPreferences.UI_MAXIMIZED) {
@@ -46,10 +51,20 @@ ApplicationWindow {
}
// Display any modal dialogs for configuration warnings
if (SystemProperties.isWow64) {
wow64Dialog.open()
if (runConfigChecks) {
if (SystemProperties.isWow64) {
wow64Dialog.open()
}
// Hardware acceleration and unmapped gamepads are checked asynchronously
SystemProperties.hasHardwareAccelerationChanged.connect(hasHardwareAccelerationChanged)
SystemProperties.unmappedGamepadsChanged.connect(hasUnmappedGamepadsChanged)
SystemProperties.startAsyncLoad()
}
else if (!SystemProperties.hasHardwareAcceleration) {
}
function hasHardwareAccelerationChanged() {
if (!SystemProperties.hasHardwareAcceleration && StreamingPreferences.videoDecoderSelection !== StreamingPreferences.VDS_FORCE_SOFTWARE) {
if (SystemProperties.isRunningXWayland) {
xWaylandDialog.open()
}
@@ -57,16 +72,28 @@ ApplicationWindow {
noHwDecoderDialog.open()
}
}
}
function hasUnmappedGamepadsChanged() {
if (SystemProperties.unmappedGamepads) {
unmappedGamepadDialog.unmappedGamepads = SystemProperties.unmappedGamepads
unmappedGamepadDialog.open()
}
}
// It would be better to use TextMetrics here, but it always lays out
// the text slightly more compactly than real Text does in ToolTip,
// causing unexpected line breaks to be inserted
Text {
id: tooltipTextLayoutHelper
visible: false
font: ToolTip.toolTip.font
text: ToolTip.toolTip.text
}
// This configures the maximum width of the singleton attached QML ToolTip. If left unconstrained,
// it will never insert a line break and just extend on forever.
ToolTip.toolTip.contentWidth: ToolTip.toolTip.implicitContentWidth < 400 ? ToolTip.toolTip.implicitContentWidth : 400
ToolTip.toolTip.contentWidth: Math.min(tooltipTextLayoutHelper.width, 400)
function goBack() {
if (clearOnBack) {
@@ -81,10 +108,16 @@ ApplicationWindow {
StackView {
id: stackView
initialItem: initialView
anchors.fill: parent
focus: true
Component.onCompleted: {
// Perform our early initialization before constructing
// the initial view and pushing it to the StackView
doEarlyInit()
push(initialView)
}
onCurrentItemChanged: {
// Ensure focus travels to the next view when going back
if (currentItem) {
@@ -158,6 +191,9 @@ ApplicationWindow {
pollingActive = true
}
}
// Poll for gamepad input only when the window is in focus
SdlGamepadKeyNavigation.notifyWindowFocus(visible && active)
}
onActiveChanged: {
@@ -176,22 +212,15 @@ ApplicationWindow {
// if focus does not return within a few minutes.
inactivityTimer.restart()
}
}
// Workaround for lack of instanceof in Qt 5.9.
//
// Based on https://stackoverflow.com/questions/13923794/how-to-do-a-is-a-typeof-or-instanceof-in-qml
function qmltypeof(obj, className) { // QtObject, string -> bool
// className plus "(" is the class instance without modification
// className plus "_QML" is the class instance with user-defined properties
var str = obj.toString();
return str.startsWith(className + "(") || str.startsWith(className + "_QML");
// Poll for gamepad input only when the window is in focus
SdlGamepadKeyNavigation.notifyWindowFocus(visible && active)
}
function navigateTo(url, objectType)
{
var existingItem = stackView.find(function(item, index) {
return qmltypeof(item, objectType)
return item instanceof objectType
})
if (existingItem !== null) {
@@ -258,7 +287,7 @@ ApplicationWindow {
Label {
id: versionLabel
visible: qmltypeof(stackView.currentItem, "SettingsView")
visible: stackView.currentItem instanceof SettingsView
text: qsTr("Version %1").arg(SystemProperties.versionString)
font.pointSize: 12
horizontalAlignment: Qt.AlignRight
@@ -268,7 +297,7 @@ ApplicationWindow {
NavigableToolButton {
id: discordButton
visible: SystemProperties.hasBrowser &&
qmltypeof(stackView.currentItem, "SettingsView")
stackView.currentItem instanceof SettingsView
iconSource: "qrc:/res/discord.svg"
@@ -287,7 +316,7 @@ ApplicationWindow {
NavigableToolButton {
id: addPcButton
visible: qmltypeof(stackView.currentItem, "PcView")
visible: stackView.currentItem instanceof PcView
iconSource: "qrc:/res/ic_add_to_queue_white_48px.svg"
@@ -385,7 +414,7 @@ ApplicationWindow {
iconSource: "qrc:/res/ic_videogame_asset_white_48px.svg"
onClicked: navigateTo("qrc:/gui/GamepadMapper.qml", "GamepadMapper")
onClicked: navigateTo("qrc:/gui/GamepadMapper.qml", GamepadMapper)
Keys.onDownPressed: {
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
@@ -397,7 +426,7 @@ ApplicationWindow {
iconSource: "qrc:/res/settings.svg"
onClicked: navigateTo("qrc:/gui/SettingsView.qml", "SettingsView")
onClicked: navigateTo("qrc:/gui/SettingsView.qml", SettingsView)
Keys.onDownPressed: {
stackView.currentItem.forceActiveFocus(Qt.TabFocus)
+41 -15
View File
@@ -13,6 +13,7 @@ SdlGamepadKeyNavigation::SdlGamepadKeyNavigation(StreamingPreferences* prefs)
m_Enabled(false),
m_UiNavMode(false),
m_FirstPoll(false),
m_HasFocus(false),
m_LastAxisNavigationEventTime(0)
{
m_PollingTimer = new QTimer(this);
@@ -50,11 +51,16 @@ void SdlGamepadKeyNavigation::enable()
// on first init of the GC subsystem. We can't depend on them due to
// overlapping lifetimes of SdlGamepadKeyNavigation instances, so we
// will attach ourselves.
SDL_PumpEvents();
//
// NB: We use SDL_JoystickUpdate() instead of SDL_PumpEvents() because
// the latter can do a bit more work that we want (like handling video
// events that we intentionally do not want to process yet).
SDL_JoystickUpdate();
SDL_FlushEvent(SDL_CONTROLLERDEVICEADDED);
// Open all currently attached game controllers
for (int i = 0; i < SDL_NumJoysticks(); i++) {
int numJoysticks = SDL_NumJoysticks();
for (int i = 0; i < numJoysticks; i++) {
if (SDL_IsGameController(i)) {
SDL_GameController* gc = SDL_GameControllerOpen(i);
if (gc != nullptr) {
@@ -63,13 +69,10 @@ void SdlGamepadKeyNavigation::enable()
}
}
// Flush events on the first poll
m_FirstPoll = true;
// Poll every 50 ms for a new joystick event
m_PollingTimer->start(50);
m_Enabled = true;
// Start the polling timer if the window is focused
updateTimerState();
}
void SdlGamepadKeyNavigation::disable()
@@ -78,7 +81,9 @@ void SdlGamepadKeyNavigation::disable()
return;
}
m_PollingTimer->stop();
m_Enabled = false;
updateTimerState();
Q_ASSERT(!m_PollingTimer->isActive());
while (!m_Gamepads.isEmpty()) {
SDL_GameControllerClose(m_Gamepads[0]);
@@ -86,25 +91,31 @@ void SdlGamepadKeyNavigation::disable()
}
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
}
m_Enabled = false;
void SdlGamepadKeyNavigation::notifyWindowFocus(bool hasFocus)
{
m_HasFocus = hasFocus;
updateTimerState();
}
void SdlGamepadKeyNavigation::onPollingTimerFired()
{
SDL_Event event;
// Update joystick state without pumping other events (see enable() comment)
SDL_JoystickUpdate();
// Discard any pending button events on the first poll to avoid picking up
// stale input data from the stream session (like the quit combo).
if (m_FirstPoll) {
SDL_PumpEvents();
SDL_FlushEvent(SDL_CONTROLLERBUTTONDOWN);
SDL_FlushEvent(SDL_CONTROLLERBUTTONUP);
m_FirstPoll = false;
}
while (SDL_PollEvent(&event)) {
// Peep events rather than polling to avoid calling SDL_PumpEvents()
while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_FIRSTEVENT, SDL_LASTEVENT) == 1) {
switch (event.type) {
case SDL_QUIT:
// SDL may send us a quit event since we initialize
@@ -207,7 +218,7 @@ void SdlGamepadKeyNavigation::onPollingTimerFired()
}
// Handle analog sticks by polling
for (auto gc : m_Gamepads) {
for (auto gc : std::as_const(m_Gamepads)) {
short leftX = SDL_GameControllerGetAxis(gc, SDL_CONTROLLER_AXIS_LEFTX);
short leftY = SDL_GameControllerGetAxis(gc, SDL_CONTROLLER_AXIS_LEFTY);
if (SDL_GetTicks() - m_LastAxisNavigationEventTime < AXIS_NAVIGATION_REPEAT_DELAY) {
@@ -261,6 +272,20 @@ void SdlGamepadKeyNavigation::sendKey(QEvent::Type type, Qt::Key key, Qt::Keyboa
}
}
void SdlGamepadKeyNavigation::updateTimerState()
{
if (m_PollingTimer->isActive() && (!m_HasFocus || !m_Enabled)) {
m_PollingTimer->stop();
}
else if (!m_PollingTimer->isActive() && m_HasFocus && m_Enabled) {
// Flush events on the first poll
m_FirstPoll = true;
// Poll every 50 ms for a new joystick event
m_PollingTimer->start(50);
}
}
void SdlGamepadKeyNavigation::setUiNavMode(bool uiNavMode)
{
m_UiNavMode = uiNavMode;
@@ -271,7 +296,8 @@ int SdlGamepadKeyNavigation::getConnectedGamepads()
Q_ASSERT(m_Enabled);
int count = 0;
for (int i = 0; i < SDL_NumJoysticks(); i++) {
int numJoysticks = SDL_NumJoysticks();
for (int i = 0; i < numJoysticks; i++) {
if (SDL_IsGameController(i)) {
count++;
}
+6 -1
View File
@@ -3,7 +3,7 @@
#include <QTimer>
#include <QEvent>
#include <SDL.h>
#include "SDL_compat.h"
#include "settings/streamingpreferences.h"
@@ -20,6 +20,8 @@ public:
Q_INVOKABLE void disable();
Q_INVOKABLE void notifyWindowFocus(bool hasFocus);
Q_INVOKABLE void setUiNavMode(bool settingsMode);
Q_INVOKABLE int getConnectedGamepads();
@@ -27,6 +29,8 @@ public:
private:
void sendKey(QEvent::Type type, Qt::Key key, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
void updateTimerState();
private slots:
void onPollingTimerFired();
@@ -37,5 +41,6 @@ private:
bool m_Enabled;
bool m_UiNavMode;
bool m_FirstPoll;
bool m_HasFocus;
Uint32 m_LastAxisNavigationEventTime;
};
Binary file not shown.
File diff suppressed because it is too large Load Diff
+243 -228
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+268 -261
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+253 -246
View File
File diff suppressed because it is too large Load Diff
+240 -229
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
+243 -236
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+244 -229
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+244 -237
View File
File diff suppressed because it is too large Load Diff
+243 -228
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+246 -231
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+480 -473
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+252 -245
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+268 -261
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+251 -244
View File
File diff suppressed because it is too large Load Diff
+243 -228
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+465 -454
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+415 -408
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+251 -244
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+313 -306
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+489 -474
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+244 -237
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
+372 -365
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More