fix: normalize core names in emudeck and retropie scrapers

This commit is contained in:
Abdessamad Derraz
2026-03-26 09:44:11 +01:00
parent 7e8491fdf7
commit a3de47dd88
4 changed files with 703 additions and 680 deletions
+31 -19
View File
@@ -1,28 +1,40 @@
platform: emudeck platform: emudeck
source: https://github.com/dragoonDorise/EmuDeck source: https://github.com/dragoonDorise/EmuDeck
scraped_at: '2026-03-26T08:18:29Z' scraped_at: '2026-03-26T08:44:04Z'
targets: targets:
steamos: steamos:
architecture: x86_64 architecture: x86_64
cores: cores:
- citronbios - beetle_psx
- dreamcastbios - beetle_saturn
- dsbios - citron
- ps1bios - desmume
- ps2bios - duckstation
- ryujinxbios - flycast
- saturnbios - genesisplusgx
- segacdbios - kronos
- yuzubios - melonds
- pcsx2
- pcsx_rearmed
- picodrive
- swanstation
- yabasanshiro
- yabause
windows: windows:
architecture: x86_64 architecture: x86_64
cores: cores:
- citronbios - beetle_psx
- dreamcastbios - beetle_saturn
- dsbios - citron
- ps1bios - desmume
- ps2bios - duckstation
- ryujinxbios - flycast
- saturnbios - genesisplusgx
- segacdbios - kronos
- yuzubios - melonds
- pcsx2
- pcsx_rearmed
- picodrive
- swanstation
- yabasanshiro
- yabause
File diff suppressed because it is too large Load Diff
@@ -28,7 +28,21 @@ WINDOWS_CHECKBIOS_URL = (
"main/functions/checkBIOS.ps1" "main/functions/checkBIOS.ps1"
) )
# Patterns for emulator name extraction from shell install/check functions # checkBIOS functions check by system, not by core. Map to actual emulators.
# Source: EmuDeck install scripts + wiki documentation.
_BIOS_SYSTEM_TO_CORES: dict[str, list[str]] = {
"ps1bios": ["beetle_psx", "pcsx_rearmed", "duckstation", "swanstation"],
"ps2bios": ["pcsx2"],
"segacdbios": ["genesisplusgx", "picodrive"],
"saturnbios": ["beetle_saturn", "kronos", "yabasanshiro", "yabause"],
"dreamcastbios": ["flycast"],
"dsbios": ["melonds", "desmume"],
"ryujinxbios": [], # standalone, not libretro
"yuzubios": [], # standalone, not libretro
"citronbios": ["citron"],
}
# Patterns for BIOS check function names
_SH_EMULATOR_RE = re.compile( _SH_EMULATOR_RE = re.compile(
r'(?:function\s+|^)(?:check|install|setup)([A-Za-z0-9_]+)\s*\(', r'(?:function\s+|^)(?:check|install|setup)([A-Za-z0-9_]+)\s*\(',
re.MULTILINE, re.MULTILINE,
@@ -51,27 +65,18 @@ def _fetch(url: str) -> str | None:
return None return None
def _extract_sh_emulators(text: str) -> list[str]: def _extract_cores(text: str, pattern: re.Pattern[str]) -> list[str]:
"""Extract emulator names from checkBIOS.sh function declarations.""" """Extract core names by parsing BIOS check functions and mapping to cores."""
seen: set[str] = set() seen: set[str] = set()
results: list[str] = [] results: list[str] = []
for m in _SH_EMULATOR_RE.finditer(text): for m in pattern.finditer(text):
name = m.group(1).lower() system_name = m.group(1).lower()
if name and name not in seen: # Map system BIOS check to actual core names
seen.add(name) cores = _BIOS_SYSTEM_TO_CORES.get(system_name, [])
results.append(name) for core in cores:
return sorted(results) if core not in seen:
seen.add(core)
results.append(core)
def _extract_ps1_emulators(text: str) -> list[str]:
"""Extract emulator names from checkBIOS.ps1 function declarations."""
seen: set[str] = set()
results: list[str] = []
for m in _PS1_EMULATOR_RE.finditer(text):
name = m.group(1).lower()
if name and name not in seen:
seen.add(name)
results.append(name)
return sorted(results) return sorted(results)
@@ -84,11 +89,11 @@ class Scraper(BaseTargetScraper):
def fetch_targets(self) -> dict: def fetch_targets(self) -> dict:
print(" fetching SteamOS checkBIOS.sh...", file=sys.stderr) print(" fetching SteamOS checkBIOS.sh...", file=sys.stderr)
sh_text = _fetch(STEAMOS_CHECKBIOS_URL) sh_text = _fetch(STEAMOS_CHECKBIOS_URL)
steamos_cores = _extract_sh_emulators(sh_text) if sh_text else [] steamos_cores = _extract_cores(sh_text, _SH_EMULATOR_RE) if sh_text else []
print(" fetching Windows checkBIOS.ps1...", file=sys.stderr) print(" fetching Windows checkBIOS.ps1...", file=sys.stderr)
ps1_text = _fetch(WINDOWS_CHECKBIOS_URL) ps1_text = _fetch(WINDOWS_CHECKBIOS_URL)
windows_cores = _extract_ps1_emulators(ps1_text) if ps1_text else [] windows_cores = _extract_cores(ps1_text, _PS1_EMULATOR_RE) if ps1_text else []
targets: dict[str, dict] = { targets: dict[str, dict] = {
"steamos": { "steamos": {
@@ -138,9 +138,15 @@ class Scraper(BaseTargetScraper):
if not module_id: if not module_id:
print(f" warning: no rp_module_id in {filename}", file=sys.stderr) print(f" warning: no rp_module_id in {filename}", file=sys.stderr)
continue continue
# Normalize: strip lr- prefix and convert hyphens to underscores
# to match emulator profile keys (lr-beetle-psx -> beetle_psx)
core_name = module_id
if core_name.startswith("lr-"):
core_name = core_name[3:]
core_name = core_name.replace("-", "_")
for platform in PLATFORM_FLAGS: for platform in PLATFORM_FLAGS:
if _is_available(flags, platform): if _is_available(flags, platform):
platform_cores[platform].append(module_id) platform_cores[platform].append(core_name)
print(f" parsed {len(filenames)} scriptmodules", file=sys.stderr) print(f" parsed {len(filenames)} scriptmodules", file=sys.stderr)