Files
libretro/ports/tools/RetroBIOS.sh
T
Abdessamad Derraz 801a0150e6 feat: run the handheld launchers in the tui
The PortMaster port now starts install.py --tui on the console (or in
foot or xterm under a compositor), with gptokeyb in kill mode on the
installer's path, retrobios.gptk, TERM=linux and a Terminus font, and
puts the console, font and mapper back on exit. pugwash screens stay as
the fallback where no terminal can show, and start in no-check mode so
PortMaster's A/B fix applies. Without a network, every launcher installs
from a pack found on the card or names the pack and the folder.

Adds launchers for Batocera and Knulli (Ports, evmapy .keys), muOS
(.muxapp in muxterm with gptokeyb2) and the Tools menu of ArkOS,
dArkOS, ROCKNIX, JELOS and AmberELEC, built by build_port.py with the
pinned installer and tested on a simulated device.
2026-10-23 16:26:47 +02:00

78 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# RetroBIOS from the Tools menu of ArkOS, dArkOS, ROCKNIX, JELOS and
# AmberELEC: checks the BIOS folder and downloads the files it lacks, in the
# installer's full-screen interface, each firmware the way its own tools do.
#
# ArkOS, dArkOS console 1 with a Terminus font, /opt/inttools/gptokeyb
# (dArkOS_Tools/Wifi.sh)
# AmberELEC /dev/console, TERM=linux, the system gptokeyb
# (modules/SetTime.sh)
# ROCKNIX, JELOS the foot or weston terminal the Tools menu opens, then a
# graphical terminal or the console, with gptokeyb
HERE="$(cd "$(dirname "$0")" && pwd)"
ROOT="${RB_ROOT:-}"
RB_DIR="$HERE/retrobios"
RB_LOG="$RB_DIR/log.txt"
ESUDO=""
OS_NAME=""
if [ -f "$ROOT/etc/os-release" ]; then
OS_NAME=$(awk -F= '$1 == "NAME" { gsub(/"/, "", $2); print $2 }' "$ROOT/etc/os-release")
fi
rb_gptokeyb() {
local candidate
for candidate in "$@"; do
if [ -x "$candidate" ]; then
printf '%s\n' "$candidate"
return 0
fi
done
command -v gptokeyb 2>/dev/null
}
if [ -d "$ROOT/opt/system" ] && [ -d "$ROOT/opt/inttools" ]; then
# ArkOS and dArkOS run EmulationStation as a user with sudo.
if sudo -n true >/dev/null 2>&1; then
ESUDO="sudo"
fi
RB_ROUTES="vt"
RB_CONSOLE="${RB_CONSOLE:-/dev/tty1}"
RB_PACK_PATH="$RB_DIR:$HERE:/roms:/roms2"
controlfolder="$ROOT/opt/system/Tools/PortMaster"
mapper=$(rb_gptokeyb "$ROOT/opt/inttools/gptokeyb" "$controlfolder/gptokeyb")
[ -f "$ROOT/opt/inttools/gamecontrollerdb.txt" ] \
&& export SDL_GAMECONTROLLERCONFIG_FILE="$ROOT/opt/inttools/gamecontrollerdb.txt"
elif [ "$OS_NAME" = "AmberELEC" ]; then
RB_ROUTES="vt"
RB_CONSOLE="${RB_CONSOLE:-/dev/console}"
RB_PACK_PATH="$RB_DIR:$HERE:/storage/roms"
controlfolder="/storage/roms/ports/PortMaster"
mapper=$(rb_gptokeyb "$ROOT/usr/bin/gptokeyb" "$controlfolder/gptokeyb")
[ -f /storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt ] \
&& export SDL_GAMECONTROLLERCONFIG_FILE="/storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt"
else
# ROCKNIX, JELOS and the other systems built like them: the Tools menu
# runs this inside foot on sway builds, so its own terminal comes first.
RB_ROUTES="here app vt"
RB_CONSOLE="${RB_CONSOLE:-/dev/tty1}"
RB_PACK_PATH="$RB_DIR:$HERE:/storage/roms"
controlfolder="/storage/roms/ports/PortMaster"
mapper=$(rb_gptokeyb "$ROOT/usr/bin/gptokeyb" "$controlfolder/gptokeyb")
fi
# Kill mode on the installer's own path: Start + Select closes the
# interface, never another program.
RB_MAPPER=""
[ -n "$mapper" ] && RB_MAPPER="$ESUDO $mapper -1"
# shellcheck source=../shared/tui.txt
source "$RB_DIR/tui.txt"
: > "$RB_LOG"
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