mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-31 16:17:19 -05:00
fix: put back only the font a firmware restores
This commit is contained in:
1 parent
e537a031d0
commit
9181b77426
4 files changed
+25
-6
No files matched your search
@@ -60,6 +60,8 @@ if [ -e "${RB_ARK_MARKER:-/usr/share/plymouth/themes/text.plymouth}" ]; then
|
||||
RB_BIOS_DEST=$(awk -F'"' '/^system_directory *=/ { print $2; exit }' \
|
||||
"${RB_RETROARCH_CFG:-/home/ark/.config/retroarch/retroarch.cfg}" 2>/dev/null)
|
||||
RB_BIOS_DEST="${RB_BIOS_DEST:-/$directory/bios}"
|
||||
# The font ArkOS's own tools put back on leaving (dArkOS_Tools/Wifi.sh).
|
||||
RB_FONT_DEFAULT="Lat7-Terminus20x10"
|
||||
fi
|
||||
# shellcheck source=../shared/tui.txt
|
||||
source "$GAMEDIR/tui.txt"
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
# RB_BIOS_DEST the one of them the firmware reads, never offered as the
|
||||
# other card
|
||||
# RB_FALLBACK 1 when the launcher has screens of its own to fall back to
|
||||
# RB_FONT_DEFAULT the console font the firmware itself puts back, by
|
||||
# name (ArkOS: Lat7-Terminus20x10), for a setfont that
|
||||
# cannot save the one in place. Unset, the font is kept.
|
||||
# RB_PAD the input route, exported to the interface as
|
||||
# RETROBIOS_PAD: gptokeyb (retrobios.gptk, the default when
|
||||
# RB_MAPPER is set), muxterm (muxterm's own keys), evmapy
|
||||
@@ -493,8 +496,9 @@ rb_route_ready() {
|
||||
# The largest Terminus font that keeps 56 columns and 20 rows, the way
|
||||
# dArkOS's own tools pick one per screen (Lat7-Terminus16 on 480x320,
|
||||
# TerminusBold22x11 on 640x480, 32x16 on 1024x768). Only changed when the
|
||||
# font in place can be put back: saved with setfont -O, or the
|
||||
# Lat7-Terminus20x10 ArkOS tools restore.
|
||||
# font in place can be put back: saved with setfont -O, or RB_FONT_DEFAULT,
|
||||
# the one the firmware's own tools restore. A fixed fallback gave a device
|
||||
# whose default differs another font after the run.
|
||||
rb_font_set() {
|
||||
command -v setfont >/dev/null 2>&1 || return 0
|
||||
local size width height spec fh fw name file="" fallback
|
||||
@@ -524,7 +528,8 @@ rb_font_set() {
|
||||
RB_FONT_BACK="$RB_STATE/font.psf"
|
||||
return 0
|
||||
fi
|
||||
fallback="$RB_FONTS/Lat7-Terminus20x10.psf.gz"
|
||||
[ -n "${RB_FONT_DEFAULT:-}" ] || return 0
|
||||
fallback="$RB_FONTS/$RB_FONT_DEFAULT.psf.gz"
|
||||
if [ -f "$fallback" ] && $ESUDO setfont -C "$RB_TTY" "$file" >> "$RB_LOG" 2>&1; then
|
||||
RB_FONT_BACK="$fallback"
|
||||
fi
|
||||
|
||||
@@ -40,6 +40,8 @@ if [ -d "$ROOT/opt/system" ] && [ -d "$ROOT/opt/inttools" ]; then
|
||||
fi
|
||||
RB_ROUTES="vt"
|
||||
RB_CONSOLE="${RB_CONSOLE:-/dev/tty1}"
|
||||
# The font ArkOS's own tools put back on leaving (dArkOS_Tools/Wifi.sh).
|
||||
RB_FONT_DEFAULT="Lat7-Terminus20x10"
|
||||
RB_PACK_PATH="$RB_DIR:$HERE:/roms:/roms2"
|
||||
# The second card is /roms2, and "Switch to SD2 for Roms" moves RetroArch's
|
||||
# system folder there (dArkOS scripts/Switch to SD2 for Roms.sh:91-92): the
|
||||
|
||||
@@ -1334,13 +1334,15 @@ class ThePortMasterPort(unittest.TestCase):
|
||||
device.assert_console_restored()
|
||||
|
||||
def test_the_font_is_put_back_without_setfont_o(self):
|
||||
"""busybox setfont has no -O: the font is changed only when the
|
||||
Lat7-Terminus20x10 ArkOS tools restore exists, and that one is put
|
||||
"""busybox setfont has no -O: on ArkOS the font is changed only when
|
||||
the Lat7-Terminus20x10 its tools restore exists, and that one is put
|
||||
back."""
|
||||
device = self.device(FAKE_NO_SAVE="1")
|
||||
fonts = device.env["RB_FONTS"]
|
||||
(Path(fonts) / "Lat7-Terminus20x10.psf.gz").write_bytes(b"")
|
||||
device.run(["bash", self.script])
|
||||
marker = device.root / "text.plymouth"
|
||||
marker.write_text("")
|
||||
device.run(["bash", self.script], RB_ARK_MARKER=str(marker))
|
||||
chosen = f"{fonts}/Lat7-TerminusBold22x11.psf.gz"
|
||||
saved = str(self.gamedir / "run" / "font.psf")
|
||||
self.assertEqual(device.tools(), [
|
||||
@@ -1349,6 +1351,14 @@ class ThePortMasterPort(unittest.TestCase):
|
||||
f"setfont -C {device.console} {fonts}/Lat7-Terminus20x10.psf.gz",
|
||||
])
|
||||
|
||||
def test_elsewhere_a_font_that_cannot_be_saved_is_left(self):
|
||||
"""Lat7-Terminus20x10 is ArkOS's font: put back on another device,
|
||||
it left the console in a font it never had."""
|
||||
device = self.device(FAKE_NO_SAVE="1")
|
||||
(Path(device.env["RB_FONTS"]) / "Lat7-Terminus20x10.psf.gz").write_bytes(b"")
|
||||
device.run(["bash", self.script])
|
||||
self.assertEqual(len([t for t in device.tools() if t.startswith("setfont")]), 1)
|
||||
|
||||
def test_without_the_fallback_font_the_font_is_left(self):
|
||||
device = self.device(FAKE_NO_SAVE="1")
|
||||
device.run(["bash", self.script])
|
||||
|
||||
Reference in new issue
Block a user