Fix the QAM button doing nothing when the pad is an Xbox or PlayStation controller (#631)

This commit is contained in:
Muaz Kadan authored and GitHub committed 2026-10-12 13:35:41 -04:00
1 parent e4c84e6e24
commit 2fe6ba36c4
2 files changed
+24 -5

No files matched your search

@@ -566,6 +566,16 @@ public class FakeInputWriter {
} }
} }
/**
* Whether the pad, as the Steam client now sees it, has a Quick Access button: a Deck's or a
* Steam Controller's does, an Xbox or PlayStation pad's does not (libfakeinput drops the bit).
* Unset is the Deck, libfakeinput's default.
*/
public static boolean padHasQam() {
int type = padType;
return type < 0 || type == PAD_TYPE_DECK || type == PAD_TYPE_STEAM;
}
/** /**
* Switches what the pad is to the Steam client while the session runs ([PAD_TYPE_DECK], * Switches what the pad is to the Steam client while the session runs ([PAD_TYPE_DECK],
* [PAD_TYPE_STEAM] or [PAD_TYPE_XBOX]); libfakeinput unplugs the old device and plugs in the new. * [PAD_TYPE_STEAM] or [PAD_TYPE_XBOX]); libfakeinput unplugs the old device and plugs in the new.
@@ -400,8 +400,8 @@ public final class PadBridge {
boolean qamStarted = qamPressed && !systemQamPressed; boolean qamStarted = qamPressed && !systemQamPressed;
systemGuidePressed = guidePressed; systemGuidePressed = guidePressed;
systemQamPressed = qamPressed; systemQamPressed = qamPressed;
// A Deck controller's QAM button is held for as long as the touch one is. // A Deck or Steam Controller's QAM button is held for as long as the touch one is.
if (qamStarted && !SessionState.getDeckPad()) startQamChord(); if (qamStarted && !nativeQam()) startQamChord();
else publish(); else publish();
} }
@@ -426,9 +426,18 @@ public final class PadBridge {
} }
} }
/** Opens the client's Quick Access menu: a tap of the Deck's button, or the Guide-then-A chord. */ /**
* Whether the client's pad has its own QAM button to press. The Deck's sysfs being up is not
* enough: the drawer can make the pad an Xbox or PlayStation one, which has none, and a press
* of it never reaches the client.
*/
private static boolean nativeQam() {
return SessionState.getDeckPad() && FakeInputWriter.padHasQam();
}
/** Opens the client's Quick Access menu: a tap of the pad's button, or the Guide-then-A chord. */
public synchronized void triggerQam() { public synchronized void triggerQam() {
if (!SessionState.getDeckPad()) { if (!nativeQam()) {
startQamChord(); startQamChord();
return; return;
} }
@@ -571,7 +580,7 @@ public final class PadBridge {
return; return;
} }
boolean guide = systemGuidePressed || qamChordActive; boolean guide = systemGuidePressed || qamChordActive;
boolean qam = SessionState.getDeckPad() && (systemQamPressed || qamTapPressed); boolean qam = nativeQam() && (systemQamPressed || qamTapPressed);
if (!guide && !qam) { if (!guide && !qam) {
writer.writePad(state); writer.writePad(state);
return; return;