mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-22 17:47:48 -06:00
refactor: system names and guides below packs
This commit is contained in:
1 parent
4037c537cc
commit
29f5c48a2c
44 files changed
+1437
-1382
No files matched your search
@@ -33,7 +33,8 @@ import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
from sitebootstrap import PIN, SH_NAME
|
||||
from sitebootstrap import PIN
|
||||
from model.guides import SH_NAME
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
PACKAGE_DIR = ROOT / "packaging" / "pypi"
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
"""Heading ids as the site's Markdown renderer spells them."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import unicodedata
|
||||
from html import unescape
|
||||
|
||||
|
||||
IDCOUNT = re.compile(r"^(.*)_([0-9]+)$")
|
||||
|
||||
|
||||
# Heading ids, as Python-Markdown's toc extension gives them
|
||||
|
||||
|
||||
def toc_slug(text: str) -> str:
|
||||
text = re.sub(r"<[^>]+>", "", text)
|
||||
text = re.sub(r"!\[[^\]]*\]\([^)]*\)(\{[^}]*\})?", "", text)
|
||||
text = re.sub(r"\[([^\]]*)\]\([^)]*\)", r"\1", text)
|
||||
text = unescape(text.replace("`", "").replace("**", "").replace("\\", ""))
|
||||
text = unicodedata.normalize("NFKD", text).encode("ascii", "ignore").decode("ascii")
|
||||
text = re.sub(r"[^\w\s-]", "", text).strip().lower()
|
||||
return re.sub(r"[-\s]+", "-", text)
|
||||
|
||||
|
||||
def _unique(ident: str, used: set[str]) -> str:
|
||||
while ident in used or not ident:
|
||||
match = IDCOUNT.match(ident)
|
||||
ident = f"{match[1]}_{int(match[2]) + 1}" if match else f"{ident}_1"
|
||||
used.add(ident)
|
||||
return ident
|
||||
@@ -149,7 +149,7 @@ def write_manifest(directory: Path, note: str, entries: list[dict]) -> None:
|
||||
|
||||
|
||||
def fetch_logos() -> None:
|
||||
from siteguides import GROUP_TILES, GUIDES
|
||||
from model.guides import GROUP_TILES, GUIDES
|
||||
|
||||
with open(ROOT / "platforms" / "_registry.yml", encoding="utf-8") as handle:
|
||||
platforms = yaml.safe_load(handle)["platforms"]
|
||||
@@ -198,7 +198,7 @@ def fetch_logos() -> None:
|
||||
|
||||
def fetch_icons() -> None:
|
||||
from model.database import load_database
|
||||
from sitecollection import _group_by_manufacturer
|
||||
from model.collection import _group_by_manufacturer
|
||||
from siterender import SYSTEM_ICON_BASE, _icon_name
|
||||
|
||||
db = load_database(str(ROOT / "database.json"))
|
||||
|
||||
@@ -34,7 +34,7 @@ from resolve.cores import resolve_platform_cores
|
||||
from model.systems import system_index
|
||||
import archive_build
|
||||
import release_record
|
||||
from siteguides import PACKAGE_COMMAND, install_command
|
||||
from model.guides import PACKAGE_COMMAND, install_command
|
||||
from resolve.review import LARGE_FILE_ISSUE_URL
|
||||
from model.largefiles import LARGE_FILES_CACHE, load_registered_paths
|
||||
import pr_checks
|
||||
|
||||
+23
-18
@@ -41,9 +41,13 @@ from pathlib import Path
|
||||
from typing import TypeVar
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
from sitecollection import (
|
||||
_copy_places, _group_by_manufacturer, _profiles_in,
|
||||
_profiles_on_disk, _slug, collection_paths,
|
||||
from model.collection import (
|
||||
_copy_places,
|
||||
_group_by_manufacturer,
|
||||
_profiles_in,
|
||||
_profiles_on_disk,
|
||||
_slug,
|
||||
collection_paths,
|
||||
)
|
||||
from resolve.ownership import BUCKET_FOLDERS, names_manufacturer
|
||||
from model.profiles import (
|
||||
@@ -67,7 +71,8 @@ from model.safeparse import require_yaml, yaml_load
|
||||
from resolve.localfile import resolution_is_hash_exact, resolve_local_file
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from resolve.layout import runs_standalone
|
||||
from siterender import SECTION_LABELS, WIKI_SRC_DIR
|
||||
from model.collection import SECTION_LABELS
|
||||
from siterender import WIKI_SRC_DIR
|
||||
from core.artifacts import ArtifactLockBusy, artifact_lock
|
||||
from core.artifacts import json_text as _json_text
|
||||
from packs.crossref import FileConsumers, entry_target, held_copy
|
||||
@@ -87,14 +92,14 @@ from generate_readme import (
|
||||
from provenance_report import build_report, distinct_missing, profile_needs
|
||||
import sitemarkup as markup
|
||||
import siteentries
|
||||
import siteinputs
|
||||
from model import siteinputs
|
||||
from model import retired as model_retired
|
||||
import siteagents
|
||||
import sitediagrams
|
||||
import sitestarlight
|
||||
import sitesteps
|
||||
from siteexports import generate_exports_page, load_export_reports
|
||||
from siteguides import (
|
||||
from model.guides import (
|
||||
ALSO_RUNS,
|
||||
DEVICE_GROUPS,
|
||||
GROUP_ANCHORS,
|
||||
@@ -110,13 +115,10 @@ from siteguides import (
|
||||
TERMINALS,
|
||||
TRUST_ITEMS,
|
||||
detected_systems as _detected_systems,
|
||||
fence,
|
||||
install_command,
|
||||
setup_count,
|
||||
platform_args,
|
||||
terminal_tabs,
|
||||
trust_box,
|
||||
)
|
||||
from siteguides import fence, platform_args, terminal_tabs, trust_box
|
||||
import archive_build
|
||||
import release_record
|
||||
import sitebootstrap
|
||||
@@ -149,9 +151,6 @@ from siterender import (
|
||||
_slugify_anchor,
|
||||
_system_page_map,
|
||||
set_system_page_map,
|
||||
set_console_sections,
|
||||
program_names,
|
||||
system_name,
|
||||
card_page,
|
||||
console_href,
|
||||
console_anchor,
|
||||
@@ -169,6 +168,7 @@ from siterender import (
|
||||
_icon_name,
|
||||
prime_system_icons,
|
||||
)
|
||||
from model.systemnames import set_console_sections, program_names, system_name
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
yaml = require_yaml()
|
||||
@@ -5151,7 +5151,8 @@ def _console_system_names(profiles: dict, coverages: dict) -> dict[tuple[str, st
|
||||
own section that folder is: a collection file is named after the console
|
||||
it is filed under. A folder no id owns, or that two names own, is left out.
|
||||
"""
|
||||
from siterender import _own_section, system_ids
|
||||
from model.systemnames import _own_section
|
||||
from siterender import system_ids
|
||||
|
||||
found: dict[tuple[str, str], set[str]] = {}
|
||||
for sys_id in system_ids(profiles, [c["config"] for c in coverages.values()]):
|
||||
@@ -5483,7 +5484,8 @@ def _console_display(manufacturer: str, console: str) -> str:
|
||||
"""A console section's name as the reader looks for it: the heading
|
||||
system_name gives its id, or the folder alone under a program's top
|
||||
(Other, Arcade), where "Other mame" would name nothing."""
|
||||
from siterender import _PROGRAM_TOPS, _heading_name
|
||||
from model.collection import _PROGRAM_TOPS
|
||||
from model.systemnames import _heading_name
|
||||
|
||||
return console if manufacturer in _PROGRAM_TOPS else _heading_name(manufacturer, console)
|
||||
|
||||
@@ -7186,7 +7188,8 @@ def _start_groups(
|
||||
the Mega CD BIOS for its Genesis), and one under Other is a single
|
||||
emulator's, its shaders and fonts. A file the emulator ships with is
|
||||
no file to fetch."""
|
||||
from siterender import _heading_name, _manufacturer_slug, system_name
|
||||
from model.systemnames import _heading_name, system_name
|
||||
from model.collection import _manufacturer_slug
|
||||
|
||||
here = (_manufacturer_slug(section[0]), section[1]) if section else None
|
||||
kept, candidates = _section_reads(files, consumers, here)
|
||||
@@ -7669,7 +7672,8 @@ class _BoardSort:
|
||||
|
||||
def arcade_folders(self, arcade: dict[str, list], by_name: dict[str, str]) -> None:
|
||||
"""The folders of bios/Arcade/, each file to its board or machine."""
|
||||
from siterender import arcade_board, archive_machine, record_card_move
|
||||
from siterender import arcade_board, archive_machine
|
||||
from model.collection import record_card_move
|
||||
|
||||
for console in sorted(arcade):
|
||||
joined = by_name.get(console.casefold())
|
||||
@@ -7689,7 +7693,8 @@ class _BoardSort:
|
||||
"""A board's set filed under a machine's folder is on the board's page
|
||||
too, whatever the folder: naomi.zip under the Dreamcast was the copy
|
||||
five setups list, and the NAOMI page did not name it."""
|
||||
from siterender import arcade_board, archive_machine, record_card_move
|
||||
from siterender import arcade_board, archive_machine
|
||||
from model.collection import record_card_move
|
||||
|
||||
for mfr, consoles in manufacturers.items():
|
||||
if mfr == "Arcade":
|
||||
|
||||
@@ -73,7 +73,7 @@ def system_cards() -> dict[str, tuple[str, str]]:
|
||||
system pages are written from."""
|
||||
from model.composition import GAME_DATA_TOPS
|
||||
from model.database import load_database
|
||||
from sitecollection import _group_by_manufacturer, _slug
|
||||
from model.collection import _group_by_manufacturer, _slug
|
||||
|
||||
def lead(manufacturer: str) -> str:
|
||||
# Other holds one folder per emulator, a game publisher's page its
|
||||
|
||||
@@ -11,7 +11,7 @@ from __future__ import annotations
|
||||
import functools
|
||||
from dataclasses import dataclass
|
||||
|
||||
import siteinputs
|
||||
from model import siteinputs
|
||||
from model.composition import GAME_DATA_TOPS
|
||||
from model.profiles import load_emulator_profiles
|
||||
|
||||
@@ -93,7 +93,6 @@ def _engine_sections(manufacturers: dict[str, dict[str, list]]) -> dict[str, dic
|
||||
top joins that top, and a folder named by a profile key is headed with
|
||||
the engine's name (SECTION_LABELS), its address unchanged.
|
||||
"""
|
||||
from siterender import SECTION_LABELS
|
||||
|
||||
profiles = {key: profile for key, profile in _profiles_on_disk().items()
|
||||
if profile.get("type") != "alias" and profile.get("role") != "test"}
|
||||
@@ -139,7 +138,6 @@ def _file_readers(profiles: dict[str, dict]) -> dict[str, set[str]]:
|
||||
|
||||
|
||||
def _regroup_top(mfr: str, consoles: dict[str, list], engines: _Engines) -> dict[str, list]:
|
||||
from siterender import record_card_move
|
||||
|
||||
own = engines.profile_of(mfr)
|
||||
regrouped: dict[str, list] = {}
|
||||
@@ -165,7 +163,6 @@ def _regroup_top(mfr: str, consoles: dict[str, list], engines: _Engines) -> dict
|
||||
def _join_other_folders(out: dict[str, dict[str, list]]) -> None:
|
||||
"""The folder under Other an engine top is named after: ScummVM's
|
||||
engine data under Other/ScummVM, its themes under ScummVM/."""
|
||||
from siterender import _PROGRAM_TOPS, record_card_move
|
||||
|
||||
others = out.get("Other", {})
|
||||
for folder in sorted(others):
|
||||
@@ -189,3 +186,41 @@ def _profiles_on_disk() -> dict[str, dict]:
|
||||
@functools.cache
|
||||
def _profiles_in(emulators_dir: str, skip_aliases: bool) -> dict[str, dict]:
|
||||
return load_emulator_profiles(emulators_dir, skip_aliases=skip_aliases)
|
||||
|
||||
|
||||
def _manufacturer_slug(manufacturer: str) -> str:
|
||||
return manufacturer.lower().replace(" ", "-")
|
||||
|
||||
|
||||
# (manufacturer slug, folder, sha1) -> the (manufacturer slug, console) a
|
||||
# copy's card went to when the system pages file it outside its folder:
|
||||
# ScummVM's engine data under Other/ScummVM, neogeo.zip under Arcade.
|
||||
_card_moves: dict[tuple[str, str, str], tuple[str, str]] = {}
|
||||
|
||||
|
||||
def record_card_move(manufacturer: str, folder: str, sha1: str,
|
||||
to_manufacturer: str, to_console: str) -> None:
|
||||
"""Mark that the card of the copy under bios/<manufacturer>/<folder>/
|
||||
sits in the section (to_manufacturer, to_console)."""
|
||||
_card_moves[(_manufacturer_slug(manufacturer), folder, str(sha1))] = (
|
||||
_manufacturer_slug(to_manufacturer), to_console)
|
||||
|
||||
|
||||
# System display names. A system is named by the heading of the console
|
||||
# section that is its own: the folder its id spells, under the maker the id
|
||||
# names when two makers file a console of that name. The page a system's
|
||||
# files were voted onto is not its section and never names it. That vote
|
||||
# called nintendo-gba "Nintendo Game Boy" and camplynx "Arcade". A system
|
||||
# with no section of its own is named in SYSTEM_NAMES, and a system in
|
||||
# neither stops the build.
|
||||
|
||||
# Folders that file copies by the emulator or board that loads them. Their
|
||||
# headings name a program, not a system.
|
||||
_PROGRAM_TOPS = frozenset({"Other", "Arcade"})
|
||||
|
||||
|
||||
# A section whose folder is a short name the code reads, headed with the
|
||||
# program's name instead (bios/Arcade/fba2012 holds FB Alpha 2012's samples).
|
||||
SECTION_LABELS: dict[tuple[str, str], str] = {
|
||||
("Arcade", "fba2012"): "FB Alpha 2012",
|
||||
}
|
||||
@@ -0,0 +1,472 @@
|
||||
"""The setup guides of platforms/_guides.yml, and the install commands they print."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import textwrap
|
||||
from dataclasses import dataclass, fields
|
||||
from pathlib import Path
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
from model.safeparse import require_yaml
|
||||
|
||||
|
||||
SH_NAME = "i"
|
||||
PS1_NAME = "i.ps1"
|
||||
|
||||
|
||||
PLATFORMS_DIR = REPO_ROOT / "platforms"
|
||||
GUIDES_FILE = PLATFORMS_DIR / "_guides.yml"
|
||||
|
||||
|
||||
class GuideError(ValueError):
|
||||
"""The guides file does not say what a page needs, or contradicts the registry."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Guide:
|
||||
"""What a platform page says before its file reference.
|
||||
|
||||
`folders` are the common cases, `more_folders` the rarer builds shown
|
||||
folded under them, under `more_folders_title`. `more_folders_detected`
|
||||
adds a row for each named system the registry detects the platform on.
|
||||
`notes` stay in the guide, one plain fact each. `reference_notes` carry
|
||||
the source citations and the details a reader checking the work wants,
|
||||
and open the Reference part of the page. `download_hint` is one more
|
||||
bullet under the pack download. `pack_manual` is the manual part of the
|
||||
README inside the pack. `logo_owner` and `logo_licence` credit the
|
||||
logo the registry links. `runs_on` names the hardware, in the project's
|
||||
own words, for its tile and its row. `terminal` replaces the shared
|
||||
"On the device" text with how this system opens a terminal. `card_run`
|
||||
names the computers that can open the BIOS folder on the device's card,
|
||||
when not every one can. `lead` comes
|
||||
before the folder table, `finish` closes the guide. `{folders}` in
|
||||
`pack_manual` is the folder list of the page, so the README and the page
|
||||
cannot name two folders for one device.
|
||||
"""
|
||||
|
||||
summary: str
|
||||
folders: tuple[tuple[str, str], ...]
|
||||
run: tuple[str, ...]
|
||||
notes: tuple[str, ...] = ()
|
||||
dest: str = ""
|
||||
on_card: bool = False
|
||||
more_folders: tuple[tuple[str, str], ...] = ()
|
||||
more_folders_title: str = "Other layouts"
|
||||
more_folders_detected: bool = False
|
||||
more_folders_note: str = ""
|
||||
reference_notes: tuple[str, ...] = ()
|
||||
download_hint: str = ""
|
||||
pack_manual: str = ""
|
||||
logo_owner: str = ""
|
||||
logo_licence: str = ""
|
||||
runs_on: str = ""
|
||||
terminal: str = ""
|
||||
lead: str = ""
|
||||
finish: str = ""
|
||||
card_run: tuple[str, ...] = ()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Tile:
|
||||
"""A tile beside the setups of a device group that is no setup of its
|
||||
own: a kind of device that runs one (Android handhelds run RetroArch).
|
||||
*link* is a site path, like the setup tiles' ``platforms/<key>.md``."""
|
||||
|
||||
name: str
|
||||
text: str
|
||||
link: str
|
||||
# A logo naming the kind of device, credited like a setup's.
|
||||
logo: str = ""
|
||||
logo_owner: str = ""
|
||||
logo_licence: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HandheldSystem:
|
||||
"""One handheld system on the handheld guide: a name the installer
|
||||
detects, the BIOS folder seen on the card from a computer, and the
|
||||
devices the system's own site lists. Each value comes with the address
|
||||
of the page that states it, and is left out when no first-party page does."""
|
||||
|
||||
name: str
|
||||
folder: str = ""
|
||||
folder_source: str = ""
|
||||
devices: tuple[str, ...] = ()
|
||||
devices_source: str = ""
|
||||
linux_only: bool = False
|
||||
# Said when the project stopped, with the project's own page saying so:
|
||||
# ArkOS points its readers to dArkOS.
|
||||
ended: str = ""
|
||||
ended_source: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HandheldGuide:
|
||||
"""The guide page for the systems that run a setup on a handheld
|
||||
(ArkOS, muOS, Onion... run RetroArch). *devices* are the names a reader
|
||||
types, searched on that page; *systems* one row each."""
|
||||
|
||||
page: str
|
||||
title: str
|
||||
summary: str
|
||||
uses: str
|
||||
systems: tuple[HandheldSystem, ...]
|
||||
|
||||
@property
|
||||
def path(self) -> str:
|
||||
return f"platforms/{self.page}.md"
|
||||
|
||||
@property
|
||||
def devices(self) -> tuple[str, ...]:
|
||||
seen: dict[str, None] = {}
|
||||
for system in self.systems:
|
||||
seen.update(dict.fromkeys(system.devices))
|
||||
return tuple(seen)
|
||||
|
||||
|
||||
_GUIDE_KEYS = {f.name for f in fields(Guide)}
|
||||
_REQUIRED = ("summary", "folders", "run")
|
||||
_TOP_KEYS = {"install_base", "trust_items", "device_groups", "terminals", "guides",
|
||||
"handheld_guide"}
|
||||
_GROUP_KEYS = {"label", "description", "anchor", "also_runs", "tiles"}
|
||||
_ALSO_KEYS = ("setup", "summary", "uses", "runs_on", "folder")
|
||||
_TILE_KEYS = ("name", "text", "link")
|
||||
_TILE_LOGO_KEYS = ("logo", "logo_owner", "logo_licence")
|
||||
_HANDHELD_KEYS = {"page", "title", "summary", "uses", "systems"}
|
||||
_SYSTEM_KEYS = {"name", "folder", "folder_source", "devices", "devices_source", "linux_only",
|
||||
"ended", "ended_source"}
|
||||
_SOURCE = re.compile(r"https://\S+")
|
||||
_TERMINAL_KEYS = ("label", "how", "shell")
|
||||
|
||||
|
||||
def _text(value: object, where: str) -> str:
|
||||
if not isinstance(value, str) or not value.strip():
|
||||
raise GuideError(f"{where}: expected text, found {value!r}")
|
||||
return value
|
||||
|
||||
|
||||
def _texts(value: object, where: str) -> tuple[str, ...]:
|
||||
if not isinstance(value, list):
|
||||
raise GuideError(f"{where}: expected a list, found {value!r}")
|
||||
return tuple(_text(item, f"{where}[{i}]") for i, item in enumerate(value))
|
||||
|
||||
|
||||
def _unknown(data: dict, allowed: set[str] | tuple[str, ...], where: str) -> None:
|
||||
extra = sorted(set(data) - set(allowed))
|
||||
if extra:
|
||||
raise GuideError(f"{where}: unknown key {', '.join(extra)} "
|
||||
f"(known: {', '.join(sorted(allowed))})")
|
||||
|
||||
|
||||
def _folder_rows(value: object, extract_to: str, where: str) -> tuple[tuple[str, str], ...]:
|
||||
"""Folder rows as (where, path). A row with no path is the registry's
|
||||
extract_to, so that folder is written once."""
|
||||
if not isinstance(value, list) or not value:
|
||||
raise GuideError(f"{where}: expected a list of folder rows")
|
||||
rows = []
|
||||
for i, row in enumerate(value):
|
||||
at = f"{where}[{i}]"
|
||||
if not isinstance(row, dict):
|
||||
raise GuideError(f"{at}: expected a mapping with `where` and `path`")
|
||||
_unknown(row, ("where", "path"), at)
|
||||
label = _text(row.get("where"), f"{at}.where")
|
||||
if "path" in row:
|
||||
rows.append((label, _text(row["path"], f"{at}.path")))
|
||||
elif extract_to:
|
||||
rows.append((label, f"`{extract_to}`"))
|
||||
else:
|
||||
raise GuideError(f"{at}: no `path`, and the registry has no extract_to for it")
|
||||
return tuple(rows)
|
||||
|
||||
|
||||
def _guide(name: str, data: object, extract_to: str, terminals: dict) -> Guide:
|
||||
where = f"{GUIDES_FILE.name}: guides.{name}"
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{where}: expected a mapping")
|
||||
_unknown(data, _GUIDE_KEYS, where)
|
||||
missing = [key for key in _REQUIRED if key not in data]
|
||||
if missing:
|
||||
raise GuideError(f"{where}: missing {', '.join(missing)}")
|
||||
run = _texts(data["run"], f"{where}.run")
|
||||
card_run = _texts(data["card_run"], f"{where}.card_run") if "card_run" in data else ()
|
||||
for key, tabs in (("run", run), ("card_run", card_run)):
|
||||
unknown_tabs = [tab for tab in tabs if tab not in terminals]
|
||||
if unknown_tabs:
|
||||
raise GuideError(f"{where}.{key}: no terminal named {', '.join(unknown_tabs)}")
|
||||
values: dict = {
|
||||
"card_run": card_run,
|
||||
"summary": _text(data["summary"], f"{where}.summary"),
|
||||
"folders": _folder_rows(data["folders"], extract_to, f"{where}.folders"),
|
||||
"run": run,
|
||||
}
|
||||
if "more_folders" in data:
|
||||
values["more_folders"] = _folder_rows(
|
||||
data["more_folders"], extract_to, f"{where}.more_folders")
|
||||
for key in ("notes", "reference_notes"):
|
||||
if key in data:
|
||||
values[key] = _texts(data[key], f"{where}.{key}")
|
||||
for key in ("dest", "download_hint", "more_folders_title", "more_folders_note",
|
||||
"logo_owner", "logo_licence", "runs_on", "terminal", "lead", "finish"):
|
||||
if key in data:
|
||||
values[key] = _text(data[key], f"{where}.{key}")
|
||||
for key in ("on_card", "more_folders_detected"):
|
||||
if key in data:
|
||||
if not isinstance(data[key], bool):
|
||||
raise GuideError(f"{where}.{key}: expected true or false")
|
||||
values[key] = data[key]
|
||||
if "pack_manual" in data:
|
||||
values["pack_manual"] = _text(data["pack_manual"], f"{where}.pack_manual")
|
||||
return Guide(**values)
|
||||
|
||||
|
||||
def detected_systems(registry: dict, platform: str) -> list[tuple[str, str]]:
|
||||
"""Named systems a platform runs on, handhelds that run RetroArch for one,
|
||||
with the BIOS folder the installer writes on each, read from the
|
||||
detection rules of the registry."""
|
||||
seen: dict[str, str] = {}
|
||||
for rule in (registry.get(platform, {}).get("install") or {}).get("detect") or []:
|
||||
name, folder = rule.get("name"), rule.get("bios_path")
|
||||
if name and folder and rule.get("installs", True) and name not in seen:
|
||||
seen[name] = folder
|
||||
return sorted(seen.items(), key=lambda item: item[0].casefold())
|
||||
|
||||
|
||||
def _source(value: object, where: str) -> str:
|
||||
text = _text(value, where)
|
||||
if not _SOURCE.fullmatch(text):
|
||||
raise GuideError(f"{where}: expected one https address, found {text!r}")
|
||||
return text
|
||||
|
||||
|
||||
def _handheld_system(data: object, where: str) -> HandheldSystem:
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{where}: expected a mapping")
|
||||
_unknown(data, _SYSTEM_KEYS, where)
|
||||
values: dict = {"name": _text(data.get("name"), f"{where}.name")}
|
||||
for value, source in (("folder", "folder_source"), ("devices", "devices_source"),
|
||||
("ended", "ended_source")):
|
||||
if (value in data) != (source in data):
|
||||
raise GuideError(f"{where}: {value} and {source} go together, "
|
||||
"a value is written only with the page that states it")
|
||||
if value in data:
|
||||
values[value] = (_texts(data[value], f"{where}.{value}") if value == "devices"
|
||||
else _text(data[value], f"{where}.{value}"))
|
||||
values[source] = _source(data[source], f"{where}.{source}")
|
||||
if "linux_only" in data:
|
||||
if not isinstance(data["linux_only"], bool) or "folder" not in data:
|
||||
raise GuideError(f"{where}.linux_only: expected true or false, with a folder")
|
||||
values["linux_only"] = data["linux_only"]
|
||||
return HandheldSystem(**values)
|
||||
|
||||
|
||||
def _handheld_guide(data: object, registry: dict, guides: dict, where: str) -> HandheldGuide | None:
|
||||
"""The handheld guide, checked against the systems the registry detects
|
||||
the setup on: one row for each, and none it does not detect."""
|
||||
if data is None:
|
||||
return None
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{where}: expected a mapping")
|
||||
_unknown(data, _HANDHELD_KEYS, where)
|
||||
uses = _text(data.get("uses"), f"{where}.uses")
|
||||
if uses not in guides:
|
||||
raise GuideError(f"{where}.uses: {uses!r} is not a platform with a guide")
|
||||
page = _text(data.get("page"), f"{where}.page")
|
||||
if page in registry:
|
||||
raise GuideError(f"{where}.page: {page!r} is the page of a registered platform")
|
||||
raw = data.get("systems")
|
||||
if not isinstance(raw, list) or not raw:
|
||||
raise GuideError(f"{where}.systems: expected a list of systems")
|
||||
systems = tuple(_handheld_system(row, f"{where}.systems[{i}]") for i, row in enumerate(raw))
|
||||
named = [system.name for system in systems]
|
||||
detected = [name for name, _folder in detected_systems(registry, uses)]
|
||||
if sorted(named, key=str.casefold) != detected:
|
||||
raise GuideError(
|
||||
f"{where}.systems: one row per system the registry detects {uses} on, "
|
||||
f"missing {sorted(set(detected) - set(named))}, "
|
||||
f"not detected {sorted(set(named) - set(detected))}")
|
||||
return HandheldGuide(
|
||||
page=page, title=_text(data.get("title"), f"{where}.title"),
|
||||
summary=_text(data.get("summary"), f"{where}.summary"), uses=uses, systems=systems,
|
||||
)
|
||||
|
||||
|
||||
def _terminals(raw: dict, file_name: str) -> dict[str, tuple[str, str, str]]:
|
||||
terminals: dict[str, tuple[str, str, str]] = {}
|
||||
for key, entry in raw.items():
|
||||
at = f"{file_name}: terminals.{key}"
|
||||
if not isinstance(entry, dict):
|
||||
raise GuideError(f"{at}: expected a mapping")
|
||||
_unknown(entry, _TERMINAL_KEYS, at)
|
||||
label, how, shell = (_text(entry.get(k), f"{at}.{k}") for k in _TERMINAL_KEYS)
|
||||
terminals[key] = (label, how, shell)
|
||||
if entry["shell"] not in ("sh", "powershell"):
|
||||
raise GuideError(f"{at}.shell: sh or powershell, found {entry['shell']!r}")
|
||||
return terminals
|
||||
|
||||
|
||||
def _also_runs(raw: list, raw_guides: dict, at: str) -> tuple[tuple[str, str, str, str, str], ...]:
|
||||
rows = []
|
||||
for i, row in enumerate(raw):
|
||||
row_at = f"{at}.also_runs[{i}]"
|
||||
if not isinstance(row, dict):
|
||||
raise GuideError(f"{row_at}: expected a mapping")
|
||||
_unknown(row, _ALSO_KEYS, row_at)
|
||||
setup, summary, uses, runs_on, folder = (_text(row.get(k), f"{row_at}.{k}")
|
||||
for k in _ALSO_KEYS)
|
||||
if uses not in raw_guides:
|
||||
raise GuideError(f"{row_at}.uses: {uses!r} is not a platform with a guide")
|
||||
rows.append((setup, summary, uses, runs_on, folder))
|
||||
return tuple(rows)
|
||||
|
||||
|
||||
def _group_tiles(raw: list, at: str) -> tuple[Tile, ...]:
|
||||
group_tiles = []
|
||||
for i, row in enumerate(raw):
|
||||
row_at = f"{at}.tiles[{i}]"
|
||||
if not isinstance(row, dict):
|
||||
raise GuideError(f"{row_at}: expected a mapping")
|
||||
_unknown(row, _TILE_KEYS + _TILE_LOGO_KEYS, row_at)
|
||||
if row.get("logo") and not all(row.get(k) for k in _TILE_LOGO_KEYS):
|
||||
raise GuideError(f"{row_at}: a logo needs logo_owner and logo_licence")
|
||||
group_tiles.append(Tile(
|
||||
*(_text(row.get(k), f"{row_at}.{k}") for k in _TILE_KEYS),
|
||||
*(_text(row[k], f"{row_at}.{k}") if row.get(k) else "" for k in _TILE_LOGO_KEYS)))
|
||||
return tuple(group_tiles)
|
||||
|
||||
|
||||
def load_guides(path: Path = GUIDES_FILE, registry: dict | None = None) -> dict:
|
||||
"""The guides file, checked against the registry.
|
||||
|
||||
Every registered platform has a guide and a device group the file
|
||||
describes. A mistake raises GuideError naming the key, so the site is
|
||||
never built from half a guide.
|
||||
"""
|
||||
yaml = require_yaml()
|
||||
if registry is None:
|
||||
with open(PLATFORMS_DIR / "_registry.yml", encoding="utf-8") as handle:
|
||||
registry = (yaml.safe_load(handle) or {}).get("platforms", {})
|
||||
with open(path, encoding="utf-8") as handle:
|
||||
data = yaml.safe_load(handle) or {}
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{path.name}: expected a mapping")
|
||||
_unknown(data, _TOP_KEYS, path.name)
|
||||
|
||||
terminals = _terminals(data.get("terminals") or {}, path.name)
|
||||
raw_guides = data.get("guides") or {}
|
||||
groups: dict[str, tuple[str, str]] = {}
|
||||
anchors: dict[str, str] = {}
|
||||
also_runs: dict[str, tuple[tuple[str, str, str, str, str], ...]] = {}
|
||||
tiles: dict[str, tuple[Tile, ...]] = {}
|
||||
for key, entry in (data.get("device_groups") or {}).items():
|
||||
at = f"{path.name}: device_groups.{key}"
|
||||
if not isinstance(entry, dict):
|
||||
raise GuideError(f"{at}: expected a mapping")
|
||||
_unknown(entry, _GROUP_KEYS, at)
|
||||
groups[key] = (_text(entry.get("label"), f"{at}.label"),
|
||||
_text(entry.get("description"), f"{at}.description"))
|
||||
anchors[key] = _text(entry.get("anchor"), f"{at}.anchor")
|
||||
rows = _also_runs(entry.get("also_runs") or [], raw_guides, at)
|
||||
if rows:
|
||||
also_runs[key] = rows
|
||||
group_tiles = _group_tiles(entry.get("tiles") or [], at)
|
||||
if group_tiles:
|
||||
tiles[key] = group_tiles
|
||||
|
||||
unregistered = sorted(set(raw_guides) - set(registry))
|
||||
if unregistered:
|
||||
raise GuideError(f"{path.name}: guides for unregistered platforms: "
|
||||
f"{', '.join(unregistered)}")
|
||||
guides = {}
|
||||
for name, entry in registry.items():
|
||||
if name not in raw_guides:
|
||||
raise GuideError(f"{path.name}: {name} is registered and has no guide "
|
||||
f"(add guides.{name})")
|
||||
group = entry.get("device_group")
|
||||
if group not in groups:
|
||||
raise GuideError(f"_registry.yml: {name}.device_group {group!r} is not "
|
||||
f"one of {', '.join(groups)} in {path.name}")
|
||||
guides[name] = _guide(name, raw_guides[name], str(entry.get("extract_to") or ""),
|
||||
terminals)
|
||||
# The order the file is written in, which the pages do not depend on.
|
||||
guides = {name: guides[name] for name in raw_guides}
|
||||
return {
|
||||
"registry": registry,
|
||||
"install_base": _text(data.get("install_base"), f"{path.name}: install_base"),
|
||||
"trust_items": _texts(data.get("trust_items"), f"{path.name}: trust_items"),
|
||||
"device_groups": groups,
|
||||
"group_anchors": anchors,
|
||||
"also_runs": also_runs,
|
||||
"tiles": tiles,
|
||||
"terminals": terminals,
|
||||
"guides": guides,
|
||||
"handheld_guide": _handheld_guide(data.get("handheld_guide"), registry, guides,
|
||||
f"{path.name}: handheld_guide"),
|
||||
}
|
||||
|
||||
|
||||
_LOADED = load_guides()
|
||||
INSTALL_BASE: str = _LOADED["install_base"]
|
||||
# The bootstraps the site serves (sitebootstrap.py writes them).
|
||||
INSTALL_SH: str = f"{INSTALL_BASE}/{SH_NAME}"
|
||||
INSTALL_PS1: str = f"{INSTALL_BASE}/{PS1_NAME}"
|
||||
# The same installer from PyPI (scripts/build_pypi.py builds the package).
|
||||
PACKAGE_COMMAND = "uvx retrobios"
|
||||
DEVICE_GROUPS: dict[str, tuple[str, str]] = _LOADED["device_groups"]
|
||||
GROUP_ANCHORS: dict[str, str] = _LOADED["group_anchors"]
|
||||
ALSO_RUNS: dict[str, tuple[tuple[str, str, str, str, str], ...]] = _LOADED["also_runs"]
|
||||
GROUP_TILES: dict[str, tuple[Tile, ...]] = _LOADED["tiles"]
|
||||
HANDHELD_GUIDE: HandheldGuide | None = _LOADED["handheld_guide"]
|
||||
TERMINALS: dict[str, tuple[str, str, str]] = _LOADED["terminals"]
|
||||
TRUST_ITEMS: tuple[str, ...] = _LOADED["trust_items"]
|
||||
GUIDES: dict[str, Guide] = _LOADED["guides"]
|
||||
_REGISTRY: dict = _LOADED["registry"]
|
||||
|
||||
|
||||
def folder_list(name: str, registry: dict | None = None) -> list[tuple[str, str]]:
|
||||
"""Every folder a guide names, as (where, path): the common ones, the
|
||||
rarer builds, and the systems the registry detects when the guide says so."""
|
||||
guide = GUIDES[name]
|
||||
rows = [*guide.folders, *guide.more_folders]
|
||||
if guide.more_folders_detected:
|
||||
rows += [(system, f"`{folder}`")
|
||||
for system, folder in detected_systems(registry or _REGISTRY, name)]
|
||||
return rows
|
||||
|
||||
|
||||
def _plain_folders(name: str) -> str:
|
||||
rows = folder_list(name)
|
||||
width = max(len(where) for where, _path in rows) + 1
|
||||
return "\n".join(f"{where + ':':<{width}} {path.replace('`', '')}" for where, path in rows)
|
||||
|
||||
|
||||
def setup_count() -> int:
|
||||
"""Setups the site covers: every registered platform, since each keeps
|
||||
its page, its pack and its command. The one count every page states."""
|
||||
return len(GUIDES)
|
||||
|
||||
|
||||
def pack_manual(name: str) -> str:
|
||||
"""The manual part of a pack README, indented as the README is, or empty."""
|
||||
guide = GUIDES.get(name)
|
||||
if not guide or not guide.pack_manual:
|
||||
return ""
|
||||
text = guide.pack_manual.rstrip("\n")
|
||||
if "{folders}" in text:
|
||||
indent = next(line[: len(line) - len(line.lstrip())]
|
||||
for line in text.splitlines() if "{folders}" in line)
|
||||
text = text.replace("{folders}", textwrap.indent(_plain_folders(name), indent).lstrip())
|
||||
return textwrap.indent(text, " ") + "\n\n"
|
||||
|
||||
|
||||
def install_command(shell: str, args: str = "") -> str:
|
||||
"""The one-liner for a shell, with installer options when given.
|
||||
|
||||
PowerShell passes options only through a scriptblock: `irm ... | iex`
|
||||
takes none.
|
||||
"""
|
||||
if shell == "sh":
|
||||
return f"curl -fsSL {INSTALL_SH} | sh" + (f" -s -- {args}" if args else "")
|
||||
if args:
|
||||
return f"&([scriptblock]::Create((irm {INSTALL_PS1}))) {args}"
|
||||
return f"irm {INSTALL_PS1} | iex"
|
||||
File renamed without changes.
@@ -0,0 +1,705 @@
|
||||
"""The name a person reads for each system, and the console sections that give it."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from model import siteinputs
|
||||
from model.collection import SECTION_LABELS, _PROGRAM_TOPS, _manufacturer_slug
|
||||
|
||||
|
||||
# (manufacturer slug, console) -> the id of the console's heading. Two
|
||||
# folders spelled alike (Sega's "Mega CD" and "Mega-CD") share a slug, and
|
||||
# the second heading took "mega-cd_1" while every link said "mega-cd".
|
||||
_console_anchors: dict[tuple[str, str], str] = {}
|
||||
|
||||
|
||||
_boards_built = [False]
|
||||
|
||||
|
||||
# Every (manufacturer, console) section the system pages carry.
|
||||
_section_pairs: set[tuple[str, str]] = set()
|
||||
# Normalized id -> the console sections spelled that way.
|
||||
_console_sections: dict[str, set[tuple[str, str]]] = {}
|
||||
# A console section by the name its heading reads (Bandai WonderSwan).
|
||||
_sections_by_name: dict[str, set[tuple[str, str]]] = {}
|
||||
# Emulator and engine names. A heading spelled like one (Game Engines >
|
||||
# Solarus, ZC > ZC210) files that program's copies and names no system.
|
||||
_program_names: set[str] = set()
|
||||
|
||||
|
||||
def program_names(profiles: dict[str, dict]) -> set[str]:
|
||||
"""Every name an emulator profile goes by: its key, its emulator and
|
||||
display names."""
|
||||
names = {str(key) for key in profiles}
|
||||
for profile in profiles.values():
|
||||
names.update(
|
||||
str(profile[field]) for field in ("emulator", "display_name")
|
||||
if profile.get(field)
|
||||
)
|
||||
return names
|
||||
|
||||
|
||||
def set_console_sections(
|
||||
sections: dict[str, dict] | set[tuple[str, str]],
|
||||
programs: set[str] | frozenset[str] = frozenset(),
|
||||
) -> None:
|
||||
"""Install the console sections the system pages carry.
|
||||
|
||||
``sections`` maps each manufacturer to its consoles, as the system pages
|
||||
group them, or is a set of (manufacturer, console) pairs. ``programs``
|
||||
are the emulator names, which never name a system.
|
||||
"""
|
||||
from model.systems import _norm_system_id
|
||||
|
||||
pairs = (
|
||||
{(mfr, console) for mfr, consoles in sections.items() for console in consoles}
|
||||
if isinstance(sections, dict) else set(sections)
|
||||
)
|
||||
# A reviewed parent under a maker the pages carry is a section even with
|
||||
# no folder of its own: the Atom's sets sit under bios/Arcade, and the
|
||||
# system pages file them under Acorn (generate_site.arcade_board_sections).
|
||||
makers = {mfr for mfr, _console in pairs}
|
||||
pairs |= {parent for parent in SYSTEM_PARENTS.values()
|
||||
if parent[0] in makers and parent[0] not in _PROGRAM_TOPS}
|
||||
from core.anchors import _unique, toc_slug
|
||||
|
||||
_console_sections.clear()
|
||||
_sections_by_name.clear()
|
||||
_console_anchors.clear()
|
||||
_section_pairs.clear()
|
||||
_section_pairs.update(pairs)
|
||||
by_maker: dict[str, list[str]] = {}
|
||||
for mfr, console in pairs:
|
||||
by_maker.setdefault(mfr, []).append(console)
|
||||
for name in {_heading_name(mfr, console).casefold(), console.casefold()}:
|
||||
_sections_by_name.setdefault(name, set()).add((mfr, console))
|
||||
# In the order the page lists them, after the page title's own id.
|
||||
for mfr, consoles in by_maker.items():
|
||||
used = {toc_slug(mfr)}
|
||||
for console in sorted(consoles):
|
||||
_console_anchors[(_manufacturer_slug(mfr), console)] = _unique(toc_slug(console), used)
|
||||
for mfr, console in pairs:
|
||||
spelled = console.lower().replace(" ", "-")
|
||||
slug = mfr.lower().replace(" ", "-")
|
||||
for key in {_norm_system_id(f"{slug}-{spelled}"), _norm_system_id(spelled)}:
|
||||
_console_sections.setdefault(key, set()).add((mfr, console))
|
||||
_program_names.clear()
|
||||
_program_names.update(name.casefold() for name in programs)
|
||||
_sections_installed[0] = True
|
||||
# Which ids are boards depends on which have a section elsewhere.
|
||||
_boards_built[0] = False
|
||||
|
||||
|
||||
_sections_installed = [False]
|
||||
|
||||
|
||||
def _ensure_console_sections() -> None:
|
||||
"""Read the sections from the repository when no generator installed
|
||||
them, so a page rendered on its own names systems as the site does."""
|
||||
if _sections_installed[0]:
|
||||
return
|
||||
import json
|
||||
|
||||
from model.profiles import load_emulator_profiles
|
||||
from model.collection import _group_by_manufacturer
|
||||
|
||||
inputs = siteinputs.current()
|
||||
with open(inputs.db, encoding="utf-8") as handle:
|
||||
db = json.load(handle)
|
||||
profiles = load_emulator_profiles(str(inputs.emulators), skip_aliases=False)
|
||||
set_console_sections(_group_by_manufacturer(db), program_names(profiles))
|
||||
|
||||
|
||||
def _own_section(sys_id: str) -> tuple[str, str] | None:
|
||||
"""The console section that is this id's own, or None.
|
||||
|
||||
Of two sections spelled alike (Atari and Camputers both file a Lynx),
|
||||
the one under the maker the id names is kept. Two left is no answer,
|
||||
and neither is a section that files a program's copies.
|
||||
"""
|
||||
from model.systems import _norm_system_id
|
||||
|
||||
_ensure_console_sections()
|
||||
places = _console_sections.get(_norm_system_id(sys_id), set())
|
||||
if len(places) > 1:
|
||||
places = {
|
||||
(mfr, console) for mfr, console in places
|
||||
if sys_id.lower().startswith(mfr.lower().replace(" ", "-") + "-")
|
||||
}
|
||||
if len(places) != 1:
|
||||
return None
|
||||
mfr, console = next(iter(places))
|
||||
# A folder under a program's top, named like its own page (Dinothawr) or
|
||||
# like an emulator holds a program's files, not a system's.
|
||||
if (
|
||||
mfr in _PROGRAM_TOPS
|
||||
or console.casefold() == mfr.casefold()
|
||||
or _heading_name(mfr, console).casefold() in _program_names
|
||||
):
|
||||
return None
|
||||
return mfr, console
|
||||
|
||||
|
||||
def _heading_name(mfr: str, console: str) -> str:
|
||||
"""A console heading read out of its page: the maker in front, unless
|
||||
the heading already starts with it or the page is a game publisher's."""
|
||||
from model.composition import GAME_DATA_TOPS
|
||||
|
||||
if mfr in GAME_DATA_TOPS:
|
||||
return SECTION_LABELS.get((mfr, console), console)
|
||||
if console.casefold().startswith(mfr.split()[0].casefold()):
|
||||
return console
|
||||
return f"{mfr} {console}"
|
||||
|
||||
|
||||
def system_name(sys_id: str) -> str:
|
||||
"""The display name of a system id, the only one a page prints."""
|
||||
sys_id = str(sys_id)
|
||||
section = _own_section(sys_id)
|
||||
if section is not None:
|
||||
return _heading_name(*section)
|
||||
name = SYSTEM_NAMES.get(sys_id)
|
||||
if name is None:
|
||||
raise KeyError(
|
||||
f"system {sys_id!r} has no console section of its own and no "
|
||||
"entry in siterender.SYSTEM_NAMES"
|
||||
)
|
||||
return name
|
||||
|
||||
|
||||
# Systems without a console section of their own.
|
||||
SYSTEM_NAMES: dict[str, str] = {
|
||||
"2ship": "The Legend of Zelda: Majora's Mask",
|
||||
"aarch64": "ARM 64-bit (AArch64)",
|
||||
"acclaim-zn1": "Acclaim ZN-1",
|
||||
"adrift": "ADRIFT",
|
||||
"advsys": "AdvSys",
|
||||
"ags": "Adventure Game Studio games",
|
||||
"agt": "Adventure Game Toolkit",
|
||||
"alan": "Alan",
|
||||
"alg-laserdisc": "American Laser Games laserdisc",
|
||||
"allied-leisure-pinball": "Allied Leisure pinball",
|
||||
"alpha": "DEC Alpha",
|
||||
"andamiro-pumpitup": "Andamiro Pump It Up",
|
||||
"apf-m1000": "APF M-1000",
|
||||
"apfm1000": "APF M-1000",
|
||||
"apple-iie": "Apple IIe",
|
||||
"apple-ios": "Apple iOS",
|
||||
"apple2": "Apple II",
|
||||
"arcade": "Arcade games",
|
||||
"arcade-laserdisc": "Laserdisc arcade games",
|
||||
"arcadia-systems": "Arcadia Systems Multi Select",
|
||||
"arduboy": "Arduboy",
|
||||
"aristocrat-mk5": "Aristocrat MK5",
|
||||
"aristocrat-mk6": "Aristocrat MK6",
|
||||
"aristocrat-mk7": "Aristocrat MK7",
|
||||
"arm": "ARM",
|
||||
"atari-falcon": "Atari Falcon",
|
||||
"atari-jaguarcd": "Atari Jaguar CD",
|
||||
"atari-ste": "Atari STE",
|
||||
"atari-system1": "Atari System 1",
|
||||
"atari-tt": "Atari TT",
|
||||
"atari-zn1": "Atari ZN-1",
|
||||
"atlus-zn1": "Atlus ZN-1",
|
||||
"bandai-playdia": "Bandai Playdia",
|
||||
"bandai-wswanc": "Bandai WonderSwan Color",
|
||||
"barcrest-mpu4": "Barcrest MPU4",
|
||||
"bbc-master-128": "Acorn BBC Master 128",
|
||||
"bbc-master-compact": "Acorn BBC Master Compact",
|
||||
"bbc-master-et": "Acorn BBC Master ET",
|
||||
"bbc-micro-b": "Acorn BBC Micro Model B",
|
||||
"bbc-micro-bplus": "Acorn BBC Micro Model B+",
|
||||
"bbk-longman-4980": "BBK Longman A4980",
|
||||
"bbk-longman-4988": "BBK Longman A4988",
|
||||
"bennugd": "BennuGD games",
|
||||
"bermuda-syndrome": "Bermuda Syndrome game",
|
||||
"brezzasoft-crystal": "BrezzaSoft Crystal System",
|
||||
"bshift": "Half-Life: Blue Shift",
|
||||
"caesar3": "Caesar III",
|
||||
"cambridge-z88": "Cambridge Computer Z88",
|
||||
"camplynx": "Camputers Lynx",
|
||||
"capcom-cps1": "Capcom CPS-1",
|
||||
"capcom-cps2": "Capcom CPS-2",
|
||||
"capcom-cps3": "Capcom CPS-3",
|
||||
"capcom-zn1": "Capcom ZN-1",
|
||||
"capcom-zn2": "Capcom ZN-2",
|
||||
"casio-pv1000": "Casio PV-1000",
|
||||
"catacomb-3d": "Catacomb 3-D",
|
||||
"catacomb-adventure": "Catacomb Adventure Series",
|
||||
"cave-cv1000": "Cave CV1000",
|
||||
"cave-story": "Cave Story",
|
||||
"cavestory": "Cave Story",
|
||||
"celeste-classic": "Celeste Classic",
|
||||
"century-cvs": "Century CVS",
|
||||
"ces-galaxy-games": "CES Galaxy Games",
|
||||
"cgenie": "EACA Colour Genie",
|
||||
"chex": "Chex Quest",
|
||||
"chip8": "CHIP-8",
|
||||
"coco3": "Tandy Color Computer 3",
|
||||
"commanderx16": "Commander X16",
|
||||
"commodore-c64-supercpu": "Commodore 64 with SuperCPU",
|
||||
"commodore-cd32": "Commodore Amiga CD32",
|
||||
"commodore-cdtv": "Commodore CDTV",
|
||||
"commodore-cubo": "CD Express Cubo CD32",
|
||||
"coolbar": "Coolbar feature phones",
|
||||
"cstrike": "Counter-Strike",
|
||||
"ctf": "Quake II: Capture the Flag",
|
||||
"czero": "Counter-Strike: Condition Zero",
|
||||
"czeror": "Counter-Strike: Condition Zero Deleted Scenes",
|
||||
"dark-forces": "Star Wars: Dark Forces",
|
||||
"dark-forces-ii": "Star Wars Jedi Knight: Dark Forces II",
|
||||
"deco-cassette": "Data East DECO Cassette System",
|
||||
"descent2": "Descent II",
|
||||
"dingoo-a320": "Dingoo A320",
|
||||
"dinothawr": "Dinothawr game",
|
||||
"discrete-arcade": "Discrete logic arcade games",
|
||||
"dmc": "Deathmatch Classic",
|
||||
"doom3-bfg": "Doom 3: BFG Edition",
|
||||
"dos": "MS-DOS",
|
||||
"dragon32": "Dragon 32",
|
||||
"dragon64": "Dragon 64",
|
||||
"droidworks": "Star Wars: DroidWorks",
|
||||
"duke-nukem-2": "Duke Nukem II",
|
||||
"duke3d": "Duke Nukem 3D",
|
||||
"dusklight": "The Legend of Zelda: Twilight Princess",
|
||||
"efo-cedar-magnet": "EFO Cedar Magnet System",
|
||||
"eighting-zn1": "Eighting ZN-1",
|
||||
"elektor-tv-games-computer": "Elektor TV Games Computer",
|
||||
"emerson-arcadia-2001": "Emerson Arcadia 2001",
|
||||
"enemy-territory-quake-wars": "Enemy Territory: Quake Wars",
|
||||
"enemyterritory": "Wolfenstein: Enemy Territory",
|
||||
"enterprise-128": "Enterprise 128",
|
||||
"enterprise-64": "Enterprise 64",
|
||||
"entex-advision": "Entex Adventure Vision",
|
||||
"epoch-scv": "Epoch Super Cassette Vision",
|
||||
"epochcv": "Epoch Cassette Vision",
|
||||
"eternal-computer": "Eternal Software Initiative computer",
|
||||
"exelvision-exl100": "Exelvision EXL 100",
|
||||
"exhumed": "PowerSlave",
|
||||
"exidy-maxaflex": "Exidy Max-A-Flex",
|
||||
"fallout": "Fallout",
|
||||
"flash": "Adobe Flash",
|
||||
"flashback": "Flashback",
|
||||
"fm77av": "Fujitsu FM77AV",
|
||||
"fpinball": "Future Pinball tables",
|
||||
"fruitmachine": "Fruit machines",
|
||||
"fury": "Ion Fury game",
|
||||
"gaelco-powervr": "Gaelco PowerVR boards",
|
||||
"galaksija": "Galaksija computer",
|
||||
"game": "Picross puzzle (libretro sample)",
|
||||
"gamecom": "Tiger Game.com",
|
||||
"gamemaker": "GameMaker games",
|
||||
"gameplan-mpu1": "Game Plan MPU-1",
|
||||
"gamepock": "Epoch Game Pocket Computer",
|
||||
"gametank": "GameTank console",
|
||||
"gearbox": "Half-Life: Opposing Force",
|
||||
"ghostship": "Super Mario 64",
|
||||
"glulx": "Glulx",
|
||||
"gottlieb-system1": "Gottlieb System 1",
|
||||
"half-life-2": "Half-Life 2",
|
||||
"handheld-electronic": "Nintendo Game & Watch",
|
||||
"heart-of-darkness": "Heart of Darkness",
|
||||
"heretic": "Heretic",
|
||||
"heroes-of-might-and-magic-2": "Heroes of Might and Magic II",
|
||||
"hexen": "Hexen",
|
||||
"hexen2": "Hexen II",
|
||||
"hugo": "Hugo",
|
||||
"hyper-neogeo64": "SNK Hyper Neo Geo 64",
|
||||
"ibm-at": "IBM PC/AT",
|
||||
"ibm-pcjr": "IBM PCjr",
|
||||
"ibm-ps1": "IBM PS/1",
|
||||
"ibm-xt": "IBM PC XT",
|
||||
"icarus-starship-command-simulator": "Icarus Starship Command Simulator",
|
||||
"igs-pgm": "IGS PolyGame Master",
|
||||
"imax-macs": "I'Max MACS",
|
||||
"interact": "Interact Home Computer",
|
||||
"interton-vc4000": "Interton VC 4000",
|
||||
"itech-eagle": "Incredible Technologies Eagle",
|
||||
"jacl": "JACL",
|
||||
"jedi-academy": "Star Wars Jedi Knight: Jedi Academy",
|
||||
"jedi-outcast": "Star Wars Jedi Knight II: Jedi Outcast",
|
||||
"jediacademy": "Star Wars Jedi Knight: Jedi Academy",
|
||||
"jediknight2": "Star Wars Jedi Knight II: Jedi Outcast",
|
||||
"jupiter-ace": "Jupiter Cantab Jupiter Ace",
|
||||
"konami-bubble-system": "Konami Bubble System",
|
||||
"konami-bubblesystem": "Konami Bubble System",
|
||||
"konami-bubsys": "Konami Bubble System",
|
||||
"konami-endeavour": "Konami Endeavour",
|
||||
"konami-gq": "Konami GQ",
|
||||
"konami-gv": "Konami GV",
|
||||
"konami-gx": "Konami GX",
|
||||
"konami-python": "Konami Python",
|
||||
"konami-python2": "Konami Python 2",
|
||||
"konami-twinkle": "Konami Twinkle",
|
||||
"konami-viper": "Konami Viper",
|
||||
"lambda-8300": "Lambda 8300",
|
||||
"laserdisc-arcade": "Laserdisc arcade games",
|
||||
"level9": "Level 9",
|
||||
"lowresnx": "LowRes NX programs",
|
||||
"lynx": "Atari Lynx",
|
||||
"m68k": "Motorola 68000",
|
||||
"magnetic-scrolls": "Magnetic Scrolls",
|
||||
"marty": "Fujitsu FM Towns Marty",
|
||||
"mega-cd-32x": "Sega Mega-CD 32X",
|
||||
"mega-duck": "Welback Mega Duck",
|
||||
"mega-ld": "Sega Mega LD",
|
||||
"microdigital-tk85": "Microdigital TK85",
|
||||
"microsoft-msx2": "MSX2",
|
||||
"midway-mcr": "Midway MCR",
|
||||
"mips": "MIPS",
|
||||
"mips64": "MIPS64",
|
||||
"miuchiz": "Miuchiz",
|
||||
"mohaa": "Medal of Honor: Allied Assault",
|
||||
"mohaa-breakthrough": "Medal of Honor: Allied Assault Breakthrough",
|
||||
"mohaa-spearhead": "Medal of Honor: Allied Assault Spearhead",
|
||||
"msx1": "MSX",
|
||||
"msx2": "MSX2",
|
||||
"msx2+": "MSX2+",
|
||||
"msx2plus": "MSX2+",
|
||||
"msxturboR": "MSX turbo R",
|
||||
"msxturbor": "MSX turbo R",
|
||||
"mysteries-of-the-sith": "Star Wars Jedi Knight: Mysteries of the Sith",
|
||||
"myvision": "Nichibutsu My Vision",
|
||||
"mz2000": "Sharp MZ-2000",
|
||||
"mz2500": "Sharp MZ-2500",
|
||||
"mz700": "Sharp MZ-700",
|
||||
"mz800": "Sharp MZ-800",
|
||||
"mz80k": "Sharp MZ-80K",
|
||||
"nam": "NAM",
|
||||
"namco-na1": "Namco NA-1",
|
||||
"namco-nb1": "Namco NB-1",
|
||||
"namco-system11": "Namco System 11",
|
||||
"namco-system246": "Namco System 246",
|
||||
"namco-system256": "Namco System 256",
|
||||
"namco-system357": "Namco System 357",
|
||||
"namco-system573": "Konami System 573",
|
||||
"naomi2": "Sega NAOMI 2",
|
||||
"napalm": "NAPALM",
|
||||
"nec-pc-80": "NEC PC-8001",
|
||||
"nec-supergrafx": "NEC SuperGrafx",
|
||||
"neogeo64": "SNK Hyper Neo Geo 64",
|
||||
"ngpc": "SNK Neo Geo Pocket Color",
|
||||
"nichibutsu-hrdvd": "Nichibutsu High Rate DVD",
|
||||
"nintendo-aleck64": "Nintendo Aleck64",
|
||||
"nintendo-gb": "Nintendo Game Boy",
|
||||
"nintendo-gbc": "Nintendo Game Boy Color",
|
||||
"nintendo-nss": "Nintendo Super System",
|
||||
"nintendo-playch10": "Nintendo PlayChoice-10",
|
||||
"nintendo-sfcbox": "Nintendo Super Famicom Box",
|
||||
"nintendo-virtualboy": "Nintendo Virtual Boy",
|
||||
"nintendo-wii-arcade": "Nintendo Wii arcade boards",
|
||||
"nmk16": "NMK16",
|
||||
"oberon": "Project Oberon",
|
||||
"olivetti-pc128": "Olivetti Prodest PC 128",
|
||||
"omicron": "Omicron cartridges",
|
||||
"onscripter": "ONScripter visual novels",
|
||||
"openbor": "OpenBOR games",
|
||||
"opengoal": "Jak and Daxter",
|
||||
"oricatmos": "Oric Atmos",
|
||||
"outlaws": "Outlaws",
|
||||
"palm-os": "Palm OS",
|
||||
"pc-engine-ld": "NEC PC Engine LD-ROM2",
|
||||
"pc60": "NEC PC-6001",
|
||||
"pc80": "NEC PC-8001",
|
||||
"pce-tourvision": "TourVision",
|
||||
"pdark": "Perfect Dark",
|
||||
"pegasus": "Aamber Pegasus",
|
||||
"philips-p2000t": "Philips P2000T",
|
||||
"philips-vg5k": "Philips VG 5000",
|
||||
"picocomputer-6502": "Picocomputer 6502 programs",
|
||||
"pocket-challenge-v2": "Benesse Pocket Challenge V2",
|
||||
"powerslave": "PowerSlave",
|
||||
"ppc": "PowerPC",
|
||||
"ppc64": "PowerPC 64-bit",
|
||||
"prey": "Prey",
|
||||
"prince-of-persia": "Prince of Persia",
|
||||
"ps4": "Sony PlayStation 4",
|
||||
"pv1000": "Casio PV-1000",
|
||||
"quadrilateral-cowboy": "Quadrilateral Cowboy",
|
||||
"quake2": "Quake II",
|
||||
"quake3": "Quake III Arena",
|
||||
"quake4": "Quake 4",
|
||||
"realrtcw": "Return to Castle Wolfenstein (RealRTCW)",
|
||||
"recel-system3": "Recel System III",
|
||||
"redneck": "Redneck Rampage",
|
||||
"ricochet": "Ricochet",
|
||||
"ringo-r470": "Ringo R470",
|
||||
"riscv": "RISC-V",
|
||||
"riscv32": "RISC-V 32-bit",
|
||||
"riscv64": "RISC-V 64-bit",
|
||||
"rogue": "Quake II: Ground Zero",
|
||||
"rott": "Rise of the Triad",
|
||||
"rpgmaker": "RPG Maker games",
|
||||
"s390x": "IBM z/Architecture (s390x)",
|
||||
"sam-coupe": "MGT SAM Coupe",
|
||||
"sammy-atomiswave": "Sammy Atomiswave",
|
||||
"sammy-medal": "Sammy medal games",
|
||||
"science-of-cambridge-mk14": "Science of Cambridge MK14",
|
||||
"scott-adams": "Scott Adams adventures",
|
||||
"scott-adams-plus": "Scott Adams Plus adventures",
|
||||
"scummvm": "ScummVM games",
|
||||
"scv": "Epoch Super Cassette Vision",
|
||||
"sdlpal": "The Legend of Sword and Fairy",
|
||||
"sega-atomiswave": "Sammy Atomiswave",
|
||||
"sega-dreamcast-arcade": "Sega Dreamcast-based arcade boards",
|
||||
"sega-isgsm": "Sega ISG Selection Master",
|
||||
"sega-megaplay": "Sega Mega Play",
|
||||
"sega-megatech": "Sega Mega-Tech",
|
||||
"sega-model1": "Sega Model 1",
|
||||
"sega-naomi": "Sega NAOMI",
|
||||
"sega-naomi2": "Sega NAOMI 2",
|
||||
"sega-naomigd": "Sega NAOMI GD-ROM",
|
||||
"sega-outrun": "OutRun",
|
||||
"sega-pico": "Sega Pico",
|
||||
"sega-sg1000": "Sega SG-1000",
|
||||
"sega-shootingzone": "Sega Shooting Zone",
|
||||
"sega-system-sp": "Sega System SP",
|
||||
"sega-system16b": "Sega System 16B",
|
||||
"sega-systemsp": "Sega System SP",
|
||||
"sega-vmu": "Sega Dreamcast VMU",
|
||||
"serious-sam": "Serious Sam",
|
||||
"sg-1000": "Sega SG-1000",
|
||||
"sielectronics-y2": "SiElectronics System Y2",
|
||||
"sinclair-ql": "Sinclair QL",
|
||||
"sinclair-zx-spectrum-next": "ZX Spectrum Next",
|
||||
"sinclair-zx80-81": "Sinclair ZX80 and ZX81",
|
||||
"skin-deep": "Skin Deep",
|
||||
"smbx": "Super Mario Bros. X",
|
||||
"snk-neogeo-aes": "SNK Neo Geo AES",
|
||||
"snk-neogeo-mvs": "SNK Neo Geo MVS",
|
||||
"snk-neogeo": "SNK Neo Geo",
|
||||
"neogeo": "SNK Neo Geo",
|
||||
"snk-ngpc": "SNK Neo Geo Pocket Color",
|
||||
"soh": "The Legend of Zelda: Ocarina of Time",
|
||||
"sonic-1-2013": "Sonic the Hedgehog (2013)",
|
||||
"sonic-2-2013": "Sonic the Hedgehog 2 (2013)",
|
||||
"sonic-mania": "Sonic Mania",
|
||||
"soniccd": "Sonic CD",
|
||||
"sony-psp": "Sony PlayStation Portable",
|
||||
"sparc": "SPARC",
|
||||
"sparc64": "SPARC64",
|
||||
"spectravideo": "Spectravideo",
|
||||
"star-control-2": "Star Control II",
|
||||
"starship": "Star Fox 64",
|
||||
"strife": "Strife",
|
||||
"sunplus-native32": "Sunplus Native32",
|
||||
"sunplus-spmp8000": "Sunplus SPMP8000",
|
||||
"super-kaneko-nova": "Kaneko Super Nova System",
|
||||
"super-mario-war": "Super Mario War game",
|
||||
"superacan": "Funtech Super A'Can",
|
||||
"supergrafx": "NEC SuperGrafx",
|
||||
"supergrafx-cd": "NEC SuperGrafx CD",
|
||||
"solarus": "Solarus games",
|
||||
"supertux": "SuperTux game",
|
||||
"supertuxkart": "SuperTuxKart game",
|
||||
"supracan": "Funtech Super A'Can",
|
||||
"symbian": "Symbian OS",
|
||||
"tab-silverball": "TAB Austria Silverball",
|
||||
"tads": "TADS",
|
||||
"taito-cchip": "Taito C-Chip",
|
||||
"taito-fx1": "Taito FX-1",
|
||||
"taito-gnet": "Taito G-NET",
|
||||
"taito-type-x": "Taito Type X",
|
||||
"taito-typezero": "Taito Type Zero",
|
||||
"tamagotchi-p1": "Bandai Tamagotchi P1",
|
||||
"tandy-1000": "Tandy 1000",
|
||||
"taylormade": "TaylorMade",
|
||||
"teamarena": "Quake III: Team Arena",
|
||||
"tecmo-tps": "Tecmo TPS",
|
||||
"tfc": "Team Fortress Classic",
|
||||
"the-dark-mod": "The Dark Mod",
|
||||
"thomson-mo6": "Thomson MO6",
|
||||
"thomson-to7": "Thomson TO7",
|
||||
"thomson-to770": "Thomson TO7/70",
|
||||
"thomson-to8": "Thomson TO8",
|
||||
"thomson-to8d": "Thomson TO8D",
|
||||
"thomson-to9": "Thomson TO9",
|
||||
"thomson-to9plus": "Thomson TO9+",
|
||||
"tic80": "TIC-80 cartridges",
|
||||
"tiger-game-com": "Tiger Game.com",
|
||||
"timex-tc2048": "Timex Computer 2048",
|
||||
"timex-ts1500": "Timex Sinclair 1500",
|
||||
"timex-ts2068": "Timex Sinclair 2068",
|
||||
"tomb-raider": "Tomb Raider",
|
||||
"tomb-raider-1": "Tomb Raider",
|
||||
"tomb-raider-2": "Tomb Raider II",
|
||||
"transport-tycoon-deluxe": "Transport Tycoon Deluxe",
|
||||
"tvgames": "Plug-and-play TV games",
|
||||
"tyrian": "Tyrian",
|
||||
"ur-quan-masters": "Star Control II",
|
||||
"urban-terror": "Urban Terror",
|
||||
"uzebox": "Uzebox",
|
||||
"vaporspec": "VaporSpec cartridges",
|
||||
"vc4000": "Interton VC 4000",
|
||||
"vg5k": "Philips VG 5000",
|
||||
"vgmplay": "Video game music files",
|
||||
"videobrain": "Umtech VideoBrain",
|
||||
"videosystem-zn1": "Video System ZN-1",
|
||||
"vircon32": "Vircon32 cartridges",
|
||||
"virtuality-su2000": "Virtuality SU2000",
|
||||
"vm-labs-nuon": "VM Labs Nuon",
|
||||
"vpinball": "Visual Pinball tables",
|
||||
"vtech-vsmile": "VTech V.Smile",
|
||||
"vvvvvv": "VVVVVV game",
|
||||
"watara-supervision": "Watara Supervision",
|
||||
"wonderswan-color": "Bandai WonderSwan Color",
|
||||
"ww2gi": "World War II GI",
|
||||
"x86": "x86 PC",
|
||||
"x86-64": "x86-64 PC",
|
||||
"xatrix": "Quake II: The Reckoning",
|
||||
"xrick": "Rick Dangerous",
|
||||
"ym2608": "Yamaha YM2608",
|
||||
"zc210": "Zelda Classic",
|
||||
"zeldaclassic": "Zelda Classic",
|
||||
"zn1-acclaim": "Acclaim ZN-1",
|
||||
"zn1-atlus": "Atlus ZN-1",
|
||||
"zn1-capcom": "Capcom ZN-1",
|
||||
# mame2003 files taitofx1.zip and tps.zip under these ids, its notes
|
||||
# name the boards: the Taito FX-1 and the Tecmo TPS, both ZN-1 based.
|
||||
"zn1-taito": "Taito FX-1",
|
||||
"zn1-tecmo": "Tecmo TPS",
|
||||
"zn1-video-system": "Video System ZN-1",
|
||||
"zn2-capcom": "Capcom ZN-2",
|
||||
"zx-spectrum-128": "Sinclair ZX Spectrum 128",
|
||||
}
|
||||
|
||||
|
||||
# A system id with no section of its own -> the (manufacturer, console)
|
||||
# section holding its files: a model, a regional name or an add-on of the
|
||||
# machine that section covers, or a game whose data that section files.
|
||||
# Reviewed entry by entry against the files the profiles and platforms
|
||||
# declare for the id, never decided by a vote of the folders those files
|
||||
# sit in. A section that is not the machine stays out of this table even
|
||||
# when it holds a copy: NAOMI's naomi2.zip filed with the Dreamcast, the
|
||||
# PET's ROMs in VICE's tree under the C128, the Arcadia's under the Saturn.
|
||||
SYSTEM_PARENTS: dict[str, tuple[str, str]] = {
|
||||
# Nintendo. The twin folders (DS and Nintendo DS, 64DD and Nintendo
|
||||
# 64DD) gave each name two headings and no link.
|
||||
"64dd": ("Nintendo", "Nintendo 64DD"),
|
||||
"nintendo-64dd": ("Nintendo", "Nintendo 64DD"),
|
||||
"nintendo-ds": ("Nintendo", "Nintendo DS"),
|
||||
"nintendo-dsi": ("Nintendo", "Nintendo DS"),
|
||||
"famicom": ("Nintendo", "NES"),
|
||||
"super-famicom": ("Nintendo", "SNES"),
|
||||
# Bandai: the Color boot ROMs, and those of Benesse's WonderSwan-based
|
||||
# Pocket Challenge V2, sit with the WonderSwan.
|
||||
"wonderswan-color": ("Bandai", "WonderSwan"),
|
||||
"bandai-wswanc": ("Bandai", "WonderSwan"),
|
||||
"pocket-challenge-v2": ("Bandai", "WonderSwan"),
|
||||
# SNK
|
||||
"ngpc": ("SNK", "Neo Geo Pocket"),
|
||||
"snk-ngpc": ("SNK", "Neo Geo Pocket"),
|
||||
"snk-neogeo-aes": ("SNK", "Neo Geo"),
|
||||
"snk-neogeo-mvs": ("SNK", "Neo Geo"),
|
||||
# The platforms' one Neo Geo system, as Batocera and RetroDECK spell it.
|
||||
"snk-neogeo": ("SNK", "Neo Geo"),
|
||||
"neogeo": ("SNK", "Neo Geo"),
|
||||
# Sega. The VMU is the Dreamcast's memory card, its images sit there.
|
||||
# Sega's arcade section holds the OutRun board ROMs Cannonball reads.
|
||||
"sega-genesis": ("Sega", "Mega Drive"),
|
||||
"mega-cd-32x": ("Sega", "Mega CD"),
|
||||
"sega-vmu": ("Sega", "Dreamcast"),
|
||||
"sega-outrun": ("Sega", "Arcade"),
|
||||
# NEC and Pioneer: both LaserActive packs (LD-ROM2 and Mega LD) file
|
||||
# their BIOS under the LaserActive.
|
||||
"nec-supergrafx": ("NEC", "PC Engine"),
|
||||
"supergrafx": ("NEC", "PC Engine"),
|
||||
"supergrafx-cd": ("NEC", "PC Engine CD"),
|
||||
"pc-engine-ld": ("Pioneer", "LaserActive"),
|
||||
"mega-ld": ("Pioneer", "LaserActive"),
|
||||
# Microsoft MSX generations
|
||||
"microsoft-msx2": ("Microsoft", "MSX"),
|
||||
"msx2": ("Microsoft", "MSX"),
|
||||
"msx2plus": ("Microsoft", "MSX"),
|
||||
"msx2+": ("Microsoft", "MSX"),
|
||||
"msxturboR": ("Microsoft", "MSX"),
|
||||
"msxturbor": ("Microsoft", "MSX"),
|
||||
# Sinclair: 128-0.rom and 128-1.rom, and Timex's tc2048.rom.
|
||||
"zx-spectrum-128": ("Sinclair", "ZX Spectrum"),
|
||||
"timex-tc2048": ("Sinclair", "ZX Spectrum"),
|
||||
# Acorn: os12.rom and basic2.rom for the Model B and B+, and the
|
||||
# Master Compact's bbcmc.zip.
|
||||
"bbc-micro-b": ("Acorn", "BBC Micro"),
|
||||
"bbc-micro-bplus": ("Acorn", "BBC Micro"),
|
||||
"bbc-master-compact": ("Acorn", "BBC Micro"),
|
||||
# Atari: falcon.img, ste.img and tt.img sit with the ST TOS images.
|
||||
"atari-ste": ("Atari", "ST"),
|
||||
"atari-tt": ("Atari", "ST"),
|
||||
"atari-falcon": ("Atari", "ST"),
|
||||
# Home computers filed under their family
|
||||
"apple-iie": ("Apple", "Apple II"),
|
||||
"apf-m1000": ("APF", "Imagination Machine"),
|
||||
"apfm1000": ("APF", "Imagination Machine"),
|
||||
"bbk-longman-4980": ("BBK", "A4980"),
|
||||
"bbk-longman-4988": ("BBK", "A4988"),
|
||||
"coco3": ("Tandy", "CoCo"),
|
||||
"commodore-cdtv": ("Commodore", "Amiga"),
|
||||
"dragon32": ("Dragon", "Dragon"),
|
||||
"dragon64": ("Dragon", "Dragon"),
|
||||
"enterprise-64": ("Enterprise", "64-128"),
|
||||
"enterprise-128": ("Enterprise", "64-128"),
|
||||
"fm77av": ("Fujitsu", "FM-7"),
|
||||
"gamepock": ("Epoch", "Game Pocket"),
|
||||
"ibm-pcjr": ("IBM", "PC"),
|
||||
"ibm-xt": ("IBM", "PC"),
|
||||
"marty": ("Fujitsu", "FM Towns"),
|
||||
"mz700": ("Sharp", "MZ"),
|
||||
"mz80k": ("Sharp", "MZ"),
|
||||
"mz800": ("Sharp", "MZ"),
|
||||
"oricatmos": ("Tangerine", "Oric"),
|
||||
"palm-os": ("Palm", "Palm"),
|
||||
"philips-vg5k": ("Philips", "VG5000"),
|
||||
"vg5k": ("Philips", "VG5000"),
|
||||
"videobrain": ("VideoBrain", "Family Computer"),
|
||||
# Computers whose sets sit under bios/Arcade with MAME's: the Atom has
|
||||
# no folder of its own, its section holds those sets. The MZ-2000 and
|
||||
# MZ-2500 sets join the MZ ones.
|
||||
"atom": ("Acorn", "Atom"),
|
||||
"mz2000": ("Sharp", "MZ"),
|
||||
"mz2500": ("Sharp", "MZ"),
|
||||
# Files kept at the maker's root, so each file is a heading of its own
|
||||
# on a page that is the machine's: the first one leads there.
|
||||
"galaksija": ("Galaksija", "Galaksija"),
|
||||
"vircon32": ("Vircon", "Vircon32"),
|
||||
# Games, filed with the game whose folder holds their data
|
||||
"dinothawr": ("Dinothawr", "Dinothawr"),
|
||||
"doom": ("Id Software", "Doom"),
|
||||
# The other games of the Doom engines keep their IWADs in its folder.
|
||||
"heretic": ("Id Software", "Doom"),
|
||||
"hexen": ("Id Software", "Doom"),
|
||||
"strife": ("Id Software", "Doom"),
|
||||
"chex": ("Id Software", "Doom"),
|
||||
"ctf": ("Id Software", "Quake II"),
|
||||
"teamarena": ("Id Software", "Quake III Arena"),
|
||||
"enemyterritory": ("Id Software", "Wolfenstein Enemy Territory"),
|
||||
"gearbox": ("Valve", "Half-Life"),
|
||||
"dmc": ("Valve", "Half-Life"),
|
||||
"ricochet": ("Valve", "Half-Life"),
|
||||
"tfc": ("Valve", "Half-Life"),
|
||||
"mohaa": ("Electronic Arts", "Medal of Honor Allied Assault"),
|
||||
"mohaa-breakthrough": ("Electronic Arts", "Medal of Honor Allied Assault"),
|
||||
"mohaa-spearhead": ("Electronic Arts", "Medal of Honor Allied Assault"),
|
||||
"ur-quan-masters": ("Toys for Bob", "The Ur-Quan Masters"),
|
||||
"star-control-2": ("Toys for Bob", "The Ur-Quan Masters"),
|
||||
# Systems whose files sit in the folder of the program that reads them,
|
||||
# the only section listing them. DOS and ScummVM also read the Roland
|
||||
# MT-32 ROMs, which their own sections do not hold.
|
||||
"bbc-master-128": ("Other", "beebem"),
|
||||
"bbc-master-et": ("Other", "beebem"),
|
||||
"cave-story": ("Other", "NXEngine"),
|
||||
"dos": ("DOS", "DOSBox"),
|
||||
"scummvm": ("ScummVM", "ScummVM"),
|
||||
"sinclair-zx-spectrum-next": ("Other", "cspect"),
|
||||
"solarus": ("Game Engines", "Solarus"),
|
||||
"sunplus-spmp8000": ("Other", "spmp8000emu"),
|
||||
"tomb-raider-1": ("Game Engines", "TRX"),
|
||||
"tyrian": ("Other", "opentyrian"),
|
||||
"vm-labs-nuon": ("Other", "nuance"),
|
||||
"xrick": ("Other", "xrick"),
|
||||
"zc210": ("ZC", "ZC210"),
|
||||
# The collection's general arcade section, where naomi.zip, neogeo.zip
|
||||
# and the other board sets sit. A sound chip's set and a toy's stay in
|
||||
# the Arcade folders holding them: neither is an arcade board.
|
||||
"arcade": ("Arcade", "Arcade"),
|
||||
"miuchiz": ("Arcade", "MAME"),
|
||||
"ym2608": ("Arcade", "Arcade"),
|
||||
}
|
||||
@@ -9,7 +9,7 @@ from typing import TYPE_CHECKING, TypedDict
|
||||
|
||||
from core.options import reject_unknown
|
||||
from model.region import label as region_label
|
||||
from siteguides import INSTALL_PS1, INSTALL_SH, pack_manual
|
||||
from model.guides import INSTALL_PS1, INSTALL_SH, pack_manual
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Unpack
|
||||
|
||||
@@ -32,7 +32,7 @@ def system_titles(*entry_lists: Iterable[dict]) -> dict[str, str]:
|
||||
and the installer shows its id: the site build refuses such a system,
|
||||
so only a test fixture reaches here with one.
|
||||
"""
|
||||
from siterender import system_name
|
||||
from model.systemnames import system_name
|
||||
|
||||
ids = {
|
||||
sys_id
|
||||
|
||||
@@ -42,7 +42,7 @@ from model.registry import (
|
||||
from model.platforms import load_platform_config
|
||||
from core.cli import require_directory
|
||||
from core.artifacts import write_text_atomic
|
||||
from siteguides import install_command
|
||||
from model.guides import install_command
|
||||
|
||||
REPO = "Abdess/retrobios"
|
||||
OWNER = "Abdess"
|
||||
|
||||
@@ -19,7 +19,7 @@ import json
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
from siteguides import PACKAGE_COMMAND
|
||||
from model.guides import PACKAGE_COMMAND
|
||||
|
||||
SITE = "https://abdess.github.io/retrobios/"
|
||||
PUBLISHER = "abdess.github.io"
|
||||
|
||||
@@ -22,10 +22,9 @@ import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from core.artifacts import write_if_changed
|
||||
from model.guides import PS1_NAME, SH_NAME
|
||||
|
||||
REPO_RAW = "https://raw.githubusercontent.com/Abdess/retrobios"
|
||||
SH_NAME = "i"
|
||||
PS1_NAME = "i.ps1"
|
||||
|
||||
# Served name: the bootstrap it copies and the one line naming the
|
||||
# installer's address there.
|
||||
|
||||
@@ -41,7 +41,7 @@ from xml.sax.saxutils import escape
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
import siteinputs
|
||||
from model import siteinputs
|
||||
import sitemarkup as markup
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
@@ -440,7 +440,7 @@ def _setups_in(platforms_dir: str) -> tuple[str, ...]:
|
||||
|
||||
def setups_named(named: list[str]) -> str:
|
||||
"""*named*, then how many other setups there are: "A, B and 15 more"."""
|
||||
from siteguides import setup_count
|
||||
from model.guides import setup_count
|
||||
|
||||
others = setup_count() - len(named)
|
||||
return ", ".join(named) + (f" and {others} more" if others else "")
|
||||
@@ -876,7 +876,7 @@ FENCE_TITLES = {"sh": "Terminal", "powershell": "PowerShell"}
|
||||
|
||||
def _installer_args(body: str) -> str:
|
||||
"""The options of a one-line install command, continuation lines joined."""
|
||||
from siteguides import INSTALL_SH
|
||||
from model.guides import INSTALL_SH
|
||||
|
||||
line = " ".join(part.strip().rstrip("\\").strip() for part in body.splitlines())
|
||||
match = re.fullmatch(rf"curl -fsSL {re.escape(INSTALL_SH)} \| sh(?: -s -- (.+))?", line)
|
||||
@@ -899,7 +899,7 @@ def expand_commands(markdown: str) -> str:
|
||||
gives a tab its own options, for a folder that differs there."""
|
||||
if "os-tabs" not in markdown:
|
||||
return markdown
|
||||
from siteguides import TERMINALS, install_command
|
||||
from model.guides import TERMINALS, install_command
|
||||
|
||||
def replace(match: re.Match[str]) -> str:
|
||||
indent = match.group("indent")
|
||||
|
||||
+1
-463
@@ -11,471 +11,9 @@ parts the pages share. The registry keeps the folder the pack unzips into
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import textwrap
|
||||
from dataclasses import dataclass, fields
|
||||
from pathlib import Path
|
||||
|
||||
import sitemarkup as markup
|
||||
from model.safeparse import require_yaml
|
||||
from sitebootstrap import PS1_NAME, SH_NAME
|
||||
from core.paths import REPO_ROOT
|
||||
|
||||
PLATFORMS_DIR = REPO_ROOT / "platforms"
|
||||
GUIDES_FILE = PLATFORMS_DIR / "_guides.yml"
|
||||
|
||||
|
||||
class GuideError(ValueError):
|
||||
"""The guides file does not say what a page needs, or contradicts the registry."""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Guide:
|
||||
"""What a platform page says before its file reference.
|
||||
|
||||
`folders` are the common cases, `more_folders` the rarer builds shown
|
||||
folded under them, under `more_folders_title`. `more_folders_detected`
|
||||
adds a row for each named system the registry detects the platform on.
|
||||
`notes` stay in the guide, one plain fact each. `reference_notes` carry
|
||||
the source citations and the details a reader checking the work wants,
|
||||
and open the Reference part of the page. `download_hint` is one more
|
||||
bullet under the pack download. `pack_manual` is the manual part of the
|
||||
README inside the pack. `logo_owner` and `logo_licence` credit the
|
||||
logo the registry links. `runs_on` names the hardware, in the project's
|
||||
own words, for its tile and its row. `terminal` replaces the shared
|
||||
"On the device" text with how this system opens a terminal. `card_run`
|
||||
names the computers that can open the BIOS folder on the device's card,
|
||||
when not every one can. `lead` comes
|
||||
before the folder table, `finish` closes the guide. `{folders}` in
|
||||
`pack_manual` is the folder list of the page, so the README and the page
|
||||
cannot name two folders for one device.
|
||||
"""
|
||||
|
||||
summary: str
|
||||
folders: tuple[tuple[str, str], ...]
|
||||
run: tuple[str, ...]
|
||||
notes: tuple[str, ...] = ()
|
||||
dest: str = ""
|
||||
on_card: bool = False
|
||||
more_folders: tuple[tuple[str, str], ...] = ()
|
||||
more_folders_title: str = "Other layouts"
|
||||
more_folders_detected: bool = False
|
||||
more_folders_note: str = ""
|
||||
reference_notes: tuple[str, ...] = ()
|
||||
download_hint: str = ""
|
||||
pack_manual: str = ""
|
||||
logo_owner: str = ""
|
||||
logo_licence: str = ""
|
||||
runs_on: str = ""
|
||||
terminal: str = ""
|
||||
lead: str = ""
|
||||
finish: str = ""
|
||||
card_run: tuple[str, ...] = ()
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class Tile:
|
||||
"""A tile beside the setups of a device group that is no setup of its
|
||||
own: a kind of device that runs one (Android handhelds run RetroArch).
|
||||
*link* is a site path, like the setup tiles' ``platforms/<key>.md``."""
|
||||
|
||||
name: str
|
||||
text: str
|
||||
link: str
|
||||
# A logo naming the kind of device, credited like a setup's.
|
||||
logo: str = ""
|
||||
logo_owner: str = ""
|
||||
logo_licence: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HandheldSystem:
|
||||
"""One handheld system on the handheld guide: a name the installer
|
||||
detects, the BIOS folder seen on the card from a computer, and the
|
||||
devices the system's own site lists. Each value comes with the address
|
||||
of the page that states it, and is left out when no first-party page does."""
|
||||
|
||||
name: str
|
||||
folder: str = ""
|
||||
folder_source: str = ""
|
||||
devices: tuple[str, ...] = ()
|
||||
devices_source: str = ""
|
||||
linux_only: bool = False
|
||||
# Said when the project stopped, with the project's own page saying so:
|
||||
# ArkOS points its readers to dArkOS.
|
||||
ended: str = ""
|
||||
ended_source: str = ""
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class HandheldGuide:
|
||||
"""The guide page for the systems that run a setup on a handheld
|
||||
(ArkOS, muOS, Onion... run RetroArch). *devices* are the names a reader
|
||||
types, searched on that page; *systems* one row each."""
|
||||
|
||||
page: str
|
||||
title: str
|
||||
summary: str
|
||||
uses: str
|
||||
systems: tuple[HandheldSystem, ...]
|
||||
|
||||
@property
|
||||
def path(self) -> str:
|
||||
return f"platforms/{self.page}.md"
|
||||
|
||||
@property
|
||||
def devices(self) -> tuple[str, ...]:
|
||||
seen: dict[str, None] = {}
|
||||
for system in self.systems:
|
||||
seen.update(dict.fromkeys(system.devices))
|
||||
return tuple(seen)
|
||||
|
||||
|
||||
_GUIDE_KEYS = {f.name for f in fields(Guide)}
|
||||
_REQUIRED = ("summary", "folders", "run")
|
||||
_TOP_KEYS = {"install_base", "trust_items", "device_groups", "terminals", "guides",
|
||||
"handheld_guide"}
|
||||
_GROUP_KEYS = {"label", "description", "anchor", "also_runs", "tiles"}
|
||||
_ALSO_KEYS = ("setup", "summary", "uses", "runs_on", "folder")
|
||||
_TILE_KEYS = ("name", "text", "link")
|
||||
_TILE_LOGO_KEYS = ("logo", "logo_owner", "logo_licence")
|
||||
_HANDHELD_KEYS = {"page", "title", "summary", "uses", "systems"}
|
||||
_SYSTEM_KEYS = {"name", "folder", "folder_source", "devices", "devices_source", "linux_only",
|
||||
"ended", "ended_source"}
|
||||
_SOURCE = re.compile(r"https://\S+")
|
||||
_TERMINAL_KEYS = ("label", "how", "shell")
|
||||
|
||||
|
||||
def _text(value: object, where: str) -> str:
|
||||
if not isinstance(value, str) or not value.strip():
|
||||
raise GuideError(f"{where}: expected text, found {value!r}")
|
||||
return value
|
||||
|
||||
|
||||
def _texts(value: object, where: str) -> tuple[str, ...]:
|
||||
if not isinstance(value, list):
|
||||
raise GuideError(f"{where}: expected a list, found {value!r}")
|
||||
return tuple(_text(item, f"{where}[{i}]") for i, item in enumerate(value))
|
||||
|
||||
|
||||
def _unknown(data: dict, allowed: set[str] | tuple[str, ...], where: str) -> None:
|
||||
extra = sorted(set(data) - set(allowed))
|
||||
if extra:
|
||||
raise GuideError(f"{where}: unknown key {', '.join(extra)} "
|
||||
f"(known: {', '.join(sorted(allowed))})")
|
||||
|
||||
|
||||
def _folder_rows(value: object, extract_to: str, where: str) -> tuple[tuple[str, str], ...]:
|
||||
"""Folder rows as (where, path). A row with no path is the registry's
|
||||
extract_to, so that folder is written once."""
|
||||
if not isinstance(value, list) or not value:
|
||||
raise GuideError(f"{where}: expected a list of folder rows")
|
||||
rows = []
|
||||
for i, row in enumerate(value):
|
||||
at = f"{where}[{i}]"
|
||||
if not isinstance(row, dict):
|
||||
raise GuideError(f"{at}: expected a mapping with `where` and `path`")
|
||||
_unknown(row, ("where", "path"), at)
|
||||
label = _text(row.get("where"), f"{at}.where")
|
||||
if "path" in row:
|
||||
rows.append((label, _text(row["path"], f"{at}.path")))
|
||||
elif extract_to:
|
||||
rows.append((label, f"`{extract_to}`"))
|
||||
else:
|
||||
raise GuideError(f"{at}: no `path`, and the registry has no extract_to for it")
|
||||
return tuple(rows)
|
||||
|
||||
|
||||
def _guide(name: str, data: object, extract_to: str, terminals: dict) -> Guide:
|
||||
where = f"{GUIDES_FILE.name}: guides.{name}"
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{where}: expected a mapping")
|
||||
_unknown(data, _GUIDE_KEYS, where)
|
||||
missing = [key for key in _REQUIRED if key not in data]
|
||||
if missing:
|
||||
raise GuideError(f"{where}: missing {', '.join(missing)}")
|
||||
run = _texts(data["run"], f"{where}.run")
|
||||
card_run = _texts(data["card_run"], f"{where}.card_run") if "card_run" in data else ()
|
||||
for key, tabs in (("run", run), ("card_run", card_run)):
|
||||
unknown_tabs = [tab for tab in tabs if tab not in terminals]
|
||||
if unknown_tabs:
|
||||
raise GuideError(f"{where}.{key}: no terminal named {', '.join(unknown_tabs)}")
|
||||
values: dict = {
|
||||
"card_run": card_run,
|
||||
"summary": _text(data["summary"], f"{where}.summary"),
|
||||
"folders": _folder_rows(data["folders"], extract_to, f"{where}.folders"),
|
||||
"run": run,
|
||||
}
|
||||
if "more_folders" in data:
|
||||
values["more_folders"] = _folder_rows(
|
||||
data["more_folders"], extract_to, f"{where}.more_folders")
|
||||
for key in ("notes", "reference_notes"):
|
||||
if key in data:
|
||||
values[key] = _texts(data[key], f"{where}.{key}")
|
||||
for key in ("dest", "download_hint", "more_folders_title", "more_folders_note",
|
||||
"logo_owner", "logo_licence", "runs_on", "terminal", "lead", "finish"):
|
||||
if key in data:
|
||||
values[key] = _text(data[key], f"{where}.{key}")
|
||||
for key in ("on_card", "more_folders_detected"):
|
||||
if key in data:
|
||||
if not isinstance(data[key], bool):
|
||||
raise GuideError(f"{where}.{key}: expected true or false")
|
||||
values[key] = data[key]
|
||||
if "pack_manual" in data:
|
||||
values["pack_manual"] = _text(data["pack_manual"], f"{where}.pack_manual")
|
||||
return Guide(**values)
|
||||
|
||||
|
||||
def detected_systems(registry: dict, platform: str) -> list[tuple[str, str]]:
|
||||
"""Named systems a platform runs on, handhelds that run RetroArch for one,
|
||||
with the BIOS folder the installer writes on each, read from the
|
||||
detection rules of the registry."""
|
||||
seen: dict[str, str] = {}
|
||||
for rule in (registry.get(platform, {}).get("install") or {}).get("detect") or []:
|
||||
name, folder = rule.get("name"), rule.get("bios_path")
|
||||
if name and folder and rule.get("installs", True) and name not in seen:
|
||||
seen[name] = folder
|
||||
return sorted(seen.items(), key=lambda item: item[0].casefold())
|
||||
|
||||
|
||||
def _source(value: object, where: str) -> str:
|
||||
text = _text(value, where)
|
||||
if not _SOURCE.fullmatch(text):
|
||||
raise GuideError(f"{where}: expected one https address, found {text!r}")
|
||||
return text
|
||||
|
||||
|
||||
def _handheld_system(data: object, where: str) -> HandheldSystem:
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{where}: expected a mapping")
|
||||
_unknown(data, _SYSTEM_KEYS, where)
|
||||
values: dict = {"name": _text(data.get("name"), f"{where}.name")}
|
||||
for value, source in (("folder", "folder_source"), ("devices", "devices_source"),
|
||||
("ended", "ended_source")):
|
||||
if (value in data) != (source in data):
|
||||
raise GuideError(f"{where}: {value} and {source} go together, "
|
||||
"a value is written only with the page that states it")
|
||||
if value in data:
|
||||
values[value] = (_texts(data[value], f"{where}.{value}") if value == "devices"
|
||||
else _text(data[value], f"{where}.{value}"))
|
||||
values[source] = _source(data[source], f"{where}.{source}")
|
||||
if "linux_only" in data:
|
||||
if not isinstance(data["linux_only"], bool) or "folder" not in data:
|
||||
raise GuideError(f"{where}.linux_only: expected true or false, with a folder")
|
||||
values["linux_only"] = data["linux_only"]
|
||||
return HandheldSystem(**values)
|
||||
|
||||
|
||||
def _handheld_guide(data: object, registry: dict, guides: dict, where: str) -> HandheldGuide | None:
|
||||
"""The handheld guide, checked against the systems the registry detects
|
||||
the setup on: one row for each, and none it does not detect."""
|
||||
if data is None:
|
||||
return None
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{where}: expected a mapping")
|
||||
_unknown(data, _HANDHELD_KEYS, where)
|
||||
uses = _text(data.get("uses"), f"{where}.uses")
|
||||
if uses not in guides:
|
||||
raise GuideError(f"{where}.uses: {uses!r} is not a platform with a guide")
|
||||
page = _text(data.get("page"), f"{where}.page")
|
||||
if page in registry:
|
||||
raise GuideError(f"{where}.page: {page!r} is the page of a registered platform")
|
||||
raw = data.get("systems")
|
||||
if not isinstance(raw, list) or not raw:
|
||||
raise GuideError(f"{where}.systems: expected a list of systems")
|
||||
systems = tuple(_handheld_system(row, f"{where}.systems[{i}]") for i, row in enumerate(raw))
|
||||
named = [system.name for system in systems]
|
||||
detected = [name for name, _folder in detected_systems(registry, uses)]
|
||||
if sorted(named, key=str.casefold) != detected:
|
||||
raise GuideError(
|
||||
f"{where}.systems: one row per system the registry detects {uses} on, "
|
||||
f"missing {sorted(set(detected) - set(named))}, "
|
||||
f"not detected {sorted(set(named) - set(detected))}")
|
||||
return HandheldGuide(
|
||||
page=page, title=_text(data.get("title"), f"{where}.title"),
|
||||
summary=_text(data.get("summary"), f"{where}.summary"), uses=uses, systems=systems,
|
||||
)
|
||||
|
||||
|
||||
def _terminals(raw: dict, file_name: str) -> dict[str, tuple[str, str, str]]:
|
||||
terminals: dict[str, tuple[str, str, str]] = {}
|
||||
for key, entry in raw.items():
|
||||
at = f"{file_name}: terminals.{key}"
|
||||
if not isinstance(entry, dict):
|
||||
raise GuideError(f"{at}: expected a mapping")
|
||||
_unknown(entry, _TERMINAL_KEYS, at)
|
||||
label, how, shell = (_text(entry.get(k), f"{at}.{k}") for k in _TERMINAL_KEYS)
|
||||
terminals[key] = (label, how, shell)
|
||||
if entry["shell"] not in ("sh", "powershell"):
|
||||
raise GuideError(f"{at}.shell: sh or powershell, found {entry['shell']!r}")
|
||||
return terminals
|
||||
|
||||
|
||||
def _also_runs(raw: list, raw_guides: dict, at: str) -> tuple[tuple[str, str, str, str, str], ...]:
|
||||
rows = []
|
||||
for i, row in enumerate(raw):
|
||||
row_at = f"{at}.also_runs[{i}]"
|
||||
if not isinstance(row, dict):
|
||||
raise GuideError(f"{row_at}: expected a mapping")
|
||||
_unknown(row, _ALSO_KEYS, row_at)
|
||||
setup, summary, uses, runs_on, folder = (_text(row.get(k), f"{row_at}.{k}")
|
||||
for k in _ALSO_KEYS)
|
||||
if uses not in raw_guides:
|
||||
raise GuideError(f"{row_at}.uses: {uses!r} is not a platform with a guide")
|
||||
rows.append((setup, summary, uses, runs_on, folder))
|
||||
return tuple(rows)
|
||||
|
||||
|
||||
def _group_tiles(raw: list, at: str) -> tuple[Tile, ...]:
|
||||
group_tiles = []
|
||||
for i, row in enumerate(raw):
|
||||
row_at = f"{at}.tiles[{i}]"
|
||||
if not isinstance(row, dict):
|
||||
raise GuideError(f"{row_at}: expected a mapping")
|
||||
_unknown(row, _TILE_KEYS + _TILE_LOGO_KEYS, row_at)
|
||||
if row.get("logo") and not all(row.get(k) for k in _TILE_LOGO_KEYS):
|
||||
raise GuideError(f"{row_at}: a logo needs logo_owner and logo_licence")
|
||||
group_tiles.append(Tile(
|
||||
*(_text(row.get(k), f"{row_at}.{k}") for k in _TILE_KEYS),
|
||||
*(_text(row[k], f"{row_at}.{k}") if row.get(k) else "" for k in _TILE_LOGO_KEYS)))
|
||||
return tuple(group_tiles)
|
||||
|
||||
|
||||
def load_guides(path: Path = GUIDES_FILE, registry: dict | None = None) -> dict:
|
||||
"""The guides file, checked against the registry.
|
||||
|
||||
Every registered platform has a guide and a device group the file
|
||||
describes. A mistake raises GuideError naming the key, so the site is
|
||||
never built from half a guide.
|
||||
"""
|
||||
yaml = require_yaml()
|
||||
if registry is None:
|
||||
with open(PLATFORMS_DIR / "_registry.yml", encoding="utf-8") as handle:
|
||||
registry = (yaml.safe_load(handle) or {}).get("platforms", {})
|
||||
with open(path, encoding="utf-8") as handle:
|
||||
data = yaml.safe_load(handle) or {}
|
||||
if not isinstance(data, dict):
|
||||
raise GuideError(f"{path.name}: expected a mapping")
|
||||
_unknown(data, _TOP_KEYS, path.name)
|
||||
|
||||
terminals = _terminals(data.get("terminals") or {}, path.name)
|
||||
raw_guides = data.get("guides") or {}
|
||||
groups: dict[str, tuple[str, str]] = {}
|
||||
anchors: dict[str, str] = {}
|
||||
also_runs: dict[str, tuple[tuple[str, str, str, str, str], ...]] = {}
|
||||
tiles: dict[str, tuple[Tile, ...]] = {}
|
||||
for key, entry in (data.get("device_groups") or {}).items():
|
||||
at = f"{path.name}: device_groups.{key}"
|
||||
if not isinstance(entry, dict):
|
||||
raise GuideError(f"{at}: expected a mapping")
|
||||
_unknown(entry, _GROUP_KEYS, at)
|
||||
groups[key] = (_text(entry.get("label"), f"{at}.label"),
|
||||
_text(entry.get("description"), f"{at}.description"))
|
||||
anchors[key] = _text(entry.get("anchor"), f"{at}.anchor")
|
||||
rows = _also_runs(entry.get("also_runs") or [], raw_guides, at)
|
||||
if rows:
|
||||
also_runs[key] = rows
|
||||
group_tiles = _group_tiles(entry.get("tiles") or [], at)
|
||||
if group_tiles:
|
||||
tiles[key] = group_tiles
|
||||
|
||||
unregistered = sorted(set(raw_guides) - set(registry))
|
||||
if unregistered:
|
||||
raise GuideError(f"{path.name}: guides for unregistered platforms: "
|
||||
f"{', '.join(unregistered)}")
|
||||
guides = {}
|
||||
for name, entry in registry.items():
|
||||
if name not in raw_guides:
|
||||
raise GuideError(f"{path.name}: {name} is registered and has no guide "
|
||||
f"(add guides.{name})")
|
||||
group = entry.get("device_group")
|
||||
if group not in groups:
|
||||
raise GuideError(f"_registry.yml: {name}.device_group {group!r} is not "
|
||||
f"one of {', '.join(groups)} in {path.name}")
|
||||
guides[name] = _guide(name, raw_guides[name], str(entry.get("extract_to") or ""),
|
||||
terminals)
|
||||
# The order the file is written in, which the pages do not depend on.
|
||||
guides = {name: guides[name] for name in raw_guides}
|
||||
return {
|
||||
"registry": registry,
|
||||
"install_base": _text(data.get("install_base"), f"{path.name}: install_base"),
|
||||
"trust_items": _texts(data.get("trust_items"), f"{path.name}: trust_items"),
|
||||
"device_groups": groups,
|
||||
"group_anchors": anchors,
|
||||
"also_runs": also_runs,
|
||||
"tiles": tiles,
|
||||
"terminals": terminals,
|
||||
"guides": guides,
|
||||
"handheld_guide": _handheld_guide(data.get("handheld_guide"), registry, guides,
|
||||
f"{path.name}: handheld_guide"),
|
||||
}
|
||||
|
||||
|
||||
_LOADED = load_guides()
|
||||
INSTALL_BASE: str = _LOADED["install_base"]
|
||||
# The bootstraps the site serves (sitebootstrap.py writes them).
|
||||
INSTALL_SH: str = f"{INSTALL_BASE}/{SH_NAME}"
|
||||
INSTALL_PS1: str = f"{INSTALL_BASE}/{PS1_NAME}"
|
||||
# The same installer from PyPI (scripts/build_pypi.py builds the package).
|
||||
PACKAGE_COMMAND = "uvx retrobios"
|
||||
DEVICE_GROUPS: dict[str, tuple[str, str]] = _LOADED["device_groups"]
|
||||
GROUP_ANCHORS: dict[str, str] = _LOADED["group_anchors"]
|
||||
ALSO_RUNS: dict[str, tuple[tuple[str, str, str, str, str], ...]] = _LOADED["also_runs"]
|
||||
GROUP_TILES: dict[str, tuple[Tile, ...]] = _LOADED["tiles"]
|
||||
HANDHELD_GUIDE: HandheldGuide | None = _LOADED["handheld_guide"]
|
||||
TERMINALS: dict[str, tuple[str, str, str]] = _LOADED["terminals"]
|
||||
TRUST_ITEMS: tuple[str, ...] = _LOADED["trust_items"]
|
||||
GUIDES: dict[str, Guide] = _LOADED["guides"]
|
||||
_REGISTRY: dict = _LOADED["registry"]
|
||||
|
||||
|
||||
def folder_list(name: str, registry: dict | None = None) -> list[tuple[str, str]]:
|
||||
"""Every folder a guide names, as (where, path): the common ones, the
|
||||
rarer builds, and the systems the registry detects when the guide says so."""
|
||||
guide = GUIDES[name]
|
||||
rows = [*guide.folders, *guide.more_folders]
|
||||
if guide.more_folders_detected:
|
||||
rows += [(system, f"`{folder}`")
|
||||
for system, folder in detected_systems(registry or _REGISTRY, name)]
|
||||
return rows
|
||||
|
||||
|
||||
def _plain_folders(name: str) -> str:
|
||||
rows = folder_list(name)
|
||||
width = max(len(where) for where, _path in rows) + 1
|
||||
return "\n".join(f"{where + ':':<{width}} {path.replace('`', '')}" for where, path in rows)
|
||||
|
||||
|
||||
def setup_count() -> int:
|
||||
"""Setups the site covers: every registered platform, since each keeps
|
||||
its page, its pack and its command. The one count every page states."""
|
||||
return len(GUIDES)
|
||||
|
||||
|
||||
def pack_manual(name: str) -> str:
|
||||
"""The manual part of a pack README, indented as the README is, or empty."""
|
||||
guide = GUIDES.get(name)
|
||||
if not guide or not guide.pack_manual:
|
||||
return ""
|
||||
text = guide.pack_manual.rstrip("\n")
|
||||
if "{folders}" in text:
|
||||
indent = next(line[: len(line) - len(line.lstrip())]
|
||||
for line in text.splitlines() if "{folders}" in line)
|
||||
text = text.replace("{folders}", textwrap.indent(_plain_folders(name), indent).lstrip())
|
||||
return textwrap.indent(text, " ") + "\n\n"
|
||||
|
||||
|
||||
def install_command(shell: str, args: str = "") -> str:
|
||||
"""The one-liner for a shell, with installer options when given.
|
||||
|
||||
PowerShell passes options only through a scriptblock: `irm ... | iex`
|
||||
takes none.
|
||||
"""
|
||||
if shell == "sh":
|
||||
return f"curl -fsSL {INSTALL_SH} | sh" + (f" -s -- {args}" if args else "")
|
||||
if args:
|
||||
return f"&([scriptblock]::Create((irm {INSTALL_PS1}))) {args}"
|
||||
return f"irm {INSTALL_PS1} | iex"
|
||||
from model.guides import Guide, TERMINALS, TRUST_ITEMS, install_command
|
||||
|
||||
|
||||
# The title over each command block, by the shell it is written for.
|
||||
|
||||
+15
-732
@@ -6,9 +6,21 @@ import re
|
||||
import urllib.parse
|
||||
from collections.abc import Callable
|
||||
|
||||
import siteinputs
|
||||
from model import siteinputs
|
||||
import sitemarkup as markup
|
||||
from core.paths import REPO_ROOT
|
||||
from model.collection import _PROGRAM_TOPS, _card_moves, _manufacturer_slug
|
||||
from model.systemnames import (
|
||||
SYSTEM_PARENTS,
|
||||
_boards_built,
|
||||
_console_anchors,
|
||||
_ensure_console_sections,
|
||||
_own_section,
|
||||
_program_names,
|
||||
_section_pairs,
|
||||
_sections_by_name,
|
||||
system_name,
|
||||
)
|
||||
|
||||
|
||||
WIKI_SRC_DIR = "wiki" # manually maintained wiki sources
|
||||
@@ -173,19 +185,9 @@ def split_system_stems() -> set[str]:
|
||||
return {stem for stems in _console_pages.values() for stem in stems}
|
||||
|
||||
|
||||
# (manufacturer slug, console) -> the id of the console's heading. Two
|
||||
# folders spelled alike (Sega's "Mega CD" and "Mega-CD") share a slug, and
|
||||
# the second heading took "mega-cd_1" while every link said "mega-cd".
|
||||
_console_anchors: dict[tuple[str, str], str] = {}
|
||||
|
||||
|
||||
def _manufacturer_slug(manufacturer: str) -> str:
|
||||
return manufacturer.lower().replace(" ", "-")
|
||||
|
||||
|
||||
def console_anchor(manufacturer: str, console: str) -> str:
|
||||
"""The id of a console's heading on its manufacturer's page."""
|
||||
from sitestarlight import toc_slug
|
||||
from core.anchors import toc_slug
|
||||
|
||||
key = (_manufacturer_slug(manufacturer), console)
|
||||
return _console_anchors.get(key) or toc_slug(console)
|
||||
@@ -206,20 +208,6 @@ def console_href(slug: str, console: str, prefix: str = "") -> str:
|
||||
return f"{prefix}systems/{urllib.parse.quote(slug)}.md#{console_anchor(slug, console)}"
|
||||
|
||||
|
||||
# (manufacturer slug, folder, sha1) -> the (manufacturer slug, console) a
|
||||
# copy's card went to when the system pages file it outside its folder:
|
||||
# ScummVM's engine data under Other/ScummVM, neogeo.zip under Arcade.
|
||||
_card_moves: dict[tuple[str, str, str], tuple[str, str]] = {}
|
||||
|
||||
|
||||
def record_card_move(manufacturer: str, folder: str, sha1: str,
|
||||
to_manufacturer: str, to_console: str) -> None:
|
||||
"""Mark that the card of the copy under bios/<manufacturer>/<folder>/
|
||||
sits in the section (to_manufacturer, to_console)."""
|
||||
_card_moves[(_manufacturer_slug(manufacturer), folder, str(sha1))] = (
|
||||
_manufacturer_slug(to_manufacturer), to_console)
|
||||
|
||||
|
||||
def card_page(path: str, sha1: str) -> str:
|
||||
"""The systems/ page stem holding the card of the copy at ``path``
|
||||
(bios/<Manufacturer>/<Console>/...). A board's set is on the board's
|
||||
@@ -325,7 +313,6 @@ _board_names: dict[str, str] = {}
|
||||
# sha1 -> the (manufacturer, console) sections of the machines whose own
|
||||
# set the archive is: neogeo.zip for the Neo Geo, mz2000.zip for the MZ.
|
||||
_archive_machines: dict[str, set[tuple[str, str] | None]] = {}
|
||||
_boards_built = [False]
|
||||
|
||||
|
||||
def set_arcade_boards(profiles: dict[str, dict], db: dict) -> None:
|
||||
@@ -573,7 +560,7 @@ def board_slug(sys_id: str) -> str:
|
||||
"""The slug of a board's section: its page is systems/arcade-<slug>/
|
||||
and its heading's id is <slug>. Read from the board's display name,
|
||||
so every id of one board gives one slug."""
|
||||
from sitestarlight import toc_slug
|
||||
from core.anchors import toc_slug
|
||||
|
||||
return toc_slug(system_name(str(sys_id)))
|
||||
|
||||
@@ -697,718 +684,14 @@ def _by_mode(value: str | dict, mode: str) -> str:
|
||||
return str(value or "")
|
||||
|
||||
|
||||
# System display names. A system is named by the heading of the console
|
||||
# section that is its own: the folder its id spells, under the maker the id
|
||||
# names when two makers file a console of that name. The page a system's
|
||||
# files were voted onto is not its section and never names it. That vote
|
||||
# called nintendo-gba "Nintendo Game Boy" and camplynx "Arcade". A system
|
||||
# with no section of its own is named in SYSTEM_NAMES, and a system in
|
||||
# neither stops the build.
|
||||
|
||||
# Folders that file copies by the emulator or board that loads them. Their
|
||||
# headings name a program, not a system.
|
||||
_PROGRAM_TOPS = frozenset({"Other", "Arcade"})
|
||||
# Of those, the top whose headings never name a system, even read whole.
|
||||
# An Arcade heading can (Namco System 246), an Other one cannot.
|
||||
_NAMELESS_TOPS = frozenset({"Other"})
|
||||
|
||||
# A section whose folder is a short name the code reads, headed with the
|
||||
# program's name instead (bios/Arcade/fba2012 holds FB Alpha 2012's samples).
|
||||
SECTION_LABELS: dict[tuple[str, str], str] = {
|
||||
("Arcade", "fba2012"): "FB Alpha 2012",
|
||||
}
|
||||
|
||||
# Every (manufacturer, console) section the system pages carry.
|
||||
_section_pairs: set[tuple[str, str]] = set()
|
||||
# Normalized id -> the console sections spelled that way.
|
||||
_console_sections: dict[str, set[tuple[str, str]]] = {}
|
||||
# A console section by the name its heading reads (Bandai WonderSwan).
|
||||
_sections_by_name: dict[str, set[tuple[str, str]]] = {}
|
||||
# Emulator and engine names. A heading spelled like one (Game Engines >
|
||||
# Solarus, ZC > ZC210) files that program's copies and names no system.
|
||||
_program_names: set[str] = set()
|
||||
|
||||
|
||||
def program_names(profiles: dict[str, dict]) -> set[str]:
|
||||
"""Every name an emulator profile goes by: its key, its emulator and
|
||||
display names."""
|
||||
names = {str(key) for key in profiles}
|
||||
for profile in profiles.values():
|
||||
names.update(
|
||||
str(profile[field]) for field in ("emulator", "display_name")
|
||||
if profile.get(field)
|
||||
)
|
||||
return names
|
||||
|
||||
|
||||
def set_console_sections(
|
||||
sections: dict[str, dict] | set[tuple[str, str]],
|
||||
programs: set[str] | frozenset[str] = frozenset(),
|
||||
) -> None:
|
||||
"""Install the console sections the system pages carry.
|
||||
|
||||
``sections`` maps each manufacturer to its consoles, as the system pages
|
||||
group them, or is a set of (manufacturer, console) pairs. ``programs``
|
||||
are the emulator names, which never name a system.
|
||||
"""
|
||||
from model.systems import _norm_system_id
|
||||
|
||||
pairs = (
|
||||
{(mfr, console) for mfr, consoles in sections.items() for console in consoles}
|
||||
if isinstance(sections, dict) else set(sections)
|
||||
)
|
||||
# A reviewed parent under a maker the pages carry is a section even with
|
||||
# no folder of its own: the Atom's sets sit under bios/Arcade, and the
|
||||
# system pages file them under Acorn (generate_site.arcade_board_sections).
|
||||
makers = {mfr for mfr, _console in pairs}
|
||||
pairs |= {parent for parent in SYSTEM_PARENTS.values()
|
||||
if parent[0] in makers and parent[0] not in _PROGRAM_TOPS}
|
||||
from sitestarlight import _unique, toc_slug
|
||||
|
||||
_console_sections.clear()
|
||||
_sections_by_name.clear()
|
||||
_console_anchors.clear()
|
||||
_section_pairs.clear()
|
||||
_section_pairs.update(pairs)
|
||||
by_maker: dict[str, list[str]] = {}
|
||||
for mfr, console in pairs:
|
||||
by_maker.setdefault(mfr, []).append(console)
|
||||
for name in {_heading_name(mfr, console).casefold(), console.casefold()}:
|
||||
_sections_by_name.setdefault(name, set()).add((mfr, console))
|
||||
# In the order the page lists them, after the page title's own id.
|
||||
for mfr, consoles in by_maker.items():
|
||||
used = {toc_slug(mfr)}
|
||||
for console in sorted(consoles):
|
||||
_console_anchors[(_manufacturer_slug(mfr), console)] = _unique(toc_slug(console), used)
|
||||
for mfr, console in pairs:
|
||||
spelled = console.lower().replace(" ", "-")
|
||||
slug = mfr.lower().replace(" ", "-")
|
||||
for key in {_norm_system_id(f"{slug}-{spelled}"), _norm_system_id(spelled)}:
|
||||
_console_sections.setdefault(key, set()).add((mfr, console))
|
||||
_program_names.clear()
|
||||
_program_names.update(name.casefold() for name in programs)
|
||||
_sections_installed[0] = True
|
||||
# Which ids are boards depends on which have a section elsewhere.
|
||||
_boards_built[0] = False
|
||||
|
||||
|
||||
_sections_installed = [False]
|
||||
_REPO_ROOT = REPO_ROOT
|
||||
|
||||
|
||||
def _ensure_console_sections() -> None:
|
||||
"""Read the sections from the repository when no generator installed
|
||||
them, so a page rendered on its own names systems as the site does."""
|
||||
if _sections_installed[0]:
|
||||
return
|
||||
import json
|
||||
|
||||
from model.profiles import load_emulator_profiles
|
||||
from sitecollection import _group_by_manufacturer
|
||||
|
||||
inputs = siteinputs.current()
|
||||
with open(inputs.db, encoding="utf-8") as handle:
|
||||
db = json.load(handle)
|
||||
profiles = load_emulator_profiles(str(inputs.emulators), skip_aliases=False)
|
||||
set_console_sections(_group_by_manufacturer(db), program_names(profiles))
|
||||
|
||||
|
||||
def _own_section(sys_id: str) -> tuple[str, str] | None:
|
||||
"""The console section that is this id's own, or None.
|
||||
|
||||
Of two sections spelled alike (Atari and Camputers both file a Lynx),
|
||||
the one under the maker the id names is kept. Two left is no answer,
|
||||
and neither is a section that files a program's copies.
|
||||
"""
|
||||
from model.systems import _norm_system_id
|
||||
|
||||
_ensure_console_sections()
|
||||
places = _console_sections.get(_norm_system_id(sys_id), set())
|
||||
if len(places) > 1:
|
||||
places = {
|
||||
(mfr, console) for mfr, console in places
|
||||
if sys_id.lower().startswith(mfr.lower().replace(" ", "-") + "-")
|
||||
}
|
||||
if len(places) != 1:
|
||||
return None
|
||||
mfr, console = next(iter(places))
|
||||
# A folder under a program's top, named like its own page (Dinothawr) or
|
||||
# like an emulator holds a program's files, not a system's.
|
||||
if (
|
||||
mfr in _PROGRAM_TOPS
|
||||
or console.casefold() == mfr.casefold()
|
||||
or _heading_name(mfr, console).casefold() in _program_names
|
||||
):
|
||||
return None
|
||||
return mfr, console
|
||||
|
||||
|
||||
def _heading_name(mfr: str, console: str) -> str:
|
||||
"""A console heading read out of its page: the maker in front, unless
|
||||
the heading already starts with it or the page is a game publisher's."""
|
||||
from model.composition import GAME_DATA_TOPS
|
||||
|
||||
if mfr in GAME_DATA_TOPS:
|
||||
return SECTION_LABELS.get((mfr, console), console)
|
||||
if console.casefold().startswith(mfr.split()[0].casefold()):
|
||||
return console
|
||||
return f"{mfr} {console}"
|
||||
|
||||
|
||||
def system_name(sys_id: str) -> str:
|
||||
"""The display name of a system id, the only one a page prints."""
|
||||
sys_id = str(sys_id)
|
||||
section = _own_section(sys_id)
|
||||
if section is not None:
|
||||
return _heading_name(*section)
|
||||
name = SYSTEM_NAMES.get(sys_id)
|
||||
if name is None:
|
||||
raise KeyError(
|
||||
f"system {sys_id!r} has no console section of its own and no "
|
||||
"entry in siterender.SYSTEM_NAMES"
|
||||
)
|
||||
return name
|
||||
|
||||
|
||||
# Systems without a console section of their own.
|
||||
SYSTEM_NAMES: dict[str, str] = {
|
||||
"2ship": "The Legend of Zelda: Majora's Mask",
|
||||
"aarch64": "ARM 64-bit (AArch64)",
|
||||
"acclaim-zn1": "Acclaim ZN-1",
|
||||
"adrift": "ADRIFT",
|
||||
"advsys": "AdvSys",
|
||||
"ags": "Adventure Game Studio games",
|
||||
"agt": "Adventure Game Toolkit",
|
||||
"alan": "Alan",
|
||||
"alg-laserdisc": "American Laser Games laserdisc",
|
||||
"allied-leisure-pinball": "Allied Leisure pinball",
|
||||
"alpha": "DEC Alpha",
|
||||
"andamiro-pumpitup": "Andamiro Pump It Up",
|
||||
"apf-m1000": "APF M-1000",
|
||||
"apfm1000": "APF M-1000",
|
||||
"apple-iie": "Apple IIe",
|
||||
"apple-ios": "Apple iOS",
|
||||
"apple2": "Apple II",
|
||||
"arcade": "Arcade games",
|
||||
"arcade-laserdisc": "Laserdisc arcade games",
|
||||
"arcadia-systems": "Arcadia Systems Multi Select",
|
||||
"arduboy": "Arduboy",
|
||||
"aristocrat-mk5": "Aristocrat MK5",
|
||||
"aristocrat-mk6": "Aristocrat MK6",
|
||||
"aristocrat-mk7": "Aristocrat MK7",
|
||||
"arm": "ARM",
|
||||
"atari-falcon": "Atari Falcon",
|
||||
"atari-jaguarcd": "Atari Jaguar CD",
|
||||
"atari-ste": "Atari STE",
|
||||
"atari-system1": "Atari System 1",
|
||||
"atari-tt": "Atari TT",
|
||||
"atari-zn1": "Atari ZN-1",
|
||||
"atlus-zn1": "Atlus ZN-1",
|
||||
"bandai-playdia": "Bandai Playdia",
|
||||
"bandai-wswanc": "Bandai WonderSwan Color",
|
||||
"barcrest-mpu4": "Barcrest MPU4",
|
||||
"bbc-master-128": "Acorn BBC Master 128",
|
||||
"bbc-master-compact": "Acorn BBC Master Compact",
|
||||
"bbc-master-et": "Acorn BBC Master ET",
|
||||
"bbc-micro-b": "Acorn BBC Micro Model B",
|
||||
"bbc-micro-bplus": "Acorn BBC Micro Model B+",
|
||||
"bbk-longman-4980": "BBK Longman A4980",
|
||||
"bbk-longman-4988": "BBK Longman A4988",
|
||||
"bennugd": "BennuGD games",
|
||||
"bermuda-syndrome": "Bermuda Syndrome game",
|
||||
"brezzasoft-crystal": "BrezzaSoft Crystal System",
|
||||
"bshift": "Half-Life: Blue Shift",
|
||||
"caesar3": "Caesar III",
|
||||
"cambridge-z88": "Cambridge Computer Z88",
|
||||
"camplynx": "Camputers Lynx",
|
||||
"capcom-cps1": "Capcom CPS-1",
|
||||
"capcom-cps2": "Capcom CPS-2",
|
||||
"capcom-cps3": "Capcom CPS-3",
|
||||
"capcom-zn1": "Capcom ZN-1",
|
||||
"capcom-zn2": "Capcom ZN-2",
|
||||
"casio-pv1000": "Casio PV-1000",
|
||||
"catacomb-3d": "Catacomb 3-D",
|
||||
"catacomb-adventure": "Catacomb Adventure Series",
|
||||
"cave-cv1000": "Cave CV1000",
|
||||
"cave-story": "Cave Story",
|
||||
"cavestory": "Cave Story",
|
||||
"celeste-classic": "Celeste Classic",
|
||||
"century-cvs": "Century CVS",
|
||||
"ces-galaxy-games": "CES Galaxy Games",
|
||||
"cgenie": "EACA Colour Genie",
|
||||
"chex": "Chex Quest",
|
||||
"chip8": "CHIP-8",
|
||||
"coco3": "Tandy Color Computer 3",
|
||||
"commanderx16": "Commander X16",
|
||||
"commodore-c64-supercpu": "Commodore 64 with SuperCPU",
|
||||
"commodore-cd32": "Commodore Amiga CD32",
|
||||
"commodore-cdtv": "Commodore CDTV",
|
||||
"commodore-cubo": "CD Express Cubo CD32",
|
||||
"coolbar": "Coolbar feature phones",
|
||||
"cstrike": "Counter-Strike",
|
||||
"ctf": "Quake II: Capture the Flag",
|
||||
"czero": "Counter-Strike: Condition Zero",
|
||||
"czeror": "Counter-Strike: Condition Zero Deleted Scenes",
|
||||
"dark-forces": "Star Wars: Dark Forces",
|
||||
"dark-forces-ii": "Star Wars Jedi Knight: Dark Forces II",
|
||||
"deco-cassette": "Data East DECO Cassette System",
|
||||
"descent2": "Descent II",
|
||||
"dingoo-a320": "Dingoo A320",
|
||||
"dinothawr": "Dinothawr game",
|
||||
"discrete-arcade": "Discrete logic arcade games",
|
||||
"dmc": "Deathmatch Classic",
|
||||
"doom3-bfg": "Doom 3: BFG Edition",
|
||||
"dos": "MS-DOS",
|
||||
"dragon32": "Dragon 32",
|
||||
"dragon64": "Dragon 64",
|
||||
"droidworks": "Star Wars: DroidWorks",
|
||||
"duke-nukem-2": "Duke Nukem II",
|
||||
"duke3d": "Duke Nukem 3D",
|
||||
"dusklight": "The Legend of Zelda: Twilight Princess",
|
||||
"efo-cedar-magnet": "EFO Cedar Magnet System",
|
||||
"eighting-zn1": "Eighting ZN-1",
|
||||
"elektor-tv-games-computer": "Elektor TV Games Computer",
|
||||
"emerson-arcadia-2001": "Emerson Arcadia 2001",
|
||||
"enemy-territory-quake-wars": "Enemy Territory: Quake Wars",
|
||||
"enemyterritory": "Wolfenstein: Enemy Territory",
|
||||
"enterprise-128": "Enterprise 128",
|
||||
"enterprise-64": "Enterprise 64",
|
||||
"entex-advision": "Entex Adventure Vision",
|
||||
"epoch-scv": "Epoch Super Cassette Vision",
|
||||
"epochcv": "Epoch Cassette Vision",
|
||||
"eternal-computer": "Eternal Software Initiative computer",
|
||||
"exelvision-exl100": "Exelvision EXL 100",
|
||||
"exhumed": "PowerSlave",
|
||||
"exidy-maxaflex": "Exidy Max-A-Flex",
|
||||
"fallout": "Fallout",
|
||||
"flash": "Adobe Flash",
|
||||
"flashback": "Flashback",
|
||||
"fm77av": "Fujitsu FM77AV",
|
||||
"fpinball": "Future Pinball tables",
|
||||
"fruitmachine": "Fruit machines",
|
||||
"fury": "Ion Fury game",
|
||||
"gaelco-powervr": "Gaelco PowerVR boards",
|
||||
"galaksija": "Galaksija computer",
|
||||
"game": "Picross puzzle (libretro sample)",
|
||||
"gamecom": "Tiger Game.com",
|
||||
"gamemaker": "GameMaker games",
|
||||
"gameplan-mpu1": "Game Plan MPU-1",
|
||||
"gamepock": "Epoch Game Pocket Computer",
|
||||
"gametank": "GameTank console",
|
||||
"gearbox": "Half-Life: Opposing Force",
|
||||
"ghostship": "Super Mario 64",
|
||||
"glulx": "Glulx",
|
||||
"gottlieb-system1": "Gottlieb System 1",
|
||||
"half-life-2": "Half-Life 2",
|
||||
"handheld-electronic": "Nintendo Game & Watch",
|
||||
"heart-of-darkness": "Heart of Darkness",
|
||||
"heretic": "Heretic",
|
||||
"heroes-of-might-and-magic-2": "Heroes of Might and Magic II",
|
||||
"hexen": "Hexen",
|
||||
"hexen2": "Hexen II",
|
||||
"hugo": "Hugo",
|
||||
"hyper-neogeo64": "SNK Hyper Neo Geo 64",
|
||||
"ibm-at": "IBM PC/AT",
|
||||
"ibm-pcjr": "IBM PCjr",
|
||||
"ibm-ps1": "IBM PS/1",
|
||||
"ibm-xt": "IBM PC XT",
|
||||
"icarus-starship-command-simulator": "Icarus Starship Command Simulator",
|
||||
"igs-pgm": "IGS PolyGame Master",
|
||||
"imax-macs": "I'Max MACS",
|
||||
"interact": "Interact Home Computer",
|
||||
"interton-vc4000": "Interton VC 4000",
|
||||
"itech-eagle": "Incredible Technologies Eagle",
|
||||
"jacl": "JACL",
|
||||
"jedi-academy": "Star Wars Jedi Knight: Jedi Academy",
|
||||
"jedi-outcast": "Star Wars Jedi Knight II: Jedi Outcast",
|
||||
"jediacademy": "Star Wars Jedi Knight: Jedi Academy",
|
||||
"jediknight2": "Star Wars Jedi Knight II: Jedi Outcast",
|
||||
"jupiter-ace": "Jupiter Cantab Jupiter Ace",
|
||||
"konami-bubble-system": "Konami Bubble System",
|
||||
"konami-bubblesystem": "Konami Bubble System",
|
||||
"konami-bubsys": "Konami Bubble System",
|
||||
"konami-endeavour": "Konami Endeavour",
|
||||
"konami-gq": "Konami GQ",
|
||||
"konami-gv": "Konami GV",
|
||||
"konami-gx": "Konami GX",
|
||||
"konami-python": "Konami Python",
|
||||
"konami-python2": "Konami Python 2",
|
||||
"konami-twinkle": "Konami Twinkle",
|
||||
"konami-viper": "Konami Viper",
|
||||
"lambda-8300": "Lambda 8300",
|
||||
"laserdisc-arcade": "Laserdisc arcade games",
|
||||
"level9": "Level 9",
|
||||
"lowresnx": "LowRes NX programs",
|
||||
"lynx": "Atari Lynx",
|
||||
"m68k": "Motorola 68000",
|
||||
"magnetic-scrolls": "Magnetic Scrolls",
|
||||
"marty": "Fujitsu FM Towns Marty",
|
||||
"mega-cd-32x": "Sega Mega-CD 32X",
|
||||
"mega-duck": "Welback Mega Duck",
|
||||
"mega-ld": "Sega Mega LD",
|
||||
"microdigital-tk85": "Microdigital TK85",
|
||||
"microsoft-msx2": "MSX2",
|
||||
"midway-mcr": "Midway MCR",
|
||||
"mips": "MIPS",
|
||||
"mips64": "MIPS64",
|
||||
"miuchiz": "Miuchiz",
|
||||
"mohaa": "Medal of Honor: Allied Assault",
|
||||
"mohaa-breakthrough": "Medal of Honor: Allied Assault Breakthrough",
|
||||
"mohaa-spearhead": "Medal of Honor: Allied Assault Spearhead",
|
||||
"msx1": "MSX",
|
||||
"msx2": "MSX2",
|
||||
"msx2+": "MSX2+",
|
||||
"msx2plus": "MSX2+",
|
||||
"msxturboR": "MSX turbo R",
|
||||
"msxturbor": "MSX turbo R",
|
||||
"mysteries-of-the-sith": "Star Wars Jedi Knight: Mysteries of the Sith",
|
||||
"myvision": "Nichibutsu My Vision",
|
||||
"mz2000": "Sharp MZ-2000",
|
||||
"mz2500": "Sharp MZ-2500",
|
||||
"mz700": "Sharp MZ-700",
|
||||
"mz800": "Sharp MZ-800",
|
||||
"mz80k": "Sharp MZ-80K",
|
||||
"nam": "NAM",
|
||||
"namco-na1": "Namco NA-1",
|
||||
"namco-nb1": "Namco NB-1",
|
||||
"namco-system11": "Namco System 11",
|
||||
"namco-system246": "Namco System 246",
|
||||
"namco-system256": "Namco System 256",
|
||||
"namco-system357": "Namco System 357",
|
||||
"namco-system573": "Konami System 573",
|
||||
"naomi2": "Sega NAOMI 2",
|
||||
"napalm": "NAPALM",
|
||||
"nec-pc-80": "NEC PC-8001",
|
||||
"nec-supergrafx": "NEC SuperGrafx",
|
||||
"neogeo64": "SNK Hyper Neo Geo 64",
|
||||
"ngpc": "SNK Neo Geo Pocket Color",
|
||||
"nichibutsu-hrdvd": "Nichibutsu High Rate DVD",
|
||||
"nintendo-aleck64": "Nintendo Aleck64",
|
||||
"nintendo-gb": "Nintendo Game Boy",
|
||||
"nintendo-gbc": "Nintendo Game Boy Color",
|
||||
"nintendo-nss": "Nintendo Super System",
|
||||
"nintendo-playch10": "Nintendo PlayChoice-10",
|
||||
"nintendo-sfcbox": "Nintendo Super Famicom Box",
|
||||
"nintendo-virtualboy": "Nintendo Virtual Boy",
|
||||
"nintendo-wii-arcade": "Nintendo Wii arcade boards",
|
||||
"nmk16": "NMK16",
|
||||
"oberon": "Project Oberon",
|
||||
"olivetti-pc128": "Olivetti Prodest PC 128",
|
||||
"omicron": "Omicron cartridges",
|
||||
"onscripter": "ONScripter visual novels",
|
||||
"openbor": "OpenBOR games",
|
||||
"opengoal": "Jak and Daxter",
|
||||
"oricatmos": "Oric Atmos",
|
||||
"outlaws": "Outlaws",
|
||||
"palm-os": "Palm OS",
|
||||
"pc-engine-ld": "NEC PC Engine LD-ROM2",
|
||||
"pc60": "NEC PC-6001",
|
||||
"pc80": "NEC PC-8001",
|
||||
"pce-tourvision": "TourVision",
|
||||
"pdark": "Perfect Dark",
|
||||
"pegasus": "Aamber Pegasus",
|
||||
"philips-p2000t": "Philips P2000T",
|
||||
"philips-vg5k": "Philips VG 5000",
|
||||
"picocomputer-6502": "Picocomputer 6502 programs",
|
||||
"pocket-challenge-v2": "Benesse Pocket Challenge V2",
|
||||
"powerslave": "PowerSlave",
|
||||
"ppc": "PowerPC",
|
||||
"ppc64": "PowerPC 64-bit",
|
||||
"prey": "Prey",
|
||||
"prince-of-persia": "Prince of Persia",
|
||||
"ps4": "Sony PlayStation 4",
|
||||
"pv1000": "Casio PV-1000",
|
||||
"quadrilateral-cowboy": "Quadrilateral Cowboy",
|
||||
"quake2": "Quake II",
|
||||
"quake3": "Quake III Arena",
|
||||
"quake4": "Quake 4",
|
||||
"realrtcw": "Return to Castle Wolfenstein (RealRTCW)",
|
||||
"recel-system3": "Recel System III",
|
||||
"redneck": "Redneck Rampage",
|
||||
"ricochet": "Ricochet",
|
||||
"ringo-r470": "Ringo R470",
|
||||
"riscv": "RISC-V",
|
||||
"riscv32": "RISC-V 32-bit",
|
||||
"riscv64": "RISC-V 64-bit",
|
||||
"rogue": "Quake II: Ground Zero",
|
||||
"rott": "Rise of the Triad",
|
||||
"rpgmaker": "RPG Maker games",
|
||||
"s390x": "IBM z/Architecture (s390x)",
|
||||
"sam-coupe": "MGT SAM Coupe",
|
||||
"sammy-atomiswave": "Sammy Atomiswave",
|
||||
"sammy-medal": "Sammy medal games",
|
||||
"science-of-cambridge-mk14": "Science of Cambridge MK14",
|
||||
"scott-adams": "Scott Adams adventures",
|
||||
"scott-adams-plus": "Scott Adams Plus adventures",
|
||||
"scummvm": "ScummVM games",
|
||||
"scv": "Epoch Super Cassette Vision",
|
||||
"sdlpal": "The Legend of Sword and Fairy",
|
||||
"sega-atomiswave": "Sammy Atomiswave",
|
||||
"sega-dreamcast-arcade": "Sega Dreamcast-based arcade boards",
|
||||
"sega-isgsm": "Sega ISG Selection Master",
|
||||
"sega-megaplay": "Sega Mega Play",
|
||||
"sega-megatech": "Sega Mega-Tech",
|
||||
"sega-model1": "Sega Model 1",
|
||||
"sega-naomi": "Sega NAOMI",
|
||||
"sega-naomi2": "Sega NAOMI 2",
|
||||
"sega-naomigd": "Sega NAOMI GD-ROM",
|
||||
"sega-outrun": "OutRun",
|
||||
"sega-pico": "Sega Pico",
|
||||
"sega-sg1000": "Sega SG-1000",
|
||||
"sega-shootingzone": "Sega Shooting Zone",
|
||||
"sega-system-sp": "Sega System SP",
|
||||
"sega-system16b": "Sega System 16B",
|
||||
"sega-systemsp": "Sega System SP",
|
||||
"sega-vmu": "Sega Dreamcast VMU",
|
||||
"serious-sam": "Serious Sam",
|
||||
"sg-1000": "Sega SG-1000",
|
||||
"sielectronics-y2": "SiElectronics System Y2",
|
||||
"sinclair-ql": "Sinclair QL",
|
||||
"sinclair-zx-spectrum-next": "ZX Spectrum Next",
|
||||
"sinclair-zx80-81": "Sinclair ZX80 and ZX81",
|
||||
"skin-deep": "Skin Deep",
|
||||
"smbx": "Super Mario Bros. X",
|
||||
"snk-neogeo-aes": "SNK Neo Geo AES",
|
||||
"snk-neogeo-mvs": "SNK Neo Geo MVS",
|
||||
"snk-neogeo": "SNK Neo Geo",
|
||||
"neogeo": "SNK Neo Geo",
|
||||
"snk-ngpc": "SNK Neo Geo Pocket Color",
|
||||
"soh": "The Legend of Zelda: Ocarina of Time",
|
||||
"sonic-1-2013": "Sonic the Hedgehog (2013)",
|
||||
"sonic-2-2013": "Sonic the Hedgehog 2 (2013)",
|
||||
"sonic-mania": "Sonic Mania",
|
||||
"soniccd": "Sonic CD",
|
||||
"sony-psp": "Sony PlayStation Portable",
|
||||
"sparc": "SPARC",
|
||||
"sparc64": "SPARC64",
|
||||
"spectravideo": "Spectravideo",
|
||||
"star-control-2": "Star Control II",
|
||||
"starship": "Star Fox 64",
|
||||
"strife": "Strife",
|
||||
"sunplus-native32": "Sunplus Native32",
|
||||
"sunplus-spmp8000": "Sunplus SPMP8000",
|
||||
"super-kaneko-nova": "Kaneko Super Nova System",
|
||||
"super-mario-war": "Super Mario War game",
|
||||
"superacan": "Funtech Super A'Can",
|
||||
"supergrafx": "NEC SuperGrafx",
|
||||
"supergrafx-cd": "NEC SuperGrafx CD",
|
||||
"solarus": "Solarus games",
|
||||
"supertux": "SuperTux game",
|
||||
"supertuxkart": "SuperTuxKart game",
|
||||
"supracan": "Funtech Super A'Can",
|
||||
"symbian": "Symbian OS",
|
||||
"tab-silverball": "TAB Austria Silverball",
|
||||
"tads": "TADS",
|
||||
"taito-cchip": "Taito C-Chip",
|
||||
"taito-fx1": "Taito FX-1",
|
||||
"taito-gnet": "Taito G-NET",
|
||||
"taito-type-x": "Taito Type X",
|
||||
"taito-typezero": "Taito Type Zero",
|
||||
"tamagotchi-p1": "Bandai Tamagotchi P1",
|
||||
"tandy-1000": "Tandy 1000",
|
||||
"taylormade": "TaylorMade",
|
||||
"teamarena": "Quake III: Team Arena",
|
||||
"tecmo-tps": "Tecmo TPS",
|
||||
"tfc": "Team Fortress Classic",
|
||||
"the-dark-mod": "The Dark Mod",
|
||||
"thomson-mo6": "Thomson MO6",
|
||||
"thomson-to7": "Thomson TO7",
|
||||
"thomson-to770": "Thomson TO7/70",
|
||||
"thomson-to8": "Thomson TO8",
|
||||
"thomson-to8d": "Thomson TO8D",
|
||||
"thomson-to9": "Thomson TO9",
|
||||
"thomson-to9plus": "Thomson TO9+",
|
||||
"tic80": "TIC-80 cartridges",
|
||||
"tiger-game-com": "Tiger Game.com",
|
||||
"timex-tc2048": "Timex Computer 2048",
|
||||
"timex-ts1500": "Timex Sinclair 1500",
|
||||
"timex-ts2068": "Timex Sinclair 2068",
|
||||
"tomb-raider": "Tomb Raider",
|
||||
"tomb-raider-1": "Tomb Raider",
|
||||
"tomb-raider-2": "Tomb Raider II",
|
||||
"transport-tycoon-deluxe": "Transport Tycoon Deluxe",
|
||||
"tvgames": "Plug-and-play TV games",
|
||||
"tyrian": "Tyrian",
|
||||
"ur-quan-masters": "Star Control II",
|
||||
"urban-terror": "Urban Terror",
|
||||
"uzebox": "Uzebox",
|
||||
"vaporspec": "VaporSpec cartridges",
|
||||
"vc4000": "Interton VC 4000",
|
||||
"vg5k": "Philips VG 5000",
|
||||
"vgmplay": "Video game music files",
|
||||
"videobrain": "Umtech VideoBrain",
|
||||
"videosystem-zn1": "Video System ZN-1",
|
||||
"vircon32": "Vircon32 cartridges",
|
||||
"virtuality-su2000": "Virtuality SU2000",
|
||||
"vm-labs-nuon": "VM Labs Nuon",
|
||||
"vpinball": "Visual Pinball tables",
|
||||
"vtech-vsmile": "VTech V.Smile",
|
||||
"vvvvvv": "VVVVVV game",
|
||||
"watara-supervision": "Watara Supervision",
|
||||
"wonderswan-color": "Bandai WonderSwan Color",
|
||||
"ww2gi": "World War II GI",
|
||||
"x86": "x86 PC",
|
||||
"x86-64": "x86-64 PC",
|
||||
"xatrix": "Quake II: The Reckoning",
|
||||
"xrick": "Rick Dangerous",
|
||||
"ym2608": "Yamaha YM2608",
|
||||
"zc210": "Zelda Classic",
|
||||
"zeldaclassic": "Zelda Classic",
|
||||
"zn1-acclaim": "Acclaim ZN-1",
|
||||
"zn1-atlus": "Atlus ZN-1",
|
||||
"zn1-capcom": "Capcom ZN-1",
|
||||
# mame2003 files taitofx1.zip and tps.zip under these ids, its notes
|
||||
# name the boards: the Taito FX-1 and the Tecmo TPS, both ZN-1 based.
|
||||
"zn1-taito": "Taito FX-1",
|
||||
"zn1-tecmo": "Tecmo TPS",
|
||||
"zn1-video-system": "Video System ZN-1",
|
||||
"zn2-capcom": "Capcom ZN-2",
|
||||
"zx-spectrum-128": "Sinclair ZX Spectrum 128",
|
||||
}
|
||||
|
||||
|
||||
# A system id with no section of its own -> the (manufacturer, console)
|
||||
# section holding its files: a model, a regional name or an add-on of the
|
||||
# machine that section covers, or a game whose data that section files.
|
||||
# Reviewed entry by entry against the files the profiles and platforms
|
||||
# declare for the id, never decided by a vote of the folders those files
|
||||
# sit in. A section that is not the machine stays out of this table even
|
||||
# when it holds a copy: NAOMI's naomi2.zip filed with the Dreamcast, the
|
||||
# PET's ROMs in VICE's tree under the C128, the Arcadia's under the Saturn.
|
||||
SYSTEM_PARENTS: dict[str, tuple[str, str]] = {
|
||||
# Nintendo. The twin folders (DS and Nintendo DS, 64DD and Nintendo
|
||||
# 64DD) gave each name two headings and no link.
|
||||
"64dd": ("Nintendo", "Nintendo 64DD"),
|
||||
"nintendo-64dd": ("Nintendo", "Nintendo 64DD"),
|
||||
"nintendo-ds": ("Nintendo", "Nintendo DS"),
|
||||
"nintendo-dsi": ("Nintendo", "Nintendo DS"),
|
||||
"famicom": ("Nintendo", "NES"),
|
||||
"super-famicom": ("Nintendo", "SNES"),
|
||||
# Bandai: the Color boot ROMs, and those of Benesse's WonderSwan-based
|
||||
# Pocket Challenge V2, sit with the WonderSwan.
|
||||
"wonderswan-color": ("Bandai", "WonderSwan"),
|
||||
"bandai-wswanc": ("Bandai", "WonderSwan"),
|
||||
"pocket-challenge-v2": ("Bandai", "WonderSwan"),
|
||||
# SNK
|
||||
"ngpc": ("SNK", "Neo Geo Pocket"),
|
||||
"snk-ngpc": ("SNK", "Neo Geo Pocket"),
|
||||
"snk-neogeo-aes": ("SNK", "Neo Geo"),
|
||||
"snk-neogeo-mvs": ("SNK", "Neo Geo"),
|
||||
# The platforms' one Neo Geo system, as Batocera and RetroDECK spell it.
|
||||
"snk-neogeo": ("SNK", "Neo Geo"),
|
||||
"neogeo": ("SNK", "Neo Geo"),
|
||||
# Sega. The VMU is the Dreamcast's memory card, its images sit there.
|
||||
# Sega's arcade section holds the OutRun board ROMs Cannonball reads.
|
||||
"sega-genesis": ("Sega", "Mega Drive"),
|
||||
"mega-cd-32x": ("Sega", "Mega CD"),
|
||||
"sega-vmu": ("Sega", "Dreamcast"),
|
||||
"sega-outrun": ("Sega", "Arcade"),
|
||||
# NEC and Pioneer: both LaserActive packs (LD-ROM2 and Mega LD) file
|
||||
# their BIOS under the LaserActive.
|
||||
"nec-supergrafx": ("NEC", "PC Engine"),
|
||||
"supergrafx": ("NEC", "PC Engine"),
|
||||
"supergrafx-cd": ("NEC", "PC Engine CD"),
|
||||
"pc-engine-ld": ("Pioneer", "LaserActive"),
|
||||
"mega-ld": ("Pioneer", "LaserActive"),
|
||||
# Microsoft MSX generations
|
||||
"microsoft-msx2": ("Microsoft", "MSX"),
|
||||
"msx2": ("Microsoft", "MSX"),
|
||||
"msx2plus": ("Microsoft", "MSX"),
|
||||
"msx2+": ("Microsoft", "MSX"),
|
||||
"msxturboR": ("Microsoft", "MSX"),
|
||||
"msxturbor": ("Microsoft", "MSX"),
|
||||
# Sinclair: 128-0.rom and 128-1.rom, and Timex's tc2048.rom.
|
||||
"zx-spectrum-128": ("Sinclair", "ZX Spectrum"),
|
||||
"timex-tc2048": ("Sinclair", "ZX Spectrum"),
|
||||
# Acorn: os12.rom and basic2.rom for the Model B and B+, and the
|
||||
# Master Compact's bbcmc.zip.
|
||||
"bbc-micro-b": ("Acorn", "BBC Micro"),
|
||||
"bbc-micro-bplus": ("Acorn", "BBC Micro"),
|
||||
"bbc-master-compact": ("Acorn", "BBC Micro"),
|
||||
# Atari: falcon.img, ste.img and tt.img sit with the ST TOS images.
|
||||
"atari-ste": ("Atari", "ST"),
|
||||
"atari-tt": ("Atari", "ST"),
|
||||
"atari-falcon": ("Atari", "ST"),
|
||||
# Home computers filed under their family
|
||||
"apple-iie": ("Apple", "Apple II"),
|
||||
"apf-m1000": ("APF", "Imagination Machine"),
|
||||
"apfm1000": ("APF", "Imagination Machine"),
|
||||
"bbk-longman-4980": ("BBK", "A4980"),
|
||||
"bbk-longman-4988": ("BBK", "A4988"),
|
||||
"coco3": ("Tandy", "CoCo"),
|
||||
"commodore-cdtv": ("Commodore", "Amiga"),
|
||||
"dragon32": ("Dragon", "Dragon"),
|
||||
"dragon64": ("Dragon", "Dragon"),
|
||||
"enterprise-64": ("Enterprise", "64-128"),
|
||||
"enterprise-128": ("Enterprise", "64-128"),
|
||||
"fm77av": ("Fujitsu", "FM-7"),
|
||||
"gamepock": ("Epoch", "Game Pocket"),
|
||||
"ibm-pcjr": ("IBM", "PC"),
|
||||
"ibm-xt": ("IBM", "PC"),
|
||||
"marty": ("Fujitsu", "FM Towns"),
|
||||
"mz700": ("Sharp", "MZ"),
|
||||
"mz80k": ("Sharp", "MZ"),
|
||||
"mz800": ("Sharp", "MZ"),
|
||||
"oricatmos": ("Tangerine", "Oric"),
|
||||
"palm-os": ("Palm", "Palm"),
|
||||
"philips-vg5k": ("Philips", "VG5000"),
|
||||
"vg5k": ("Philips", "VG5000"),
|
||||
"videobrain": ("VideoBrain", "Family Computer"),
|
||||
# Computers whose sets sit under bios/Arcade with MAME's: the Atom has
|
||||
# no folder of its own, its section holds those sets. The MZ-2000 and
|
||||
# MZ-2500 sets join the MZ ones.
|
||||
"atom": ("Acorn", "Atom"),
|
||||
"mz2000": ("Sharp", "MZ"),
|
||||
"mz2500": ("Sharp", "MZ"),
|
||||
# Files kept at the maker's root, so each file is a heading of its own
|
||||
# on a page that is the machine's: the first one leads there.
|
||||
"galaksija": ("Galaksija", "Galaksija"),
|
||||
"vircon32": ("Vircon", "Vircon32"),
|
||||
# Games, filed with the game whose folder holds their data
|
||||
"dinothawr": ("Dinothawr", "Dinothawr"),
|
||||
"doom": ("Id Software", "Doom"),
|
||||
# The other games of the Doom engines keep their IWADs in its folder.
|
||||
"heretic": ("Id Software", "Doom"),
|
||||
"hexen": ("Id Software", "Doom"),
|
||||
"strife": ("Id Software", "Doom"),
|
||||
"chex": ("Id Software", "Doom"),
|
||||
"ctf": ("Id Software", "Quake II"),
|
||||
"teamarena": ("Id Software", "Quake III Arena"),
|
||||
"enemyterritory": ("Id Software", "Wolfenstein Enemy Territory"),
|
||||
"gearbox": ("Valve", "Half-Life"),
|
||||
"dmc": ("Valve", "Half-Life"),
|
||||
"ricochet": ("Valve", "Half-Life"),
|
||||
"tfc": ("Valve", "Half-Life"),
|
||||
"mohaa": ("Electronic Arts", "Medal of Honor Allied Assault"),
|
||||
"mohaa-breakthrough": ("Electronic Arts", "Medal of Honor Allied Assault"),
|
||||
"mohaa-spearhead": ("Electronic Arts", "Medal of Honor Allied Assault"),
|
||||
"ur-quan-masters": ("Toys for Bob", "The Ur-Quan Masters"),
|
||||
"star-control-2": ("Toys for Bob", "The Ur-Quan Masters"),
|
||||
# Systems whose files sit in the folder of the program that reads them,
|
||||
# the only section listing them. DOS and ScummVM also read the Roland
|
||||
# MT-32 ROMs, which their own sections do not hold.
|
||||
"bbc-master-128": ("Other", "beebem"),
|
||||
"bbc-master-et": ("Other", "beebem"),
|
||||
"cave-story": ("Other", "NXEngine"),
|
||||
"dos": ("DOS", "DOSBox"),
|
||||
"scummvm": ("ScummVM", "ScummVM"),
|
||||
"sinclair-zx-spectrum-next": ("Other", "cspect"),
|
||||
"solarus": ("Game Engines", "Solarus"),
|
||||
"sunplus-spmp8000": ("Other", "spmp8000emu"),
|
||||
"tomb-raider-1": ("Game Engines", "TRX"),
|
||||
"tyrian": ("Other", "opentyrian"),
|
||||
"vm-labs-nuon": ("Other", "nuance"),
|
||||
"xrick": ("Other", "xrick"),
|
||||
"zc210": ("ZC", "ZC210"),
|
||||
# The collection's general arcade section, where naomi.zip, neogeo.zip
|
||||
# and the other board sets sit. A sound chip's set and a toy's stay in
|
||||
# the Arcade folders holding them: neither is an arcade board.
|
||||
"arcade": ("Arcade", "Arcade"),
|
||||
"miuchiz": ("Arcade", "MAME"),
|
||||
"ym2608": ("Arcade", "Arcade"),
|
||||
}
|
||||
|
||||
|
||||
# A system id that names a family of arcade boards -> the board its link
|
||||
# leads to. RetroArch's sega-dreamcast-arcade lists the NAOMI, NAOMI 2 and
|
||||
# Atomiswave BIOS: the NAOMI page comes first, the Dreamcast section links
|
||||
|
||||
@@ -14,7 +14,6 @@ from __future__ import annotations
|
||||
import html
|
||||
import json
|
||||
import re
|
||||
import unicodedata
|
||||
import urllib.parse
|
||||
from collections.abc import Callable, Iterator, Mapping
|
||||
from dataclasses import dataclass, field
|
||||
@@ -22,6 +21,7 @@ from html import unescape
|
||||
from pathlib import Path, PurePosixPath
|
||||
|
||||
from core.paths import REPO_ROOT
|
||||
from core.anchors import _unique, toc_slug
|
||||
|
||||
BASE = "/retrobios/"
|
||||
SITE_URL = "https://abdess.github.io/retrobios/"
|
||||
@@ -47,7 +47,6 @@ MD_LINK = re.compile(r"(?P<bang>!?)\[(?P<text>(?:[^\[\]\n]|\[[^\]\n]*\])*)\]\((?
|
||||
HTML_URL = re.compile(r"(?P<attr>\b(?:href|src))=\"(?P<url>[^\"]*)\"")
|
||||
ATTR_BLOCK = re.compile(r"[ \t]*\{(?P<attrs>[^{}]*)\}[ \t]*$")
|
||||
ID_ATTR = re.compile(r"\bid=\"(?P<id>[^\"]+)\"")
|
||||
IDCOUNT = re.compile(r"^(.*)_([0-9]+)$")
|
||||
|
||||
|
||||
# Addresses
|
||||
@@ -128,27 +127,6 @@ def rewrite_links(text: str, rel: str) -> str:
|
||||
return outside_fences(text, lambda chunk: HTML_URL.sub(attribute, chunk))
|
||||
|
||||
|
||||
# Heading ids, as Python-Markdown's toc extension gives them
|
||||
|
||||
|
||||
def toc_slug(text: str) -> str:
|
||||
text = re.sub(r"<[^>]+>", "", text)
|
||||
text = re.sub(r"!\[[^\]]*\]\([^)]*\)(\{[^}]*\})?", "", text)
|
||||
text = re.sub(r"\[([^\]]*)\]\([^)]*\)", r"\1", text)
|
||||
text = unescape(text.replace("`", "").replace("**", "").replace("\\", ""))
|
||||
text = unicodedata.normalize("NFKD", text).encode("ascii", "ignore").decode("ascii")
|
||||
text = re.sub(r"[^\w\s-]", "", text).strip().lower()
|
||||
return re.sub(r"[-\s]+", "-", text)
|
||||
|
||||
|
||||
def _unique(ident: str, used: set[str]) -> str:
|
||||
while ident in used or not ident:
|
||||
match = IDCOUNT.match(ident)
|
||||
ident = f"{match[1]}_{int(match[2]) + 1}" if match else f"{ident}_1"
|
||||
used.add(ident)
|
||||
return ident
|
||||
|
||||
|
||||
def pin_heading_ids(text: str, title_id: str = "") -> str:
|
||||
"""Every heading with the id the MkDocs build gave it. *title_id* is
|
||||
the page title's, taken first."""
|
||||
|
||||
@@ -428,7 +428,7 @@ def _check_get_pages(
|
||||
"""
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
import release_record
|
||||
from siteguides import INSTALL_SH
|
||||
from model.guides import INSTALL_SH
|
||||
from model.registry import list_registered_platforms, list_release_pack_platforms
|
||||
|
||||
if not (platforms_dir / "_registry.yml").is_file():
|
||||
|
||||
@@ -60,7 +60,7 @@ class ReadmeRegressions(unittest.TestCase):
|
||||
|
||||
def test_advertised_bootstrap_urls_are_the_shipped_ones(self):
|
||||
import sitebootstrap
|
||||
from siteguides import INSTALL_BASE
|
||||
from model.guides import INSTALL_BASE
|
||||
|
||||
quick_install = self._quick_install()
|
||||
for name in sitebootstrap.SOURCES:
|
||||
@@ -880,7 +880,7 @@ class PackReadmesSayWhatTheInstallerDoes(unittest.TestCase):
|
||||
return text[text.index("INSTALLATION"):text.index("TROUBLESHOOTING")]
|
||||
|
||||
def test_retroarch_offers_the_windows_installer(self):
|
||||
from siteguides import INSTALL_PS1, INSTALL_SH
|
||||
from model.guides import INSTALL_PS1, INSTALL_SH
|
||||
|
||||
guide = self._guide("retroarch")
|
||||
self.assertIn(f"{INSTALL_SH} | sh", guide)
|
||||
@@ -907,7 +907,7 @@ class PackReadmesSayWhatTheInstallerDoes(unittest.TestCase):
|
||||
|
||||
def test_retropie_never_sends_a_pc_to_the_linux_partition(self):
|
||||
guide = self._guide("retropie")
|
||||
from siteguides import INSTALL_SH
|
||||
from model.guides import INSTALL_SH
|
||||
|
||||
self.assertNotIn("Put the SD card in your PC", guide)
|
||||
self.assertIn(f"{INSTALL_SH} | sh", guide)
|
||||
|
||||
@@ -910,7 +910,7 @@ class RetroArchWindowsSystemFolder(unittest.TestCase):
|
||||
source = inspect.getsource(install)
|
||||
self.assertIn('ra_dir or exe_dir / "system"', source)
|
||||
self.assertTrue(str(install._os_default_dests("windows")["retroarch"]).replace("\\", "/").endswith("/system"))
|
||||
from siteguides import GUIDES
|
||||
from model.guides import GUIDES
|
||||
|
||||
guide = GUIDES["retroarch"]
|
||||
section = "\n".join([*(path for _label, path in guide.folders), *guide.notes])
|
||||
@@ -923,7 +923,7 @@ class RetroArchWindowsSystemFolder(unittest.TestCase):
|
||||
(platform_darwin.m), Application Support only for a portable or
|
||||
Steam build, and install.py looks there in that order."""
|
||||
import install
|
||||
from siteguides import GUIDES
|
||||
from model.guides import GUIDES
|
||||
|
||||
source = inspect.getsource(install._macos_retroarch_base)
|
||||
self.assertIn('Path.home() / "Documents" / "RetroArch"', source)
|
||||
@@ -1626,7 +1626,7 @@ def unserved_one_liners(page: str, text: str) -> list[str]:
|
||||
address of the repository stays as the fallback of the One line
|
||||
section, and must name a bootstrap the repository holds."""
|
||||
import sitebootstrap
|
||||
from siteguides import INSTALL_BASE
|
||||
from model.guides import INSTALL_BASE
|
||||
|
||||
served = {f"{INSTALL_BASE}/{name}" for name in sitebootstrap.SOURCES}
|
||||
fallback = _section(text, "One line") if page == "installer.md" else ""
|
||||
|
||||
@@ -68,7 +68,7 @@ class ThePackGuideNamesTheInstallerDefault(unittest.TestCase):
|
||||
rule["path"] for rule in registry["retrobat"]["install"]["detect"]
|
||||
if rule["os"] == "windows" and rule["method"] == "path_exists"
|
||||
)
|
||||
from siteguides import pack_manual
|
||||
from model.guides import pack_manual
|
||||
|
||||
# The pack guide text is data (platforms/_guides.yml): read what the
|
||||
# pack README prints, not the source of the script that prints it.
|
||||
|
||||
@@ -117,14 +117,14 @@ class TheOneLinerFollowsTheRegistry(unittest.TestCase):
|
||||
"""The address comes from install_base in platforms/_guides.yml, the
|
||||
one the site's commands use."""
|
||||
from packs import readme as packreadme
|
||||
import sitebootstrap
|
||||
from siteguides import INSTALL_BASE
|
||||
from model import guides
|
||||
from model.guides import INSTALL_BASE
|
||||
|
||||
source = (REPO_ROOT / "scripts" / "packs" / "readme.py").read_text(encoding="utf-8")
|
||||
self.assertNotIn("raw.githubusercontent.com", source)
|
||||
self.assertNotIn("abdess.github.io", source)
|
||||
self.assertEqual(packreadme.INSTALL_SH, f"{INSTALL_BASE}/{sitebootstrap.SH_NAME}")
|
||||
self.assertEqual(packreadme.INSTALL_PS1, f"{INSTALL_BASE}/{sitebootstrap.PS1_NAME}")
|
||||
self.assertEqual(packreadme.INSTALL_SH, f"{INSTALL_BASE}/{guides.SH_NAME}")
|
||||
self.assertEqual(packreadme.INSTALL_PS1, f"{INSTALL_BASE}/{guides.PS1_NAME}")
|
||||
|
||||
|
||||
class GuidesInstallFromTheZipInHand(unittest.TestCase):
|
||||
|
||||
@@ -21,7 +21,8 @@ from pathlib import Path
|
||||
|
||||
|
||||
import siterender
|
||||
from sitestarlight import toc_slug
|
||||
from model import systemnames
|
||||
from core.anchors import toc_slug
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -67,8 +68,8 @@ STAYS_PLAIN = {
|
||||
def _reset() -> None:
|
||||
"""Back to the repository's sections and boards, none written."""
|
||||
siterender._arcade_source[0] = None
|
||||
siterender._boards_built[0] = False
|
||||
siterender._sections_installed[0] = False
|
||||
systemnames._boards_built[0] = False
|
||||
systemnames._sections_installed[0] = False
|
||||
siterender.reset_console_pages()
|
||||
|
||||
|
||||
@@ -100,7 +101,7 @@ class Boards(unittest.TestCase):
|
||||
names = set(boards.values())
|
||||
for sys_id, name in NAMED_BOARDS.items():
|
||||
with self.subTest(sys_id=sys_id):
|
||||
self.assertEqual(siterender.system_name(sys_id), name)
|
||||
self.assertEqual(systemnames.system_name(sys_id), name)
|
||||
self.assertIn(name, names)
|
||||
|
||||
def test_every_copy_names_its_board(self) -> None:
|
||||
@@ -227,7 +228,7 @@ class BoardRules(unittest.TestCase):
|
||||
tmp_root.mkdir(exist_ok=True)
|
||||
self._tmp = tempfile.TemporaryDirectory(dir=tmp_root)
|
||||
self.root = Path(self._tmp.name)
|
||||
siterender.set_console_sections({("Arcade", "MAME"), ("SNK", "Neo Geo")})
|
||||
systemnames.set_console_sections({("Arcade", "MAME"), ("SNK", "Neo Geo")})
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self._tmp.cleanup()
|
||||
|
||||
@@ -23,7 +23,8 @@ from unittest import mock
|
||||
|
||||
import install
|
||||
import sitebootstrap
|
||||
from siteguides import INSTALL_BASE, INSTALL_PS1, INSTALL_SH, install_command
|
||||
from model import guides
|
||||
from model.guides import INSTALL_BASE, INSTALL_PS1, INSTALL_SH, install_command
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -156,8 +157,8 @@ class DocumentedCommands(unittest.TestCase):
|
||||
site = re.search(r"const SITE = '([^']+)'", config).group(1)
|
||||
base = re.search(r"const BASE = '([^']+)'", config).group(1)
|
||||
self.assertEqual(f"{INSTALL_BASE}/", site + base)
|
||||
self.assertEqual(INSTALL_SH, f"{site}{base}{sitebootstrap.SH_NAME}")
|
||||
self.assertEqual(INSTALL_PS1, f"{site}{base}{sitebootstrap.PS1_NAME}")
|
||||
self.assertEqual(INSTALL_SH, f"{site}{base}{guides.SH_NAME}")
|
||||
self.assertEqual(INSTALL_PS1, f"{site}{base}{guides.PS1_NAME}")
|
||||
self.assertEqual(install.BOOTSTRAP_URL, INSTALL_SH)
|
||||
self.assertEqual(f"{install.BOOTSTRAP_URL}.ps1", INSTALL_PS1)
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ from pathlib import Path
|
||||
import yaml
|
||||
|
||||
import generate_site
|
||||
import siteguides
|
||||
from siteguides import GUIDES, GuideError, load_guides
|
||||
from model import guides
|
||||
from model.guides import GUIDES, GuideError, load_guides
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -96,10 +96,10 @@ class GuidesLiveInYaml(unittest.TestCase):
|
||||
self._load(_guides_text(), registry)
|
||||
|
||||
def test_the_pack_readme_keeps_its_indent(self):
|
||||
manual = siteguides.pack_manual("retrobat")
|
||||
manual = guides.pack_manual("retrobat")
|
||||
self.assertTrue(manual.startswith(" Option B: Manual\n ----------------\n"))
|
||||
self.assertTrue(manual.endswith(" 4. Overwrite if asked\n\n"))
|
||||
self.assertEqual(siteguides.pack_manual("minui"), "")
|
||||
self.assertEqual(guides.pack_manual("minui"), "")
|
||||
|
||||
|
||||
# A table of prose keyed by platform: what the guides file replaced.
|
||||
|
||||
@@ -116,7 +116,7 @@ class TheTapeAndTheDriverAgree(unittest.TestCase):
|
||||
self.assertEqual(variant.mount, "/roms")
|
||||
|
||||
def test_the_command_typed_is_the_one_the_pages_give(self):
|
||||
from siteguides import install_command
|
||||
from model.guides import install_command
|
||||
|
||||
self.assertIn(f'Type "{install_command("sh", "--for-games")}"\n', self.tape)
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import json
|
||||
|
||||
import generate_site as gs
|
||||
import siterender
|
||||
from model import systemnames
|
||||
import validate_site
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -222,7 +223,7 @@ class TheIndexNamesEmulatorsAndSystems(unittest.TestCase):
|
||||
self.assertNotIn("| Engine |", page)
|
||||
self.assertNotIn(" -- ", page)
|
||||
row = next(line for line in page.splitlines() if line.startswith("| [DuckStation]"))
|
||||
self.assertIn(f"[{siterender.system_name('sony-playstation')}]", row)
|
||||
self.assertIn(f"[{systemnames.system_name('sony-playstation')}]", row)
|
||||
self.assertIn("(../systems/sony.md#playstation)", row)
|
||||
self.assertNotIn("sony-playstation |", row)
|
||||
|
||||
|
||||
+46
-46
@@ -45,7 +45,7 @@ import yaml
|
||||
import generate_readme
|
||||
import generate_site
|
||||
import release_record
|
||||
import siteguides
|
||||
from model import guides
|
||||
import sitemarkup
|
||||
from model.platforms import load_platform_config
|
||||
from model.registry import load_platform_registry
|
||||
@@ -86,7 +86,7 @@ class TrustItemsSayWhereItWrites(unittest.TestCase):
|
||||
for entry in json.loads(path.read_text(encoding="utf-8")).get("files", []))
|
||||
]
|
||||
self.assertTrue(saves, "no manifest files an entry under root: save")
|
||||
text = " ".join(siteguides.TRUST_ITEMS).lower()
|
||||
text = " ".join(guides.TRUST_ITEMS).lower()
|
||||
self.assertNotIn("only in your bios folder", text)
|
||||
self.assertIn("save folder", text)
|
||||
self.assertIn("--restore", text)
|
||||
@@ -94,7 +94,7 @@ class TrustItemsSayWhereItWrites(unittest.TestCase):
|
||||
def test_home_shows_the_same_items(self):
|
||||
# A term's first use on the page carries its gloss.
|
||||
home = re.sub(r"</?abbr[^>]*>", "", _page("index.md"))
|
||||
for item in siteguides.TRUST_ITEMS:
|
||||
for item in guides.TRUST_ITEMS:
|
||||
self.assertIn(f"- {item}", home)
|
||||
self.assertNotIn("only in your BIOS folder", home)
|
||||
|
||||
@@ -137,7 +137,7 @@ class DatesInWords(unittest.TestCase):
|
||||
class OneSetupCount(unittest.TestCase):
|
||||
def test_every_entry_page_states_the_registry_count(self):
|
||||
count = len(REGISTRY)
|
||||
self.assertEqual(siteguides.setup_count(), count)
|
||||
self.assertEqual(guides.setup_count(), count)
|
||||
self.assertIn(f"and {count - 3} more.", _page("index.md"))
|
||||
self.assertIn(f'<span class="rb-stat-value">{count}</span>', _page("explore.md"))
|
||||
|
||||
@@ -147,7 +147,7 @@ class SetupTiles(unittest.TestCase):
|
||||
for name in ("index.md", "which-pack.md"):
|
||||
text = _page(name)
|
||||
with self.subTest(page=name):
|
||||
extra = sum(len(tiles) for tiles in siteguides.GROUP_TILES.values())
|
||||
extra = sum(len(tiles) for tiles in guides.GROUP_TILES.values())
|
||||
self.assertEqual(text.count('class="rb-card rb-tile"'), len(REGISTRY) + extra)
|
||||
for key in REGISTRY:
|
||||
self.assertIn(f'href="/retrobios/platforms/{key}/"', text)
|
||||
@@ -168,7 +168,7 @@ class SetupTiles(unittest.TestCase):
|
||||
home = _page("index.md")
|
||||
display = {k: load_platform_config(k, str(REPO_ROOT / "platforms")).get("platform", k)
|
||||
for k in REGISTRY}
|
||||
for group, (label, _description) in siteguides.DEVICE_GROUPS.items():
|
||||
for group, (label, _description) in guides.DEVICE_GROUPS.items():
|
||||
members = [k for k in REGISTRY if REGISTRY[k].get("device_group") == group]
|
||||
if len(members) == 1:
|
||||
with self.subTest(group=group):
|
||||
@@ -176,9 +176,9 @@ class SetupTiles(unittest.TestCase):
|
||||
self.assertIn(f">{display[members[0]]}</strong>", home)
|
||||
|
||||
def test_hardware_is_named_and_cited(self):
|
||||
self.assertIn("Raspberry Pi", siteguides.GUIDES["batocera"].summary)
|
||||
self.assertIn("Raspberry Pi", siteguides.DEVICE_GROUPS["gaming-os"][0])
|
||||
self.assertIn("Anbernic", siteguides.DEVICE_GROUPS["handheld"][0])
|
||||
self.assertIn("Raspberry Pi", guides.GUIDES["batocera"].summary)
|
||||
self.assertIn("Raspberry Pi", guides.DEVICE_GROUPS["gaming-os"][0])
|
||||
self.assertIn("Anbernic", guides.DEVICE_GROUPS["handheld"][0])
|
||||
lines = GUIDES_YAML.splitlines()
|
||||
for number, line in enumerate(lines):
|
||||
if re.match(r" (runs_on|terminal):", line):
|
||||
@@ -224,7 +224,7 @@ class GuideRoutes(unittest.TestCase):
|
||||
text = _page("platforms/batocera.md")
|
||||
self.assertLess(text.index("## From a computer"), text.index("## On the device"))
|
||||
self.assertIn("{ #install }", "\n".join(generate_site._guide_install(
|
||||
"batocera", siteguides.GUIDES["batocera"], "## On the device { #install }")))
|
||||
"batocera", guides.GUIDES["batocera"], "## On the device { #install }")))
|
||||
self.assertIn("Unzip them all into the network folder above", text)
|
||||
|
||||
def test_a_computer_app_keeps_the_command_first(self):
|
||||
@@ -232,8 +232,8 @@ class GuideRoutes(unittest.TestCase):
|
||||
self.assertLess(text.index("## Install"), text.index("## Download"))
|
||||
|
||||
def test_each_device_tab_says_how_to_open_its_terminal(self):
|
||||
shared = siteguides.TERMINALS["device"][1]
|
||||
for name, guide in siteguides.GUIDES.items():
|
||||
shared = guides.TERMINALS["device"][1]
|
||||
for name, guide in guides.GUIDES.items():
|
||||
if "device" not in guide.run:
|
||||
continue
|
||||
with self.subTest(platform=name):
|
||||
@@ -256,17 +256,17 @@ class GuideRoutes(unittest.TestCase):
|
||||
|
||||
class PackManualReadsThePageFolders(unittest.TestCase):
|
||||
def test_every_path_in_a_pack_manual_is_a_folder_of_its_page(self):
|
||||
for name, guide in siteguides.GUIDES.items():
|
||||
for name, guide in guides.GUIDES.items():
|
||||
if not guide.pack_manual:
|
||||
continue
|
||||
known = " ".join(path.replace("`", "") for _w, path in siteguides.folder_list(name))
|
||||
known = " ".join(path.replace("`", "") for _w, path in guides.folder_list(name))
|
||||
known += " " + str(REGISTRY[name].get("extract_to") or "")
|
||||
for path in ABSOLUTE_PATH.findall(siteguides.pack_manual(name)):
|
||||
for path in ABSOLUTE_PATH.findall(guides.pack_manual(name)):
|
||||
with self.subTest(platform=name, path=path):
|
||||
self.assertIn(path.rstrip(".:"), known)
|
||||
|
||||
def test_the_retroarch_manual_lists_the_detected_systems(self):
|
||||
manual = siteguides.pack_manual("retroarch")
|
||||
manual = guides.pack_manual("retroarch")
|
||||
self.assertNotIn("{folders}", manual)
|
||||
self.assertIn("/run/muos/storage/bios", manual)
|
||||
self.assertIn("~/.var/app/org.libretro.RetroArch/config/retroarch/system/", manual)
|
||||
@@ -317,7 +317,7 @@ class CommandBlocks(unittest.TestCase):
|
||||
self.assertEqual(sorted(set(sh_args)), sorted(set(ps_args)))
|
||||
self.assertEqual(len(set(sh_args)), 2)
|
||||
self.assertIn('```powershell title="PowerShell"', block)
|
||||
for key, guide in siteguides.GUIDES.items():
|
||||
for key, guide in guides.GUIDES.items():
|
||||
if "windows" in guide.run:
|
||||
with self.subTest(platform=key):
|
||||
self.assertIn("/i.ps1", _guide_part(_page(f"platforms/{key}.md")))
|
||||
@@ -351,7 +351,7 @@ class HomeLinksTheOtherTasks(unittest.TestCase):
|
||||
self.assertLess(home.index("/retrobios/wiki/troubleshooting/"), home.index("## Is it needed? { #do-i-need-it }"))
|
||||
|
||||
|
||||
GUIDE = siteguides.HANDHELD_GUIDE
|
||||
GUIDE = guides.HANDHELD_GUIDE
|
||||
|
||||
|
||||
def _plain_guide_part(text: str) -> str:
|
||||
@@ -367,7 +367,7 @@ def _display(key: str) -> str:
|
||||
|
||||
class HandheldWayIn(unittest.TestCase):
|
||||
def test_android_and_linux_tiles_on_home_and_get_your_files(self):
|
||||
tiles = siteguides.GROUP_TILES.get("handheld", ())
|
||||
tiles = guides.GROUP_TILES.get("handheld", ())
|
||||
self.assertEqual([tile.name for tile in tiles],
|
||||
["Android", "Linux handhelds", "iPhone and iPad"])
|
||||
for name in ("index.md", "which-pack.md"):
|
||||
@@ -381,7 +381,7 @@ class HandheldWayIn(unittest.TestCase):
|
||||
self.assertNotIn("Other handhelds that run RetroArch", _page("which-pack.md"))
|
||||
|
||||
def test_one_row_per_detected_system(self):
|
||||
detected = [name for name, _folder in siteguides.detected_systems(REGISTRY, GUIDE.uses)]
|
||||
detected = [name for name, _folder in guides.detected_systems(REGISTRY, GUIDE.uses)]
|
||||
self.assertEqual(sorted((s.name for s in GUIDE.systems), key=str.casefold), detected)
|
||||
text = _page(GUIDE.path)
|
||||
for system in GUIDE.systems:
|
||||
@@ -397,8 +397,8 @@ class HandheldWayIn(unittest.TestCase):
|
||||
self.assertTrue(systems["ArkOS"].ended_source.startswith("https://github.com/"))
|
||||
self.assertTrue(systems["JELOS"].ended)
|
||||
self.assertNotIn("ArkOS,", GUIDE.summary.replace("dArkOS,", ""))
|
||||
with self.assertRaises(siteguides.GuideError):
|
||||
siteguides._handheld_system({"name": "X", "ended": "no longer updated"}, "test")
|
||||
with self.assertRaises(guides.GuideError):
|
||||
guides._handheld_system({"name": "X", "ended": "no longer updated"}, "test")
|
||||
|
||||
def test_every_folder_and_device_list_is_cited(self):
|
||||
for system in GUIDE.systems:
|
||||
@@ -413,17 +413,17 @@ class HandheldWayIn(unittest.TestCase):
|
||||
self.assertTrue(system.folder and system.devices)
|
||||
|
||||
def test_a_value_without_its_page_is_refused(self):
|
||||
with self.assertRaises(siteguides.GuideError):
|
||||
siteguides._handheld_system({"name": "Onion", "folder": "`BIOS`"}, "x")
|
||||
with self.assertRaises(siteguides.GuideError):
|
||||
siteguides._handheld_system(
|
||||
with self.assertRaises(guides.GuideError):
|
||||
guides._handheld_system({"name": "Onion", "folder": "`BIOS`"}, "x")
|
||||
with self.assertRaises(guides.GuideError):
|
||||
guides._handheld_system(
|
||||
{"name": "Onion", "devices": ["Miyoo Mini"], "devices_source": "a blog"}, "x")
|
||||
|
||||
def test_the_guide_rejects_a_missing_or_unknown_system(self):
|
||||
data = {"page": "x", "title": "X", "summary": "S", "uses": "retroarch",
|
||||
"systems": [{"name": "Onion"}]}
|
||||
with self.assertRaises(siteguides.GuideError):
|
||||
siteguides._handheld_guide(data, REGISTRY, siteguides.GUIDES, "x")
|
||||
with self.assertRaises(guides.GuideError):
|
||||
guides._handheld_guide(data, REGISTRY, guides.GUIDES, "x")
|
||||
|
||||
def test_devices_are_a_search_field_with_no_text(self):
|
||||
text = _page(GUIDE.path)
|
||||
@@ -441,7 +441,7 @@ class HandheldWayIn(unittest.TestCase):
|
||||
setup = next(tab["Setups"] for tab in nav if "Setups" in tab)
|
||||
groups = {next(iter(item)): next(iter(item.values()))
|
||||
for item in setup if isinstance(item, dict)}
|
||||
label = siteguides.DEVICE_GROUPS["handheld"][0]
|
||||
label = guides.DEVICE_GROUPS["handheld"][0]
|
||||
self.assertIn({GUIDE.title: GUIDE.path}, groups[label])
|
||||
|
||||
def test_the_guide_fills_the_card_and_never_its_root(self):
|
||||
@@ -663,7 +663,7 @@ class DownloadLine(unittest.TestCase):
|
||||
self.assertRegex(line, r"\[SHA256SUMS\.txt\]\([^)]+\) and its \[signature\]\([^)]+\)\.$")
|
||||
|
||||
|
||||
HANDHELDS = siteguides.HANDHELD_GUIDE
|
||||
HANDHELDS = guides.HANDHELD_GUIDE
|
||||
OFFLINE_ANCHOR = "#without-a-network-offline-install"
|
||||
|
||||
|
||||
@@ -677,7 +677,7 @@ def _with_zip(name: str) -> bool:
|
||||
return bool(pack and pack.get("assets"))
|
||||
|
||||
|
||||
SETUPS = [name for name in siteguides.GUIDES if name in REGISTRY]
|
||||
SETUPS = [name for name in guides.GUIDES if name in REGISTRY]
|
||||
|
||||
|
||||
class NoZipNoUnzipText(unittest.TestCase):
|
||||
@@ -733,9 +733,9 @@ class NoZipNoUnzipText(unittest.TestCase):
|
||||
|
||||
def test_the_network_route_needs_a_share_and_no_zip(self):
|
||||
for name in SETUPS:
|
||||
share = generate_site._network_share(name, siteguides.GUIDES[name])
|
||||
share = generate_site._network_share(name, guides.GUIDES[name])
|
||||
with self.subTest(setup=name):
|
||||
if _with_zip(name) or siteguides.GUIDES[name].run != ("device",):
|
||||
if _with_zip(name) or guides.GUIDES[name].run != ("device",):
|
||||
self.assertEqual(share, "")
|
||||
if share:
|
||||
self.assertTrue(share.startswith("\\\\"))
|
||||
@@ -772,8 +772,8 @@ class EveryHandheldRowSaysWhere(unittest.TestCase):
|
||||
self.assertNotIn("Windows and macOS cannot open", text)
|
||||
|
||||
def test_linux_only_needs_a_folder(self):
|
||||
with self.assertRaises(siteguides.GuideError):
|
||||
siteguides._handheld_system({"name": "X", "linux_only": True}, "test")
|
||||
with self.assertRaises(guides.GuideError):
|
||||
guides._handheld_system({"name": "X", "linux_only": True}, "test")
|
||||
|
||||
def test_download_is_one_jump_under_the_lead(self):
|
||||
text = _plain_page(HANDHELDS.path)
|
||||
@@ -809,7 +809,7 @@ class EntryCopy(unittest.TestCase):
|
||||
|
||||
def test_the_setup_index_lists_the_handheld_tiles(self):
|
||||
text = _plain_page("platforms/index.md")
|
||||
for tile in siteguides.GROUP_TILES["handheld"]:
|
||||
for tile in guides.GROUP_TILES["handheld"]:
|
||||
target = tile.link.removesuffix(".md").replace(".md#", "/#")
|
||||
with self.subTest(tile=tile.name):
|
||||
self.assertIn(f"**[{tile.name}](/retrobios/{target}", text.replace("/)", ")"))
|
||||
@@ -818,7 +818,7 @@ class EntryCopy(unittest.TestCase):
|
||||
|
||||
class IphoneAndIpad(unittest.TestCase):
|
||||
def test_a_tile_in_the_handheld_group(self):
|
||||
tile = next(t for t in siteguides.GROUP_TILES["handheld"] if t.name == "iPhone and iPad")
|
||||
tile = next(t for t in guides.GROUP_TILES["handheld"] if t.name == "iPhone and iPad")
|
||||
self.assertEqual(tile.link, "which-pack.md#iphone-and-ipad")
|
||||
for name in ("index.md", "which-pack.md"):
|
||||
with self.subTest(page=name):
|
||||
@@ -875,18 +875,18 @@ class GetPagesGiveTheSetupsOwnRoutes(unittest.TestCase):
|
||||
|
||||
def test_a_card_setup_names_the_card(self):
|
||||
for name in SETUPS:
|
||||
if not siteguides.GUIDES[name].on_card:
|
||||
if not guides.GUIDES[name].on_card:
|
||||
continue
|
||||
with self.subTest(setup=name):
|
||||
for command in COMMAND.findall(_plain_page(f"get/{name}.md")):
|
||||
self.assertIn("--dest ", command)
|
||||
|
||||
def test_no_tab_for_a_system_the_setup_does_not_run_from(self):
|
||||
labels = {key: entry[0] for key, entry in siteguides.TERMINALS.items()}
|
||||
labels = {key: entry[0] for key, entry in guides.TERMINALS.items()}
|
||||
for name in SETUPS:
|
||||
if _with_zip(name):
|
||||
continue
|
||||
guide = siteguides.GUIDES[name]
|
||||
guide = guides.GUIDES[name]
|
||||
allowed = {labels[key] for key in guide.run}
|
||||
allowed |= {labels[key] for key in guide.card_run or ("windows", "macos", "linux")}
|
||||
if generate_site._network_share(name, guide):
|
||||
@@ -929,7 +929,7 @@ class CheckNeedsTheFiles(unittest.TestCase):
|
||||
class ARouteWithoutANetwork(unittest.TestCase):
|
||||
def test_every_setup_page_has_the_offline_line_or_the_card_route(self):
|
||||
for name in SETUPS:
|
||||
guide = siteguides.GUIDES[name]
|
||||
guide = guides.GUIDES[name]
|
||||
text = _guide_part(_plain_page(f"platforms/{name}.md"))
|
||||
with self.subTest(setup=name):
|
||||
if _with_zip(name):
|
||||
@@ -942,7 +942,7 @@ class ARouteWithoutANetwork(unittest.TestCase):
|
||||
|
||||
def test_every_device_setup_with_no_zip_links_the_card_answer(self):
|
||||
for name in SETUPS:
|
||||
guide = siteguides.GUIDES[name]
|
||||
guide = guides.GUIDES[name]
|
||||
if _with_zip(name) or guide.run != ("device",):
|
||||
continue
|
||||
extract_to = REGISTRY[name]["extract_to"]
|
||||
@@ -959,7 +959,7 @@ class ARouteWithoutANetwork(unittest.TestCase):
|
||||
self.assertLess(text.index("## From a computer"), text.index("## On the device"))
|
||||
|
||||
def test_retropie_card_is_read_from_linux_only(self):
|
||||
self.assertEqual(siteguides.GUIDES["retropie"].card_run, ("linux",))
|
||||
self.assertEqual(guides.GUIDES["retropie"].card_run, ("linux",))
|
||||
text = _plain_page("platforms/retropie.md")
|
||||
card = text.split("No network?", 1)[1].split("## On the device", 1)[0]
|
||||
# One system, so no tab bar: its label leads the command.
|
||||
@@ -972,7 +972,7 @@ class ARouteWithoutANetwork(unittest.TestCase):
|
||||
folder neither can open."""
|
||||
for name in ("lakka", "retropie"):
|
||||
with self.subTest(setup=name):
|
||||
self.assertEqual(siteguides.GUIDES[name].card_run, ("linux",))
|
||||
self.assertEqual(guides.GUIDES[name].card_run, ("linux",))
|
||||
card = _plain_page(f"platforms/{name}.md").split("No network?", 1)[1]
|
||||
card = card.split("## On the device", 1)[0]
|
||||
self.assertEqual(_tab_labels(card), set())
|
||||
@@ -1030,7 +1030,7 @@ class GetPagesSayWhatTheyHold(unittest.TestCase):
|
||||
|
||||
class HandheldRowsSayWhere(unittest.TestCase):
|
||||
def test_retrooz_names_its_folder_with_a_pinned_source(self):
|
||||
system = next(s for s in siteguides.HANDHELD_GUIDE.systems if s.name == "RetroOZ")
|
||||
system = next(s for s in guides.HANDHELD_GUIDE.systems if s.name == "RetroOZ")
|
||||
self.assertIn("`/roms/bios`", system.folder)
|
||||
self.assertRegex(system.folder_source, r"/wiki/Home/[0-9a-f]{40}$")
|
||||
row = next(line for line in _plain_page("platforms/linux-handhelds.md").splitlines()
|
||||
@@ -1044,7 +1044,7 @@ class GetIndex(unittest.TestCase):
|
||||
for name in SETUPS:
|
||||
with self.subTest(setup=name):
|
||||
self.assertIn(f"(/retrobios/get/{name}/)", text)
|
||||
for label, _description in siteguides.DEVICE_GROUPS.values():
|
||||
for label, _description in guides.DEVICE_GROUPS.values():
|
||||
self.assertIn(f"## {label}", text)
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import generate_site
|
||||
from tests import sitepages
|
||||
from model.registry import list_registered_platforms, load_platform_registry
|
||||
from model.platforms import load_platform_config
|
||||
from siteguides import DEVICE_GROUPS, GROUP_ANCHORS, GUIDES
|
||||
from model.guides import DEVICE_GROUPS, GROUP_ANCHORS, GUIDES
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
@@ -134,7 +134,7 @@ class EveryPlatformOnThePicker(unittest.TestCase):
|
||||
def test_handheld_systems_that_run_retroarch_are_named(self):
|
||||
"""muOS, ArkOS and the rest are detected as RetroArch by the
|
||||
installer and were named on no page a user reads."""
|
||||
from siteguides import HANDHELD_GUIDE
|
||||
from model.guides import HANDHELD_GUIDE
|
||||
|
||||
page = generate_site.generate_handheld_guide(HANDHELD_GUIDE)
|
||||
self.assertIn("| muOS |", page)
|
||||
|
||||
@@ -21,7 +21,7 @@ from pathlib import Path
|
||||
|
||||
import generate_site
|
||||
import sitediagrams
|
||||
import siteinputs
|
||||
from model import siteinputs
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -93,7 +93,7 @@ class TheCollectionDoesNotDependOnTheWorkingDirectory(unittest.TestCase):
|
||||
def test_same_sections_and_paths_from_another_directory(self) -> None:
|
||||
import json
|
||||
|
||||
import sitecollection
|
||||
from model import collection as sitecollection
|
||||
|
||||
db = json.loads((REPO_ROOT / "database.json").read_text(encoding="utf-8"))
|
||||
here = sitecollection.collection_paths(db)
|
||||
@@ -108,7 +108,7 @@ class TheCollectionDoesNotDependOnTheWorkingDirectory(unittest.TestCase):
|
||||
self.assertGreater(sum(map(len, here.values())), len(here))
|
||||
|
||||
def test_the_bios_folder_sits_beside_the_given_database(self) -> None:
|
||||
import siteinputs
|
||||
from model import siteinputs
|
||||
|
||||
siteinputs.use(siteinputs.SiteInputs(db=Path("/elsewhere/database.json")))
|
||||
self.addCleanup(siteinputs.use, siteinputs.SiteInputs())
|
||||
|
||||
@@ -24,7 +24,7 @@ import yaml
|
||||
import check_freshness
|
||||
import generate_site as gs
|
||||
import sitediagrams
|
||||
import siterender
|
||||
from model import collection
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -67,7 +67,7 @@ class SectionNames(unittest.TestCase):
|
||||
self.assertEqual(gs._section_label("Arcade", "fba2012"), "FB Alpha 2012")
|
||||
self.assertEqual(gs._section_label("Arcade", "Arcade"), gs.OTHER_ARCADE_LABEL)
|
||||
self.assertEqual(gs._section_label("Sony", "PlayStation"), "PlayStation")
|
||||
self.assertEqual(siterender.SECTION_LABELS[("Arcade", "fba2012")],
|
||||
self.assertEqual(collection.SECTION_LABELS[("Arcade", "fba2012")],
|
||||
_profile("fbalpha2012")["emulator"])
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class PlatformLogos(unittest.TestCase):
|
||||
self.assertTrue(self.registry["minui"]["logo_flip"])
|
||||
|
||||
def test_every_logo_copy_has_a_registry_or_tile_logo(self):
|
||||
from siteguides import GROUP_TILES
|
||||
from model.guides import GROUP_TILES
|
||||
|
||||
tiles = {re.sub(r"[^a-z0-9]+", "-", tile.name.lower()).strip("-"): tile.logo
|
||||
for group in GROUP_TILES.values() for tile in group}
|
||||
|
||||
@@ -35,10 +35,11 @@ from html import unescape
|
||||
|
||||
import generate_site
|
||||
import sitestarlight
|
||||
from core import anchors as core_anchors
|
||||
from model.registry import list_registered_platforms, load_platform_registry
|
||||
from model.platforms import load_platform_config
|
||||
|
||||
from siteguides import DEVICE_GROUPS
|
||||
from model.guides import DEVICE_GROUPS
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -77,7 +78,7 @@ def _index_anchors(markdown: str) -> set[str]:
|
||||
|
||||
|
||||
ANCHORS = {
|
||||
"platforms/index.md": {sitestarlight.toc_slug(label) for label, _ in DEVICE_GROUPS.values()},
|
||||
"platforms/index.md": {core_anchors.toc_slug(label) for label, _ in DEVICE_GROUPS.values()},
|
||||
"systems/index.md": {"consoles-and-computers"},
|
||||
"emulators/index.md": _index_anchors(generate_site.generate_emulators_index({
|
||||
"duckstation": {"emulator": "DuckStation", "systems": ["sony-playstation"]},
|
||||
@@ -173,7 +174,7 @@ class EmulatorsOneLevelDeep(unittest.TestCase):
|
||||
for group in generate_site._emulator_nav(profiles)[1:]:
|
||||
(label, _pages), = group.items()
|
||||
with self.subTest(initial=label):
|
||||
self.assertIn(sitestarlight.toc_slug(label), anchors)
|
||||
self.assertIn(core_anchors.toc_slug(label), anchors)
|
||||
|
||||
def test_every_initial_holds_pages(self):
|
||||
from model.profiles import load_emulator_profiles
|
||||
@@ -472,7 +473,7 @@ def _moved_platform_pages() -> list[Path]:
|
||||
return []
|
||||
# A guide page sits beside the setups (platforms/linux-handhelds) without
|
||||
# being a list moved off one of them.
|
||||
from siteguides import HANDHELD_GUIDE
|
||||
from model.guides import HANDHELD_GUIDE
|
||||
|
||||
guides = {Path(HANDHELD_GUIDE.path).stem} if HANDHELD_GUIDE else set()
|
||||
return [path for path in sorted(folder.glob("*.md*"))
|
||||
|
||||
@@ -25,7 +25,7 @@ from pathlib import Path
|
||||
import sitediagrams
|
||||
import siteentries
|
||||
import sitesteps
|
||||
from siteguides import TERMINALS
|
||||
from model.guides import TERMINALS
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import tests
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
import siterender
|
||||
from model import systemnames
|
||||
from generate_site import _render_platform_systems
|
||||
|
||||
A, B, C = "a" * 32, "b" * 32, "c" * 32
|
||||
@@ -36,7 +36,7 @@ class EachRowItsDeclaration(unittest.TestCase):
|
||||
],
|
||||
}
|
||||
names = {"psx": "Sony PlayStation", "saturn": "Sega Saturn"}
|
||||
with mock.patch.dict(siterender.SYSTEM_NAMES, names):
|
||||
with mock.patch.dict(systemnames.SYSTEM_NAMES, names):
|
||||
text = "\n".join(_render_platform_systems(by_system, config_files, {}))
|
||||
psx, saturn = text.split("saturn", 1)[0], text.split("saturn", 1)[1]
|
||||
self.assertIn(A, psx)
|
||||
|
||||
@@ -53,7 +53,7 @@ import urllib.error
|
||||
|
||||
import generate_site
|
||||
import sitewanted
|
||||
import siterender
|
||||
from model import systemnames
|
||||
from model.registry import list_registered_platforms, list_release_pack_platforms
|
||||
from model.profiles import load_emulator_profiles
|
||||
from model.platforms import load_platform_config
|
||||
@@ -281,7 +281,7 @@ class PlatformReferenceInWords(unittest.TestCase):
|
||||
def test_systems_by_name_with_the_id_in_small_text(self):
|
||||
systems = {"sony-playstation": {"files": [{"name": "f.bin"}]}}
|
||||
page = self._page("md5", "md5", systems)
|
||||
name = siterender.system_name("sony-playstation")
|
||||
name = systemnames.system_name("sony-playstation")
|
||||
self.assertIn(f"| [{name}](#sony-playstation) <small data-pagefind-ignore>sony-playstation</small> |", page)
|
||||
heading = next(line for line in page.splitlines() if line.startswith("### ")
|
||||
and "sony-playstation" in line)
|
||||
@@ -782,7 +782,7 @@ class LookupUrlsResolve(unittest.TestCase):
|
||||
def test_each_record_names_its_system_as_the_pages_do(self):
|
||||
"""Find a file opens on "a BIOS file for Sony PlayStation": the name
|
||||
comes from system_name, never built in the browser."""
|
||||
from siterender import system_name
|
||||
from model.systemnames import system_name
|
||||
|
||||
db = {"files": {"ab" * 20: {"path": "bios/Sony/PlayStation/scph5501.bin",
|
||||
"name": "scph5501.bin", "md5": "490f666e1afb15b7362b406ed1cea246"}}}
|
||||
|
||||
@@ -12,6 +12,7 @@ from unittest import mock
|
||||
import yaml
|
||||
|
||||
import siterender
|
||||
from model import systemnames
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -380,7 +381,7 @@ class TheSearchLandsOnTheCard(unittest.TestCase):
|
||||
by_system = {f"system-{i:02d}": [{"name": f"f{i}.bin", "status": "ok"}]
|
||||
for i in range(11)}
|
||||
names = {sys_id: f"System {sys_id[-2:]}" for sys_id in by_system}
|
||||
with mock.patch.dict(siterender.SYSTEM_NAMES, names):
|
||||
with mock.patch.dict(systemnames.SYSTEM_NAMES, names):
|
||||
lines = generate_site._render_platform_systems(by_system, {}, {})
|
||||
headings = [line for line in lines if line.startswith("### ")]
|
||||
self.assertEqual(len(headings), 11)
|
||||
|
||||
@@ -18,7 +18,7 @@ from pathlib import Path
|
||||
|
||||
import sitediagrams
|
||||
import sitesteps
|
||||
from siteguides import TERMINALS
|
||||
from model.guides import TERMINALS
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ from pathlib import Path
|
||||
|
||||
import generate_site as gs
|
||||
import siterender
|
||||
from model import systemnames
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -288,7 +289,7 @@ class EverySystemLinkLandsOnItsSection(unittest.TestCase):
|
||||
|
||||
db = load_database(str(REPO_ROOT / "database.json"))
|
||||
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"), skip_aliases=False)
|
||||
siterender.set_console_sections(gs._group_by_manufacturer(db), siterender.program_names(profiles))
|
||||
systemnames.set_console_sections(gs._group_by_manufacturer(db), systemnames.program_names(profiles))
|
||||
platforms = REPO_ROOT / "platforms"
|
||||
ids = {str(sid) for profile in profiles.values() for sid in profile.get("systems") or []}
|
||||
for name in list_registered_platforms(str(platforms)):
|
||||
|
||||
@@ -16,7 +16,7 @@ import json
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import siterender
|
||||
from model import systemnames
|
||||
from model.registry import list_registered_platforms
|
||||
from model.profiles import load_emulator_profiles
|
||||
from model.platforms import load_platform_config
|
||||
@@ -47,8 +47,8 @@ class SystemNames(unittest.TestCase):
|
||||
cls.manufacturers = _group_by_manufacturer(db)
|
||||
cls.profiles = load_emulator_profiles(
|
||||
str(REPO_ROOT / "emulators"), skip_aliases=False)
|
||||
siterender.set_console_sections(
|
||||
cls.manufacturers, siterender.program_names(cls.profiles))
|
||||
systemnames.set_console_sections(
|
||||
cls.manufacturers, systemnames.program_names(cls.profiles))
|
||||
platforms_dir = str(REPO_ROOT / "platforms")
|
||||
cls.platform_ids = {
|
||||
sys_id
|
||||
@@ -64,7 +64,7 @@ class SystemNames(unittest.TestCase):
|
||||
unnamed = []
|
||||
for sys_id in sorted(self._all_ids()):
|
||||
try:
|
||||
name = siterender.system_name(sys_id)
|
||||
name = systemnames.system_name(sys_id)
|
||||
except KeyError:
|
||||
unnamed.append(sys_id)
|
||||
continue
|
||||
@@ -73,11 +73,11 @@ class SystemNames(unittest.TestCase):
|
||||
|
||||
def test_no_name_is_a_manufacturer_page_or_an_emulator(self) -> None:
|
||||
taken = {name.casefold() for name in self.manufacturers}
|
||||
taken |= {name.casefold() for name in siterender.program_names(self.profiles)}
|
||||
taken |= {name.casefold() for name in systemnames.program_names(self.profiles)}
|
||||
clashes = sorted(
|
||||
(sys_id, siterender.system_name(sys_id))
|
||||
(sys_id, systemnames.system_name(sys_id))
|
||||
for sys_id in self._all_ids()
|
||||
if siterender.system_name(sys_id).casefold() in taken
|
||||
if systemnames.system_name(sys_id).casefold() in taken
|
||||
)
|
||||
self.assertEqual(clashes, [])
|
||||
|
||||
@@ -85,33 +85,33 @@ class SystemNames(unittest.TestCase):
|
||||
"""A table entry an own section shadows is never read, and an entry
|
||||
no platform or profile names is a leftover."""
|
||||
shadowed = sorted(
|
||||
sys_id for sys_id in siterender.SYSTEM_NAMES
|
||||
if siterender._own_section(sys_id) is not None
|
||||
sys_id for sys_id in systemnames.SYSTEM_NAMES
|
||||
if systemnames._own_section(sys_id) is not None
|
||||
)
|
||||
self.assertEqual(shadowed, [])
|
||||
unused = sorted(set(siterender.SYSTEM_NAMES) - self._all_ids())
|
||||
unused = sorted(set(systemnames.SYSTEM_NAMES) - self._all_ids())
|
||||
self.assertEqual(unused, [])
|
||||
|
||||
def test_names_that_read_a_folder_vote(self) -> None:
|
||||
self.assertEqual(siterender.system_name("nintendo-gba"), "Nintendo Game Boy Advance")
|
||||
self.assertEqual(siterender.system_name("camplynx"), "Camputers Lynx")
|
||||
self.assertEqual(siterender.system_name("atari-lynx"), "Atari Lynx")
|
||||
self.assertEqual(siterender.system_name("arcade"), "Arcade games")
|
||||
self.assertEqual(siterender.system_name("sega-naomi"), "Sega NAOMI")
|
||||
self.assertEqual(systemnames.system_name("nintendo-gba"), "Nintendo Game Boy Advance")
|
||||
self.assertEqual(systemnames.system_name("camplynx"), "Camputers Lynx")
|
||||
self.assertEqual(systemnames.system_name("atari-lynx"), "Atari Lynx")
|
||||
self.assertEqual(systemnames.system_name("arcade"), "Arcade games")
|
||||
self.assertEqual(systemnames.system_name("sega-naomi"), "Sega NAOMI")
|
||||
|
||||
def test_own_section_names_from_its_heading(self) -> None:
|
||||
self.assertEqual(siterender.system_name("nintendo-snes"), "Nintendo SNES")
|
||||
self.assertEqual(siterender.system_name("sony-playstation"), "Sony PlayStation")
|
||||
self.assertEqual(systemnames.system_name("nintendo-snes"), "Nintendo SNES")
|
||||
self.assertEqual(systemnames.system_name("sony-playstation"), "Sony PlayStation")
|
||||
|
||||
def test_an_unknown_id_raises(self) -> None:
|
||||
with self.assertRaises(KeyError):
|
||||
siterender.system_name("no-such-system-anywhere")
|
||||
systemnames.system_name("no-such-system-anywhere")
|
||||
|
||||
def test_mame_names_systems_not_emulators(self) -> None:
|
||||
names = {siterender.system_name(s) for s in self.profiles["mame"].get("systems") or []}
|
||||
names = {systemnames.system_name(s) for s in self.profiles["mame"].get("systems") or []}
|
||||
self.assertNotIn("FBNeo", names)
|
||||
self.assertNotIn("Arcade", names)
|
||||
self.assertFalse(names & siterender.program_names(self.profiles))
|
||||
self.assertFalse(names & systemnames.program_names(self.profiles))
|
||||
|
||||
|
||||
class SectionsComeBeforeThePlan(unittest.TestCase):
|
||||
|
||||
@@ -23,6 +23,7 @@ from collections.abc import Iterable
|
||||
from pathlib import Path
|
||||
|
||||
import siterender
|
||||
from model import systemnames
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -156,8 +157,8 @@ class SystemLinks(unittest.TestCase):
|
||||
db = json.load(handle)
|
||||
cls.manufacturers = _group_by_manufacturer(db)
|
||||
profiles = load_emulator_profiles("emulators", skip_aliases=False)
|
||||
siterender.set_console_sections(
|
||||
cls.manufacturers, siterender.program_names(profiles))
|
||||
systemnames.set_console_sections(
|
||||
cls.manufacturers, systemnames.program_names(profiles))
|
||||
# The system pages give every arcade board a section of its own
|
||||
# and record it. The built pages are checked by
|
||||
# test_site_built_gate.
|
||||
@@ -205,16 +206,16 @@ class SystemLinks(unittest.TestCase):
|
||||
by_heading: dict[str, set[tuple[str, str]]] = {}
|
||||
for mfr, consoles in self.manufacturers.items():
|
||||
for console in consoles:
|
||||
for name in {siterender._heading_name(mfr, console), console}:
|
||||
for name in {systemnames._heading_name(mfr, console), console}:
|
||||
by_heading.setdefault(name.casefold(), set()).add((mfr, console))
|
||||
missed = []
|
||||
for sys_id in sorted(self.ids):
|
||||
places = by_heading.get(siterender.system_name(sys_id).casefold(), set())
|
||||
places = by_heading.get(systemnames.system_name(sys_id).casefold(), set())
|
||||
if len(places) != 1:
|
||||
continue
|
||||
mfr, console = next(iter(places))
|
||||
if mfr == "Other" or (
|
||||
mfr == "Arcade" and console.casefold() in siterender._program_names
|
||||
mfr == "Arcade" and console.casefold() in systemnames._program_names
|
||||
):
|
||||
continue
|
||||
if siterender.system_section(sys_id) is None:
|
||||
@@ -227,19 +228,19 @@ class SystemLinks(unittest.TestCase):
|
||||
for mfr, consoles in self.sections.items() for console in consoles
|
||||
}
|
||||
self.assertEqual(
|
||||
sorted(k for k, v in siterender.SYSTEM_PARENTS.items() if v not in sections), [])
|
||||
sorted(k for k, v in systemnames.SYSTEM_PARENTS.items() if v not in sections), [])
|
||||
|
||||
def test_parents_hold_the_files(self) -> None:
|
||||
"""A parent holds a file of the id, or of an id of the same name.
|
||||
An entry its own section shadows is never read and is not judged."""
|
||||
by_name: dict[str, set[tuple[str, str]]] = {}
|
||||
for sys_id, sections in self.held.items():
|
||||
by_name.setdefault(siterender.system_name(sys_id), set()).update(sections)
|
||||
by_name.setdefault(systemnames.system_name(sys_id), set()).update(sections)
|
||||
wrong = []
|
||||
for sys_id, parent in sorted(siterender.SYSTEM_PARENTS.items()):
|
||||
if siterender._own_section(sys_id) is not None:
|
||||
for sys_id, parent in sorted(systemnames.SYSTEM_PARENTS.items()):
|
||||
if systemnames._own_section(sys_id) is not None:
|
||||
continue
|
||||
held = by_name.get(siterender.system_name(sys_id))
|
||||
held = by_name.get(systemnames.system_name(sys_id))
|
||||
if held is not None and parent not in held:
|
||||
wrong.append((sys_id, parent))
|
||||
self.assertEqual(wrong, [])
|
||||
@@ -276,7 +277,7 @@ class SystemLinks(unittest.TestCase):
|
||||
self.assertEqual(siterender.system_section("naomi2"), ("arcade", "Sega NAOMI 2"))
|
||||
for sys_id in ("emerson-arcadia-2001", "naomi2"):
|
||||
with self.subTest(sys_id=sys_id):
|
||||
self.assertNotIn(sys_id, siterender.SYSTEM_PARENTS)
|
||||
self.assertNotIn(sys_id, systemnames.SYSTEM_PARENTS)
|
||||
|
||||
def test_emulator_rows_link_the_variant(self) -> None:
|
||||
from generate_site import _named_system_link
|
||||
|
||||
@@ -42,9 +42,10 @@ import json
|
||||
|
||||
import generate_site as gs
|
||||
import siterender
|
||||
from model import systemnames
|
||||
from packs.crossref import FileConsumers
|
||||
import make_og_cards
|
||||
from sitestarlight import toc_slug
|
||||
from core.anchors import toc_slug
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -1125,7 +1126,7 @@ class ABoardIsAnArcadeMachine(unittest.TestCase):
|
||||
|
||||
def test_no_board_has_a_parent_outside_arcade(self) -> None:
|
||||
wrong = sorted(board for board in siterender.arcade_boards()
|
||||
if board in siterender.SYSTEM_PARENTS)
|
||||
if board in systemnames.SYSTEM_PARENTS)
|
||||
self.assertEqual(wrong, [])
|
||||
|
||||
def test_no_board_page_for_a_machine_filed_elsewhere(self) -> None:
|
||||
|
||||
@@ -42,7 +42,7 @@ import yaml
|
||||
import importlib.util
|
||||
|
||||
import sitediagrams
|
||||
from siteguides import INSTALL_SH
|
||||
from model.guides import INSTALL_SH
|
||||
from tests import sitepages
|
||||
import build_port
|
||||
from check_release import SUMS, Asset, compare_release
|
||||
|
||||
Reference in new issue
Block a user