From 73b82375d9ad37558256475fc024ef1e5cd9fe6b Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 5 Nov 2026 19:25:30 +0100 Subject: [PATCH] feat: recognise a mister card on a computer --- install.ps1 | 2 +- install.py | 6 ++++ install.sh | 2 +- install/launchers/index.json | 16 +++++----- scripts/generate_installer_doc.py | 8 +++-- tests/fixtures/tui/colour-120x40.txt | 2 +- tests/fixtures/tui/colour-40x15.txt | 2 +- tests/fixtures/tui/colour-80x24.txt | 2 +- tests/fixtures/tui/platforms-120x40.txt | 2 +- tests/fixtures/tui/platforms-40x15.txt | 2 +- tests/fixtures/tui/platforms-80x24.txt | 2 +- tests/fixtures/tui/route-evmapy.txt | 4 +-- tests/fixtures/tui/route-gptokeyb.txt | 4 +-- tests/fixtures/tui/route-gptokeyb_muxterm.txt | 4 +-- tests/fixtures/tui/route-keys.txt | 4 +-- tests/fixtures/tui/route-miyoo.txt | 4 +-- tests/fixtures/tui/route-muxterm.txt | 4 +-- tests/test_install_tui.py | 29 +++++++++++++++++-- wiki/installer.md | 7 +++-- 19 files changed, 72 insertions(+), 34 deletions(-) diff --git a/install.ps1 b/install.ps1 index d60007075..9261c6ee4 100644 --- a/install.ps1 +++ b/install.ps1 @@ -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 = "aa9407fbbe2d7a7b2ac78407272b96b1d9befb177eea64a5a084c73a0100dee9" + $defaultInstallSha256 = "fdc80bcbe544c34e66af5cb953edd9b2b18c4722d32077f570f8503cc6815ca1" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index d5824b476..64dde5a76 100644 --- a/install.py +++ b/install.py @@ -13737,6 +13737,12 @@ _SHARE_RULES: tuple[_OsRule, ...] = ( _OsRule("rocknix", "ROCKNIX", "file_matches", (".config/system/configs/system.cfg", r"^root\.password=rocknix\s*$"), "roms/bios"), + # MiSTer's is its exFAT partition, /media/fat (Main_MiSTer e0a234f9, + # file_io.cpp:1177), whose root holds the MiSTer binary and menu.rbf + # (Distribution_MiSTer ce602319) and which reads each core's files + # below games/ (GAMES_DIR, file_io.h:171). A card prepared on a + # computer got RetroArch's list, or MiSTer's at its root. + _OsRule("misterfpga", "MiSTer FPGA", "file_exists", ("MiSTer", "menu.rbf"), "games"), ) diff --git a/install.sh b/install.sh index 841e60b9d..ade706434 100755 --- a/install.sh +++ b/install.sh @@ -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="aa9407fbbe2d7a7b2ac78407272b96b1d9befb177eea64a5a084c73a0100dee9" +DEFAULT_INSTALL_SHA256="fdc80bcbe544c34e66af5cb953edd9b2b18c4722d32077f570f8503cc6815ca1" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/install/launchers/index.json b/install/launchers/index.json index 2b470c65b..fd23b4139 100644 --- a/install/launchers/index.json +++ b/install/launchers/index.json @@ -27,8 +27,8 @@ { "dest": "roms/ports/retrobios/install.py", "repo_path": "install.py", - "size": 1091637, - "sha256": "aa9407fbbe2d7a7b2ac78407272b96b1d9befb177eea64a5a084c73a0100dee9", + "size": 1092074, + "sha256": "fdc80bcbe544c34e66af5cb953edd9b2b18c4722d32077f570f8503cc6815ca1", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1145264, - "sha256": "3d17d78050a0fe0181712084cb7bfbc258be08853ffcb7da897628e8a9e9f545" + "size": 1145701, + "sha256": "844b1ee7a71dabae0fa7fb9aedba24ab8255dfab867c2ef4e8189ea286abc6e3" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1091637, - "sha256": "aa9407fbbe2d7a7b2ac78407272b96b1d9befb177eea64a5a084c73a0100dee9", + "size": 1092074, + "sha256": "fdc80bcbe544c34e66af5cb953edd9b2b18c4722d32077f570f8503cc6815ca1", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1091637, - "sha256": "aa9407fbbe2d7a7b2ac78407272b96b1d9befb177eea64a5a084c73a0100dee9", + "size": 1092074, + "sha256": "fdc80bcbe544c34e66af5cb953edd9b2b18c4722d32077f570f8503cc6815ca1", "executable": false }, { diff --git a/scripts/generate_installer_doc.py b/scripts/generate_installer_doc.py index 5775298e3..d0cfce9bb 100644 --- a/scripts/generate_installer_doc.py +++ b/scripts/generate_installer_doc.py @@ -175,6 +175,10 @@ def route_keys() -> str: return _table(heading, rows) +# Card markers that are files with no extension: the MiSTer binary. +_BARE_FILES = frozenset({"MiSTer"}) + + def _marker(rule: _install._OsRule) -> str: """A card rule's evidence in words: the file or folder, and the line it holds for a rule that reads one.""" @@ -182,8 +186,8 @@ def _marker(rule: _install._OsRule) -> str: path, pattern = rule.values line = re.sub(r"\\s\*\$$", "", re.sub(r"^(\^|\\A)", "", pattern)).replace("\\", "") return f"`{path}` holding the line `{line}`" - named = ", ".join(f"`{value}`" if PurePosixPath(value).suffix else f"`{value}/`" - for value in rule.values) + named = ", ".join(f"`{value}`" if PurePosixPath(value).suffix or value in _BARE_FILES + else f"`{value}/`" for value in rule.values) if rule.method == "games_part": # Told on the games part beside its bios folder, on a drive the # system does not call fixed (install.games_part). diff --git a/tests/fixtures/tui/colour-120x40.txt b/tests/fixtures/tui/colour-120x40.txt index c4227fd0e..81bbef3da 100644 --- a/tests/fixtures/tui/colour-120x40.txt +++ b/tests/fixtures/tui/colour-120x40.txt @@ -54,7 +54,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -69,6 +68,7 @@ KOLOS, SD card RG353P, RG353M, RG353V, RG353VS, RG503, +3 Koriki, SD card Miyoo Mini MinUI, SD card RG28XX, RG34XX, RG34XX SP, RG35XX, +19 + MiSTer FPGA, SD card MiyooCFW, SD card BittBoy, Pocket Go, PowKiddy Q90, +4 muOS, SD card RG35XX H, RG35XX Plus, RG35XX SP, +8 MyMinUI, SD card RG35XX, Miyoo Mini, Miyoo Mini Flip, +18 diff --git a/tests/fixtures/tui/colour-40x15.txt b/tests/fixtures/tui/colour-40x15.txt index 3d4f54e39..e883877d6 100644 --- a/tests/fixtures/tui/colour-40x15.txt +++ b/tests/fixtures/tui/colour-40x15.txt @@ -27,7 +27,7 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie ^[[0;2m 1-10 of 34^[[0m ^[[0;1;35mA^[[0m Choose ^[[0;2mB^[[0m Back ^[[0;2m/^[[0m Filter ^[[0;2m?^[[0m Help === folder diff --git a/tests/fixtures/tui/colour-80x24.txt b/tests/fixtures/tui/colour-80x24.txt index 121db8b0c..f0562838e 100644 --- a/tests/fixtures/tui/colour-80x24.txt +++ b/tests/fixtures/tui/colour-80x24.txt @@ -36,7 +36,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -46,6 +45,7 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 ^[[0;2m 1-19 of 34^[[0m ^[[0;1;35mA/Enter^[[0m Choose ^[[0;2mB/Esc^[[0m Back ^[[0;2m/^[[0m Filter ^[[0;2m?^[[0m Help === folder diff --git a/tests/fixtures/tui/platforms-120x40.txt b/tests/fixtures/tui/platforms-120x40.txt index 258c9ce65..2f5817998 100644 --- a/tests/fixtures/tui/platforms-120x40.txt +++ b/tests/fixtures/tui/platforms-120x40.txt @@ -12,7 +12,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -27,6 +26,7 @@ KOLOS, SD card RG353P, RG353M, RG353V, RG353VS, RG503, +3 Koriki, SD card Miyoo Mini MinUI, SD card RG28XX, RG34XX, RG34XX SP, RG35XX, +19 + MiSTer FPGA, SD card MiyooCFW, SD card BittBoy, Pocket Go, PowKiddy Q90, +4 muOS, SD card RG35XX H, RG35XX Plus, RG35XX SP, +8 MyMinUI, SD card RG35XX, Miyoo Mini, Miyoo Mini Flip, +18 diff --git a/tests/fixtures/tui/platforms-40x15.txt b/tests/fixtures/tui/platforms-40x15.txt index d0ebd799c..7327b4417 100644 --- a/tests/fixtures/tui/platforms-40x15.txt +++ b/tests/fixtures/tui/platforms-40x15.txt @@ -10,6 +10,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie 1-10 of 34 A Choose B Back / Filter ? Help diff --git a/tests/fixtures/tui/platforms-80x24.txt b/tests/fixtures/tui/platforms-80x24.txt index 7fb53a4c8..3d7f38047 100644 --- a/tests/fixtures/tui/platforms-80x24.txt +++ b/tests/fixtures/tui/platforms-80x24.txt @@ -10,7 +10,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -20,5 +19,6 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 1-19 of 34 A/Enter Choose B/Esc Back / Filter ? Help diff --git a/tests/fixtures/tui/route-evmapy.txt b/tests/fixtures/tui/route-evmapy.txt index 4ecf7723d..0c693acb1 100644 --- a/tests/fixtures/tui/route-evmapy.txt +++ b/tests/fixtures/tui/route-evmapy.txt @@ -78,7 +78,7 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie 1-10 of 34 A Choose B Back === platforms 80x24 @@ -94,7 +94,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -104,6 +103,7 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 1-19 of 34 A Choose B Back === folder 40x12 diff --git a/tests/fixtures/tui/route-gptokeyb.txt b/tests/fixtures/tui/route-gptokeyb.txt index 0c2ec38af..8d519b749 100644 --- a/tests/fixtures/tui/route-gptokeyb.txt +++ b/tests/fixtures/tui/route-gptokeyb.txt @@ -78,7 +78,7 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie 1-10 of 34 A Choose B Back === platforms 80x24 @@ -94,7 +94,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -104,6 +103,7 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 1-19 of 34 A Choose B Back === folder 40x12 diff --git a/tests/fixtures/tui/route-gptokeyb_muxterm.txt b/tests/fixtures/tui/route-gptokeyb_muxterm.txt index 5a52cc315..04a435413 100644 --- a/tests/fixtures/tui/route-gptokeyb_muxterm.txt +++ b/tests/fixtures/tui/route-gptokeyb_muxterm.txt @@ -78,7 +78,7 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie 1-10 of 34 A Choose B Back === platforms 80x24 @@ -94,7 +94,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -104,6 +103,7 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 1-19 of 34 A Choose B Back === folder 40x12 diff --git a/tests/fixtures/tui/route-keys.txt b/tests/fixtures/tui/route-keys.txt index 912da09d8..e06f9847f 100644 --- a/tests/fixtures/tui/route-keys.txt +++ b/tests/fixtures/tui/route-keys.txt @@ -78,7 +78,7 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie 1-10 of 34 Enter Choose Esc Back / Filter === platforms 80x24 @@ -94,7 +94,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -104,6 +103,7 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 1-19 of 34 Enter Choose Esc Back / Filter ? Help === folder 40x12 diff --git a/tests/fixtures/tui/route-miyoo.txt b/tests/fixtures/tui/route-miyoo.txt index 715bb7e85..f742e01a9 100644 --- a/tests/fixtures/tui/route-miyoo.txt +++ b/tests/fixtures/tui/route-miyoo.txt @@ -78,7 +78,7 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie 1-10 of 34 A Choose R2 Back === platforms 80x24 @@ -94,7 +94,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -104,6 +103,7 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 1-19 of 34 A Choose R2 Back === folder 40x12 diff --git a/tests/fixtures/tui/route-muxterm.txt b/tests/fixtures/tui/route-muxterm.txt index 0d132306f..4dfeda61b 100644 --- a/tests/fixtures/tui/route-muxterm.txt +++ b/tests/fixtures/tui/route-muxterm.txt @@ -78,7 +78,7 @@ RetroDECK RomM BizHawk - MiSTer FPGA + RetroPie 1-10 of 34 Start Choose B Back === platforms 80x24 @@ -94,7 +94,6 @@ RetroDECK RomM BizHawk - MiSTer FPGA RetroPie Allium, SD card Miyoo Mini, Miyoo Mini Plus, +1 AmberELEC, SD card RG351, RG552 @@ -104,6 +103,7 @@ CrossMix-OS, SD card TrimUI Smart Pro dArkOS, SD card Odroid Go Advance, RGB10, RG351MP, G350 EmuELEC, SD card Odroid Go + JELOS, SD card RG351M, RG351V, RG353M, RG353P, +30 1-19 of 34 Start Choose B Back === folder 40x12 diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index a9bcdef79..d805c1ab9 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -6097,6 +6097,26 @@ class EveryCardSetupGoesToItsCard(unittest.TestCase): self.assertEqual(install.card_choice(setup.name, setup.plat, nested).folder, nested) + def test_a_mister_card_gets_its_files_below_games(self): + """A MiSTer card mounted on a computer got RetroArch's list, and + with --platform misterfpga its files at the root, where MiSTer + reads none: it reads games// below /media/fat.""" + card = self.root / "MiSTer" + (card / "games").mkdir(parents=True) + (card / "_Computer").mkdir() + for name in ("MiSTer", "menu.rbf", "MiSTer.ini"): + (card / name).write_text("", encoding="utf-8") + self.assertEqual(install.card_system(card), + ("misterfpga", card / "games", "MiSTer FPGA")) + for named in (card, card / "games"): + with self.subTest(named=named.name): + choice = install.card_choice("misterfpga", "misterfpga", named) + self.assertEqual((choice.refused, choice.folder), ("", card / "games")) + # A folder holding a games folder and nothing of MiSTer's is no card. + other = self.root / "stick" + (other / "games").mkdir(parents=True) + self.assertIsNone(install.card_system(other)) + def test_a_blank_drive_is_refused_where_the_card_always_names_its_system(self): blank = self.root / "BLANK" blank.mkdir() @@ -7074,8 +7094,13 @@ class _CardFixtures: def narrowed(self, plat: str, **given) -> tuple[int, str, list]: """(exit code, what was said, the files kept) of a --dry-run narrowed as given.""" - dest = self.root / "dest" - if not dest.exists(): + dest = self.root / f"dest-{plat}" + if plat == "misterfpga" and not dest.exists(): + # A MinUI card is another system's card for MiSTer's list. + dest.mkdir() + for marker in ("MiSTer", "menu.rbf"): + (dest / marker).write_text("", encoding="utf-8") + elif not dest.exists(): make_card(dest, "MinUI") stream = io.StringIO() code = 0 diff --git a/wiki/installer.md b/wiki/installer.md index cb4dbbdd9..e2b234b6d 100644 --- a/wiki/installer.md +++ b/wiki/installer.md @@ -1097,6 +1097,7 @@ gives for the device, below the card's root instead of its mount point: | `system/configs/emulationstation/about.info` holding the line `KNULLI` | KNULLI | `bios`, KNULLI's list | | `system/batocera.conf` holding the line `system.hostname=KNULLI` | KNULLI | `bios`, KNULLI's list | | `.config/system/configs/system.cfg` holding the line `root.password=rocknix` | ROCKNIX | `roms/bios`, ROCKNIX's list | +| `MiSTer`, `menu.rbf` | MiSTer FPGA | `games`, MiSTer FPGA's list | | `MUOS/` | muOS | `MUOS/bios`, RetroArch's list | | `spruce/` | spruceOS | `BIOS`, RetroArch's list | | `System/usr/trimui/crossmix-version.txt` | CrossMix-OS | `BIOS`, RetroArch's list | @@ -1220,7 +1221,7 @@ beside its executable wherever the archive was extracted, so a forced `--platform bizhawk` that finds no install stops and asks for `--dest`. The systems that run from an SD card keep their files there: MinUI, NextUI, -MyMinUI, KNULLI, ROCKNIX, AmberELEC and EmuELEC (the card's games part, which +MyMinUI, KNULLI, ROCKNIX, MiSTer FPGA, AmberELEC and EmuELEC (the card's games part, which they mount as `/storage/roms`), and each system of the [Linux handhelds](../platforms/linux-handhelds.md) that gets RetroArch's list (Onion, muOS, spruceOS, ArkOS, UnofficialOS and the others). Run on the @@ -1556,7 +1557,9 @@ names each route it tried, and `log.prev.txt` keeps the run before. **From a computer.** Onion, MinUI, NextUI, Allium, GarlicOS and the Switch have no Python 3 to run the installer. Put the card in a computer and run the [one-line command](#one-line) there: it finds a mounted Onion, -spruceOS, MinUI, muOS, Knulli or ROCKNIX card by itself. For a card it does +spruceOS, MinUI, muOS, Knulli, ROCKNIX or MiSTer card by itself (MiSTer's +files go to `games/` below the card's root, which MiSTer reads as +`/media/fat/games`). For a card it does not recognise, add `--platform --dest `. This works for every system above too.