Files
PS5_RetroArch/tests/test_esde_library.py
T
Mihawk f35915abca The game library: every frontend's systems and games come from RetroArch
A frontend keeps no game library of its own. Its systems and game lists
are RetroArch's playlists, read again each time it starts, so a game
added to or removed from a playlist in RetroArch appears or goes in
every frontend. src/ps5_library.h and src/ps5_library.c are that
contract, compiled into eboot.bin and into every frontend
(tools/build-frontend.sh), like game mode's:

- Games: the entries of /app0/playlists, minus RetroArch's history,
  favourites and media lists, each game once.
- A game's system: the first known platform among its entry's
  database, the playlist's name, its folder and its core's database;
  otherwise a system of its own. A mixed playlist of DETECT entries,
  like the base console's content.lpl, is split by folder.
- A system's core: the one its entries name most, else the core
  RetroArch's core info associates with the platform. Its folder is the
  deepest folder holding all its games, and its extensions are those of
  its games and its core.
- ps5_library_command gives game mode's command line; game mode now
  reads playlists through the same reader.

ES-DE (frontends/es-de/ps5/library_ps5.cpp) writes
custom_systems/es_systems.xml and each system's gamelist.xml from the
library at every start, using ES-DE's own names and themes. A game ES-DE
already knows keeps its play count, play time, favourite and scraped
details; a game no longer in any playlist is dropped. ES-DE then runs
with --gamelist-only. The fixed table (systems.tsv, systems.py) is gone.

Evidence: evidence/game-library/ (capture.json, expectation.json,
capture-test.jsonl); base PS5 13.40: 5 playlists gave 14 systems and 16
games, 0 failures. ES-DE loaded the 14 systems, started Donkey Kong
Country 2 through game mode and came back with the play counted
(playcount 2, playtime 21); no fatal signal.
Command:
  PS5_FRONTENDS='es-de picker' tools/build-title.sh
  tools/run-title.sh --no-build --relaunch-test=1 \
    --relaunch-image=es-de/es-de.bin --frontend-capture=4,20 \
    --frontend-launch --retroarch-frames=600 --watch 80
Gates: tools/verify.sh PASS (format unit build integration evidence).
2026-10-04 18:54:38 -04:00

31 lines
1.4 KiB
Python

"""EmulationStation's systems and game lists from RetroArch's playlists (frontends/es-de/ps5/library_ps5.cpp)."""
from pathlib import Path
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parent.parent
PUGIXML = ROOT / 'build' / 'pugixml-ps5' / 'src' / 'src'
class EsdeLibrary(unittest.TestCase):
def test_systems_and_game_lists(self):
if not (PUGIXML / 'pugixml.cpp').is_file():
self.skipTest('pugixml not fetched (tools/build-pugixml.sh fetches it)')
with tempfile.TemporaryDirectory() as td:
objects = []
for source in ('src/ps5_library.c', 'src/ps5_game.c'):
obj = str(Path(td) / (Path(source).stem + '.o'))
subprocess.run(['cc', '-std=c11', '-O2', '-Wall', '-Wextra', '-Werror', '-c', source, '-o', obj],
cwd=ROOT, check=True)
objects.append(obj)
binary = str(Path(td) / 'esde-library-test')
subprocess.run(['c++', '-std=c++17', '-O2', '-Wall', '-Wextra', '-Werror', '-Isrc', '-isystem',
str(PUGIXML), 'tests/esde_library_test.cpp', 'frontends/es-de/ps5/library_ps5.cpp',
str(PUGIXML / 'pugixml.cpp'), *objects, '-o', binary], cwd=ROOT, check=True)
subprocess.run([binary, td], cwd=ROOT, check=True, timeout=15)
if __name__ == '__main__':
unittest.main()