Add AntiMicroX plumbing for a universal controller-combo hotkey

Wires up the infrastructure for RetroArch's own hotkeys (global across
every libretro core already) to be matched by an equivalent for
Dolphin/PCSX2/Azahar, none of which support gamepad-bound hotkeys
natively (confirmed open feature requests: PCSX2/pcsx2#1082,
azahar-emu/azahar#722; Dolphin's are hardcoded to keyboard only).

AntiMicroX watches Wolf's virtual gamepad directly — a real uinput
device per Wolf's own "inputtino" docs, not a proprietary channel —
and injects whatever keyboard shortcut the focused emulator actually
expects.

Mechanism: GoW's own stock Sway config (baked into the esde/retroarch
images) has a deliberate first-line extension point,
`include /home/retro/.config/sway/custom-cfg` (confirmed by reading it
directly out of a running container). Since /home/retro/.config is
already the retro-home mount added earlier this session, writing a
file to $GAME_STORAGE_DIR/retro-home/sway/custom-cfg on the host lands
exactly there in both containers — zero changes to GoW's own image or
scripts needed.

Deliberately scoped to plumbing only: download AntiMicroX (reusing the
_wolf_download_emulator_appimage helper added for PCSX2/Dolphin), add
the Sway launch hook (floating window, not hidden, so it's reachable
through the Moonlight stream), and document the actual one-time setup
flow in the generated README. The button mapping itself, including
AntiMicroX's own per-application Auto Profile switching, is built
through its real GUI rather than a hand-authored .gamecontroller.amgp
this repo can't verify blind.

Marked experimental throughout (install prompt defaults to n, DRY-RUN
summary, README) — this is unverified against a live session.
This commit is contained in:
Claude
2026-09-01 02:24:29 +00:00
parent 1ed7fe89ea
commit f087984526
+101
View File
@@ -278,6 +278,9 @@ EOF
echo " - Create bios/ + retroarch/{cores,shaders,overlays}/ on the game drive and pre-download RetroArch cores (~1.5 GB)"
echo " - Offer to auto-download standalone emulator AppImages into emulators/:"
echo " Azahar (3DS), PCSX2 (PS2), Dolphin (GameCube/Wii — unofficial community build)"
echo " - Offer to set up AntiMicroX (universal controller-combo hotkey, experimental —"
echo " downloads it and wires a Sway launch hook; the button mapping itself is"
echo " built later through AntiMicroX's own GUI)"
return 0
fi
@@ -840,6 +843,72 @@ UDEV
_wolf_download_emulator_appimage \
"Dolphin (GameCube/Wii, community AppImage build)" "pkgforge-dev/Dolphin-emu-AppImage" "*[Dd]olphin*.AppImage" "$_EMU_DIR"
# ── Optional: AntiMicroX for a universal controller-combo hotkey ─────────
# RetroArch's own hotkeys (Settings -> Input -> Input Hotkey Binds) are
# global across every libretro core, but Dolphin/PCSX2/Azahar each run as
# standalone apps ES-DE launches directly and none of the three support
# gamepad-bound hotkeys natively (confirmed open feature requests:
# PCSX2/pcsx2#1082, azahar-emu/azahar#722; Dolphin's hotkeys are
# hardcoded to keyboard only). AntiMicroX bridges this by watching the
# real controller device (Wolf's virtual gamepad is a genuine uinput
# device — see games-on-whales/wolf's own docs on "inputtino" — so this
# is a real input device AntiMicroX can open, not a proprietary channel)
# and injecting whatever keyboard shortcut each app actually expects.
#
# GoW's own stock Sway config (/cfg/sway/config, baked into the esde and
# retroarch images — same one both apps' `launcher()` call copies) has a
# deliberate extension point at its very first line:
# include /home/retro/.config/sway/custom-cfg
# Since /home/retro/.config is already our own retro-home mount (see the
# esde/retroarch CATALOG mounts above), just writing a file to
# $GAME_STORAGE_DIR/retro-home/sway/custom-cfg on the host lands exactly
# there in the container, for both apps, with zero changes to GoW's own
# image or scripts needed.
#
# This only wires up the plumbing (download AntiMicroX, launch it
# visibly as a floating window every session). The actual button
# mapping — including AntiMicroX's own per-application "Auto Profile"
# switching (Options -> Settings -> Auto Profile in its GUI) needed to
# send a different key to each emulator from the same physical combo —
# has to be built once through AntiMicroX's own GUI while it's running;
# hand-authoring its .gamecontroller.amgp profile XML blind isn't
# something to guess at. Whatever gets saved there persists automatically
# (same retro-home mount), so it's a one-time setup.
local _AMX_DIR="$GAME_STORAGE_DIR/retro-home/antimicrox"
local _SWAY_CFG_DIR="$GAME_STORAGE_DIR/retro-home/sway"
mkdir -p "$_AMX_DIR" "$_SWAY_CFG_DIR"
echo ""
log_info "AntiMicroX lets you map one controller combo (e.g. Select+Start) to a"
log_info "different real keyboard shortcut per emulator — RetroArch's own hotkeys"
log_info "already cover every RetroArch-driven system; this is for Dolphin/PCSX2/"
log_info "Azahar, none of which support gamepad hotkeys natively. EXPERIMENTAL:"
log_info "the actual button mapping has to be built once through its own GUI."
local _GET_AMX=""
prompt_yn "Set up AntiMicroX for a universal controller hotkey? (y/n):" "n" _GET_AMX
if [[ "$_GET_AMX" =~ ^[Yy]$ ]]; then
_wolf_download_emulator_appimage \
"AntiMicroX" "AntiMicroX/antimicrox" "antimicrox*.AppImage" "$_AMX_DIR"
local _AMX_APP
_AMX_APP=$(ls "$_AMX_DIR"/antimicrox*.AppImage 2>/dev/null | head -1)
if [[ -n "$_AMX_APP" ]]; then
backup_if_exists "$_SWAY_CFG_DIR/custom-cfg"
cat > "$_SWAY_CFG_DIR/custom-cfg" << CFGEOF
# Written by services/wolf.sh — AntiMicroX: universal controller-combo hotkey.
# Launched as a normal floating window (not hidden) so its own GUI is
# reachable through the Moonlight stream for one-time profile setup —
# see ~/docker/wolf/README.md for how to build the actual button mapping.
for_window [app_id="antimicrox"] floating enable, resize set 480 360, move position 20 20
exec /home/retro/.config/antimicrox/$(basename "$_AMX_APP") --appimage-extract-and-run &
CFGEOF
chown -R 1000:1000 "$_AMX_DIR" "$_SWAY_CFG_DIR" 2>/dev/null || true
log_success "AntiMicroX will launch (as a small floating window) alongside ES-DE/RetroArch."
log_info "First session: open its window, map your combo, save — it persists from then on."
else
log_warning "AntiMicroX download didn't produce a usable AppImage — skipping the Sway launch hook."
fi
fi
# ── App selection ─────────────────────────────────────────────────────────
echo ""
echo "═══════════════════════════════════════════════════════"
@@ -3153,6 +3222,38 @@ auto-detected. Missing ones get offered again on a fresh install
(\`sudo ./setup.sh wolf\`); to grab just one by hand, download its AppImage
into \`emulators/\`, \`chmod +x\` it.
## AntiMicroX — universal controller-combo hotkey (experimental)
RetroArch's own hotkeys (Settings -> Input -> Input Hotkey Binds) already
cover every RetroArch-driven system, but Dolphin/PCSX2/Azahar don't support
gamepad-bound hotkeys natively — AntiMicroX watches the controller directly
and injects whatever keyboard shortcut each app actually expects, so one
physical combo (e.g. hold Select, press Start) can mean "exit" — or save
state, or anything else — everywhere.
If you said yes to the AntiMicroX prompt during install, it launches
automatically as a small floating window every time ES-DE or RetroArch
starts. **Building the actual mapping is a one-time step, done through its
own GUI, not something this installer can pre-configure:**
1. Start ES-DE (or RetroArch) from Moonlight as normal — AntiMicroX's small
window appears floating in the corner alongside it.
2. In AntiMicroX: set up your controller under its device list, then create
a profile — click a button in its UI, press the real combo on your
gamepad, assign it the keyboard key the target emulator expects for that
action (see each emulator's own Settings -> Input/Hotkeys for its actual
bindings — Dolphin/PCSX2 defaults are commonly F1-F4-range keys).
3. For a **different translation per emulator** from the same physical
combo, use AntiMicroX's own **Options -> Settings -> Auto Profile** —
add a rule per application (matched by window class/title) so e.g.
Select+Start sends Esc when Dolphin has focus but F4 when RetroArch does.
4. Save. It's written under \`~/.config/antimicrox/\` inside the container,
which is the same \`retro-home/\` mount everything else here persists
through — it'll auto-load on every future session with no further setup.
To change the mapping later, just reopen AntiMicroX the same way. To remove
it entirely, delete \`retro-home/sway/custom-cfg\` and \`retro-home/antimicrox/\`
on the host and re-run \`sudo ./setup.sh wolf\`.
## Troubleshooting: app exits immediately ("Permission denied")
If a launcher (Steam, etc.) closes the moment it opens, its Wolf-managed home
dir has root-owned files the in-container user (uid 1000) can't write. Fix: