Skip to content

Commit d7c0653

Browse files
committed
add QAM button to GPD devices
1 parent fc9c4d2 commit d7c0653

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/hhd/controller/base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def __init__(
250250
r3_to_share: bool = False,
251251
select_reboots: bool = False,
252252
nintendo_mode: bool = False,
253+
qam_button: str | None = None,
253254
) -> None:
254255
self.swap_guide = swap_guide
255256
self.trigger = trigger
@@ -258,7 +259,6 @@ def __init__(
258259
self.touchpad = touchpad
259260
self.status = status
260261
self.trigger_discrete_lvl = trigger_discrete_lvl
261-
self.share_to_qam = share_to_qam
262262
self.touchpad_short = touchpad_short
263263
self.touchpad_hold = touchpad_hold
264264
self.touchpad_right = touchpad_right
@@ -273,6 +273,9 @@ def __init__(
273273
self.queue: list[tuple[Event | Literal["reboot"], float]] = []
274274
self.select_pressed = None
275275
self.select_is_held = False
276+
self.qam_button = qam_button
277+
if share_to_qam:
278+
self.qam_button = "share"
276279

277280
assert touchpad is None, "touchpad rewiring not supported yet"
278281

@@ -445,7 +448,7 @@ def process(self, events: Sequence[Event]):
445448
self.select_is_held = False
446449
self.select_pressed = None
447450

448-
if self.share_to_qam and ev["code"] == "share":
451+
if self.qam_button is not None and ev["code"] == self.qam_button:
449452
if ev["value"]:
450453
ev["code"] = "mode"
451454
self.queue.append(

src/hhd/device/gpd/win/base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,14 @@ def controller_loop(conf: Config, should_exit: TEvent, updated: TEvent, dconf: d
249249
# btn_map={EC("KEY_SYSRQ"): "extra_l1", EC("KEY_PAUSE"): "extra_r1"},
250250
)
251251

252+
match conf["l4r4_to_qam"].to(str):
253+
case "l4":
254+
qam_button = "extra_l1"
255+
case "r4":
256+
qam_button = "extra_r1"
257+
case _:
258+
qam_button = None
259+
252260
if has_touchpad:
253261
touch_actions = (
254262
conf["touchpad.controller"]
@@ -262,12 +270,14 @@ def controller_loop(conf: Config, should_exit: TEvent, updated: TEvent, dconf: d
262270
touchpad_short=touch_actions["short"].to(TouchpadAction),
263271
touchpad_hold=touch_actions["hold"].to(TouchpadAction),
264272
nintendo_mode=conf["nintendo_mode"].to(bool),
273+
qam_button=qam_button,
265274
)
266275
else:
267276
multiplexer = Multiplexer(
268277
trigger="analog_to_discrete",
269278
dpad="analog_to_discrete",
270279
nintendo_mode=conf["nintendo_mode"].to(bool),
280+
qam_button=qam_button,
271281
)
272282

273283
REPORT_FREQ_MIN = 25

src/hhd/device/gpd/win/controllers.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ children:
4040
Swaps A with B and X with Y.
4141
default: False
4242

43+
l4r4_to_qam:
44+
type: multiple
45+
title: Map L4/R4 to QAM.
46+
options:
47+
disabled: "Disabled"
48+
l4: "L4"
49+
r4: "R4"
50+
default: disabled
51+
4352
debug:
4453
type: bool
4554
title: Debug

0 commit comments

Comments
 (0)