Files
libretro/ports/muos/mux_launch.sh
T
Abdessamad Derraz e7d27a264d fix: hide the pad from muxterm on every muos build
muxterm was allowed vendor and product 0001:0001, the id gpio-keys
gives the H700 pad on muOS before 2026-08-28: muxterm and gptokeyb2
both read it and every button acted twice. The allow-list is now
0000:0001, which SDL never reads back for a device (a vendor of 0 makes
a name GUID, read back as 0:0), so a pad plugged in later stays hidden.

- muxterm keeps PgUp and PgDn for its scrollback: in muxterm L1 and R1
  send nothing, and the README and wiki stop promising paging there.
- The offline detection runs with RETROBIOS_INSTALL_OFFLINE=1 instead
  of a closed loopback URL.
- Every launcher sets RETROBIOS_IDLE_EXIT=300 for the interface.
- ROCKNIX: control.ini's -sudokill goes through a sudo stub that runs
  nothing, so the mapper starts with -1.
- The sentinel ends with its launcher, a closed terminal app writes its
  status, a mapper lost mid-run is said and named (gptokeyb2 included),
  and the unwritable-card message stays in view.
- Tests: an SDL GUID model, a gptokeyb2 that outlives its kill, an
  interface that ignores SIGTERM, a zombie, a SIGHUP to the inner run,
  arrow bytes at the question, ROCKNIX's sudo.
2026-10-23 21:29:48 +02:00

64 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# HELP: Checks the BIOS folder and installs the missing BIOS files
# ICON: retrobios
# GRID: RetroBIOS
# RetroBIOS for muOS, from Applications: the installer's full-screen
# interface in muxterm, the terminal muOS's own Terminal core runs, with
# PortMaster's gptokeyb2 turning the buttons into keys. Without muxterm it
# runs on the console.
MUOS="${RB_MUOS:-/opt/muos}"
# shellcheck source=/dev/null
. "$MUOS/script/var/retro.sh"
SETUP_APP "retrobios" ""
APP_DIR="$(cd "$(dirname "$0")" && pwd)"
ROM_MOUNT="$(GET_VAR "device" "storage/rom/mount")"
PM_DIR="$ROM_MOUNT/MUOS/PortMaster"
MUXTERM="$MUOS/frontend/muxterm"
RB_DIR="$APP_DIR"
RB_LOG="$APP_DIR/log.txt"
# muOS binds MUOS/bios from SD2 when that card has one, else from SD1, onto
# /run/muos/storage/bios (script/device/bind.sh:10-11,30-52): the other card's
# MUOS/bios is the one offered to copy from.
SD2_MOUNT="$(GET_VAR "device" "storage/sdcard/mount")"
RB_PACK_PATH="$APP_DIR:$ROM_MOUNT:$SD2_MOUNT"
RB_OTHER_CARDS="$ROM_MOUNT/MUOS/bios:$SD2_MOUNT/MUOS/bios"
RB_BIOS_DEST="${RB_BIOS_DEST:-/run/muos/storage/bios}"
# PortMaster keeps its runtimes here: the Python runtime is used when
# PortMaster has downloaded it.
controlfolder="$PM_DIR"
# shellcheck source=../shared/tui.txt
source "$APP_DIR/tui.txt"
rb_open_log fresh
RB_GPTK="$APP_DIR/retrobios.gptk"
if [ -x "$PM_DIR/gptokeyb2" ]; then
# As muOS's own launchers start it (script/launch/ext-xroar.sh). gptokeyb2
# kills only with SIGKILL: by process name by default, which never names
# this run, and quits all the same, or with -X by command line, which is
# what reaches the Start + Select sentinel (gptokeyb2 src/util.c).
ln -sf "$PM_DIR/libinterpose.aarch64.so" "/usr/lib/libinterpose.aarch64.so" >/dev/null 2>&1
RB_MAPPER="$PM_DIR/gptokeyb2 -X"
fi
if [ -x "$MUXTERM" ]; then
RB_ROUTES="app"
# With gptokeyb2, muxterm leaves the pad to it. Without, muxterm's own
# buttons are all there is.
rb_muxterm "$MUXTERM"
else
RB_ROUTES="vt"
RB_CONSOLE="${RB_CONSOLE:-/dev/tty0}"
fi
rb_select_python
# A launcher's own arguments are not install.py's (muOS passes the app folder).
# shellcheck disable=SC2119
rb_launch
status=$?
rb_release_python
exit $status