fix: name missing game data apart from firmware

This commit is contained in:
Abdessamad Derraz committed 2026-10-26 21:11:02 +01:00
1 parent 381ec6de69
commit e537a031d0
2 files changed
+42 -7

No files matched your search

+23 -7
View File
@@ -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]]:
+19
View File
@@ -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