mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-18 23:57:55 -06:00
feat: give each set its requirement and one pick
Three changes to the search-list model, one commit because the readers
and the profiles must move together for the schema to hold.
Set requirement in a groups map. pom2 falls back on apple2.rom for the
][ and the ][+, and on apple2e.rom for the //e it boots and for the
unenhanced //e: one required on the file could not say both. A profile
now declares groups: {name: {required}}, a member writes no required
of its own (schema and validate_schemas refuse one) and load_emulator_
profiles derives it, true when one of its sets is. group takes a name,
a list, or a map from set to rank where the rank differs per set. pom2
is grouped from SystemProfile.cpp and MainWindow.cpp:246-296 at its pin.
One member per required set under --required-only. The pick is the
first the code reads among the held members the region filter leaves,
by rank then declaration order; a set the platform declares a member
of is carried by that declaration. The emulator pack, verify
--emulator, the platform pack, its manifest and verify --platform read
alternatives.required_only_spares or core_file_spares.
variant_group is now selection_slot: files a core chooses between by
a rule other than first found (disc territory for PicoDrive and
Pizza Boy SC, the o2em_bios option, a WebAssembly probe in SWF
Player). Where the code takes any one, the field became a group:
ARMSX1 (ArmSxBackend.java:149-157, name order), ePSXe (load_bios
0x433540-0x433621 of the 2.0.5 Linux x64 binary, one configured path,
HLE when BiosHLE is set), FPse and FPse-NG, DXX-Rebirth's HOGs
(inferno.cpp:472-512). odin and zesarux carried it with no effect.
slot.py compares ranks only between candidates that share a set.
This commit is contained in:
1 parent
1e12d9fe38
commit
315dab82b7
38 files changed
+661
-432
No files matched your search
+49
-10
@@ -9,6 +9,7 @@ from __future__ import annotations
|
||||
from collections.abc import Iterable
|
||||
|
||||
from common import PROFILE_IDENTITY_FIELDS, _norm_system_id, entry_system_ids
|
||||
from alternatives import core_file_spares, required_only_spares, set_fields
|
||||
from common import archive_members, holds_required_members
|
||||
from common import declared_root, expand_platform_declared_names, platform_declarations
|
||||
from common import load_emulator_profiles
|
||||
@@ -388,8 +389,12 @@ def hidden_extras(
|
||||
)
|
||||
if system_ids:
|
||||
extras = extras_for_systems(extras, system_ids)
|
||||
spares = core_file_spares(
|
||||
extras,
|
||||
lambda fe: extra_region_key(fe, region_prefix) in (region_drops or set()),
|
||||
) if required_only else set()
|
||||
for fe in extras:
|
||||
if required_only and fe.get("required") is False:
|
||||
if required_only and (fe.get("required") is False or id(fe) in spares):
|
||||
continue
|
||||
dest = sanitize_pack_path(fe.get("destination", fe.get("name", "")))
|
||||
if not dest or (region_drops and extra_region_key(fe, region_prefix) in region_drops):
|
||||
@@ -640,7 +645,7 @@ def _agnostic_scan_extras(
|
||||
"source_system": f.get("system"),
|
||||
"source_systems": entry_system_ids(f, profile),
|
||||
"region": f.get("region"),
|
||||
"variant_group": f.get("variant_group"),
|
||||
"selection_slot": f.get("selection_slot"),
|
||||
"agnostic_scan": True,
|
||||
}
|
||||
extra["claim_order"] = (4, 0, emu_name)
|
||||
@@ -796,7 +801,7 @@ def _companion_extras(
|
||||
"source_system": seed.get("system"),
|
||||
"source_systems": entry_system_ids(seed, profile),
|
||||
"region": seed.get("region"),
|
||||
"variant_group": seed.get("variant_group"),
|
||||
"selection_slot": seed.get("selection_slot"),
|
||||
"agnostic_scan": True,
|
||||
}
|
||||
extra["claim_order"] = (4, 0, emu_name)
|
||||
@@ -970,7 +975,7 @@ def _archive_prefix_copies(
|
||||
"source_system": archive_entry.get("system"),
|
||||
"source_systems": entry_system_ids(archive_entry, profile),
|
||||
"region": archive_entry.get("region"),
|
||||
"variant_group": archive_entry.get("variant_group"),
|
||||
"selection_slot": archive_entry.get("selection_slot"),
|
||||
}
|
||||
members = archive_members(archive_name, profile.get("files", []))
|
||||
if members:
|
||||
@@ -1354,7 +1359,8 @@ def _collect_emulator_extras(
|
||||
"source_system": f.get("system"),
|
||||
"source_systems": entry_system_ids(f, profile),
|
||||
"region": f.get("region"),
|
||||
"variant_group": f.get("variant_group"),
|
||||
"selection_slot": f.get("selection_slot"),
|
||||
**set_fields(f, profile),
|
||||
}
|
||||
# The same identity the first pass carries: without it the copy
|
||||
# resolves on its name alone and a same-named file of another
|
||||
@@ -1522,7 +1528,8 @@ def _report_extra(u: dict, name: str, dest: str) -> dict:
|
||||
"source_system": u.get("system"),
|
||||
"source_systems": u.get("systems", []),
|
||||
"region": u.get("region"),
|
||||
"variant_group": u.get("variant_group"),
|
||||
"selection_slot": u.get("selection_slot"),
|
||||
**{k: u[k] for k in ("required_groups", "set_declared") if k in u},
|
||||
}
|
||||
if u.get("members"):
|
||||
extra["members"] = u["members"]
|
||||
@@ -1795,9 +1802,9 @@ def extra_region_groups(
|
||||
return (spellings or {}).get(_norm_system_id(sys_id), sys_id)
|
||||
|
||||
emulator = extra.get("source_emulator", "")
|
||||
variant = extra.get("variant_group")
|
||||
variant = extra.get("selection_slot")
|
||||
if variant:
|
||||
# A variant group is one slot of one core, whatever system each
|
||||
# A selection slot is one slot of one core, whatever system each
|
||||
# member is filed under: PicoDrive files its US Mega CD BIOS under
|
||||
# sega-segacd and the EU/JP ones under sega-megacd, and find_bios
|
||||
# picks one of the twelve. Keyed as emulator mode keys it.
|
||||
@@ -1826,7 +1833,7 @@ def emulator_region_drops(
|
||||
) -> set[str]:
|
||||
"""Destinations an emulator-mode `--region` withdraws.
|
||||
|
||||
One group per system (or explicit variant_group) inside each profile, so
|
||||
One group per system (or explicit selection_slot) 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.
|
||||
@@ -1864,6 +1871,38 @@ def emulator_region_drops(
|
||||
return region_mod.resolve_region_drops(region_groups, region_index, regions, held)
|
||||
|
||||
|
||||
def emulator_required_spares(
|
||||
emu_name: str,
|
||||
profile: dict,
|
||||
files: list[dict],
|
||||
standalone: bool,
|
||||
region_drops: set[str],
|
||||
db: dict,
|
||||
validation_index: dict,
|
||||
zip_contents: dict | None,
|
||||
data_registry: dict | None,
|
||||
) -> set[int]:
|
||||
"""The members of required sets an emulator --required-only pack leaves
|
||||
out: one held member stays per set, the first the code loads among those
|
||||
the pack still carries after the region filter. The pack and
|
||||
verify --emulator both read this."""
|
||||
from alternatives import groups_of, rank_in, required_groups
|
||||
from packpaths import _resolve_destination
|
||||
|
||||
loose = [fe for fe in files if not fe.get("archive") and groups_of(fe)]
|
||||
if not loose:
|
||||
return set()
|
||||
return required_only_spares(
|
||||
loose,
|
||||
owner=lambda _fe: emu_name,
|
||||
held=lambda fe: _emulator_ships(
|
||||
fe, emu_name, profile, db, validation_index, zip_contents, data_registry,
|
||||
),
|
||||
gone=lambda fe: _resolve_destination(fe, standalone) in region_drops,
|
||||
sets=lambda fe: {g: rank_in(fe, g) for g in required_groups(fe, profile)},
|
||||
)
|
||||
|
||||
|
||||
def _emulator_ships(
|
||||
file_entry: dict, emu_name: str, profile: dict, db: dict,
|
||||
validation_index: dict, zip_contents: dict | None, data_registry: dict | None,
|
||||
@@ -1904,7 +1943,7 @@ def _emulator_region_group(
|
||||
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")
|
||||
variant = file_entry.get("selection_slot")
|
||||
if variant:
|
||||
return f"{emu_name}:variant:{variant}"
|
||||
system = file_entry.get("system")
|
||||
|
||||
Reference in new issue
Block a user