Steam's touch controller as on-screen controls (beta) (#431)

* feat: Steam's touch controller as on-screen controls (beta)

* fix: Steam touch controls appear once the session makes the device; tidier default layout

* fix: Steam touch layout decoding, saved layouts and new sessions

* docs: Steam's touch controls

* feat: Steam's touch icons, labels and colours on the touch controls; pick and save them like Steam

* feat: Steam touch icon picker as in-session panels; layout colour; docs

* Give each physical controller its own player slot

Every controller fed the one exported pad, so two pads played as one.
The first controller keeps slot 0 (the Deck in a Steam session); further
ones get slots 1-3 as separate Xbox 360 pads, created on first input and
removed on disconnect. In Deck mode only the Steam client sees those
pads and hands them to games through Steam Input. Rumble follows the
slot it names.

* feat: Steam Link's touch menu, per-game input modes, action set editing, add/copy/paste, oval controls, paste control

* feat: Steam touch controls drawn as Steam Link draws them; Steam Link's touch menu and layout tray

* feat: Steam touch controls in DroidDeck's style, D-mark guide button, shake to hide

* refactor: Steam touch controls become an On-screen controls choice instead of a second dropdown

---------

Co-authored-by: maxjivi05 <maxjividen@gmail.com>
This commit is contained in:
Kurt Himebauchandmaxjivi05 authored and GitHub committed 2026-10-09 21:12:46 -04:00
1 parent a6d15bcd0b
commit 0da45e53cb
23 files changed
+4160 -94

No files matched your search

@@ -115,16 +115,41 @@ class RumbleComponentTest {
assertFalse(pad.vibrating)
}
@After fun clearActiveController() { activeController(PadBridge.NO_CONTROLLER) }
private fun activeController(id: Int) {
PadBridge::class.java.getDeclaredField("activeControllerId").apply { isAccessible = true }.setInt(null, id)
@Test fun eachPlayerSlotRumblesItsOwnControllerAndVirtualPadsUseTheLastActive() {
val first = FakeMotors()
val second = FakeMotors()
rumble.controllerMotors = { id -> if (id == PAD_ID) first else if (id == SECOND_PAD_ID) second else null }
activeController(PAD_ID)
activeController(SECOND_PAD_ID, slot = 1)
effect(strong = 100, weak = 0, slot = 1)
assertEquals(listOf(Triple(100, 0, 5000L)), second.played)
assertTrue(first.played.isEmpty())
effect(strong = 200, weak = 0)
assertEquals(listOf(Triple(200, 0, 5000L)), first.played)
assertTrue("one player's effect ended another's", second.vibrating)
effect(strong = 0, weak = 0, slot = 1)
assertFalse(second.vibrating)
assertTrue(first.vibrating)
effect(strong = 300, weak = 0, slot = 16)
assertEquals(Triple(300, 0, 5000L), second.played.last())
assertFalse(shadowOf(vibrator).isVibrating)
}
private fun effect(strong: Int = 65535, weak: Int = 65535) {
@After fun clearActiveController() {
for (slot in 0 until PadBridge.SLOTS) activeController(PadBridge.NO_CONTROLLER, slot)
}
private fun activeController(id: Int, slot: Int = 0) {
PadBridge::class.java.getDeclaredField("activeControllerId").apply { isAccessible = true }.setInt(null, id)
val slots = PadBridge::class.java.getDeclaredField("slotControllers").apply { isAccessible = true }.get(null)
(slots as java.util.concurrent.atomic.AtomicIntegerArray).set(slot, id)
}
private fun effect(strong: Int = 65535, weak: Int = 65535, slot: Int = 0) {
// Inject a decoded force-feedback packet; transport is outside these tests.
RumbleComponent::class.java.getDeclaredMethod("buzz", Int::class.javaPrimitiveType, Int::class.javaPrimitiveType, Int::class.javaPrimitiveType)
.apply { isAccessible = true }.invoke(rumble, strong, weak, 5000)
val int = Int::class.javaPrimitiveType
RumbleComponent::class.java.getDeclaredMethod("buzz", int, int, int, int)
.apply { isAccessible = true }.invoke(rumble, strong, weak, 5000, slot)
}
private class FakeMotors : RumbleComponent.Motors {
@@ -135,7 +160,10 @@ class RumbleComponentTest {
override fun cancel() { vibrating = false }
}
private companion object { const val PAD_ID = 7 }
private companion object {
const val PAD_ID = 7
const val SECOND_PAD_ID = 8
}
@Implements(LocalServerSocket::class)
class NoPacketsSocket {