mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-13 21:43:55 -06:00
fix: read the EmuDeck Windows cores from Windows
This commit is contained in:
1 parent
ae0b23a801
commit
1f3fc52013
4 files changed
+47
-23
No files matched your search
@@ -342,7 +342,6 @@
|
||||
"freechaf",
|
||||
"freeintv",
|
||||
"frodo",
|
||||
"fsuae",
|
||||
"fuse",
|
||||
"galaksija",
|
||||
"gam4980",
|
||||
@@ -424,7 +423,6 @@
|
||||
"nxengine",
|
||||
"o2em",
|
||||
"oberon",
|
||||
"omicron",
|
||||
"openlara",
|
||||
"opera",
|
||||
"panda3ds",
|
||||
@@ -505,7 +503,6 @@
|
||||
"vice_xplus4",
|
||||
"vice_xscpu64",
|
||||
"vice_xvic",
|
||||
"video_processor",
|
||||
"vircon32",
|
||||
"virtualjaguar",
|
||||
"virtualxt",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
platform: emudeck
|
||||
source: https://github.com/dragoonDorise/EmuDeck/tree/dddb30229adbbd54d5ff7283cfd70e11c4322c26
|
||||
scraped_at: '2026-11-06T07:10:22Z'
|
||||
scraped_at: '2026-11-06T13:46:57Z'
|
||||
targets:
|
||||
steamos:
|
||||
architecture: x86_64
|
||||
@@ -348,7 +348,6 @@ targets:
|
||||
- freechaf
|
||||
- freeintv
|
||||
- frodo
|
||||
- fsuae
|
||||
- fuse
|
||||
- galaksija
|
||||
- gam4980
|
||||
@@ -430,7 +429,6 @@ targets:
|
||||
- nxengine
|
||||
- o2em
|
||||
- oberon
|
||||
- omicron
|
||||
- openlara
|
||||
- opera
|
||||
- panda3ds
|
||||
@@ -511,7 +509,6 @@ targets:
|
||||
- vice_xplus4
|
||||
- vice_xscpu64
|
||||
- vice_xvic
|
||||
- video_processor
|
||||
- vircon32
|
||||
- virtualjaguar
|
||||
- virtualxt
|
||||
|
||||
@@ -16,6 +16,7 @@ import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
@@ -32,6 +33,7 @@ STEAMOS_API = (
|
||||
WINDOWS_API = (
|
||||
"https://api.github.com/repos/EmuDeck/emudeck-we/contents/functions/EmuScripts"
|
||||
)
|
||||
RETROARCH_TARGETS = Path(__file__).resolve().parents[3] / "platforms" / "targets" / "retroarch.yml"
|
||||
|
||||
def _fetch(url: str) -> str:
|
||||
headers = {"User-Agent": "retrobios-scraper/1.0"}
|
||||
@@ -75,7 +77,7 @@ class Scraper(BaseTargetScraper):
|
||||
return self._revision
|
||||
|
||||
def _fetch_cores_for_target(
|
||||
self, api_url: str, label: str, arch: str = "x86_64"
|
||||
self, api_url: str, label: str, retroarch_target: str
|
||||
) -> list[str]:
|
||||
print(f" fetching {label} EmuScripts...", file=sys.stderr)
|
||||
scripts = _list_emuscripts(api_url)
|
||||
@@ -94,7 +96,7 @@ class Scraper(BaseTargetScraper):
|
||||
standalone_count = len(cores)
|
||||
# EmuDeck ships RetroArch = all its libretro cores are available
|
||||
if has_retroarch:
|
||||
ra_cores = self._load_retroarch_cores(arch)
|
||||
ra_cores = self._load_retroarch_cores(retroarch_target)
|
||||
for c in ra_cores:
|
||||
if c not in seen:
|
||||
seen.add(c)
|
||||
@@ -108,24 +110,21 @@ class Scraper(BaseTargetScraper):
|
||||
return sorted(cores)
|
||||
|
||||
@staticmethod
|
||||
def _load_retroarch_cores(arch: str) -> list[str]:
|
||||
"""Load RetroArch target cores for given architecture."""
|
||||
import os
|
||||
|
||||
target_path = os.path.join("platforms", "targets", "retroarch.yml")
|
||||
with open(target_path) as f:
|
||||
def _load_retroarch_cores(target: str, path: Path = RETROARCH_TARGETS) -> list[str]:
|
||||
"""The buildbot's libretro cores for one RetroArch target, by name:
|
||||
linux-x86_64 and windows-x86_64 share an architecture, not a list."""
|
||||
with path.open(encoding="utf-8") as f:
|
||||
data = yaml_load(f) or {}
|
||||
# Find a target matching the architecture
|
||||
for tinfo in data.get("targets", {}).values():
|
||||
if tinfo.get("architecture") == arch and tinfo.get("cores"):
|
||||
return tinfo["cores"]
|
||||
raise RuntimeError(f"no {arch} core list in {target_path}")
|
||||
cores = ((data.get("targets") or {}).get(target) or {}).get("cores")
|
||||
if not cores:
|
||||
raise RuntimeError(f"no {target} core list in {path}")
|
||||
return cores
|
||||
|
||||
def fetch_targets(self) -> dict:
|
||||
steamos_cores = self._fetch_cores_for_target(
|
||||
f"{STEAMOS_API}?ref={self.revision}", "SteamOS"
|
||||
f"{STEAMOS_API}?ref={self.revision}", "SteamOS", "linux-x86_64"
|
||||
)
|
||||
windows_cores = self._fetch_cores_for_target(WINDOWS_API, "Windows")
|
||||
windows_cores = self._fetch_cores_for_target(WINDOWS_API, "Windows", "windows-x86_64")
|
||||
|
||||
targets: dict[str, dict] = {}
|
||||
if steamos_cores:
|
||||
|
||||
@@ -9,6 +9,7 @@ packs built for it shrank without an error.
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
import urllib.error
|
||||
@@ -589,12 +590,42 @@ class EmuDeckScriptNamesHaveOneRule(unittest.TestCase):
|
||||
with mock.patch.object(
|
||||
emudeck_targets_scraper, "_list_emuscripts", return_value=listing
|
||||
), mock.patch.object(scraper, "_load_retroarch_cores", return_value=["mgba"]):
|
||||
cores = scraper._fetch_cores_for_target("unused", "Windows")
|
||||
cores = scraper._fetch_cores_for_target("unused", "Windows", "windows-x86_64")
|
||||
standalone = {emulator_of_script(name) for name in listing} - {None, "retroarch"}
|
||||
self.assertEqual(standalone, {"mupen64plus_next", "pcsx2", "xemu"})
|
||||
self.assertEqual(cores, sorted(standalone | {"mgba"}))
|
||||
|
||||
|
||||
class EmuDeckWindowsReadsTheWindowsBuild(unittest.TestCase):
|
||||
"""The RetroArch list was the first target of the architecture:
|
||||
EmuDeck's Windows target carried fsuae, omicron and video_processor,
|
||||
which the buildbot publishes for Linux only."""
|
||||
|
||||
def test_each_target_gets_its_own_retroarch_list(self):
|
||||
seen: list[str] = []
|
||||
|
||||
def load(target: str) -> list[str]:
|
||||
seen.append(target)
|
||||
return [target]
|
||||
|
||||
scraper = emudeck_targets_scraper.Scraper(revision="0" * 40)
|
||||
with mock.patch.object(
|
||||
emudeck_targets_scraper, "_list_emuscripts", return_value=["emuDeckRetroArch.sh"]
|
||||
), mock.patch.object(scraper, "_load_retroarch_cores", side_effect=load):
|
||||
data = scraper.fetch_targets()
|
||||
self.assertEqual(seen, ["linux-x86_64", "windows-x86_64"])
|
||||
self.assertEqual(data["targets"]["windows"]["cores"], ["windows-x86_64"])
|
||||
|
||||
def test_the_list_is_read_by_target_name_from_any_directory(self):
|
||||
cwd = os.getcwd()
|
||||
self.addCleanup(os.chdir, cwd)
|
||||
os.chdir(Path(__file__).parent)
|
||||
load = emudeck_targets_scraper.Scraper._load_retroarch_cores
|
||||
windows, linux = load("windows-x86_64"), load("linux-x86_64")
|
||||
self.assertNotIn("video_processor", windows)
|
||||
self.assertIn("video_processor", linux)
|
||||
|
||||
|
||||
class HashScrapersRefuseAnUnknownVersion(unittest.TestCase):
|
||||
"""mame_hash_scraper wrote core_version "unknown" after a failed API call
|
||||
and cached it for a day, while the pipeline step still read OK."""
|
||||
|
||||
Reference in new issue
Block a user