Files
libretro/ports/RetroBIOS/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

75 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
# RetroBIOS: checks the BIOS folder of this system and downloads the files
# it lacks, in the installer's full-screen interface on the console, the way
# PortMaster's Moonlight and Rlvm ports draw dialog there.
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
if [ -d "/opt/system/Tools/PortMaster/" ]; then
controlfolder="/opt/system/Tools/PortMaster"
elif [ -d "/opt/tools/PortMaster/" ]; then
controlfolder="/opt/tools/PortMaster"
elif [ -d "$XDG_DATA_HOME/PortMaster/" ]; then
controlfolder="$XDG_DATA_HOME/PortMaster"
else
controlfolder="/roms/ports/PortMaster"
fi
# shellcheck source=/dev/null
source "$controlfolder/control.txt"
# shellcheck source=/dev/null
[ -f "${controlfolder}/mod_${CFW_NAME}.txt" ] && source "${controlfolder}/mod_${CFW_NAME}.txt"
get_controls
# Set by control.txt.
: "${directory:?}" "${GPTOKEYB:=}" "${sdl_controllerconfig:=}"
GAMEDIR="/$directory/ports/retrobios"
cd "$GAMEDIR" || exit 1
# Appended to, as the launcher and install.py also write this file: a tee
# writing from its own offset would overwrite their lines.
: > "$GAMEDIR/log.txt" && exec > >(tee -a "$GAMEDIR/log.txt") 2>&1
# PortMasterDialog.txt has shipped with PortMaster since before 2024.02.26,
# and the 8.5.23 copy JELOS and KOLOS preinstall has no funcs.txt to source
# it: it is sourced here. It downloads the Python runtime when one is
# needed, and draws the fallback screens.
if [ ! -f "$controlfolder/PortMasterDialog.txt" ]; then
echo "RetroBIOS needs PortMaster 2024.02.26 or newer: update PortMaster, then start RetroBIOS again."
exit 1
fi
# shellcheck source=/dev/null
source "$controlfolder/PortMasterDialog.txt"
RB_DIR="$GAMEDIR"
RB_ROUTES="app vt"
RB_CONSOLE="${CUR_TTY:-/dev/tty0}"
RB_MAPPER="$GPTOKEYB"
RB_FALLBACK=1
RB_PACK_PATH="$GAMEDIR:/$directory/ports:/$directory"
# shellcheck source=../shared/tui.txt
source "$GAMEDIR/tui.txt"
# shellcheck source=retrobios/screens.txt
source "$GAMEDIR/screens.txt"
export SDL_GAMECONTROLLERCONFIG="$sdl_controllerconfig"
rb_select_python
# A launcher's own arguments are not install.py's (muOS passes the app folder).
# shellcheck disable=SC2119
rb_launch
status=$?
if [ "$status" = "125" ]; then
# No console or terminal app shows the interface here: PortMaster's own
# screens do.
rb_main
status=$?
fi
rb_release_python
if declare -F pm_finish > /dev/null; then
pm_finish
fi
exit $status