fix: read a card's games under --platform

The full screen passes --platform=retroarch for a muOS card. Detection
never runs in that child, so games_setups fell back to RetroArch's own
setup and the run said no games folder was found beside MUOS/bios. The
card's own files now name its system, as card_app reads them.
This commit is contained in:
Abdessamad Derraz committed 2026-11-09 06:12:02 +01:00
1 parent ae5b6219bb
commit 6692cf908c
5 files changed
+48 -12

No files matched your search

+1 -1
View File
@@ -16,7 +16,7 @@
# and Invoke-WebRequest throws on a cut transfer before the hash is read:
# the site's build rewrites this line there (scripts/sitebootstrap.py).
$mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
$defaultInstallSha256 = "bba0f7cd7677fb7f4d767504412843cf3809c03b91808c7c7772f17758893d50"
$defaultInstallSha256 = "7bfcc3b63b3d8c34998e021d84f873a49c91837fc266e593e918ac7871ef78b2"
$maximumInstallerBytes = 2MB
$installerExit = 0
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
+7
View File
@@ -9943,6 +9943,13 @@ def games_setups(index: dict, plat: str, bios_path: Path, os_type: str = "") ->
if not named:
above = card_root_above(bios_path)
named = above[0] if above else ""
if not named:
# --platform names the list, not the card: the full screen passes
# --platform=retroarch for a muOS card, detection never runs in that
# run, and the card's ROMS/ was never read. The card's own files
# name its system, as card_app reads them for the app.
card = card_app(bios_path)
named = card.system if card else ""
if not named:
# --dest on a handheld's games part from a computer (ArkOS's
# EASYROMS/bios): detection never ran there, and the card's own rom
+1 -1
View File
@@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins
# curl or wget stop on a cut transfer before the hash is read: the site's
# build rewrites this line there (scripts/sitebootstrap.py).
MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that."
DEFAULT_INSTALL_SHA256="bba0f7cd7677fb7f4d767504412843cf3809c03b91808c7c7772f17758893d50"
DEFAULT_INSTALL_SHA256="7bfcc3b63b3d8c34998e021d84f873a49c91837fc266e593e918ac7871ef78b2"
MAX_INSTALLER_BYTES=2097152
cleanup() {
+8 -8
View File
@@ -27,8 +27,8 @@
{
"dest": "roms/ports/retrobios/install.py",
"repo_path": "install.py",
"size": 1125268,
"sha256": "bba0f7cd7677fb7f4d767504412843cf3809c03b91808c7c7772f17758893d50",
"size": 1125652,
"sha256": "7bfcc3b63b3d8c34998e021d84f873a49c91837fc266e593e918ac7871ef78b2",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
"size": 1178895,
"sha256": "814d80f123e59f5192631842d53a4808bf373599ced857f4622612ffbc25322b"
"size": 1179279,
"sha256": "bce18e6f5457057162d0c9113a9c41bd6dad53bd5badaa46d44b62e7fd7a9299"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
"size": 1125268,
"sha256": "bba0f7cd7677fb7f4d767504412843cf3809c03b91808c7c7772f17758893d50",
"size": 1125652,
"sha256": "7bfcc3b63b3d8c34998e021d84f873a49c91837fc266e593e918ac7871ef78b2",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
"size": 1125268,
"sha256": "bba0f7cd7677fb7f4d767504412843cf3809c03b91808c7c7772f17758893d50",
"size": 1125652,
"sha256": "7bfcc3b63b3d8c34998e021d84f873a49c91837fc266e593e918ac7871ef78b2",
"executable": false
},
{
+31 -2
View File
@@ -202,7 +202,8 @@ def _dumps(doc: object) -> bytes:
def write_index(folder: Path, systems: dict | None = None, arcade: dict | None = None,
setup: dict | None = None, extra_sets: dict | None = None) -> None:
setup: dict | None = None, extra_sets: dict | None = None,
more_setups: dict | None = None) -> None:
"""install/games/ as the generator lays it out, every digest right."""
rows = sorted({(dest, FILES[dest][0], "bios") for files, _o in SETS.values()
for dest in files})
@@ -213,7 +214,7 @@ def write_index(folder: Path, systems: dict | None = None, arcade: dict | None =
"optional": [position[d] for d in optional],
"bytes": 0, "required_bytes": 0}
for key, (files, optional) in sets.items()}}
docs = {"setups": {"retroarch": setup or SETUP}, "fallback": {"retroarch": fallback},
docs = {"setups": {"retroarch": setup or SETUP, **(more_setups or {})}, "fallback": {"retroarch": fallback},
"systems": {key: {"format_version": 1, "system": key, **value}
for key, value in (systems or SYSTEMS).items()},
"arcade": {"fbneo": {"profile": "fbneo", **(arcade or ARCADE)}}}
@@ -912,6 +913,34 @@ class CommandLine(unittest.TestCase):
self.assertTrue((self.card.cache / install.GAMES_SCAN_FILE).is_file())
class AMuosCardNamedByItsList(unittest.TestCase):
"""The full screen passes --platform=retroarch for a muOS card, and the
run said no games folder was found beside MUOS/bios, where line mode,
which had detected the card, read ROMS/."""
def test_the_card_its_bios_folder_is_on_names_its_rom_folders(self):
card = Card()
self.addCleanup(card.close)
root = card.root / "MUOSCARD"
card.bios = root / "MUOS" / "bios"
card.bios.mkdir(parents=True)
game = root / "ROMS" / "MD" / "eu.md"
game.parent.mkdir(parents=True)
game.write_bytes(MD_EU)
muos = dict(SETUP, setup="muos", name="muOS",
roms_root={"path": "/mnt/mmc/ROMS", "from_bios": "../../ROMS"})
# RetroArch's own setup names no rom folder (configuration.c).
retroarch = dict(SETUP, roms_root={"path": None, "from_bios": None})
write_index(card.lists / "games", setup=retroarch, more_setups={"muos": muos})
proc = run_cli(card, "--for-games", "--check", "--events")
events = [json.loads(line) for line in proc.stdout.splitlines()
if line.startswith("{")]
self.assertEqual([e for e in events if e["event"] == "games_unavailable"], [])
games = next(e for e in events if e["event"] == "games")
self.assertEqual(games["folder"], str(root / "ROMS"))
self.assertEqual(games["games"], 1)
class ARunThatAsksNothing(unittest.TestCase):
"""`--yes` alone installed the whole list (6.4 GB on a dArkOS card that
held two games), while the screen offers what the games need first."""