mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-18 09:23:26 -05:00
Batocera, ROCKNIX and Recalbox find a file through the core that wants it. Additions now carry that core under the platform's own name: the emulator/core pair checkBios reads (ROCKNIX's from its emulators package), or Recalbox's core attribute. One with no nameable core, or filed in a system gated on another core, is counted as not stated.
72 lines
2.2 KiB
Python
72 lines
2.2 KiB
Python
"""Exporter for ROCKNIX's rocknix-systems.
|
|
|
|
Same shape as Batocera's script: a systems mapping inside a checker ROCKNIX
|
|
runs, so only the mapping is rewritten.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
from .baseline import NativeSystem, Report
|
|
from .batocera_exporter import Exporter as BatoceraExporter
|
|
|
|
SOURCE_URL = (
|
|
"https://raw.githubusercontent.com/ROCKNIX/distribution/next/projects/ROCKNIX"
|
|
"/packages/rocknix/sources/scripts/rocknix-systems"
|
|
)
|
|
|
|
|
|
EMULATORS_URL = (
|
|
"https://raw.githubusercontent.com/ROCKNIX/distribution/next/projects/ROCKNIX"
|
|
"/packages/virtual/emulators/package.mk"
|
|
)
|
|
EMULATORS_MK = "emulators/package.mk"
|
|
# `add_emu_core <system> <emulator> <core> <default>`: the pairs es_systems.cfg
|
|
# lists, and so the names checkBios's emuDict holds.
|
|
_ADD_EMU_CORE = re.compile(r"^\s*add_emu_core\s+(\S+)\s+(\S+)\s+(\S+)", re.MULTILINE)
|
|
|
|
|
|
class Exporter(BatoceraExporter):
|
|
"""Write ROCKNIX's rocknix-systems, corrected."""
|
|
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
self._emulator_of: dict[str, str] = {}
|
|
|
|
def _runner_pair(self, runner: tuple[bool, str]) -> tuple[str, str | None] | None:
|
|
"""ROCKNIX registers libretro cores under `retroarch` and each
|
|
standalone under its own emulator (`azahar azahar-sa`), in the
|
|
emulators package; the `libretro` Batocera writes names nothing
|
|
there."""
|
|
_standalone, name = runner
|
|
emulator = self._emulator_of.get(name)
|
|
return (emulator, name) if emulator else None
|
|
|
|
def render(
|
|
self,
|
|
systems: dict[str, NativeSystem],
|
|
report: Report,
|
|
originals: dict[str, str],
|
|
scraped: dict | None = None,
|
|
) -> dict[str, str]:
|
|
self._emulator_of = {
|
|
core: emulator
|
|
for _system, emulator, core in _ADD_EMU_CORE.findall(
|
|
originals.get(EMULATORS_MK, "")
|
|
)
|
|
}
|
|
return super().render(systems, report, originals, scraped)
|
|
|
|
@staticmethod
|
|
def platform_name() -> str:
|
|
return "rocknix"
|
|
|
|
@staticmethod
|
|
def native_filename() -> str:
|
|
return "rocknix-systems"
|
|
|
|
@staticmethod
|
|
def native_sources() -> dict[str, str]:
|
|
return {"rocknix-systems": SOURCE_URL, EMULATORS_MK: EMULATORS_URL}
|