mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 10:23:16 -05:00
fix: let a lone core file leave its system's drop
This commit is contained in:
1 parent
dbe26fddc9
commit
6c7f1c9d06
3 files changed
+28
-3
No files matched your search
@@ -20,6 +20,7 @@ from common import standalone_set as platform_standalone_set
|
||||
from common import sanitize_pack_path
|
||||
from common import size_fits
|
||||
from validation import read_from_system_dir
|
||||
from region import FILE_GROUP
|
||||
|
||||
|
||||
def _detect_extras_prefix(config: dict, base_dest: str) -> str:
|
||||
@@ -1044,7 +1045,7 @@ def extra_region_groups(
|
||||
# Enterprise group drop its German ROM. Alone, it drops nothing and is
|
||||
# never dropped.
|
||||
destination = extra.get("destination", extra.get("name", ""))
|
||||
return [f"{emulator}:file:{destination}"]
|
||||
return [f"{emulator}{FILE_GROUP}{destination}"]
|
||||
|
||||
def emulator_region_drops(
|
||||
selected: list[tuple[str, dict]],
|
||||
@@ -1108,5 +1109,5 @@ def _emulator_region_group(
|
||||
if not system and len(profile_systems) == 1:
|
||||
system = profile_systems[0]
|
||||
if not system:
|
||||
return f"{emu_name}:file:{dest}"
|
||||
return f"{emu_name}{FILE_GROUP}{dest}"
|
||||
return f"{emu_name}:system:{system}"
|
||||
+13
-1
@@ -266,6 +266,11 @@ def _competing_ranks(
|
||||
return ranked
|
||||
|
||||
|
||||
# Marks the group of a file no system names (extra_region_groups and the
|
||||
# emulator-mode grouping both build it).
|
||||
FILE_GROUP = ":file:"
|
||||
|
||||
|
||||
def resolve_region_drops(
|
||||
groups: dict[str, list[tuple[str, str]]],
|
||||
index: dict[str, dict],
|
||||
@@ -288,7 +293,14 @@ def resolve_region_drops(
|
||||
|
||||
keep: set[str] = set()
|
||||
drop: set[str] = set()
|
||||
for members in groups.values():
|
||||
for group_id, members in groups.items():
|
||||
if FILE_GROUP in group_id:
|
||||
# A file no system names competes with nothing: it drops nothing,
|
||||
# and keeping it would veto the group that does decide for the
|
||||
# same path. Dolphin's GC/EUR/IPL.bin, alone as a core extra,
|
||||
# kept what the GameCube group dropped for --region us. A system
|
||||
# holding one file still keeps it: a group is never emptied.
|
||||
continue
|
||||
regional: list[tuple[int, str]] = []
|
||||
world: set[str] = set()
|
||||
untagged: set[str] = set()
|
||||
|
||||
@@ -267,6 +267,18 @@ class TestResolveRegionDrops(unittest.TestCase):
|
||||
def _drops(self, groups, requested):
|
||||
return region.resolve_region_drops(groups, self.index, requested)
|
||||
|
||||
def test_a_lone_file_never_vetoes_its_system(self):
|
||||
"""Dolphin's GC/EUR/IPL.bin came back as a core extra alone in its
|
||||
group, and that group's keep cancelled the drop the GameCube group
|
||||
decided: the full pack kept what --source platform dropped."""
|
||||
groups = {
|
||||
"psx": [("scph5501.bin", "scph5501.bin"), ("scph5502.bin", "scph5502.bin")],
|
||||
"core:file:scph5502.bin": [("scph5502.bin", "scph5502.bin")],
|
||||
}
|
||||
self.assertEqual(self._drops(groups, ["north-america"]), {"scph5502.bin"})
|
||||
alone = {"core:file:scph5502.bin": [("scph5502.bin", "scph5502.bin")]}
|
||||
self.assertEqual(self._drops(alone, ["north-america"]), set())
|
||||
|
||||
def test_a_missing_match_never_displaces_a_held_file(self):
|
||||
"""Grouped so the report can withdraw it, a missing file must not
|
||||
take a held one's place: a Japanese request with only the American
|
||||
|
||||
Reference in new issue
Block a user