OmarAlTaki1 a8aff1c1a3 fix(input): read a USB mouse directly where Android won't capture it, as in REDMAGIC cast mode (#2298)
* fix(input): read a USB mouse directly where Android won't capture it, as in REDMAGIC cast mode

REDMAGIC's cast mode shows the session on a virtual display while its own
mirror activity keeps focus on the phone's display. Android only grants
pointer capture on the focused display, so the session got a cursor that
stopped at the screen edge and the camera stopped turning in mouse-look games.

When capture is wanted but not granted within 500 ms, the session claims the
mouse's USB HID boot interface instead, reads its reports with the layout from
its report descriptor (boot protocol if that can't be read), and sends motion,
five buttons and the wheel the way captured motion goes. The mouse goes back
to Android whenever capture is no longer wanted.

* feat(input): hold the middle button still to open the session menu while the mouse is read over USB

While the session reads the mouse over USB, Android has no cursor, so the
mouse can't reach REDMAGIC's cast-mode panel or anything else outside the
session. Holding the middle button for two seconds without moving opens the
session menu, which hands the mouse back to Android until the menu closes.
Quick middle clicks and middle-button drags still reach the game.

Relative motion sent to a locked pointer now hides the session's own cursor,
as pad pointer motion already does. A desktop keeps its grab while the menu
is open, so a click made with Android's cursor on the way back showed the
session cursor, which then stayed where the click was.

* fix(input): give a USB mouse back to Android when the app starts after being killed while reading it

A process killed while it reads the mouse, by a crash or an update, leaves
the mouse's interface with no driver, so Android has no mouse until it is
replugged. At startup, any permitted USB boot mouse that can be claimed
without force has no driver, and releasing it reattaches Android's.

* fix(input): only sessions shown off the phone's screen fall back to reading the USB mouse

Android grants pointer capture on the focused display, which the phone's own
screen is, so a session there never needs the USB mouse. Checking the display
keeps a slow capture grant from ever asking for the mouse's USB access there.

* fix(input): reject out-of-range HID report sizes and counts, and release USB buttons when the mouse is lost

A report descriptor can give any 32-bit report count or size, which drove the
field loop for billions of iterations and could overflow bit offsets into a
negative index on the reader thread. Items outside 32 bits and 4096 fields are
rejected, so such a mouse falls back to the boot protocol.

A mouse that stops responding while it is read over USB now releases the
buttons it held and cancels a pending menu hold, through a separate onLost
callback, since the session's own release path only runs while the grab is
still active.

* test(input): an oversized report count is rejected even when X and Y follow it

The earlier case had no X or Y fields, so it returned null without the count
check too. A 4097-field item before valid X and Y is now rejected, and a
4096-field one still parses.

* fix(input): Auto relative mouse sees a mouse read over USB, and re-checks when it is lost

The Auto relative-mouse decision from #2305 reads mouseAttached() on the
relative-mouse thread, which counts a mouse read over USB, so the grab's
state is now volatile. Losing that mouse re-runs the decision, as removing
an Android mouse does.

* fix(input): set up the USB mouse on its reader thread, select report protocol, and retry a failed permission request

Opening the receiver and its descriptor and protocol transfers now run on the
reader thread, so an unresponsive receiver can't stall the session for up to
two seconds. A release during setup lets the thread clean up as it already
did. A mouse that fails setup isn't tried again until it is replugged, since
releasing it re-adds Android's mouse, which would start another attempt.

A parsed report descriptor now selects report protocol first: HID 1.11
7.2.6 says a host must not assume the protocol a device is in.

A permission request that throws no longer marks the mouse as asked.

* fix(input): a cancelled or overlapping USB reader can't claim the mouse or mark it failed

A new reader waits for the previous one to let go of the interface, so a
quick release and grab, like toggling the session menu, no longer fails the
claim. A reader released before or during setup doesn't claim the interface
or keeps going. Failing to open or claim leaves the mouse with Android without
marking it failed, since nothing re-adds it to start another attempt; only a
failure after claiming, or a lost mouse, marks it, and only for the current
reader.

If SET_PROTOCOL(report) fails, setup tries boot protocol before giving up,
so the decoder always matches the protocol the mouse was set to.

* fix(input): release can't slip between the USB reader's cancellation check and its claim

The reader checked `running` and then claimed the interface, so a release in
between still let it claim and start setup. The check and claim now share a
lock with release, so the reader either never claims or claims first and sees
the release before setup.

* fix(input): hand the mouse back to Android while the WoW chat bar is on top

appUiOwnsPointer() already shows Android's pointer for the on-top chat bar,
but pointer capture, and now the USB mouse, stayed on, so that pointer
couldn't reach the bar. The bar on top now ends capture and USB reading like
the session menus do, and its changes re-run the capture decision.
2026-11-15 10:21:15 -05:00
2026-10-13 21:27:42 -04:00
2026-10-13 21:27:42 -04:00
2026-10-13 21:27:42 -04:00
2026-10-13 21:27:42 -04:00

DroidDeck

DroidDeck brings the SteamOS experience to Android: Steam Gaming Mode, full Linux desktop, integration with GOG, Epic Games, Xbox, and other storefronts, Steam VR, and more!

100% open source. No ads. No telemetry. No proprietary components. No source withheld.

Download DroidDeck 0.7.1 Join the DroidDeck Discord

Star History Rank

Droid-Deck%2FDroidDeck | Trendshift Droid-Deck%2FDroidDeck | Trendshift

On a Retroid Pocket Duo: Play Steam from the DroidDeck launcher, open Pac-Man in Steam Big Picture and play it, exit the game, then Switch to Desktop from the Power menu

The official website is droid-deck.dev. Only download DroidDeck from this repository's Releases.

The Library switching source chips, changing the card size and opening the Filter menu A Windows game running through Proton with the on-screen controls Two controllers playing split screen on one handheld The Kubuntu desktop with Discover open

Install

  1. Android 9 or newer on Adreno 730 or newer, or any 8xx. Adreno 6xx, Mali, Xclipse and PowerVR are experimental. Adreno 710 is currently unsupported. No root needed.
  2. About 3 GB free for the runtime, plus 1.1 GB for the desktop and emulators.
  3. Install the APK, install the Linux runtime, press Play and sign in to Steam.
  4. On Android 14 and newer, turn on Disable child process restrictions in Developer options. On Android 12 and 13, Steam's first launch shows a Fix it for me button that walks you through it.

Smart glasses setup is in the support matrix. Release notes are in docs/releases.

Help, Preview builds and device reports are on Discord. For bugs, post in #bug-reports with the zip from Share logs.

Build

Needs Docker, Java 17, the Android SDK and NDK, Rust via rustup, GitHub CLI, Python 3 and zstd.

tools/build_local.sh

The APK lands in app/build/outputs/apk/release/. Install it with tools/deploy_local.sh. After the first run, ./gradlew :app:assembleRelease reuses the prepared inputs. Unit tests run with ./gradlew -PskipRust=true :app:testDebugUnitTest, and the helper and preload suite with bash tools/test_local.sh.

On Windows, see tools/run_windows.ps1 and tools/prepare_windows_runtime.py.

Limits

Compatibility and performance vary by device. Desktop compositing is software rendered, and Firefox sandboxing is reduced under proot.

Credits and licence

DroidDeck is GPL-3.0. Steam and Proton belong to Valve Corporation. VITURE, RayNeo, XREAL, Rokid, REDMAGIC, Nintendo Switch and Joy-Con are trademarks of their owners. This project is not affiliated with any of them.

Runtime, Wine and Proton
  • Runtime, shim, input and controller work build on WinNative and Bannerlator by maxjivi05.
  • mmap ring buffer controller input by ribbit384 (WinNative #345).
  • FEX (MIT) runs x86 code. DroidDeck's build puts the platform name under AT_PLATFORM so sharun AppImages by VHSgunzo (MIT) start through its userland-execve loader (MIT). FEX's code disk cache was checked in its source.
  • x86 AppImages, and arm64 ones whose runtime can't unpack on Android, are unpacked with uruntime by VHSgunzo (MIT), shipped unmodified with its licence.
  • x86 programs linking OpenSSL 3 use the copy in the Steam Linux Runtime 4.0. x86 Linux games get the /etc/asound.conf that pressure-vessel writes.
  • WriteProcessMemory hooks fall back to /proc/<pid>/mem the way Wine's server/ptrace.c did before Wine 11.
  • Wine write watches use userfaultfd support in Proton's dlls/ntdll/unix/virtual.c (LGPL-2.1-or-later). libblsession supplies the arm64 syscall number and answers PAGEMAP_SCAN from /proc/self/pagemap.
  • libblsession runs Wine's arm64 SIGUSR2 context handler (dlls/ntdll/unix/signal_arm64.c, LGPL-2.1-or-later) in place on a frame laid out like Linux's arch/arm64/kernel/signal.c, and serves fill_vm_counters in dlls/ntdll/unix/process.c the kernel's own /proc/<pid>/status.
  • droiddeck-ntsync follows the Linux ntsync semantics in Documentation/userspace-api/ntsync.rst (GPL-2.0).
  • The proot fast path orders bindings like PRoot's path/binding.c (GPL-2.0-or-later).
  • DiRT 3 and DiRT Showdown keep their telemetry socket the way RoccoC's DiRTTelemetryErrorFix (MIT) does, based on the fix by Carsten Gottschling.
  • Zink on PowerVR keeps colour textures in colour with Icenowy Zheng's upstream Mesa fix d55418dae7 (MIT), carried as a runtime patch.
  • Games and AppImage, Flatpak and Snap programs such as emulators use TU_DEBUG=sysmem by default, as does the Steam client. Turnip sysmem rendering can be turned off in Performance settings, except with the Adreno 710/720 driver, which always uses it.
  • Black Ops III and Dark Souls Remastered start without umu-protonfixes (BSD-2-Clause), whose 311210.py and 570940.py fail under ARM64 Proton.
  • ReSkate (GPL-3.0) by Dingo Shenanigans uses the launch option from its README and D3D12 feature level 12_1.
  • The arm64 client's sign in was checked by reading Steam's saved token with the ConnectCache format from deadlock-api-ingest.
Stores
  • Epic Games and GOG build on Phobos's adaptation of Legendary and gogdl. GOG install script registry entries are read the way Heroic Games Launcher (GPL-3.0) reads them. GOG cloud storage requests send the Galaxy communication-service User-Agent that gogdl and Lutris (GPL-3.0) send.
  • Epic's official Linux launcher preview runs through FEX. That setup is outside Epic's listed Linux support.
  • The launcher's .deb gets the WebKitGTK and GTK 3 libraries it needs from unmodified Debian 13 packages, following @zooluis's research in #2268.
  • Battle.net is by @kayakyakr. It runs Blizzard's own client in Proton (downloaded from Blizzard, not included) and shows key art from the Battle.net Shop. Without Steam, its games see the pad as an Xbox 360 controller via PROTON_SPOOF_STEAMINPUT_VIDPID in Proton's dlls/winebus.sys.
  • The EA store follows the EA app's protocols as documented by ArmchairDevelopers' Maxima (GPL-3.0): sign-in, the GraphQL queries (included verbatim, since EA matches them by hash), build archives, online activation licences and the LSX game endpoint. The code is DroidDeck's own.
  • Battle.net installs drive Blizzard's Agent the way @barncastle's Battle.Net-Installer does, with requests from wowdev.wiki. Read without taking code: @mubaraknumann's unifideck, @djmittens's neo-mittens bnetswitch, @BCD1210's soju and Lutris's product.db reader.
  • World of Warcraft addon imports replace an addon's folder from a temporary copy, as WowUp does, and read flavour folders the way WoWDeck does. No code from either is used.
  • The World of Warcraft addon Download window searches WoWInterface through its MMOUI API. CurseForge opens in the user's browser, with no API and no key.
  • Xbox games load @domsvoboda's xodus-nexus modules (LGPL-2.1-or-later), including wintypes.dll. Content licensing sends delegation-compact device tickets in the licensing wire form, following the nexus-backend commit 27c335e. Minecraft's GameInput setup was checked against @Wyze3306's BedrockOnLinux (MIT).
  • The Xbox Cloud Gaming player uses the WebRTC client of @unknownskl's Greenlight (MIT), and its offer tweaks and sharpening follow @redphx's Better xCloud (MIT). See tools/xcloud-player/NOTICE.md.
  • The itch.io butler pack ships butler's 7z.so, itch.io's build of 7-Zip by Igor Pavlov (LGPL-2.1, unRAR restriction on RAR code), unmodified. Other archives use Apache Commons Compress and the runtime's bsdtar (libarchive).
  • The Store uses Flatpak (LGPL-2.1) through DroidDeck's own bubblewrap shim. Chromium and Electron apps start directly, since zypak by @refi64 (BSD-3-Clause) always uses Flatpak's spawn portal.
  • Folder sync runs Syncthing (MPL-2.0), built from @researchxxl's syncthing-android fork (MPL-2.0).
Audio, video and HUD
  • Steam audio goes through @The412Banner's DirectAudio PulseAudio sink (LGPL-2.1-or-later), built from tools/directaudio/sink.
  • The DroidDeck HUD is @The412Banner's FusionHUD (GPL-3.0 with an attribution term). Its readings match Valve's MangoHud build (MIT), with frame times from gamescope patch 0125.
  • The HUD's CPU, GPU load, thermal and battery readers come from @xXJSONDeruloXx's work.
  • LSFG frame generation comes from Camille LaVey and the Eden project, following lsfg-vk, ported by @maxjivi05. It needs your own copy of Lossless Scaling and ships none of its shaders.
  • Remote Play decodes through Android's MediaCodec or the FFmpeg (LGPL-2.1-or-later) in Steam's runtime. Qualcomm low latency settings follow Moonlight (GPL-3.0).
  • PipeWire (MIT) sockets use the settings in its module-access.c, and WirePlumber (MIT) keeps those clients at full permissions.
Desktop
  • The KDE pacman repository snapshots Arch Linux ARM and installs with pacman (GPL-2.0-or-later).
  • KWin (GPL-2.0-or-later) is patched to pass on the scroll data its wayland_backend.cpp leaves as a TODO.
  • Read without taking code: Qt's qwaylandinputdevice.cpp and qguiapplication.cpp, Konsole's TerminalDisplay.cpp, and Mesa's u_threaded_context.c and zink_resource.c.
  • The Steam Keyboard window rule follows Valve's steamdeck-kde-presets with Bazzite's 0001-steam-virtual-keyboard.patch.
  • Steam's Browse buttons open a GTK 3 file chooser via PyGObject (LGPL-2.1-or-later), shown over Steam by gamescope (BSD-2-Clause) through GetAppIdFromReaper.
  • The AYN Odin 2 phantom second display was confirmed by @SapphireRhodonite's WatermelonDS 0.0.5 notes and iiSU #363, without taking their code.
Smart glasses
VR, Joy-Con and hand tracking
  • Joy-Con VR ports the arm model from Google's GVR SDK for Unity (Apache-2.0) and adapts the hand skeleton from Valve's OpenVR handskeletonsimulation sample (BSD-3-Clause), which follows Moshi Turner's work in Monado. Index offsets come from Monado's vive_poses.c (BSL-1.0).
  • Joy-Con research: Linux's hid-nintendo by Daniel J. Ogorchock, @dekuNukem's Nintendo_Switch_Reverse_Engineering, SDL and AOSP. Checked against ALVR, OpenComposite, PSMoveSteamVRBridge, @F8LEFT's JoyConVr, @krnelpan1c's Daydream-Controller-SteamVR, @yoyobuae's joyconvr, Moonlight and Dolphin. See docs/third-party/joycon.
  • Camera hand tracking runs Google's MediaPipe Pose Landmarker (Lite), BlazePose GHUM 3D and Hand Landmarker (Apache-2.0) on CameraX frames (Apache-2.0), with usage reports off. Checked against JoyConVr's camera app (MIT).
  • Tracking math: the GVR arm model's accelerometer mode, Eric Foxlin's zero velocity updates, Frosio, Pedersini and Borghese's accelerometer autocalibration, a Kalman filter (Kalman, 1960), Horn's quaternion method (1987) and the 1€ filter (Casiez, Roussel and Vogel, 2012).
  • Gestures follow ALVR's hand_gestures.rs (MIT) and Meta Quest's menu pinch, tuned on HaGRID photos (CC BY-SA 4.0, not included).
  • The glove model follows OpenVR's render model reference, is meshed with surface nets (Gibson, 1998; Mikola Lysenko), and uses Inigo Quilez's smooth minimum, distance field ambient occlusion and polygon distance (MIT). See docs/third-party/handtracking.

Star history

Star history chart
S
Description
No description provided
Readme GPL-3.0
1 GiB
0 Stars 1 Watchers 0 Forks
Languages
Kotlin 51.2%
Python 16.7%
C 15.2%
C++ 7.3%
Rust 3.5%
Other 5.9%