From e537a031d0d276c762bf6e21325995b3128305a7 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Mon, 26 Oct 2026 21:11:02 +0100 Subject: [PATCH] fix: name missing game data apart from firmware --- install.py | 30 +++++++++++++++++++++++------- tests/test_install_tui.py | 19 +++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/install.py b/install.py index d5732b4f7..883ab3164 100644 --- a/install.py +++ b/install.py @@ -12559,14 +12559,30 @@ def _unavailable_lines(state: TuiState) -> list[str]: rows = {row["system"]: row for row in state.systems} def system(name: str) -> str: - return _tui_system_label(rows.get(name) or {"system": name}, titles) + label = _tui_system_label(rows.get(name) or {"system": name}, titles) + # An id no title names (jazz-jackrabbit-2) read as a raw key. + return label.replace("-", " ").title() if label == name else label - names = [f"{entry['dest']} ({system(entry['system'])})" if entry.get("system") - else entry["dest"] for entry in needed[:3]] - more = f" and {len(needed) - 3} more" if len(needed) > 3 else "" - return [f"Not available here, and needed to start " - f"{'its emulator' if len(needed) == 1 else 'their emulators'}: " - f"{', '.join(names)}{more}. Your own copy goes in the BIOS folder."] + def named(entries: list[dict]) -> str: + names = [f"{entry['dest']} ({system(entry['system'])})" if entry.get("system") + else entry["dest"] for entry in entries[:3]] + more = f" and {len(entries) - 3} more" if len(entries) > 3 else "" + return f"{', '.join(names)}{more}" + + # A game's own data is not firmware: on every RetroArch plan the one + # alarm named Jazz Jackrabbit 2's Anims.j2a, read as a broken install. + games = [entry for entry in needed if entry.get("category") == GAME_DATA] + firmware = [entry for entry in needed if entry.get("category") != GAME_DATA] + lines = [] + if firmware: + lines.append(f"Not available here, and needed to start " + f"{'its emulator' if len(firmware) == 1 else 'their emulators'}: " + f"{named(firmware)}. Your own copy goes in the BIOS folder.") + if games: + lines.append(f"Game data not available here, read by " + f"{'its game' if len(games) == 1 else 'their games'}: " + f"{named(games)}. Copy it from your own copy of the game.") + return lines def tui_outcome(state: TuiState) -> tuple[str, list[str]]: diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index e3d8b2e65..740dba734 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -3921,6 +3921,25 @@ class ThePlanNumbersAddUp(unittest.TestCase): "machine, 3 downloaded", screen) +class GameDataIsNoFirmwareAlarm(unittest.TestCase): + """Every RetroArch plan named jazz2/Source/Anims.j2a (jazz-jackrabbit-2) + as the file needed to start an emulator: a game's data, under a raw id.""" + + def test_game_data_has_its_own_line(self): + state = checked_state() + state.systems = [] + state.manifest = {**MANIFEST, "omitted_files": [ + {"dest": "jazz2/Source/Anims.j2a", "system": "jazz-jackrabbit-2", + "required": True, "category": "game_data"}, + {"dest": "missing.bin", "system": "sony-playstation", "required": True}]} + lines = install._unavailable_lines(state) + self.assertEqual(len(lines), 2, lines) + self.assertIn("needed to start its emulator: missing.bin", lines[0]) + self.assertNotIn("Anims.j2a", lines[0]) + self.assertIn("Game data not available here", lines[1]) + self.assertIn("Anims.j2a (Jazz Jackrabbit 2)", lines[1]) + + class NothingFoundIsSaid(unittest.TestCase): """With nothing detected the first screen was the list of 18 setups, with no line at 40x15 saying nothing was found, which the beginner's