mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-17 08:53:28 -05:00
fix: list only real systems as region fallbacks
This commit is contained in:
1 parent
08aa0beb22
commit
11b679252b
3 files changed
+30
-2
No files matched your search
@@ -254,7 +254,7 @@ def _build_readme(
|
||||
" Only the best-matching BIOS was kept for each system.\n"
|
||||
)
|
||||
if fallback_systems:
|
||||
listed = "\n".join(f" {s}" for s in fallback_systems)
|
||||
listed = "\n".join(f" {_group_label(s)}" for s in fallback_systems)
|
||||
region_info += (
|
||||
"\n These systems have no BIOS in those regions, so all\n"
|
||||
" of theirs were kept:\n"
|
||||
@@ -324,3 +324,11 @@ def _build_agnostic_rename_readme(
|
||||
lines.append("")
|
||||
lines.append(f"To use a different variant, rename it to: {destination}")
|
||||
return "\n".join(lines) + "\n"
|
||||
|
||||
|
||||
def _group_label(group_id: str) -> str:
|
||||
"""A region group as a reader names it: the system, or one core's slot."""
|
||||
emulator, kind, rest = (group_id.split(":", 2) + ["", ""])[:3]
|
||||
if kind == "variant" and rest:
|
||||
return f"{rest} ({emulator})"
|
||||
return group_id
|
||||
+5
-1
@@ -323,12 +323,16 @@ def fallback_groups(
|
||||
A world file, or one that declares no region at all, answers every
|
||||
region: the C64 kernal VICE loads by default is untagged, and a group
|
||||
holding it beside a Japanese and a Swedish kernal does have a BIOS for
|
||||
North America.
|
||||
North America. A file no system claims is a group of its own and keeps
|
||||
nothing as a fallback: Dolphin's GC/EUR/IPL.bin named the GameCube as
|
||||
lacking a North American BIOS the pack carries.
|
||||
"""
|
||||
if not requested:
|
||||
return []
|
||||
out: list[str] = []
|
||||
for group_id, members in groups.items():
|
||||
if ":file:" in group_id:
|
||||
continue
|
||||
ranked = _competing_ranks(members, index, requested)
|
||||
served = any(
|
||||
not regions or WORLD in regions
|
||||
|
||||
@@ -380,6 +380,22 @@ class TestFallbackGroups(unittest.TestCase):
|
||||
groups = {"fds": [("disksys.rom", "disksys.rom"), ("generic.rom", "generic.rom")]}
|
||||
self.assertEqual(region.fallback_groups(groups, self.index, ["north-america"]), [])
|
||||
|
||||
def test_a_file_no_system_claims_is_no_fallback(self):
|
||||
"""Dolphin's GC/EUR/IPL.bin, alone in its group, named the GameCube
|
||||
in the pack README as lacking a North American BIOS it carries."""
|
||||
groups = {"Dolphin:file:GC/EUR/IPL.bin": [("GC/EUR/IPL.bin", "IPL.bin")],
|
||||
"fds": [("disksys.rom", "disksys.rom")]}
|
||||
self.assertEqual(
|
||||
region.fallback_groups(groups, self.index, ["north-america"]), ["fds"]
|
||||
)
|
||||
|
||||
def test_the_readme_names_a_slot_as_a_reader_does(self):
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
||||
from packreadme import _group_label
|
||||
|
||||
self.assertEqual(_group_label("PicoDrive:variant:megacd"), "megacd (PicoDrive)")
|
||||
self.assertEqual(_group_label("sega-mega-cd"), "sega-mega-cd")
|
||||
|
||||
def test_no_requested_regions_reports_nothing(self):
|
||||
groups = {"fds": [("disksys.rom", "disksys.rom")]}
|
||||
self.assertEqual(region.fallback_groups(groups, self.index, []), [])
|
||||
|
||||
Reference in new issue
Block a user