mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-12 14:33:23 -05:00
fix: emulator region report reads the pack drop set
This commit is contained in:
1 parent
012bf2fec2
commit
3177a57103
4 files changed
+71
-45
No files matched your search
@@ -1283,25 +1283,9 @@ def generate_emulator_pack(
|
||||
zip_path = os.path.join(output_dir, zip_name)
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
# One group per system (or explicit variant_group) inside each profile.
|
||||
# Multi-system cores such as O2EM therefore retain a fallback BIOS for
|
||||
# every system instead of letting one matching system empty another.
|
||||
region_drops: set[str] = set()
|
||||
if regions:
|
||||
region_index = region_mod.build_region_index(dict(selected))
|
||||
region_groups: dict[str, list[tuple[str, str]]] = {}
|
||||
for emu_name, profile in sorted(selected):
|
||||
structure = profile.get("pack_structure")
|
||||
for fe in filter_files_by_mode(profile.get("files", []), standalone):
|
||||
dest = _resolve_destination(fe, structure, standalone)
|
||||
if dest:
|
||||
group_id = _emulator_region_group(emu_name, profile, fe)
|
||||
region_groups.setdefault(group_id, []).append(
|
||||
(dest, fe.get("name", ""))
|
||||
)
|
||||
region_drops = region_mod.resolve_region_drops(
|
||||
region_groups, region_index, regions
|
||||
)
|
||||
region_drops: set[str] = (
|
||||
emulator_region_drops(selected, standalone, regions) if regions else set()
|
||||
)
|
||||
|
||||
total_files = 0
|
||||
missing_files = []
|
||||
@@ -3436,6 +3420,7 @@ from packextras import ( # noqa: E402,F401
|
||||
_collect_emulator_extras,
|
||||
_extra_system_ids,
|
||||
platform_region_groups,
|
||||
emulator_region_drops,
|
||||
_emulator_region_group,
|
||||
)
|
||||
|
||||
|
||||
@@ -600,6 +600,34 @@ def platform_region_groups(
|
||||
groups.setdefault(group_id, []).append((dest, name))
|
||||
return groups, extra_dests
|
||||
|
||||
def emulator_region_drops(
|
||||
selected: list[tuple[str, dict]], standalone: bool, regions: list[str]
|
||||
) -> set[str]:
|
||||
"""Destinations an emulator-mode `--region` withdraws.
|
||||
|
||||
One group per system (or explicit variant_group) inside each profile, so
|
||||
a multi-system core such as O2EM keeps a fallback BIOS for every system
|
||||
instead of letting one matching system empty another. The emulator pack
|
||||
and `verify --emulator` both read this, keyed by pack destination.
|
||||
"""
|
||||
import region as region_mod
|
||||
from packpaths import _resolve_destination
|
||||
from validation import filter_files_by_mode
|
||||
|
||||
region_index = region_mod.build_region_index(dict(selected))
|
||||
region_groups: dict[str, list[tuple[str, str]]] = {}
|
||||
for emu_name, profile in sorted(selected):
|
||||
structure = profile.get("pack_structure")
|
||||
for fe in filter_files_by_mode(profile.get("files", []), standalone):
|
||||
dest = _resolve_destination(fe, structure, standalone)
|
||||
if dest:
|
||||
group_id = _emulator_region_group(emu_name, profile, fe)
|
||||
region_groups.setdefault(group_id, []).append(
|
||||
(dest, fe.get("name", ""))
|
||||
)
|
||||
return region_mod.resolve_region_drops(region_groups, region_index, regions)
|
||||
|
||||
|
||||
def _emulator_region_group(emu_name: str, profile: dict, file_entry: dict) -> str:
|
||||
"""Stable group ID for regional alternatives within an emulator profile."""
|
||||
variant = file_entry.get("variant_group")
|
||||
|
||||
+8
-15
@@ -1242,7 +1242,7 @@ def verify_emulator(
|
||||
"""Verify files for specific emulator profiles.
|
||||
|
||||
A region priority list narrows the report the same way a pack built with the
|
||||
same list would be narrowed. One group per profile, as in generate_pack.
|
||||
same list would be narrowed, through the emulator pack's own drop set.
|
||||
"""
|
||||
load_emulator_profiles(emulators_dir)
|
||||
zip_contents = build_zip_contents_index(db)
|
||||
@@ -1265,22 +1265,12 @@ def verify_emulator(
|
||||
dest_to_name: dict[str, str] = {}
|
||||
data_dir_notices: list[str] = []
|
||||
|
||||
# The emulator pack withdraws these; the report withdraws the same.
|
||||
region_drops: set[str] = set()
|
||||
if regions:
|
||||
import region as region_mod
|
||||
from packextras import emulator_region_drops
|
||||
|
||||
region_index = region_mod.build_region_index(dict(selected))
|
||||
region_groups: dict[str, list[tuple[str, str]]] = {}
|
||||
for emu_name, profile in selected:
|
||||
members = region_groups.setdefault(emu_name, [])
|
||||
for fe in filter_files_by_mode(profile.get("files", []), standalone):
|
||||
nm = fe.get("name", "")
|
||||
key = fe.get("path") or nm
|
||||
if key:
|
||||
members.append((key, nm))
|
||||
region_drops = region_mod.resolve_region_drops(
|
||||
region_groups, region_index, regions
|
||||
)
|
||||
region_drops = emulator_region_drops(selected, standalone, regions)
|
||||
|
||||
for emu_name, profile in selected:
|
||||
files = expand_directory_entries(
|
||||
@@ -1289,10 +1279,13 @@ def verify_emulator(
|
||||
standalone,
|
||||
)
|
||||
if region_drops:
|
||||
from packpaths import _resolve_destination
|
||||
|
||||
structure = profile.get("pack_structure")
|
||||
files = [
|
||||
fe
|
||||
for fe in files
|
||||
if (fe.get("path") or fe.get("name", "")) not in region_drops
|
||||
if _resolve_destination(fe, structure, standalone) not in region_drops
|
||||
]
|
||||
|
||||
# Check data directories (only notice if not cached)
|
||||
|
||||
Reference in new issue
Block a user