mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
fix: group system-less files alike in both modes
This commit is contained in:
1 parent
ff3428e1f1
commit
dbe26fddc9
2 files changed
+38
-6
No files matched your search
+14
-4
@@ -1079,7 +1079,7 @@ def emulator_region_drops(
|
||||
for fe in _kept(entries, required_only):
|
||||
dest = _resolve_destination(fe, standalone)
|
||||
if dest:
|
||||
group_id = _emulator_region_group(emu_name, profile, fe)
|
||||
group_id = _emulator_region_group(emu_name, profile, fe, dest)
|
||||
region_groups.setdefault(group_id, []).append(
|
||||
(dest, fe.get("name", ""))
|
||||
)
|
||||
@@ -1090,8 +1090,16 @@ def emulator_region_drops(
|
||||
return region_mod.resolve_region_drops(region_groups, region_index, regions, held)
|
||||
|
||||
|
||||
def _emulator_region_group(emu_name: str, profile: dict, file_entry: dict) -> str:
|
||||
"""Stable group ID for regional alternatives within an emulator profile."""
|
||||
def _emulator_region_group(
|
||||
emu_name: str, profile: dict, file_entry: dict, dest: str
|
||||
) -> str:
|
||||
"""Stable group ID for regional alternatives within an emulator profile.
|
||||
|
||||
The rule extra_region_groups applies on the platform side: a file no
|
||||
system names, in a profile serving several, competes with nothing.
|
||||
Grouped together, geargrafx's LaserActive pac-n1.bin was dropped by
|
||||
--emulator --region us and kept by --platform --region us.
|
||||
"""
|
||||
variant = file_entry.get("variant_group")
|
||||
if variant:
|
||||
return f"{emu_name}:variant:{variant}"
|
||||
@@ -1099,4 +1107,6 @@ def _emulator_region_group(emu_name: str, profile: dict, file_entry: dict) -> st
|
||||
profile_systems = list(profile.get("systems", []))
|
||||
if not system and len(profile_systems) == 1:
|
||||
system = profile_systems[0]
|
||||
return f"{emu_name}:system:{system or '_profile'}"
|
||||
if not system:
|
||||
return f"{emu_name}:file:{dest}"
|
||||
return f"{emu_name}:system:{system}"
|
||||
@@ -1441,13 +1441,35 @@ class RegionRegressions(unittest.TestCase):
|
||||
def test_multi_system_emulator_uses_separate_region_groups(self):
|
||||
profile = {"systems": ["odyssey2", "videopac"]}
|
||||
north_america = _emulator_region_group(
|
||||
"o2em", profile, {"name": "o2rom.bin", "system": "odyssey2"}
|
||||
"o2em", profile, {"name": "o2rom.bin", "system": "odyssey2"}, "o2rom.bin"
|
||||
)
|
||||
europe = _emulator_region_group(
|
||||
"o2em", profile, {"name": "c52.bin", "system": "videopac"}
|
||||
"o2em", profile, {"name": "c52.bin", "system": "videopac"}, "c52.bin"
|
||||
)
|
||||
self.assertNotEqual(north_america, europe)
|
||||
|
||||
def test_a_systemless_file_groups_alike_in_both_modes(self):
|
||||
"""geargrafx files pac-n1.bin [japan] and pac-n10.bin [north-america]
|
||||
under none of its four systems: emulator mode grouped them and
|
||||
dropped pac-n1.bin for --region us, platform mode isolated each and
|
||||
kept it."""
|
||||
from packextras import extra_region_groups
|
||||
|
||||
profile = {"systems": ["nec-pc-engine", "nec-pc-engine-cd", "nec-supergrafx",
|
||||
"pioneer-laseractive"]}
|
||||
names = ["pac-n1.bin", "pac-n10.bin"]
|
||||
emulator = [
|
||||
_emulator_region_group("geargrafx", profile, {"name": n}, n) for n in names
|
||||
]
|
||||
platform = [
|
||||
extra_region_groups({
|
||||
"source_emulator": "geargrafx", "destination": n,
|
||||
"source_systems": profile["systems"],
|
||||
})[0]
|
||||
for n in names
|
||||
]
|
||||
self.assertEqual(emulator, platform)
|
||||
|
||||
def test_region_audit_resolves_the_way_the_pack_does(self):
|
||||
"""A private resolver read sha1, md5 and a lone name: an entry
|
||||
identified by its path (Dolphin's three IPL.bin) was never checked."""
|
||||
|
||||
Reference in new issue
Block a user