mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-10 13:33:24 -05:00
fix: point pack guides at the path each platform reads
This commit is contained in:
1 parent
16be9476cb
commit
236d8322b0
3 files changed
+69
-3
No files matched your search
@@ -1110,6 +1110,12 @@ def generate_pack(
|
||||
undecidable_slots=slot_undecidable,
|
||||
narrowings=narrowings,
|
||||
system_filter=system_filter,
|
||||
bios_paths=[
|
||||
str(detect.get("bios_path", ""))
|
||||
for detect in (
|
||||
_pack_registry.get(platform_name, {}).get("install", {}) or {}
|
||||
).get("detect", [])
|
||||
],
|
||||
)
|
||||
_write_generated_member(zf, "README.txt", readme_text)
|
||||
|
||||
|
||||
+13
-3
@@ -19,6 +19,7 @@ def _build_readme(
|
||||
undecidable_slots: list[str] | None = None,
|
||||
narrowings: list[tuple[str, str]] | None = None,
|
||||
system_filter: list[str] | None = None,
|
||||
bios_paths: list[str] | None = None,
|
||||
) -> str:
|
||||
"""Build a personalized step-by-step README for each platform pack."""
|
||||
narrowings = narrowings or []
|
||||
@@ -128,8 +129,9 @@ def _build_readme(
|
||||
" ----------------\n"
|
||||
" 1. Open Dolphin file manager\n"
|
||||
" 2. Show hidden files (Ctrl+H)\n"
|
||||
" 3. Navigate to ~/retrodeck/bios/\n"
|
||||
" 4. Extract all files from this archive directly into ~/retrodeck/bios/\n\n"
|
||||
" 3. Navigate to ~/retrodeck/\n"
|
||||
" 4. Extract all files from this archive directly into ~/retrodeck/\n"
|
||||
" (the archive already holds the bios/ and roms/ folders)\n\n"
|
||||
" NOTE: RetroDECK uses its own BIOS checker. After\n"
|
||||
" copying, open RetroDECK > Tools > BIOS Checker to\n"
|
||||
" verify everything is detected.\n\n"
|
||||
@@ -186,11 +188,19 @@ def _build_readme(
|
||||
# Lakka uses same guide as RetroArch
|
||||
guides["lakka"] = guides["retroarch"]
|
||||
|
||||
# A platform without a written guide is told where its files go by the
|
||||
# registry, which the installer reads too: "your BIOS directory" sent
|
||||
# MiSTer users looking for a folder MiSTer does not have.
|
||||
targets = [path for path in bios_paths or [] if path]
|
||||
where = (
|
||||
" or ".join(f"{path}/" for path in targets)
|
||||
if targets else "your BIOS directory"
|
||||
)
|
||||
guide = guides.get(
|
||||
platform_name,
|
||||
(
|
||||
f"INSTALLATION\n\n"
|
||||
f" 1. Extract all files from this archive directly into your BIOS directory\n"
|
||||
f" 1. Extract all files from this archive directly into {where}\n"
|
||||
f" 2. Overwrite if asked\n\n"
|
||||
),
|
||||
)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
"""The README inside a pack sends files where the platform reads them.
|
||||
|
||||
RetroDECK's pack holds bios/ and roms/ at its root, and its guide said to
|
||||
extract into ~/retrodeck/bios/, giving ~/retrodeck/bios/bios/. MiSTer and
|
||||
ROCKNIX had no guide and were told "your BIOS directory", a folder MiSTer
|
||||
does not have, while the registry names the path.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
||||
|
||||
from packreadme import _build_readme # noqa: E402
|
||||
|
||||
|
||||
def _extract_lines(text: str) -> list[str]:
|
||||
return [line for line in text.splitlines() if "Extract all files" in line]
|
||||
|
||||
|
||||
class GuidesPointAtTheReadPath(unittest.TestCase):
|
||||
def test_retrodeck_is_extracted_at_its_root(self):
|
||||
text = _build_readme("retrodeck", "RetroDECK", "", 1, 1)
|
||||
for line in _extract_lines(text):
|
||||
self.assertNotIn("retrodeck/bios", line)
|
||||
|
||||
def test_unguided_platforms_name_the_registry_path(self):
|
||||
registry = yaml.safe_load((REPO_ROOT / "platforms" / "_registry.yml").read_text())
|
||||
for name, data in registry["platforms"].items():
|
||||
paths = [
|
||||
str(d.get("bios_path", ""))
|
||||
for d in (data.get("install", {}) or {}).get("detect", [])
|
||||
]
|
||||
if not any(paths):
|
||||
continue
|
||||
text = _build_readme(name, name, "", 1, 1, bios_paths=paths)
|
||||
with self.subTest(platform=name):
|
||||
self.assertFalse(
|
||||
any("your BIOS directory" in line for line in _extract_lines(text))
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user