mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-13 21:43:55 -06:00
feat: record every core a rom folder offers
The rom folders files kept the default core of each folder only, so a core the user picks in the frontend's menu was not known to read its sets there. Each folder now lists its offers: every <core> of every <emulator> in AmberELEC's es_systems.cfg (arcade: packages/ui/emulationstation/config/es_systems.cfg:116-150), every core of EmuELEC's es_systems.json, every add_emu_core of ROCKNIX's emulators package.mk with the device case it is written under (arcade: 218-229), and the emulator of every ES-DE <command>. A core written under every branch of a case is offered unconditionally. The ES-XML, ES-JSON, ELEC-conf and ES-DE setups are rescraped at their pins: archr, arkos, chaos, darkos, jelos, kolos, pan4elec, retrobat and unofficialos gain the same records and nothing else. A libretro core offered for a folder reads the sets it loads beside the game there, as the default one does. Manifests, roms folders gaining sets read beside the game: - AmberELEC: +215 (293.1 MB) in fbneo, arcade and mame, for MAME 2010, 2015, 2016 and 2003-Plus. 1 omission leaves. - EmuELEC: +291 (232.0 MB) in cps1, cps2, cps3, mame, fbneo and arcade, for MAME 2010 and 2003-Plus. 47 omissions leave. - ROCKNIX: +501 (538.7 MB) in fbneo, neogeo, cps1, cps2, cps3, arcade and mame, for MAME 2010, 2015 and 2003-Plus. 120 omissions leave. - EmuDeck: +306 (251.2 MB) in cps, cps1, cps2, cps3, arcade and mame, for MAME 2000, 2003, 2003-Plus and 2010. 92 omissions leave. Each omission that leaves was a set named as read outside the BIOS folder. RetroDECK and the other platforms do not change. No file leaves, and verify --all keeps its severity and status counts.
This commit is contained in:
1 parent
01a422f86c
commit
801af113b7
21 files changed
+19272
-6
No files matched your search
@@ -36,7 +36,7 @@ SETUP_KEYS = (
|
||||
)
|
||||
ROW_KEYS = (
|
||||
"folder", "name", "aliases", "extensions", "files", "core", "emulator", "source_ref",
|
||||
"board_defaults", "arcade", "searched_by", "note",
|
||||
"board_defaults", "offers", "arcade", "searched_by", "note",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,44 @@ def _board(core: str | None, emulator: str | None, source_ref: str) -> dict:
|
||||
return {k: str(v) for k, v in out.items() if v}
|
||||
|
||||
|
||||
def _offers(choices: list[dict], core: str | None, emulator: str | None) -> list[dict]:
|
||||
"""Every (emulator, core) a folder can start, in the list's order, or
|
||||
none when the default is the only one.
|
||||
|
||||
A core written under several branches of a device case keeps the
|
||||
conditions it is written under, and none once a branch is the `*)` one
|
||||
beside another or no branch at all: every build then offers it.
|
||||
"""
|
||||
found: dict[tuple[str, str], dict] = {}
|
||||
whens: dict[tuple[str, str], set[str]] = {}
|
||||
lines: dict[tuple[str, str], list[str]] = {}
|
||||
for choice in choices:
|
||||
pair = (str(choice.get("emulator") or ""), str(choice.get("core") or choice.get("emulator") or ""))
|
||||
if not pair[1]:
|
||||
continue
|
||||
whens.setdefault(pair, set()).add(str(choice.get("when") or ""))
|
||||
ref = str(choice.get("source_ref") or "")
|
||||
if ref and pair in found and found[pair].get("source_ref", "").split(":")[0] == ref.split(":")[0]:
|
||||
lines[pair].append(ref.rsplit(":", 1)[-1])
|
||||
if pair not in found:
|
||||
found[pair] = {k: str(v) for k, v in {**choice, "core": pair[1]}.items()
|
||||
if v and k != "when"}
|
||||
lines[pair] = []
|
||||
out = []
|
||||
for pair, offer in found.items():
|
||||
if lines[pair] and offer.get("source_ref"):
|
||||
offer["source_ref"] = ",".join([offer["source_ref"], *lines[pair]])
|
||||
conditions = whens[pair]
|
||||
if "" not in conditions and not (
|
||||
len(conditions) > 1 and any(w.endswith(" *") for w in conditions)):
|
||||
offer = {**offer, "when": "; ".join(sorted(conditions))}
|
||||
offer = {k: offer[k] for k in ("emulator", "core", "when", "source_ref") if k in offer}
|
||||
out.append(offer)
|
||||
if [(o.get("emulator", ""), o["core"]) for o in out] == [(emulator or "", core or emulator or "")]:
|
||||
return []
|
||||
return out
|
||||
|
||||
|
||||
def _top_key_lines(text: str) -> dict[str, int]:
|
||||
"""First line of each top-level YAML key."""
|
||||
out: dict[str, int] = {}
|
||||
@@ -286,6 +324,9 @@ def _xml_rows(text: str, key: str, path: str, params: dict) -> list[dict]:
|
||||
"core": core or emulator,
|
||||
"emulator": emulator,
|
||||
"source_ref": _ref(key, path, row["line"]),
|
||||
"offers": _offers(
|
||||
[{"emulator": e, "core": c} for e, cores in emulators for c, _d in cores or [(e, False)]],
|
||||
core, emulator),
|
||||
"arcade": _is_arcade(system.findtext("hardware"), platform),
|
||||
"note": row.get("note"),
|
||||
})
|
||||
@@ -322,6 +363,9 @@ def es_json(spec: dict, fetcher: Fetcher) -> list[dict]:
|
||||
"core": core or emulator,
|
||||
"emulator": emulator,
|
||||
"source_ref": _ref(key, path, row["line"]),
|
||||
"offers": _offers(
|
||||
[{"emulator": e, "core": c} for e, cores in emulators for c, _d in cores or [(e, False)]],
|
||||
core, emulator),
|
||||
"arcade": _is_arcade(system.get("hardware"), system.get("platform")),
|
||||
"note": row.get("note"),
|
||||
})
|
||||
@@ -470,6 +514,12 @@ def elec_conf(spec: dict, fetcher: Fetcher) -> list[dict]:
|
||||
"emulator": pick["emulator"] if pick else None,
|
||||
"source_ref": "; ".join(refs),
|
||||
"board_defaults": board_defaults,
|
||||
"offers": _offers([
|
||||
{"emulator": c["emulator"], "core": c["core"],
|
||||
"when": ", ".join(f"{v} {p}".strip() for v, p in c["branches"]),
|
||||
"source_ref": _ref(key, package, c["line"])}
|
||||
for c in mine
|
||||
], pick and pick["core"], pick and pick["emulator"]),
|
||||
"arcade": values.get("SYSTEM_HARDWARE") == "arcade" or None,
|
||||
"note": note,
|
||||
})
|
||||
@@ -647,6 +697,7 @@ def esde(spec: dict, fetcher: Fetcher) -> list[dict]:
|
||||
"folder": folder, "extensions": extensions, "commands": commands,
|
||||
"ref": _ref(key, path, lines.get(name)),
|
||||
"searched_by": _searched_by(placed, key, path),
|
||||
"placed": [(*c, key, path) for c in placed],
|
||||
}
|
||||
alternatives: dict[str, tuple[str, int]] = {}
|
||||
alt = params.get("alternatives")
|
||||
@@ -669,6 +720,11 @@ def esde(spec: dict, fetcher: Fetcher) -> list[dict]:
|
||||
else:
|
||||
note = f"alternative emulator '{label}' names no command of this system"
|
||||
emulator, core = _command_core(chosen[1])
|
||||
offers = _offers([
|
||||
{"emulator": e, "core": c, "source_ref": _ref(key_, path_, line)}
|
||||
for _label, command, line, key_, path_ in system["placed"]
|
||||
for e, c in [_command_core(command)] if e
|
||||
], core, emulator)
|
||||
extensions = system["extensions"]
|
||||
if "." in extensions:
|
||||
# ES-DE's "." is a file without an extension (SystemData.cpp
|
||||
@@ -683,6 +739,7 @@ def esde(spec: dict, fetcher: Fetcher) -> list[dict]:
|
||||
"emulator": emulator,
|
||||
"source_ref": "; ".join(refs),
|
||||
"note": note,
|
||||
"offers": offers,
|
||||
"searched_by": system["searched_by"] or None,
|
||||
})
|
||||
return rows
|
||||
|
||||
Reference in new issue
Block a user