mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-19 01:43:25 -05:00
fix: lay out both builds of a dual-mode emulator
Batocera, RetroBat, Recalbox and ROCKNIX offer some emulators both as a libretro core and standalone. Filed as standalone only, the libretro layout was dropped: libretro Dolphin had no dolphin-emu/Sys/GC files. Platforms now name dual-mode emulators and each gets both layouts.
This commit is contained in:
1 parent
2b535525ef
commit
3c856bbc10
23 files changed
+1367
-478
No files matched your search
@@ -44,6 +44,21 @@ ES_SYSTEMS_URL = (
|
||||
)
|
||||
|
||||
|
||||
def es_systems_dual(text: str) -> set[str]:
|
||||
"""Emulators es_systems.cfg offers both as a libretro core and standalone."""
|
||||
from common import parse_untrusted_xml
|
||||
|
||||
libretro: set[str] = set()
|
||||
standalone: set[str] = set()
|
||||
for emulator in parse_untrusted_xml(text, "es_systems.cfg").iter("emulator"):
|
||||
name = (emulator.get("name") or "").strip()
|
||||
if name == "libretro":
|
||||
libretro |= {(core.text or "").strip() for core in emulator.iter("core")} - {""}
|
||||
elif name:
|
||||
standalone.add(name)
|
||||
return libretro & standalone
|
||||
|
||||
|
||||
def es_systems_cores(text: str) -> tuple[set[str], set[str]]:
|
||||
"""Every core RetroBat's ES offers, and the emulators it runs standalone.
|
||||
|
||||
@@ -207,7 +222,9 @@ class Scraper(BaseScraper):
|
||||
req = urllib.request.Request(es_url, headers={"User-Agent": "retrobios-scraper/1.0"})
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=30) as resp:
|
||||
cores, standalone = es_systems_cores(resp.read().decode("utf-8"))
|
||||
es_text = resp.read().decode("utf-8")
|
||||
cores, standalone = es_systems_cores(es_text)
|
||||
dual = es_systems_dual(es_text)
|
||||
except urllib.error.URLError as e:
|
||||
raise ConnectionError(f"Failed to fetch {es_url}: {e}") from e
|
||||
if not cores:
|
||||
@@ -223,6 +240,8 @@ class Scraper(BaseScraper):
|
||||
"verification_mode": "md5",
|
||||
"cores": sorted(cores),
|
||||
"standalone_cores": sorted(standalone),
|
||||
# Launched both ways: each layout gets its files.
|
||||
**({"dual_mode_cores": sorted(dual)} if dual else {}),
|
||||
"systems": systems,
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user