fix: apply --required-only to data directories

The Required packs and manifests carried every data tree, the FreeIntv
overlays included. A data_directories entry now accepts required: false,
and the platform, emulator and manifest walks leave such a tree out under
--required-only. FreeIntv reads its overlays only with the multi-screen
option and draws a placeholder keypad without one (src/libretro.c:294-296,
350-369).
This commit is contained in:
Abdessamad Derraz committed 2026-10-21 05:05:49 +02:00
1 parent 83d49d93a8
commit 5fc2423ca5
9 files changed
+86 -5

No files matched your search

+11 -2
View File
@@ -383,6 +383,7 @@ def _data_directory_members(
seen_lower: set,
seen_parents: set,
refs_out: dict | None = None,
required_only: bool = False,
) -> Iterator[tuple[str, str]]:
"""Yield (source, destination) for the cached data directories a
platform's systems declare.
@@ -394,6 +395,8 @@ def _data_directory_members(
trees an emulator reads, refreshed from upstream, so what ships is
whatever the cache holds. The pack and the install manifest both read
this, the first to write the files and the second to count them.
``required_only`` leaves out a tree declared ``required: false``, one the
core runs without, as it leaves out such a file.
"""
# Data directories from _data_dirs.yml
for sys_id, system in sorted(pack_systems.items()):
@@ -401,6 +404,8 @@ def _data_directory_members(
ref_key = dd.get("ref", "")
if not ref_key or not data_registry or ref_key not in data_registry:
continue
if required_only and dd.get("required") is False:
continue
if ref_key in installed_data_refs(platform_name):
continue
entry = data_registry[ref_key]
@@ -455,12 +460,14 @@ def _pack_data_directories(
seen_destinations: set,
seen_lower: set,
seen_parents: set,
required_only: bool = False,
) -> int:
"""Add the data directories to the pack. Returns how many files went in."""
added = 0
for src, full in _data_directory_members(
pack_systems, data_registry, platform_name, base_dest,
case_insensitive, seen_destinations, seen_lower, seen_parents,
required_only=required_only,
):
_add_pack_member(zf, src, _flat(full, base_dest, flatten))
added += 1
@@ -1142,7 +1149,7 @@ def generate_pack(
total_files += _pack_data_directories(
zf, pack_systems, data_registry, platform_name, base_dest,
flatten, case_insensitive, seen_destinations, seen_lower,
seen_parents,
seen_parents, required_only=required_only,
)
# README.txt for users: personalized step-by-step per platform
@@ -1682,6 +1689,8 @@ def generate_emulator_pack(
for dd in deliverable(
profile.get("data_directories", []), standalone
):
if required_only and dd.get("required") is False:
continue
ref_key = dd.get("ref", "")
if not ref_key or not data_registry or ref_key not in data_registry:
if ref_key:
@@ -4264,7 +4273,7 @@ def generate_manifest(
data_members = list(_data_directory_members(
pack_systems, data_registry, platform_name, base_dest,
case_insensitive, seen_destinations, seen_lower, seen_parents,
data_refs,
data_refs, required_only=required_only,
))
data_sizes = pack_only_sizes + [os.path.getsize(src) for src, _dest in data_members]
data_directories = _manifest_data_directories(
+8 -1
View File
@@ -495,8 +495,15 @@ class Scraper(BaseScraper):
# so final path is system/freeintv_overlays/FreeIntvTS_Overlays/<rom>.png
# but core expects system/freeintv_overlays/<rom>.png
# fix: point destination into the subfolder
# Optional: read only with the multi-screen option on, and a
# missing PNG falls back to a drawn placeholder keypad
# (FreeIntv/src/libretro.c:294-296, 350-369).
"mattel-intellivision": [
{"ref": "freeintv-overlays", "destination": "freeintv_overlays"},
{
"ref": "freeintv-overlays",
"destination": "freeintv_overlays",
"required": False,
},
],
}
for sys_id, data_dirs in SYSTEM_DATA_DIRS.items():