From 2060673b44b33ae78124b242da1c60f30de2b838 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Thu, 12 Nov 2026 04:03:46 +0100 Subject: [PATCH] feat: add expert narrowing to the installer --one-per-slot, --emulator NAME --standalone, --source truth and --find HASH (with --json), each replaying the pack builder's option of the same name from the list. Change offers One BIOS per console and region and Standalone version of it. A combination the builder refuses, or a list without the fields, is refused. Parity against the real packs of every registered platform in tests/test_install_expert.py. --- install.ps1 | 2 +- install.py | 563 +++++++++++++++++- install.sh | 2 +- install/launchers/index.json | 16 +- scripts/sitediagrams.py | 5 +- tests/fixtures/tui/change-slot-120x40.txt | 40 ++ tests/fixtures/tui/change-slot-40x12.txt | 12 + tests/fixtures/tui/change-slot-40x15.txt | 15 + tests/fixtures/tui/change-slot-80x24.txt | 24 + .../fixtures/tui/change-standalone-120x40.txt | 40 ++ .../fixtures/tui/change-standalone-40x12.txt | 12 + .../fixtures/tui/change-standalone-40x15.txt | 15 + .../fixtures/tui/change-standalone-80x24.txt | 24 + tests/fixtures/tui/colour-120x40.txt | 82 +++ tests/fixtures/tui/colour-40x12.txt | 26 + tests/fixtures/tui/colour-40x15.txt | 32 + tests/fixtures/tui/colour-80x24.txt | 50 ++ tests/fixtures/tui/route-evmapy.txt | 108 ++++ tests/fixtures/tui/route-gptokeyb.txt | 108 ++++ tests/fixtures/tui/route-gptokeyb_muxterm.txt | 108 ++++ tests/fixtures/tui/route-keys.txt | 108 ++++ tests/fixtures/tui/route-miyoo.txt | 108 ++++ tests/fixtures/tui/route-muxterm.txt | 108 ++++ tests/test_audit_regressions.py | 25 + tests/test_install_expert.py | 470 +++++++++++++++ tests/test_install_tui.py | 15 + wiki/installer.md | 46 ++ wiki/testing-guide.md | 2 +- 28 files changed, 2141 insertions(+), 25 deletions(-) create mode 100644 tests/fixtures/tui/change-slot-120x40.txt create mode 100644 tests/fixtures/tui/change-slot-40x12.txt create mode 100644 tests/fixtures/tui/change-slot-40x15.txt create mode 100644 tests/fixtures/tui/change-slot-80x24.txt create mode 100644 tests/fixtures/tui/change-standalone-120x40.txt create mode 100644 tests/fixtures/tui/change-standalone-40x12.txt create mode 100644 tests/fixtures/tui/change-standalone-40x15.txt create mode 100644 tests/fixtures/tui/change-standalone-80x24.txt create mode 100644 tests/test_install_expert.py diff --git a/install.ps1 b/install.ps1 index 0b74ab6fc..37b44513e 100644 --- a/install.ps1 +++ b/install.ps1 @@ -16,7 +16,7 @@ # and Invoke-WebRequest throws on a cut transfer before the hash is read: # the site's build rewrites this line there (scripts/sitebootstrap.py). $mismatchAdvice = "The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." - $defaultInstallSha256 = "4edabf49923f6733a13292ad62407a9388338dd53d25816db161c6ba620ff51d" + $defaultInstallSha256 = "b92824f7fd4b3a4e40a02c48838a9d8597cb2228a3cd1e01ce051a3015d4ad29" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. $maximumInstallerBytes = 8MB diff --git a/install.py b/install.py index c9dc002b8..f5e580762 100644 --- a/install.py +++ b/install.py @@ -4140,9 +4140,109 @@ def _check_entry( _check_omission(claim, dest) for field in (*SELECTION_FIELDS, "declared_in"): _check_tags(entry, field, dest) + _check_expert_fields(entry, dest) return size, largest +def _check_expert_fields(entry: dict, dest: str) -> None: + """`truth` and `slot`, what --source truth and --one-per-slot read.""" + if "truth" in entry and entry["truth"] is not False: + raise ValueError(f"invalid truth flag for {dest}") + slot = entry.get("slot") + if slot is None: + return + if not isinstance(slot, dict) or set(slot) != {"groups", "keys"}: + raise ValueError(f"invalid slot for {dest}") + _check_tags(slot, "groups", dest) + keys = slot["keys"] + if not isinstance(keys, list) or not keys or len(keys) > MAX_SELECTION_TAGS: + raise ValueError(f"invalid slot keys for {dest}") + for claims in keys: + if not isinstance(claims, dict) or not claims or len(claims) > MAX_SELECTION_TAGS: + raise ValueError(f"invalid slot claims for {dest}") + for name, claim in claims.items(): + ranks = claim.get("ranks") if isinstance(claim, dict) else None + if (not isinstance(name, str) or not 0 < len(name) <= 256 + or not set(claim) <= {"ranks", "regions", "sets"} + or not isinstance(ranks, list) or not ranks + or len(ranks) > MAX_SELECTION_TAGS + or not all(rank is None or (isinstance(rank, int) + and not isinstance(rank, bool)) + for rank in ranks)): + raise ValueError(f"invalid slot claim for {dest}") + _check_tags(claim, "regions", dest) + _check_tags(claim, "sets", dest) + + +def _check_truth_lists(data: dict, seen_destinations: set[str]) -> int: + """truth_files and truth_omitted, what --source truth adds to the list: + each a valid entry, and the truth list it makes holds each destination + once. Returns the largest size the truth files may fetch.""" + files = data.get("truth_files") + if files is None: + if "truth_omitted" in data: + raise ValueError("truth_omitted without truth_files") + return 0 + if not isinstance(files, list) or len(files) > MAX_MANIFEST_FILES: + raise ValueError("invalid truth_files list") + kept = {_entry_key(entry) for entry in data.get("files", []) + if entry.get("truth", True)} + seen: set[str] = set() + largest = 0 + for index, entry in enumerate(files): + _size, most = _check_entry(entry, f"truth_files[{index}]", seen) + largest += most + if seen & kept: + raise ValueError("truth_files repeats a destination the truth list keeps") + omitted = data.get("truth_omitted", []) + if not isinstance(omitted, list) or len(omitted) > MAX_MANIFEST_FILES: + raise ValueError("invalid truth_omitted list") + for index, entry in enumerate(omitted): + if not isinstance(entry, dict): + raise ValueError(f"truth_omitted[{index}] must be an object") + dest = str(_safe_relative_path(entry.get("dest"), f"truth_omitted[{index}].dest")) + _check_omission(entry, dest) + _check_root(entry, dest, omitted=True) + return largest + + +def _check_standalone_layouts(data: dict) -> int: + """standalone_layouts: per emulator, entries or [dest, sha1] pairs whose + content the list carries. Returns the largest size they may fetch.""" + layouts = data.get("standalone_layouts") + if layouts is None: + return 0 + if not isinstance(layouts, dict) or len(layouts) > MAX_SELECTION_TAGS: + raise ValueError("invalid standalone_layouts") + sizes = { + copy["sha1"]: copy.get("size", 0) + for entry in [*data.get("files", []), *(data.get("truth_files") or [])] + for copy in [entry, *entry.get("alternatives", []), *entry.get("slot_choices", [])] + if isinstance(copy, dict) and copy.get("sha1") + and (copy.get("repo_path") or copy.get("release_asset")) + } + largest = 0 + for name, items in layouts.items(): + if (not isinstance(name, str) or not 0 < len(name) <= 256 + or not isinstance(items, list) or len(items) > MAX_MANIFEST_FILES): + raise ValueError("invalid standalone_layouts entry") + seen: set[str] = set() + for index, item in enumerate(items): + where = f"standalone_layouts[{name!r}][{index}]" + if isinstance(item, list): + if (len(item) != 2 or not isinstance(item[1], str) + or item[1] not in sizes): + raise ValueError(f"invalid {where}") + key = _entry_key({"dest": str(_safe_relative_path(item[0], where))}) + if key in seen: + raise ValueError(f"duplicate destination in {where}") + seen.add(key) + largest += int(sizes[item[1]] or 0) + else: + largest += _check_entry(item, where, seen)[1] + return largest + + def _check_data_directory(entry: object, where: str) -> None: """A data directory: its source archive, its mapping, its file list.""" if not isinstance(entry, dict): @@ -4289,6 +4389,13 @@ def _validate_manifest(data: object, plat: str) -> dict: raise ValueError(f"invalid omitted alternative for {dest}") for field in (*SELECTION_FIELDS, "declared_in"): _check_tags(entry, field, dest) + _check_expert_fields(entry, dest) + if data.get("slot_fields", True) is not True: + raise ValueError("invalid slot_fields") + largest_total += _check_truth_lists(data, seen_destinations) + largest_total += _check_standalone_layouts(data) + if largest_total > MAX_TOTAL_DOWNLOAD_SIZE: + raise ValueError("manifest total size exceeds safety limit") declared_total_omitted = data.get("total_omitted") if ( declared_total_omitted is not None @@ -5193,6 +5300,188 @@ def _chosen(entry: dict, wanted: set[str]) -> bool: return bool(wanted & set(systems)) +def _merged_slot(claims: dict) -> tuple[int | None, tuple, frozenset]: + """One key's rank, regions and sets over the emulators claiming it, as + the pack builder merges them (slot.merge_claims). Two ranks that differ, + or a rank beside an emulator declaring the file without one, leave the + file unranked: neither order may win for a pack serving both cores.""" + ranks = {rank for claim in claims.values() for rank in claim.get("ranks", []) + if rank is not None} + ranked_by = {name for name, claim in claims.items() + if any(rank is not None for rank in claim.get("ranks", []))} + unranked_by = {name for name, claim in claims.items() if None in claim.get("ranks", [])} + conflict = len(ranks) > 1 or bool(ranked_by and unranked_by - ranked_by) + regions = tuple(sorted({r for claim in claims.values() for r in claim.get("regions", [])})) + sets = frozenset((name, group) for name, claim in claims.items() + for group in claim.get("sets", [])) + return (None if conflict or not ranks else min(ranks)), regions, sets + + +def slot_drops(entries: list[dict], held: set[str], + reach: Collection[str] | None = None) -> set[str]: + """Destinations --one-per-slot withdraws, as _entry_key spells them. + + The pack builder's rule (slot.resolve_slot_drops), replayed over the + `slot` each entry records. A slot is a group and the regions the code + selects the file for, split where no set links its files. In a slot of + two files or more, the one ranked first by `priority:` (lower first) + stays and the others go, and only when every file of it is ranked and + one ranks best: otherwise every file stays. `held` names what the run + can install, as for the regions. `reach` is the cores of the board: the + claims of the others are no part of its order. + """ + bucketed: dict[tuple[str, tuple], list[tuple[str, int | None, frozenset]]] = {} + keep: set[str] = set() + for entry in entries: + slot = entry.get("slot") + key = _entry_key(entry) + if not isinstance(slot, dict) or key not in held: + continue + merged = None + for claims in slot.get("keys", []): + here = {name: claim for name, claim in claims.items() + if reach is None or name in reach} + if here: + merged = _merged_slot(here) + break + if merged is None: + keep.add(key) + continue + rank, regions, sets = merged + for group in slot.get("groups", []): + bucketed.setdefault((group, regions), []).append((key, rank, sets)) + drop: set[str] = set() + for found in bucketed.values(): + for candidates in _linked_by_set(found): + if len(candidates) < 2 or any(rank is None for _key, rank in candidates): + keep.update(key for key, _rank in candidates) + continue + best = min(rank for _key, rank in candidates if rank is not None) + winners = [key for key, rank in candidates if rank == best] + if len(winners) != 1: + keep.update(key for key, _rank in candidates) + continue + keep.add(winners[0]) + drop.update(key for key, _rank in candidates if key != winners[0]) + return drop - keep + + +def _linked_by_set(found: list[tuple[str, int | None, frozenset]] + ) -> list[list[tuple[str, int | None]]]: + """The files of one slot split where no set links them: a rank orders + the members of one set, and files in no set are compared together.""" + parent = list(range(len(found))) + + def root(i: int) -> int: + while parent[i] != i: + parent[i] = parent[parent[i]] + i = parent[i] + return i + + first_of: dict[object, int] = {} + for i, (_key, _rank, sets) in enumerate(found): + for set_key in sets or {None}: + if set_key in first_of: + parent[root(i)] = root(first_of[set_key]) + else: + first_of[set_key] = i + parts: dict[int, list[tuple[str, int | None]]] = {} + for i, (key, rank, _sets) in enumerate(found): + parts.setdefault(root(i), []).append((key, rank)) + return list(parts.values()) + + +def one_per_slot(files: list[dict], omitted: list[dict], + reach: Collection[str] | None = None) -> tuple[list[dict], list[dict]]: + """The files and omissions --one-per-slot keeps. What the builder holds + and this download lacks (held: true) displaces a file as in the pack.""" + held = {_entry_key(f) for f in files} | {_entry_key(o) for o in omitted if o.get("held")} + dropped = slot_drops(files + omitted, held, reach) + return ([f for f in files if _entry_key(f) not in dropped], + [o for o in omitted if _entry_key(o) not in dropped]) + + +def truth_lists(manifest: dict, files: list[dict], + omitted: list[dict]) -> tuple[list[dict], list[dict]]: + """What --source truth installs: the files the emulator profiles prove a + core reads, as `generate_pack.py --source truth` packs them. The full + list marks what that list lacks (truth: false) and carries what only it + holds (truth_files, truth_omitted).""" + return ([f for f in files if f.get("truth", True)] + list(manifest.get("truth_files") or []), + [o for o in omitted if o.get("truth", True)] + + list(manifest.get("truth_omitted") or [])) + + +def standalone_entries(manifest: dict, profile: str) -> list[dict] | None: + """The files a profile's standalone build reads, as entries of the list: + None for a profile without one. An item [dest, sha1] takes its download + from the copy of the list with that content.""" + layouts = manifest.get("standalone_layouts") or {} + if profile not in layouts: + return None + copies = { + copy["sha1"]: copy + for entry in [*manifest.get("files", []), *manifest.get("truth_files", [])] + for copy in [entry, *entry.get("alternatives", []), *entry.get("slot_choices", [])] + if copy.get("sha1") and (copy.get("repo_path") or copy.get("release_asset")) + } + result: list[dict] = [] + for item in layouts[profile]: + if isinstance(item, list): + dest, sha1 = item + copy = copies[sha1] + result.append({"dest": dest, **{k: copy[k] for k in _COPY_FIELDS + if k in copy and k != "cores"}, + "cores": [profile]}) + else: + result.append({**item, "cores": [profile]}) + return result + + +def standalone_layout(manifest: dict, profiles: list[str], files: list[dict], + omitted: list[dict]) -> tuple[list[dict], list[dict]]: + """--emulator with --standalone: the platform's own files of the systems + the emulators run, and beside them each emulator's standalone build, in + profile order, first at a destination wins, as `generate_pack.py + --emulator --standalone` packs them.""" + built: dict[str, dict] = {} + for profile in sorted(profiles): + for entry in standalone_entries(manifest, profile) or []: + built.setdefault(_entry_key(entry), entry) + own = [entry for entry in files + if entry.get("cores") is None and _entry_key(entry) not in built] + return own + list(built.values()), [o for o in omitted if o.get("cores") is None] + + +# What --find reads a hash as, by its length in hex digits. +FIND_KINDS = {40: "sha1", 64: "sha256", 32: "md5", 8: "crc32"} + + +def find_by_hash(files: list[dict], value: str) -> tuple[str, list[dict], bool]: + """The entries of a list whose content has this hash: the kind read + from its length, the matches, each at its destination with the copy + that has it, and whether the list records that kind at all.""" + value = value.strip().lower() + kind = FIND_KINDS.get(len(value), "") + matches: list[dict] = [] + recorded = False + seen: set[tuple[str, str]] = set() + for entry in files: + for copy in [entry, *entry.get("alternatives", []), *entry.get("slot_choices", [])]: + if kind in copy: + recorded = True + if str(copy.get(kind, "")).lower() != value: + continue + found = dict(entry) + for field in ("alternatives", "slot_choices", "declared_choices", "declared_copy"): + found.pop(field, None) + found.update((k, copy[k]) for k in _COPY_FIELDS if k in copy) + if (_entry_key(found), found.get("sha1", "")) not in seen: + seen.add((_entry_key(found), found.get("sha1", ""))) + matches.append(found) + return kind, matches, recorded + + def recorded_axes(files: list[dict], omitted: list[dict] = ()) -> frozenset: """What a file list lets --system, --core and --region narrow by: its systems, its cores, its regions. A list from an older release records @@ -8062,8 +8351,10 @@ _CHOICE_OPTIONS = ("--system", "--core", "--region", "--for-games", "--required- # wrote --manifest before --from and line mode after it, for one choice # An option not named here comes after them. _COMMAND_ORDER = ( - "--manifest", "--from-pack", "--system", "--core", "--emulator", "--region", - "--for-games", "--required-only", "--all-files", "--target", "--no-game-data", "--installed-cores", "--cores-dir", "--every-board", + "--manifest", "--from-pack", "--system", "--core", "--emulator", "--standalone", + "--region", "--one-per-slot", "--source", "--find", "--for-games", "--required-only", + "--all-files", "--target", "--no-game-data", "--installed-cores", "--cores-dir", + "--every-board", "--declared-only", "--standalone-copies", "--save-dir", "--jobs", "--from", "--add-app", "--offline", "--check", "--dry-run", ) @@ -8112,6 +8403,10 @@ class Invocation: games = getattr(args, "for_games", None) if games is not None: options.append(("--for-games", None if games is True else str(games))) + if getattr(args, "source", "full") != "full": + options.append(("--source", args.source)) + if getattr(args, "find", None): + options.append(("--find", args.find)) for flag, on in ( ("--required-only", getattr(args, "required_only", False)), ("--all-files", getattr(args, "all_files", False)), @@ -8119,6 +8414,8 @@ class Invocation: ("--installed-cores", args.installed_cores and not args.cores_dir), ("--no-game-data", args.no_game_data), ("--declared-only", args.declared_only), + ("--one-per-slot", getattr(args, "one_per_slot", False)), + ("--standalone", getattr(args, "standalone", False)), ("--standalone-copies", args.standalone_copies), ("--offline", offline_option(getattr(args, "offline", False))), ("--check", args.check), @@ -11629,6 +11926,31 @@ def _narrow_to_emulators( return files, omitted +def _standalone_builds( + values: list[str], names: dict[str, str], manifest: dict, plat: str, + files: list[dict], omitted: list[dict], +) -> tuple[list[dict], list[dict]]: + """--emulator with --standalone: each emulator's standalone build in + place of the files its core reads. An emulator with no standalone + build is refused, as `generate_pack.py --standalone` refuses it.""" + if "standalone_layouts" not in manifest: + print(f"Error: the {plat} file list does not say what each standalone build " + "reads, which --standalone needs.", file=sys.stderr) + print(_older_list_advice(plat), file=sys.stderr) + sys.exit(1) + profiles = sorted({names[name] for name in resolve_choices(values, sorted(names), + "emulator")}) + lacking = [p for p in profiles if p not in manifest["standalone_layouts"]] + if lacking: + refuse_name(plat, f"Error: {', '.join(lacking)} has no standalone build: run " + "again without --standalone.") + before = len(files) + files, omitted = standalone_layout(manifest, profiles, files, omitted) + detail(f" The standalone {'builds' if len(profiles) > 1 else 'build'}: " + f"{before} to {len(files)} files") + return files, omitted + + def _known_names(values: list[str] | None, known: list[str], label: str, aliases: dict[str, str] | None = None) -> list[str]: """The names of values that resolve against known, the others left out.""" @@ -16359,6 +16681,36 @@ def build_parser() -> argparse.ArgumentParser: help="keep only the files the platform's own list names, not the extra " "files cores load: --check then answers for the list the platform checks", ) + parser.add_argument( + "--one-per-slot", + action="store_true", + help="keep one BIOS per console and region, the one the emulators' own " + "search order ranks first (a slot no order decides keeps every file)", + ) + parser.add_argument( + "--standalone", + action="store_true", + help="with --emulator: the files each emulator's standalone build reads, " + "where that build reads them", + ) + parser.add_argument( + "--source", + choices=("full", "truth"), + default="full", + help="truth: only the files the emulator profiles prove a core reads " + "(default full: the platform's list and what its cores read)", + ) + parser.add_argument( + "--find", + metavar="HASH", + help="install the file of the list with this sha1 or sha256, or md5 or " + "crc32 where the list records them", + ) + parser.add_argument( + "--json", + action="store_true", + help="with --find: print the matching files as JSON and install nothing", + ) parser.add_argument( "--list-systems", action="store_true", @@ -16558,6 +16910,97 @@ def build_parser() -> argparse.ArgumentParser: return parser +def _check_expert(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None: + """--one-per-slot, --standalone, --source truth and --find, applied or + refused, never ignored. Each is held equal to the pack builder's own + option, so a choice the builder refuses beside it is refused here.""" + listing = (args.list_platforms or args.list_targets or args.list_systems + or args.list_cores or args.list_emulators) + truth = args.source == "truth" + refusals = ( + (args.json and not args.find, "--json applies to --find"), + (args.standalone and not args.emulator, + "--standalone applies to --emulator: it picks that emulator's standalone build"), + (args.standalone and (args.region or args.one_per_slot or args.core or args.system), + "--standalone installs each emulator's standalone build whole, which " + "--region, --one-per-slot, --core and --system do not narrow"), + (args.one_per_slot and (args.system or args.emulator or args.for_games is not None), + "--one-per-slot decides each slot over the whole list, which --system, " + "--emulator and --for-games narrow first"), + (args.one_per_slot and args.declared_only, + "--one-per-slot ranks the files cores load too, which --declared-only leaves out"), + (truth and (args.system or args.core or args.emulator or args.region + or args.one_per_slot or args.for_games is not None + or args.declared_only or args.target or args.installed_cores + or args.no_game_data), + "--source truth installs what the emulator profiles prove is read, over " + "the whole list: run it without other choices"), + (truth and args.tui, "the full-screen interface has no choice for --source truth"), + (bool(args.find) and (args.system or args.core or args.emulator or args.region + or args.one_per_slot or truth or args.for_games is not None + or args.declared_only or args.no_game_data or args.target + or args.installed_cores or args.all_files or args.standalone), + "--find picks one file by its hash: run it without other choices"), + (bool(args.find) and (listing or args.check or args.tui), + "--find installs or names one file, not a listing, a check or the full screen"), + (args.json and args.events, "--json and --events each write JSON on stdout"), + (listing and (args.one_per_slot or args.standalone or truth), + "a listing prints the whole list, which --one-per-slot, --standalone and " + "--source do not narrow"), + ) + for given, reason in refusals: + if given: + parser.error(reason) + if args.find is not None: + value = args.find.strip() + if len(value) not in FIND_KINDS or not re.fullmatch(r"[0-9a-fA-F]+", value): + kinds = ", ".join(f"{kind} ({length} digits)" for length, kind in FIND_KINDS.items()) + parser.error(f"--find takes a hash in hexadecimal: {kinds}") + + +FIND_SCHEMA = 1 +# What a match of --find --json carries, in this order. +FIND_FIELDS = ("dest", "root", "sha1", "sha256", "md5", "crc32", "size", "systems", "cores") + + +def _found_files(args: argparse.Namespace, plat: str, + files: list[dict]) -> tuple[list[dict], list[dict]]: + """--find: the file of the list with the hash given, the run narrowed to + it, or with --json the matches printed and nothing installed. + + One content found at several destinations installs at each. A hash two + contents share (a crc32) is ambiguous: named, never chosen. A kind the + list does not record (md5, crc32) is said as such, never as unknown. + """ + value = args.find.strip().lower() + kind, matches, recorded = find_by_hash(files, value) + contents = {match.get("sha1") or match.get("sha256") for match in matches} + result = ("found" if len(contents) == 1 else "ambiguous" if contents + else "unknown" if recorded else "unrecorded") + if args.json: + record = {"schema": FIND_SCHEMA, "platform": plat, "hash": value, "kind": kind, + "result": result, + "matches": [{field: match.get(field) for field in FIND_FIELDS + if field in match or field in ("root", "cores")} + for match in matches]} + print(json.dumps(record), file=args.json_out, flush=True) + if result != "found": + args.find_failed = True + return [], [] + if result == "unrecorded": + refuse_name(plat, f"Error: the {plat} file list records no {kind}: --find reads " + "sha1 and sha256 in every list.") + if result == "unknown": + refuse_name(plat, f"Error: no file of the {plat} list has the {kind} {value}.") + if result == "ambiguous": + refuse_name(plat, f"Error: {len(contents)} files of the {plat} list have the " + f"{kind} {value}: give their sha1 instead.", + *(f" {match['dest']} {match.get('sha1', '')}" for match in matches)) + for match in matches: + print(f" {value} is {match['dest']}") + return matches, [] + + def say_raw_errors(verbose: bool) -> None: """Each run says errors from its own options: a run with --verbose before it in the same process left every later message with its raw cause.""" @@ -16655,6 +17098,7 @@ def main() -> None: ): if given: parser.error(reason) + _check_expert(parser, args) if args.tui: reason = tui_blocker(args) if reason: @@ -16721,10 +17165,12 @@ def main() -> None: "or --list-targets") # The screens have no choice for --declared-only: the questions ask the # rest, and the run keeps the platform's own list. + # Nor for --source truth and --find, which choose the files themselves. + lined = args.declared_only or args.source == "truth" or bool(args.find) blocker = "" if args.tui else tui_blocker(args) - if args.tui or not (plain_requested(args) or args.declared_only or blocker): + if args.tui or not (plain_requested(args) or lined or blocker): sys.exit(run_tui(args)) - if not (plain_requested(args) or args.declared_only): + if not (plain_requested(args) or lined): # The questions came line by line with no word of why: the page # says a smaller window says so, and a TERM # unset or dumb said nothing. @@ -16749,6 +17195,16 @@ def main() -> None: raise EVENTS.emit("end", code=0) return + if args.json: + # The matches own stdout, the text a person reads goes to stderr. + args.no_input = True + args.json_out = sys.stdout + sys.stdout = sys.stderr + try: + _run(args) + finally: + sys.stdout = args.json_out + return _run(args) @@ -18198,6 +18654,12 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: # A namespace built by a caller that predates --for-games has neither. args.for_games = getattr(args, "for_games", None) args.required_only = getattr(args, "required_only", False) + for name, default in (("one_per_slot", False), ("standalone", False), ("source", "full"), + ("find", None), ("json", False)): + setattr(args, name, getattr(args, name, default)) + # Options that choose the files themselves: no question chooses again, + # and no board or game of the card narrows what they chose. + chosen_by_flag = bool(args.find) or args.source == "truth" term = Terminal(real_stdout, quiet=args.quiet) interactive = sys.stdin.isatty() and not args.no_input and not args.quiet listing = (args.list_targets or args.list_systems or args.list_cores @@ -18634,6 +19096,16 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: categorized = categorized or bool(manifest.get("categorized")) files = manifest.get("files", []) omitted_files = manifest.get("omitted_files", []) + if args.source == "truth": + if "truth_files" not in manifest: + print(f"Error: the {plat_name} file list does not say what the emulator " + "profiles prove is read, which --source truth needs.", file=sys.stderr) + print(_older_list_advice(plat_name), file=sys.stderr) + sys.exit(1) + before = len(files) + files, omitted_files = truth_lists(manifest, files, omitted_files) + detail(f" What the emulator profiles prove is read: {before} to " + f"{len(files)} files (--source truth)") variants = manifest.get("case_variants", []) case_kept = keeps_case(bios_path) if variants and case_kept: @@ -18667,6 +19139,11 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: f"{FAT_REFUSED_SHOWN} ({screen_text(shown)})" ) + if args.find: + # Among the case variants kept here too: bios.col is one file. + files, omitted_files = _found_files(args, plat_name, files) + if args.json: + continue game_data_cut = 0 if args.no_game_data and not manifest.get("categorized") and by_record(args): drop_recorded(args, plat_name, "--no-game-data", "the list marks no game data") @@ -18703,7 +19180,9 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: # a card prepared on a computer took every board's files, and the # full-screen interface, which always gives --dest, never applied one. target = args.target - if (not target and not args.every_board and not packing + # The cores whose order decides a slot: the board's, else every core. + slot_reach: set[str] | None = None + if (not target and not args.every_board and not packing and not chosen_by_flag and (not LOCAL.offline or local_targets(plat_name) is not None)): board = detect_board(plat_name) where = "detected" @@ -18746,6 +19225,7 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: manifest, target_info["cores"], files, omitted_files, target=target, ) + slot_reach = designated_cores(manifest, target_info["cores"], target) detail(f" Filtered {before} to {len(files)} files for target {target}") found_cores = cores_found.get((plat_name, bios_path), []) @@ -18784,9 +19264,13 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: if args.emulator and by_record(args): _recorded_emulators(args, plat_name, manifest, files, omitted_files) if args.emulator: + names = emulator_names(manifest, files, omitted_files) files, omitted_files = _narrow_to_emulators( args.emulator, manifest, plat_name, files, omitted_files ) + if args.standalone: + files, omitted_files = _standalone_builds( + args.emulator, names, manifest, plat_name, files, omitted_files) # Said before the install and again with the result. note = None if listing or packing else version_note(plat_name, bios_path, manifest) @@ -18818,7 +19302,8 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: # The games of the card, read before the choices: where it holds # some, what they need is the menu's first choice, and --for-games # narrows the list here, before the systems are counted. - will_ask = interactive and not args.check and not listing + will_ask = (interactive and not args.check and not listing and not chosen_by_flag + and not args.one_per_slot) # A run that asks nothing takes the plan's first choice: the games of # the card. `--yes` alone installed 6.4 GB on a dArkOS card holding # two games, while the screen offers what they need first. Not for a @@ -18828,7 +19313,8 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: and not getattr(args, "all_files", False) and LOCAL.manifest is None and LOCAL.pack is None and not (args.installed_cores or args.no_game_data or args.system - or args.core or args.region or args.emulator or args.declared_only)) + or args.core or args.region or args.emulator or args.declared_only + or args.one_per_slot or chosen_by_flag)) games_plan = None if args.for_games is not None or unasked or (will_ask and not ( args.installed_cores or args.no_game_data or LOCAL.pack is not None)): @@ -18874,7 +19360,7 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: given = GamesChoice(games_plan, args.required_only) # g at the menu: whether it left the game data out. cut: list[bool] | None = None - menu = interactive and not args.check and not listing + menu = will_ask if menu: whole_installed = ( narrow_to_cores(manifest, found_cores, files, omitted_files) @@ -18965,6 +19451,15 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: # Enter for every system narrows nothing: "Narrowed 23 to 23". # The menu counted the choice again before Enter. detail(f" Narrowed {before} to {len(files)} files") + if args.one_per_slot: + if not manifest.get("slot_fields"): + print(f"Error: the {plat_name} file list does not say which files a " + "slot holds, which --one-per-slot needs.", file=sys.stderr) + print(_older_list_advice(plat_name), file=sys.stderr) + sys.exit(1) + before = len(files) + files, omitted_files = one_per_slot(files, omitted_files, slot_reach) + detail(f" One BIOS per console and region: {before} to {len(files)} files") if (cut and cut[0]) or args.no_game_data: # Left out at g or by --no-game-data, from what the choice kept: # g offered the game data of the systems chosen, and the line @@ -18996,14 +19491,15 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: # must count the same trees. narrowed = bool( target or args.system or args.core or args.region or args.installed_cores + or args.one_per_slot or args.standalone or chosen_by_flag or args.declared_only or len(files) + game_data_cut + len(unplaced) != len(manifest.get("files", [])) + len(variants if case_kept else []) or games_applied ) - data_dirs = select_data_directories(manifest, files, narrowed, - bool(args.required_only), - games_plan if games_applied else None, - chosen_systems(selection)) + # --find installs the file found, no tree beside it. + data_dirs = [] if args.find else select_data_directories( + manifest, files, narrowed, bool(args.required_only), + games_plan if games_applied else None, chosen_systems(selection)) # The kinds as the plan and the menu head say them (parts_words), # the data files of the folders kept among them: this head said # BIOS files and game data beside a plan of three kinds, neither @@ -19538,6 +20034,9 @@ def _install(args: argparse.Namespace, real_stdout: TextIO) -> None: "they read into them.") sys.stdout = real_stdout + if args.find and getattr(args, "json", False): + # The matches are the answer: nothing was installed. + sys.exit(2 if getattr(args, "find_failed", False) else 0) if not listing: EVENTS.emit( "summary", mode=_event_mode(args), installed=total_downloaded, @@ -20502,6 +21001,9 @@ class TuiState: self.cli_regions: list = [] self.cores: list = [] self.no_game_data: bool = False + # --one-per-slot and --standalone, set on Change or given. + self.one_per_slot: bool = False + self.standalone: bool = False # --no-game-data on the command line: the plan has no game data row, # as line mode has no g then. self.cli_no_game_data: bool = False @@ -21061,6 +21563,10 @@ def tui_flags(state: TuiState) -> list[tuple[str, str | None]]: flags.append(("--required-only", None)) if state.no_game_data: flags.append(("--no-game-data", None)) + if state.standalone and _tui_standalone_offered(state): + flags.append(("--standalone", None)) + if state.one_per_slot and _tui_slot_offered(state, flags): + flags.append(("--one-per-slot", None)) if state.installed_only and not any(flag == "--cores-dir" for flag, _v in flags): flags.append(("--installed-cores", None)) if state.jobs != 8: @@ -21959,6 +22465,9 @@ def _option_rows(state: TuiState) -> list[TuiRow]: what.append(TuiRow("regions", "Preferred regions: " + (", ".join(map(region_title, state.regions)) or "any"), "--region")) + if _tui_slot_offered(state, tui_flags(state)): + what.append(TuiRow("slot", "One BIOS per console and region: " + + _yes(state.one_per_slot), "--one-per-slot")) if len(choices["cores"]) > 1: # The plan's words, the noun left to the row's own label. A list # with one core asks nothing, as line mode does not. @@ -21967,6 +22476,9 @@ def _option_rows(state: TuiState) -> list[TuiRow]: if "system_cores" in manifest and tui_emulators(state): what.append(TuiRow("emulators", f"Emulators: {_emulator_words(state)}", "--emulator")) + if _tui_standalone_offered(state): + what.append(TuiRow("standalone", "Standalone version of it: " + + _yes(state.standalone), "--standalone")) if manifest.get("categorized"): # "Leave out game data: no" was a double negative. what.append(TuiRow("game_data", "Game data: " @@ -22019,6 +22531,26 @@ def _option_rows(state: TuiState) -> list[TuiRow]: return rows +def _tui_standalone_offered(state: TuiState) -> bool: + """Whether Change offers --standalone: emulators are chosen, and the + list records a standalone build for each of them.""" + manifest = state.manifest or {} + layouts = manifest.get("standalone_layouts") or {} + if not state.emulators or not layouts: + return False + names = emulator_names(manifest, *tui_run_files(state)) + return all(names.get(name) in layouts for name in state.emulators) + + +def _tui_slot_offered(state: TuiState, flags: list[tuple[str, str | None]]) -> bool: + """Whether Change offers --one-per-slot: the list records its slots and + the choice is the whole list, as the pack builder decides slots over it + (no system, emulator or game choice narrows it first).""" + return bool((state.manifest or {}).get("slot_fields")) and not any( + flag in ("--system", "--emulator", "--for-games", "--declared-only") + for flag, _value in flags) + + def tui_emulators(state: TuiState) -> list[str]: """The emulators Emulators lists: each profile once, by the name the list gives it, as --list-emulators names them.""" @@ -23623,6 +24155,10 @@ def _option(state: TuiState, action: str, step: int) -> list[tuple]: """A row of the options: step 0 is Enter, -1 and 1 are Left and Right.""" if action == "game_data": state.no_game_data = step > 0 if step else not state.no_game_data + elif action == "slot": + state.one_per_slot = step > 0 if step else not state.one_per_slot + elif action == "standalone": + state.standalone = step > 0 if step else not state.standalone elif action == "installed" and not _cores_dir_given(state): state.installed_only = step > 0 if step else not state.installed_only elif action == "jobs": @@ -24744,6 +25280,7 @@ _ROW_VERBS = { "none": "Untick all", "filter": "Filter", "system": "Tick", "core": "Tick", "region": "Tick", "done": "Done", "regions": "Open", "cores": "Open", "command": "Open", "preview": "Open", "folder": "Choose", "game_data": "Change", "installed": "Change", + "slot": "Change", "standalone": "Change", "jobs": "Change", "retry": "Try again", "back": "Back", "stay": "Stay", "fromcard": "Choose", "from": "Add a folder", "misplaced": "Show", "zip": "Copy from it", "unreadable": "Show", "exit": "Exit", "addapp": "Put it on the card", @@ -27713,6 +28250,8 @@ def tui_start( if token.strip())) state.cli_cores = list(state.cores) state.no_game_data = state.cli_no_game_data = bool(args.no_game_data) + state.one_per_slot = bool(getattr(args, "one_per_slot", False)) + state.standalone = bool(getattr(args, "standalone", False)) state.installed_only = bool(args.installed_cores) state.jobs = args.jobs state.add_app = bool(getattr(args, "add_app", False)) diff --git a/install.sh b/install.sh index c392e581d..e24e7e445 100755 --- a/install.sh +++ b/install.sh @@ -23,7 +23,7 @@ DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/ins # curl or wget stop on a cut transfer before the hash is read: the site's # build rewrites this line there (scripts/sitebootstrap.py). MISMATCH_ADVICE="The download was most likely cut short: try again. Within minutes of an update of this project the two files can come from caches of different ages. Waiting five minutes settles that." -DEFAULT_INSTALL_SHA256="4edabf49923f6733a13292ad62407a9388338dd53d25816db161c6ba620ff51d" +DEFAULT_INSTALL_SHA256="b92824f7fd4b3a4e40a02c48838a9d8597cb2228a3cd1e01ce051a3015d4ad29" # The pin above refuses any changed byte: this cap only stops a body that # cannot be the installer (a sign-in portal's page) before it is hashed. MAX_INSTALLER_BYTES=8388608 diff --git a/install/launchers/index.json b/install/launchers/index.json index ee329d8f0..25495f828 100644 --- a/install/launchers/index.json +++ b/install/launchers/index.json @@ -27,8 +27,8 @@ { "dest": "roms/ports/retrobios/install.py", "repo_path": "install.py", - "size": 1337892, - "sha256": "4edabf49923f6733a13292ad62407a9388338dd53d25816db161c6ba620ff51d", + "size": 1365027, + "sha256": "b92824f7fd4b3a4e40a02c48838a9d8597cb2228a3cd1e01ce051a3015d4ad29", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1391517, - "sha256": "b01262a0d614953e5de52c79b074982069b675a39598ecbaa42abd52675da700" + "size": 1418652, + "sha256": "fbc544c18ceadfceb06f98f9b35341ab311a0b29f560f0a4530444bd99e5960c" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 1337892, - "sha256": "4edabf49923f6733a13292ad62407a9388338dd53d25816db161c6ba620ff51d", + "size": 1365027, + "sha256": "b92824f7fd4b3a4e40a02c48838a9d8597cb2228a3cd1e01ce051a3015d4ad29", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 1337892, - "sha256": "4edabf49923f6733a13292ad62407a9388338dd53d25816db161c6ba620ff51d", + "size": 1365027, + "sha256": "b92824f7fd4b3a4e40a02c48838a9d8597cb2228a3cd1e01ce051a3015d4ad29", "executable": false }, { diff --git a/scripts/sitediagrams.py b/scripts/sitediagrams.py index 2e71eeb33..91e89977e 100644 --- a/scripts/sitediagrams.py +++ b/scripts/sitediagrams.py @@ -998,7 +998,8 @@ GLANCE_GROUPS: tuple[tuple[str, tuple[str, ...]], ...] = ( ("Where and for what", ("--platform", "--dest", "--target", "--every-board", "--save-dir", "--romm-firmware", "--standalone-copies", "--add-app")), ("Fewer files", ("--for-games", "--required-only", "--all-files", "--system", "--core", "--emulator", - "--region", "--no-game-data", "--declared-only", "--installed-cores", + "--standalone", "--region", "--one-per-slot", "--no-game-data", + "--declared-only", "--source", "--find", "--installed-cores", "--cores-dir")), ("Look first", ("--check", "--dry-run", "--list-platforms", "--list-targets", "--list-systems", "--list-cores", "--list-emulators")), @@ -1007,7 +1008,7 @@ GLANCE_GROUPS: tuple[tuple[str, tuple[str, ...]], ...] = ( ("Remove and put back", ("--remove", "--file", "--backup", "--backups", "--restore", "--delete-backup")), ("How the run talks", ("--tui", "--plain", "--no-input", "--yes", "--quiet", "--verbose", - "--events", "--jobs", "--version", "--help")), + "--events", "--json", "--jobs", "--version", "--help")), ) GLANCE_OTHER = "Other" diff --git a/tests/fixtures/tui/change-slot-120x40.txt b/tests/fixtures/tui/change-slot-120x40.txt new file mode 100644 index 000000000..dfa555275 --- /dev/null +++ b/tests/fixtures/tui/change-slot-120x40.txt @@ -0,0 +1,40 @@ + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + + + + + + + + + + + + + + + + + A/Enter Change B/Esc Back Left/Right Set ? Help diff --git a/tests/fixtures/tui/change-slot-40x12.txt b/tests/fixtures/tui/change-slot-40x12.txt new file mode 100644 index 000000000..6550dd83d --- /dev/null +++ b/tests/fixtures/tui/change-slot-40x12.txt @@ -0,0 +1,12 @@ + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set ? Help diff --git a/tests/fixtures/tui/change-slot-40x15.txt b/tests/fixtures/tui/change-slot-40x15.txt new file mode 100644 index 000000000..aeeaca307 --- /dev/null +++ b/tests/fixtures/tui/change-slot-40x15.txt @@ -0,0 +1,15 @@ + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set ? Help diff --git a/tests/fixtures/tui/change-slot-80x24.txt b/tests/fixtures/tui/change-slot-80x24.txt new file mode 100644 index 000000000..d8e6818a7 --- /dev/null +++ b/tests/fixtures/tui/change-slot-80x24.txt @@ -0,0 +1,24 @@ + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A/Enter Change B/Esc Back Left/Right Set ? Help diff --git a/tests/fixtures/tui/change-standalone-120x40.txt b/tests/fixtures/tui/change-standalone-120x40.txt new file mode 100644 index 000000000..359d47689 --- /dev/null +++ b/tests/fixtures/tui/change-standalone-120x40.txt @@ -0,0 +1,40 @@ + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + + + + + + + + + + + + + + + + + A/Enter Change B/Esc Back Left/Right Set ? Help diff --git a/tests/fixtures/tui/change-standalone-40x12.txt b/tests/fixtures/tui/change-standalone-40x12.txt new file mode 100644 index 000000000..f48a4e5a1 --- /dev/null +++ b/tests/fixtures/tui/change-standalone-40x12.txt @@ -0,0 +1,12 @@ + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set ? Help diff --git a/tests/fixtures/tui/change-standalone-40x15.txt b/tests/fixtures/tui/change-standalone-40x15.txt new file mode 100644 index 000000000..11b21e324 --- /dev/null +++ b/tests/fixtures/tui/change-standalone-40x15.txt @@ -0,0 +1,15 @@ + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set ? Help diff --git a/tests/fixtures/tui/change-standalone-80x24.txt b/tests/fixtures/tui/change-standalone-80x24.txt new file mode 100644 index 000000000..ee1439ab6 --- /dev/null +++ b/tests/fixtures/tui/change-standalone-80x24.txt @@ -0,0 +1,24 @@ + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A/Enter Change B/Esc Back Left/Right Set ? Help diff --git a/tests/fixtures/tui/colour-120x40.txt b/tests/fixtures/tui/colour-120x40.txt index 4d83d7fab..f56c2ea83 100644 --- a/tests/fixtures/tui/colour-120x40.txt +++ b/tests/fixtures/tui/colour-120x40.txt @@ -490,6 +490,88 @@ ^[[0;1;35mA/Enter^[[0m Open ^[[0;2mB/Esc^[[0m Back ^[[0;2mLeft/Right^[[0m Set ^[[0;2m?^[[0m Help +=== change-slot +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any --region +^[[0;7;35m > One BIOS per console and region: yes --one-per-slot^[[0m + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config/retroarch/system^[[0m --dest + Copy from: none --from + From a pack: none --from-pack +^[[0;1m For which device^[[0m + Device: every board --target + Installed cores only: no (1 found) --installed-cores +^[[0;1m How^[[0m + Without the internet: no --offline + Parallel downloads: 8 --jobs +^[[0;1m See^[[0m + Preview the file list --dry-run + Show the command line + + + + + + + + + + + + + + + + + + + ^[[0;1;35mA/Enter^[[0m Change ^[[0;2mB/Esc^[[0m Back ^[[0;2mLeft/Right^[[0m Set ^[[0;2m?^[[0m Help +=== change-standalone +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator +^[[0;7;35m > Standalone version of it: no --standalone^[[0m + Game data: kept --no-game-data +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config/retroarch/system^[[0m --dest + Copy from: none --from + From a pack: none --from-pack +^[[0;1m For which device^[[0m + Device: every board --target + Installed cores only: no (1 found) --installed-cores +^[[0;1m How^[[0m + Without the internet: no --offline + Parallel downloads: 8 --jobs +^[[0;1m See^[[0m + Preview the file list --dry-run + Show the command line + + + + + + + + + + + + + + + + + + + ^[[0;1;35mA/Enter^[[0m Change ^[[0;2mB/Esc^[[0m Back ^[[0;2mLeft/Right^[[0m Set ^[[0;2m?^[[0m Help === device ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Device^[[0m diff --git a/tests/fixtures/tui/colour-40x12.txt b/tests/fixtures/tui/colour-40x12.txt index 61e860630..b42524c2d 100644 --- a/tests/fixtures/tui/colour-40x12.txt +++ b/tests/fixtures/tui/colour-40x12.txt @@ -154,6 +154,32 @@ Copy from: none ^[[0;2m 1-8 of 18^[[0m ^[[0;1;35mA^[[0m Open ^[[0;2mB^[[0m Back ^[[0;2m<>^[[0m Set ^[[0;2m?^[[0m Help +=== change-slot +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any +^[[0;7;35m > One BIOS per console and region: yes^[[0m + Cores: all + Emulators: all + Game data: kept +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config...ch/system^[[0m +^[[0;2m 1-8 of 19^[[0m + ^[[0;1;35mA^[[0m Change ^[[0;2mB^[[0m Back ^[[0;2m<>^[[0m Set ^[[0;2m?^[[0m Help +=== change-standalone +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed +^[[0;7;35m > Standalone version of it: no^[[0m + Game data: kept +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config...ch/system^[[0m +^[[0;2m 1-8 of 19^[[0m + ^[[0;1;35mA^[[0m Change ^[[0;2mB^[[0m Back ^[[0;2m<>^[[0m Set ^[[0;2m?^[[0m Help === device ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Device^[[0m diff --git a/tests/fixtures/tui/colour-40x15.txt b/tests/fixtures/tui/colour-40x15.txt index 3f9d7274d..818f6a55d 100644 --- a/tests/fixtures/tui/colour-40x15.txt +++ b/tests/fixtures/tui/colour-40x15.txt @@ -190,6 +190,38 @@ Device: every board ^[[0;2m 1-11 of 18^[[0m ^[[0;1;35mA^[[0m Open ^[[0;2mB^[[0m Back ^[[0;2m<>^[[0m Set ^[[0;2m?^[[0m Help +=== change-slot +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any +^[[0;7;35m > One BIOS per console and region: yes^[[0m + Cores: all + Emulators: all + Game data: kept +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config...ch/system^[[0m + Copy from: none + From a pack: none +^[[0;1m For which device^[[0m +^[[0;2m 1-11 of 19^[[0m + ^[[0;1;35mA^[[0m Change ^[[0;2mB^[[0m Back ^[[0;2m<>^[[0m Set ^[[0;2m?^[[0m Help +=== change-standalone +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed +^[[0;7;35m > Standalone version of it: no^[[0m + Game data: kept +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config...ch/system^[[0m + Copy from: none + From a pack: none +^[[0;1m For which device^[[0m +^[[0;2m 1-11 of 19^[[0m + ^[[0;1;35mA^[[0m Change ^[[0;2mB^[[0m Back ^[[0;2m<>^[[0m Set ^[[0;2m?^[[0m Help === device ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Device^[[0m diff --git a/tests/fixtures/tui/colour-80x24.txt b/tests/fixtures/tui/colour-80x24.txt index 672214f9d..06ebc0dc5 100644 --- a/tests/fixtures/tui/colour-80x24.txt +++ b/tests/fixtures/tui/colour-80x24.txt @@ -298,6 +298,56 @@ ^[[0;1;35mA/Enter^[[0m Open ^[[0;2mB/Esc^[[0m Back ^[[0;2mLeft/Right^[[0m Set ^[[0;2m?^[[0m Help +=== change-slot +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any --region +^[[0;7;35m > One BIOS per console and region: yes --one-per-slot^[[0m + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config/retroarch/system^[[0m --dest + Copy from: none --from + From a pack: none --from-pack +^[[0;1m For which device^[[0m + Device: every board --target + Installed cores only: no (1 found) --installed-cores +^[[0;1m How^[[0m + Without the internet: no --offline + Parallel downloads: 8 --jobs +^[[0;1m See^[[0m + Preview the file list --dry-run + Show the command line + + + ^[[0;1;35mA/Enter^[[0m Change ^[[0;2mB/Esc^[[0m Back ^[[0;2mLeft/Right^[[0m Set ^[[0;2m?^[[0m Help +=== change-standalone +^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Change^[[0m + +^[[0;1m What to install^[[0m + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator +^[[0;7;35m > Standalone version of it: no --standalone^[[0m + Game data: kept --no-game-data +^[[0;1m Where^[[0m + BIOS folder: ^[[0;1m~/.config/retroarch/system^[[0m --dest + Copy from: none --from + From a pack: none --from-pack +^[[0;1m For which device^[[0m + Device: every board --target + Installed cores only: no (1 found) --installed-cores +^[[0;1m How^[[0m + Without the internet: no --offline + Parallel downloads: 8 --jobs +^[[0;1m See^[[0m + Preview the file list --dry-run + Show the command line + + + ^[[0;1;35mA/Enter^[[0m Change ^[[0;2mB/Esc^[[0m Back ^[[0;2mLeft/Right^[[0m Set ^[[0;2m?^[[0m Help === device ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Device^[[0m diff --git a/tests/fixtures/tui/route-evmapy.txt b/tests/fixtures/tui/route-evmapy.txt index 3dc99f2ab..61cceeda4 100644 --- a/tests/fixtures/tui/route-evmapy.txt +++ b/tests/fixtures/tui/route-evmapy.txt @@ -617,6 +617,114 @@ A Open B Back Left/Right Set +=== change-slot 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set +=== change-slot 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set +=== change-slot 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change B Back Left/Right Set +=== change-standalone 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set +=== change-standalone 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set +=== change-standalone 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change B Back Left/Right Set === device 40x12 RetroBIOS: Device diff --git a/tests/fixtures/tui/route-gptokeyb.txt b/tests/fixtures/tui/route-gptokeyb.txt index 2199e8666..a3dc08149 100644 --- a/tests/fixtures/tui/route-gptokeyb.txt +++ b/tests/fixtures/tui/route-gptokeyb.txt @@ -617,6 +617,114 @@ A Open B Back Left/Right Set +=== change-slot 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set +=== change-slot 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set +=== change-slot 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change B Back Left/Right Set +=== change-standalone 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set +=== change-standalone 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set +=== change-standalone 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change B Back Left/Right Set === device 40x12 RetroBIOS: Device diff --git a/tests/fixtures/tui/route-gptokeyb_muxterm.txt b/tests/fixtures/tui/route-gptokeyb_muxterm.txt index 0f47f0e63..14c681183 100644 --- a/tests/fixtures/tui/route-gptokeyb_muxterm.txt +++ b/tests/fixtures/tui/route-gptokeyb_muxterm.txt @@ -617,6 +617,114 @@ A Open B Back Left/Right Set +=== change-slot 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set +=== change-slot 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set +=== change-slot 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change B Back Left/Right Set +=== change-standalone 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change B Back <> Set +=== change-standalone 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change B Back <> Set +=== change-standalone 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change B Back Left/Right Set === device 40x12 RetroBIOS: Device diff --git a/tests/fixtures/tui/route-keys.txt b/tests/fixtures/tui/route-keys.txt index f44cac139..274cc5c31 100644 --- a/tests/fixtures/tui/route-keys.txt +++ b/tests/fixtures/tui/route-keys.txt @@ -592,6 +592,114 @@ Enter Open Esc Back Left/Right Set ? Help +=== change-slot 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + Enter Change Esc Back <> Set ? Help +=== change-slot 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + Enter Change Esc Back <> Set ? Help +=== change-slot 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + Enter Change Esc Back Left/Right Set ? Help +=== change-standalone 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + Enter Change Esc Back <> Set ? Help +=== change-standalone 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + Enter Change Esc Back <> Set ? Help +=== change-standalone 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + Enter Change Esc Back Left/Right Set ? Help === device 40x12 RetroBIOS: Device diff --git a/tests/fixtures/tui/route-miyoo.txt b/tests/fixtures/tui/route-miyoo.txt index e834baddb..24d1078cf 100644 --- a/tests/fixtures/tui/route-miyoo.txt +++ b/tests/fixtures/tui/route-miyoo.txt @@ -646,6 +646,114 @@ A Open R2 Back Left/Right Set +=== change-slot 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change R2 Back <> Set +=== change-slot 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change R2 Back <> Set +=== change-slot 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change R2 Back Left/Right Set +=== change-standalone 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + A Change R2 Back <> Set +=== change-standalone 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + A Change R2 Back <> Set +=== change-standalone 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + A Change R2 Back Left/Right Set === device 40x12 RetroBIOS: Device diff --git a/tests/fixtures/tui/route-muxterm.txt b/tests/fixtures/tui/route-muxterm.txt index 0a532753b..9e78a7dd0 100644 --- a/tests/fixtures/tui/route-muxterm.txt +++ b/tests/fixtures/tui/route-muxterm.txt @@ -646,6 +646,114 @@ Start Open B Back Left/Right Set +=== change-slot 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + Start Change B Back <> Set +=== change-slot 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + > One BIOS per console and region: yes + Cores: all + Emulators: all + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + Start Change B Back <> Set +=== change-slot 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + > One BIOS per console and region: yes --one-per-slot + Cores: all --core + Emulators: all --emulator + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + Start Change B Back Left/Right Set +=== change-standalone 40x12 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + 1-8 of 19 + Start Change B Back <> Set +=== change-standalone 40x15 + RetroBIOS: Change + + What to install + Preferred regions: any + Cores: all + Emulators: pcsx_rearmed + > Standalone version of it: no + Game data: kept + Where + BIOS folder: ~/.config...ch/system + Copy from: none + From a pack: none + For which device + 1-11 of 19 + Start Change B Back <> Set +=== change-standalone 80x24 + RetroBIOS: Change + + What to install + Preferred regions: any --region + Cores: all --core + Emulators: pcsx_rearmed --emulator + > Standalone version of it: no --standalone + Game data: kept --no-game-data + Where + BIOS folder: ~/.config/retroarch/system --dest + Copy from: none --from + From a pack: none --from-pack + For which device + Device: every board --target + Installed cores only: no (1 found) --installed-cores + How + Without the internet: no --offline + Parallel downloads: 8 --jobs + See + Preview the file list --dry-run + Show the command line + + + Start Change B Back Left/Right Set === device 40x12 RetroBIOS: Device diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index a6b0a7aab..a25d19bed 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -4546,6 +4546,31 @@ class EveryToolRefusesAFlagItWouldDrop(unittest.TestCase): ["--offline", "--source", "truth", "--full-narrowings"], ["--offline", "--source", "platform", "--full-narrowings"], ], + # The expert narrowings: what the pack builder refuses beside its + # option of the same name, and a flag with no mode to apply it. + "install.py": [ + ["--json"], + ["--standalone"], + ["--emulator", "duckstation", "--standalone", "--region", "us"], + ["--emulator", "duckstation", "--standalone", "--one-per-slot"], + ["--one-per-slot", "--system", "sony-playstation"], + ["--one-per-slot", "--emulator", "duckstation"], + ["--one-per-slot", "--for-games"], + ["--one-per-slot", "--declared-only"], + ["--one-per-slot", "--list-systems"], + ["--source", "truth", "--system", "sony-playstation"], + ["--source", "truth", "--target", "switch"], + ["--source", "truth", "--one-per-slot"], + ["--source", "truth", "--tui"], + ["--source", "platform"], + ["--find", "0" * 40, "--system", "sony-playstation"], + ["--find", "0" * 40, "--one-per-slot"], + ["--find", "0" * 40, "--check"], + ["--find", "0" * 40, "--list-systems"], + ["--find", "0" * 40, "--json", "--events"], + ["--find", "not-a-hash"], + ["--find", "0" * 12], + ], } def test_each_pair_is_refused(self): diff --git a/tests/test_install_expert.py b/tests/test_install_expert.py new file mode 100644 index 000000000..ebc166da2 --- /dev/null +++ b/tests/test_install_expert.py @@ -0,0 +1,470 @@ +"""The expert narrowings of the installer give what the pack builder gives. + +`--one-per-slot`, `--emulator X --standalone` and `--source truth` replay, +from the install list alone, the pack builder's options of the same name. +The parity cases build the real packs in memory on every registered +platform and compare each (dest, sha1) with what the installer keeps. +`--find` picks one file by its hash, from the list. +""" + +from __future__ import annotations + +import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache + +import contextlib +import copy +import hashlib +import importlib.util +import io +import json +import os +import subprocess +import sys +import tempfile +import unittest +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parent.parent +sys.path.insert(0, str(REPO_ROOT / "scripts")) + +_spec = importlib.util.spec_from_file_location("install", REPO_ROOT / "install.py") +install = importlib.util.module_from_spec(_spec) +_spec.loader.exec_module(install) + +# Boards whose cores rank a slot differently from the whole list. +TARGETS = (("retroarch", "switch"), ("batocera", "bcm2711"), ("retropie", "rpi4"), + ("emudeck", "steamos"), ("knulli", "h700")) + + +class RealListParity(unittest.TestCase): + """Each option against the pack builder, every registered platform.""" + + @classmethod + def setUpClass(cls): + db_path = REPO_ROOT / "database.json" + if not db_path.exists(): + raise unittest.SkipTest("database.json is not built") + if sys.version_info < (3, 9): + # The builder's floor: install.py alone keeps 3.8. + raise unittest.SkipTest("generate_pack.py needs Python 3.9 or newer") + import generate_pack as gp + from common import (build_zip_contents_index, list_registered_platforms, + load_emulator_profiles, load_platform_config) + + cls.gp = gp + cls.config = staticmethod( + lambda plat: load_platform_config(plat, str(REPO_ROOT / "platforms"))) + cls.db = json.loads(db_path.read_text(encoding="utf-8")) + cls.zip_contents = build_zip_contents_index(cls.db) + cls.profiles = load_emulator_profiles(str(REPO_ROOT / "emulators")) + cls.by_path = {entry["path"]: sha1 for sha1, entry in cls.db["files"].items()} + cls.platforms = list_registered_platforms(str(REPO_ROOT / "platforms")) + cls.manifests: dict[str, dict] = {} + cls.baselines: dict[str, set[str]] = {} + + def manifest(self, plat: str) -> dict: + if plat not in self.manifests: + with contextlib.redirect_stdout(io.StringIO()): + self.manifests[plat] = self.gp.generate_manifest( + plat, str(REPO_ROOT / "platforms"), self.db, str(REPO_ROOT / "bios"), + str(REPO_ROOT / "platforms" / "_registry.yml"), + emulators_dir=str(REPO_ROOT / "emulators"), + zip_contents=self.zip_contents, emu_profiles=self.profiles, + offline=True) + return self.manifests[plat] + + def packed(self, plat: str, **options) -> dict[str, str | None]: + """Each member of the platform pack, below its base, with its sha1, + None for a member a data directory cache gave: the list carries the + trees apart (data_directories), and a cache copy at a destination + the list serves from the collection is no choice of either option.""" + base = self.config(plat).get("base_destination", "") + record = self.gp.PackRecord() + with contextlib.redirect_stdout(io.StringIO()), \ + contextlib.redirect_stderr(io.StringIO()): + self.gp.generate_pack( + plat, str(REPO_ROOT / "platforms"), self.db, str(REPO_ROOT / "bios"), + str(REPO_ROOT / "tmp"), emulators_dir=str(REPO_ROOT / "emulators"), + zip_contents=self.zip_contents, emu_profiles=self.profiles, + offline=True, record=record, **options) + prefix = f"{base}/" if base else "" + return {(m[len(prefix):] if prefix and m.startswith(prefix) else m): + self.by_path.get(record.sources.get(m)) for m in record.members} + + def apart(self, plat: str) -> set[str]: + """The destinations where the pack built without any option already + holds other bytes than the list (a data directory cache filling a + platform entry, held by the pack alone): no option decides them.""" + if plat not in self.baselines: + fold = str.lower if self.config(plat).get("case_insensitive_fs") else str + packed = {fold(d): sha1 for d, sha1 in self.packed(plat).items()} + self.baselines[plat] = { + fold(f["dest"]) for f in self.manifest(plat)["files"] + if not f.get("root") and packed.get(fold(f["dest"])) != f["sha1"]} + return self.baselines[plat] + + def assert_same(self, plat: str, files: list[dict], packed: dict) -> None: + """The installer's BIOS-tree files and the pack's members the list can + serve, (dest, sha1) for (dest, sha1). A member the list cannot serve + (a data tree, a note, a file it omits) is no file of either.""" + full = self.manifest(plat) + fold = str.lower if self.config(plat).get("case_insensitive_fs") else str + cached = {fold(d) for d, sha1 in packed.items() if sha1 is None} + listed = {fold(f["dest"]) for f in [*full["files"], *full.get("truth_files", [])] + if not f.get("root")} - cached - self.apart(plat) + mine = {fold(f["dest"]): f["sha1"] for f in files + if not f.get("root") and fold(f["dest"]) in listed} + theirs = {fold(d): s for d, s in packed.items() if fold(d) in listed} + self.assertEqual(mine, theirs) + + def test_one_per_slot(self): + dropped = 0 + for plat in self.platforms: + with self.subTest(platform=plat): + full = self.manifest(plat) + files, _omitted = install.one_per_slot(full["files"], full["omitted_files"]) + dropped += len(full["files"]) - len(files) + self.assert_same(plat, files, self.packed(plat, one_per_slot=True)) + # Real slots decided, not a rule that never drops anything. + self.assertGreater(dropped, 0) + + def test_one_per_slot_on_a_board(self): + from common import load_target_config + + for plat, target in TARGETS: + with self.subTest(platform=plat, target=target): + cores = sorted(load_target_config(plat, target, str(REPO_ROOT / "platforms"))) + full = self.manifest(plat) + files, omitted = install.narrow_to_cores(full, cores, target=target) + files, _omitted = install.one_per_slot( + files, omitted, install.designated_cores(full, cores, target)) + self.assert_same(plat, files, self.packed( + plat, one_per_slot=True, target_cores=set(cores), target_name=target)) + + def test_source_truth(self): + for plat in self.platforms: + with self.subTest(platform=plat): + full = self.manifest(plat) + files, _omitted = install.truth_lists(full, full["files"], + full["omitted_files"]) + self.assert_same(plat, files, self.packed(plat, source="truth")) + + def test_standalone(self): + """Each emulator with a standalone build: every file of the pack + `--emulator X --standalone` builds, at its place with its bytes, + and beside them only the platform's own files of its systems.""" + checked = 0 + for plat in self.platforms: + full = self.manifest(plat) + for profile in sorted(full.get("standalone_layouts") or {}): + with self.subTest(platform=plat, emulator=profile): + record = self.gp.PackRecord() + with contextlib.redirect_stdout(io.StringIO()), \ + contextlib.redirect_stderr(io.StringIO()): + self.gp.generate_emulator_pack( + [profile], str(REPO_ROOT / "emulators"), self.db, + str(REPO_ROOT / "bios"), str(REPO_ROOT / "tmp"), + standalone=True, zip_contents=self.zip_contents, + offline=True, record=record) + files, omitted = install._narrow_to_emulators( + [profile], full, plat, full["files"], full["omitted_files"]) + files, _omitted = install.standalone_layout(full, [profile], files, + omitted) + packed = {member: self.by_path[record.sources[member]] + for member in record.files + if record.sources.get(member) in self.by_path} + installed = {entry["dest"]: entry["sha1"] for entry in files + if not entry.get("root")} + self.assertEqual({dest: installed.get(dest) for dest in packed}, packed) + self.assertEqual( + [entry["dest"] for entry in files + if entry.get("cores") not in (None, [profile])], []) + checked += 1 + self.assertGreater(checked, 0) + + +def _copy(dest: str, body: bytes, cores: list[str] | None = None, **fields) -> dict: + return {"dest": dest, "sha1": hashlib.sha1(body).hexdigest(), + "sha256": hashlib.sha256(body).hexdigest(), "size": len(body), + "repo_path": f"bios/Test/{dest}", "cores": cores, **fields} + + +def _claims(**ranks: object) -> dict: + return {name: {"ranks": rank if isinstance(rank, list) else [rank]} + for name, rank in ranks.items()} + + +def _slot(*keys: dict, groups: tuple = ("sony-playstation",)) -> dict: + return {"groups": list(groups), "keys": list(keys)} + + +class TheSlotRuleIsTheBuilders(unittest.TestCase): + """slot_drops against slot.resolve_slot_drops on the same claims.""" + + def drops(self, entries: list[dict], reach=None) -> set[str]: + held = {entry["dest"] for entry in entries} + return install.slot_drops(entries, held, reach) + + def test_the_lowest_rank_stays(self): + entries = [_copy("a.bin", b"a", slot=_slot(_claims(duckstation=10))), + _copy("b.bin", b"b", slot=_slot(_claims(duckstation=5)))] + self.assertEqual(self.drops(entries), {"a.bin"}) + + def test_an_unranked_candidate_keeps_every_file(self): + entries = [_copy("a.bin", b"a", slot=_slot(_claims(duckstation=10))), + _copy("b.bin", b"b", slot=_slot(_claims(pcsx=None)))] + self.assertEqual(self.drops(entries), set()) + + def test_two_cores_ranking_one_file_differently_keep_it_open(self): + entries = [_copy("a.bin", b"a", slot=_slot(_claims(duckstation=10, pcsx=1))), + _copy("b.bin", b"b", slot=_slot(_claims(duckstation=5)))] + self.assertEqual(self.drops(entries), set()) + # On a board without pcsx, DuckStation's order decides. + self.assertEqual(self.drops(entries, {"duckstation"}), {"a.bin"}) + + def test_regions_split_a_slot(self): + entries = [ + _copy("jp.bin", b"j", slot=_slot({"duckstation": {"ranks": [1], + "regions": ["japan"]}})), + _copy("us.bin", b"u", slot=_slot({"duckstation": {"ranks": [2], + "regions": ["north-america"]}})), + ] + self.assertEqual(self.drops(entries), set()) + + def test_a_file_listed_twice_in_a_group_ties_with_itself(self): + entries = [_copy("a.bin", b"a", slot=_slot( + _claims(px68k=1), groups=("x68000", "x68000"))), + _copy("b.bin", b"b", slot=_slot(_claims(px68k=2), groups=("x68000",)))] + self.assertEqual(self.drops(entries), set()) + + @unittest.skipIf(sys.version_info < (3, 9), "slot.py needs Python 3.9 or newer") + def test_random_slots_against_the_builder(self): + import random + + import manifestselect + import slot as slot_mod + + rng = random.Random(7) + for _round in range(400): + entries, profiles = [], {} + for index in range(rng.randint(2, 6)): + name = f"f{index}.bin" + for emulator in rng.sample(["ds", "pcsx", "beetle"], rng.randint(1, 2)): + rank = rng.choice([None, 1, 2, 3]) + region = rng.choice([[], ["japan"]]) + group = rng.choice([None, "ipl", "font"]) + profiles.setdefault(emulator, {"files": []})["files"].append( + {"name": name, "priority": rank, "region": region, + **({"group": group} if group else {})}) + entries.append(name) + reach = set(rng.sample(sorted(profiles), rng.randint(1, len(profiles)))) + groups = {"sys": [(name, name) for name in entries]} + claims = slot_mod.slot_claims(profiles) + index_ = slot_mod.build_slot_index({k: v for k, v in profiles.items() + if k in reach}) + expected, _undecided = slot_mod.resolve_slot_drops(groups, index_, set(entries)) + fields = manifestselect._slot_fields(groups, claims) + listed = [_copy(name, name.encode(), **({"slot": fields[name]} + if name in fields else {})) + for name in entries] + self.assertEqual(self.drops(listed, reach), expected) + + +class Lists(unittest.TestCase): + """A list written for the runs below, in tmp/.""" + + def setUp(self): + scratch = tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") + self.addCleanup(scratch.cleanup) + self.root = Path(scratch.name) + self.dest = self.root / "bios" + + def write(self, manifest: dict) -> Path: + path = self.root / "retroarch.json" + path.write_text(json.dumps(manifest), encoding="utf-8") + return path + + def run_install(self, manifest: dict, *argv: str) -> subprocess.CompletedProcess: + env = dict(os.environ, RETROBIOS_OS="linux", RETROBIOS_OFFLINE="1") + return subprocess.run( + [sys.executable, str(REPO_ROOT / "install.py"), "--platform", "retroarch", + "--dest", str(self.dest), "--manifest", str(self.write(manifest)), + "--no-input", *argv], + capture_output=True, text=True, timeout=120, env=env, check=False) + + +LIST = { + "manifest_version": 2, "platform": "retroarch", "source": "full", "regions": [], + "categorized": True, "slot_fields": True, + "core_names": {"pcsx_rearmed": [], "duckstation": []}, + "system_cores": {"sony-playstation": ["duckstation", "pcsx_rearmed"]}, + "files": [ + _copy("scph1001.bin", b"one", systems=["sony-playstation"], + slot=_slot(_claims(duckstation=10))), + _copy("scph5501.bin", b"two", systems=["sony-playstation"], + slot=_slot(_claims(duckstation=5)), md5=hashlib.md5(b"two").hexdigest()), + _copy("pcsx/extra.bin", b"extra", ["pcsx_rearmed"], systems=["sony-playstation"], + truth=False), + _copy("copy.bin", b"two", systems=["sony-playstation"], + md5=hashlib.md5(b"two").hexdigest()), + _copy("x.bin", b"crc-a", crc32="aaaaaaaa"), + _copy("y.bin", b"crc-b", crc32="aaaaaaaa"), + ], + "omitted_files": [], + "truth_files": [_copy("ds/only.bin", b"truth", ["duckstation"])], + "truth_omitted": [], + "standalone_layouts": {"duckstation": [["ds/scph5501.bin", + hashlib.sha1(b"two").hexdigest()]]}, +} + + +class FindByHash(Lists): + """--find, each kind of hash, with --json and without.""" + + def found(self, value: str) -> dict: + proc = self.run_install(LIST, "--find", value, "--json") + self.assertIn(proc.returncode, (0, 2), proc.stderr) + return json.loads(proc.stdout) + + def test_each_kind(self): + two = LIST["files"][1] + for kind in ("sha1", "sha256", "md5"): + with self.subTest(kind=kind): + said = self.found(two[kind].upper()) + self.assertEqual((said["kind"], said["result"]), (kind, "found")) + # One content at two destinations: both are the file. + self.assertEqual([m["dest"] for m in said["matches"]], + ["scph5501.bin", "copy.bin"]) + said = self.found("aaaaaaaa") + self.assertEqual((said["kind"], said["result"]), ("crc32", "ambiguous")) + + def test_the_shape_is_stable(self): + said = self.found(LIST["files"][1]["sha1"]) + self.assertEqual(list(said), ["schema", "platform", "hash", "kind", "result", + "matches"]) + self.assertEqual(said["schema"], 1) + self.assertEqual(list(said["matches"][0]), ["dest", "root", "sha1", "sha256", "md5", + "size", "systems", "cores"]) + + def test_unknown_ambiguous_and_unrecorded(self): + unknown = self.run_install(LIST, "--find", "0" * 40, "--json") + self.assertEqual(unknown.returncode, 2) + self.assertEqual(json.loads(unknown.stdout)["result"], "unknown") + for value, words in (("0" * 40, "no file of the retroarch list has the sha1"), + ("aaaaaaaa", "2 files of the retroarch list have the crc32")): + with self.subTest(value=value): + proc = self.run_install(LIST, "--find", value, "--dry-run") + self.assertEqual(proc.returncode, 2, proc.stdout + proc.stderr) + self.assertIn(words, proc.stderr) + bare = copy.deepcopy(LIST) + for entry in bare["files"]: + entry.pop("md5", None) + proc = self.run_install(bare, "--find", "1" * 32, "--json") + self.assertEqual(json.loads(proc.stdout)["result"], "unrecorded") + + def test_without_json_it_names_the_file_and_plans_it_alone(self): + sha1 = LIST["files"][0]["sha1"] + proc = self.run_install(LIST, "--find", sha1, "--dry-run") + self.assertEqual(proc.returncode, 0, proc.stdout + proc.stderr) + self.assertIn(f"{sha1} is scph1001.bin", proc.stdout) + self.assertNotIn("scph5501.bin", proc.stdout) + + +class ExpertRuns(Lists): + """The options on a run, and the lists that cannot apply them.""" + + def plan(self, manifest: dict, *argv: str) -> str: + proc = self.run_install(manifest, "--dry-run", "--verbose", *argv) + self.assertEqual(proc.returncode, 0, proc.stdout + proc.stderr) + return proc.stdout + + def test_each_option_narrows_the_run(self): + said = self.plan(LIST, "--one-per-slot") + self.assertIn("One BIOS per console and region: 6 to 5 files", said) + said = self.plan(LIST, "--source", "truth") + self.assertIn("What the emulator profiles prove is read: 6 to 6 files", said) + self.assertIn("ds/only.bin", said) + self.assertNotIn("pcsx/extra.bin", said) + said = self.plan(LIST, "--emulator", "duckstation", "--standalone") + self.assertIn("ds/scph5501.bin", said) + + def test_a_list_without_the_fields_is_refused(self): + older = copy.deepcopy(LIST) + for field in ("slot_fields", "truth_files", "truth_omitted", "standalone_layouts"): + older.pop(field) + for argv, words in ( + (["--one-per-slot"], "which --one-per-slot needs"), + (["--source", "truth"], "which --source truth needs"), + (["--emulator", "duckstation", "--standalone"], "which --standalone needs"), + ): + with self.subTest(argv=argv): + proc = self.run_install(older, "--dry-run", *argv) + self.assertEqual(proc.returncode, 1, proc.stdout + proc.stderr) + self.assertIn(words, proc.stderr) + + def test_an_emulator_without_a_standalone_build_is_refused(self): + proc = self.run_install(LIST, "--dry-run", "--emulator", "pcsx_rearmed", + "--standalone") + self.assertEqual(proc.returncode, 2, proc.stdout + proc.stderr) + self.assertIn("pcsx_rearmed has no standalone build", proc.stderr) + + def test_a_malformed_field_is_refused_at_the_boundary(self): + for field, value in (("slot", {"groups": ["s"], "keys": [{"ds": {"ranks": ["1"]}}]}), + ("truth", True)): + with self.subTest(field=field): + bad = copy.deepcopy(LIST) + bad["files"][0][field] = value + with self.assertRaises(ValueError): + install._validate_manifest(bad, "retroarch") + bad = copy.deepcopy(LIST) + bad["standalone_layouts"]["duckstation"] = [["../x.bin", "0" * 40]] + with self.assertRaises(ValueError): + install._validate_manifest(bad, "retroarch") + install._validate_manifest(copy.deepcopy(LIST), "retroarch") + + +class ChangeRows(unittest.TestCase): + """The two rows of Change and the flags they give the runs.""" + + def state(self, manifest: dict) -> install.TuiState: + state = install.TuiState(os_type="linux") + state.platform, state.dest = "retroarch", Path("/x/bios") + state.manifest, state.manifest_for = manifest, "retroarch" + state.stack = ["plan", "options"] + return state + + def actions(self, state: install.TuiState) -> list[str]: + return [row.action for row in install.tui_rows(state)] + + def test_one_per_slot_on_the_whole_list(self): + state = self.state(LIST) + self.assertIn("slot", self.actions(state)) + state.focus["options"] = self.actions(state).index("slot") + install.tui_update(state, install.TuiKey("enter")) + self.assertIn(("--one-per-slot", None), install.tui_flags(state)) + # A choice of emulator narrows the list first: the row and its flag go. + state.emulators = ["duckstation"] + self.assertNotIn("slot", self.actions(state)) + self.assertNotIn(("--one-per-slot", None), install.tui_flags(state)) + + def test_standalone_when_the_emulator_has_a_build(self): + state = self.state(LIST) + self.assertNotIn("standalone", self.actions(state)) + state.emulators = ["duckstation"] + state.focus["options"] = self.actions(state).index("standalone") + install.tui_update(state, install.TuiKey("enter")) + self.assertIn(("--standalone", None), install.tui_flags(state)) + state.emulators = ["pcsx_rearmed"] + self.assertNotIn("standalone", self.actions(state)) + self.assertNotIn(("--standalone", None), install.tui_flags(state)) + + def test_no_row_on_a_list_without_the_fields(self): + older = {key: value for key, value in LIST.items() + if key not in ("slot_fields", "standalone_layouts")} + state = self.state(older) + state.emulators = ["duckstation"] + self.assertFalse({"slot", "standalone"} & set(self.actions(state))) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index de37081ec..75bb8553d 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -999,6 +999,18 @@ def golden_states() -> dict: options.focus["options"] = 1 options.regions = ["north-america", "japan"] states["change"] = options + slots = checked_state() + slots.manifest = {**MANIFEST, "slot_fields": True} + slots.stack.append("options") + slots.one_per_slot = True + option_focus(slots, "slot") + states["change-slot"] = slots + standalone = checked_state() + standalone.manifest = {**MANIFEST, "standalone_layouts": {"pcsx_rearmed": []}} + standalone.stack.append("options") + standalone.emulators = ["pcsx_rearmed"] + option_focus(standalone, "standalone") + states["change-standalone"] = standalone states["device"] = device_state() emulators = checked_state() emulators.stack += ["options", "emulators"] @@ -15311,6 +15323,9 @@ SCREEN_WORDS = { # rows for Emulators, a pack, the device and the internet, and the five # headings that group them, the intro sentence they replace dropped. "change": (32, 42, 72, 72), + # Change with an expert row: one BIOS per console and region on a list + # that records its slots, or the standalone build of the emulator chosen. + "change-slot": (34, 44, 78, 78), "change-standalone": (32, 42, 76, 76), # A list of boards and one of emulators, each with the line that says # what the choice does and the gloss of "board". "device": (35, 35, 33, 33), "emulators": (29, 29, 27, 27), diff --git a/wiki/installer.md b/wiki/installer.md index fcba019a7..409c43271 100644 --- a/wiki/installer.md +++ b/wiki/installer.md @@ -1242,6 +1242,47 @@ The questions are asked only when standard input is a terminal. Piped, scripted or run with `--no-input`, the installer asks nothing and installs what the options name, everything by default. +### One level further { #one-level-further } + +Four options sit below the default path, on the Change screen and as flags. +Each gives what the pack builder's option of the same name gives, and +`tests/test_install_expert.py` compares the two, (dest, sha1) for (dest, +sha1), on the real list of every registered platform. + +- [`--one-per-slot`](#option-one-per-slot) keeps one BIOS per console and + region: the one the emulators' own search order ranks first. A slot is a + system and the regions the code selects the file for, so the Japanese and + the American PlayStation BIOS never compete. Change offers it as + **One BIOS per console and region** while no system, emulator or game + choice narrows the list. +- [`--standalone`](#option-standalone), with `--emulator`, installs the + emulator's standalone build in place of its core's layout. Change shows + **Standalone version of it** once an emulator with such a build is ticked. +- [`--source truth`](#option-source) keeps only what the emulator profiles + prove a core reads, the platform's own declarations aside. +- [`--find HASH`](#option-find) installs the one BIOS with that content. + +`--find` with `--json` prints, for each platform, one line: + +```json +{"schema": 1, "platform": "retroarch", "hash": "", + "kind": "sha1", "result": "found", + "matches": [{"dest": "scph5501.bin", "root": null, "sha1": "...", + "sha256": "...", "size": 524288, + "systems": ["sony-playstation"], "cores": null}]} +``` + +`kind` is `sha1`, `sha256`, `md5` or `crc32`, read from the length. +`result` is `found` (one content), `ambiguous` (two contents share the +hash), `unknown`, or `unrecorded` when the list records no hash of that +kind. A match carries `md5` or `crc32` too where the list does. New keys +may come, existing ones keep their meaning. + +A list published before these options lacks what they read, and the run +stops on it with code 1 rather than install the whole list. None of them is +kept in the [install record](#the-install-record): a later run without the +option takes the recorded choice whole. + ## Options @@ -1264,6 +1305,11 @@ what the options name, everything by default. | `--all-files` | The whole list, even when the card holds games. A run that asks nothing (`--yes`, `--no-input`, `--events`) otherwise installs what the card's games need, the plan's first choice. See [For the games on this card](#for-the-games-on-this-card) | | `--no-game-data` | Leave out game data (a game's own files, not firmware) and install the firmware only. What it leaves out is named. See [Firmware without game data](#firmware-without-game-data) | | `--declared-only` | Keep only the files the platform's own list names (`cores: null` in the manifest), not the extra files cores load. With `--check`, the answer is about the list the platform itself checks. Refused with `--core`, the listings it does not change, `--standalone-copies` and `--tui` | +| `--one-per-slot` | Keep one BIOS per console and region, the one the emulators' own search order (`priority:`, lower first) ranks first, as `generate_pack.py --one-per-slot` does. A slot with an unranked candidate, or a candidate two cores rank apart, keeps all of them. Decided over the whole list, by the board's cores on a board: refused with `--system`, `--emulator`, `--for-games`, `--declared-only` and the listings. See [One level further](#one-level-further) | +| `--standalone` | With `--emulator`: that emulator's standalone build, at the paths it reads, beside the platform's own BIOS of its systems, as `generate_pack.py --emulator NAME --standalone` packs it. An emulator without a standalone build is refused, and so are `--region`, `--one-per-slot`, `--core` and `--system` beside it | +| `--source SOURCE` | `truth`: only what the emulator profiles prove a core reads, as `generate_pack.py --source truth` packs it. `full`, the default, is the platform's list and what its cores read. `truth` takes no other choice, opens no full screen, and is refused on a list published before it | +| `--find HASH` | Install the one BIOS of the list with this content: a sha1 or sha256 always, an md5 or crc32 where the list records it. A content at several destinations is installed at each. A hash two contents share is named and refused, as is one the list lacks. Takes no other choice | +| `--json` | With `--find`: print the matches as one JSON object per platform and install nothing. The shape is in [One level further](#one-level-further). Exit code 0 when found, 2 otherwise | | `--list-systems` | Print a platform's systems with the files and size each holds, the files other systems share too counted apart. `--system`, `--core`, `--region`, `--target` and `--installed-cores` narrow it, as they narrow an install. A run prints one list: two listing options are refused | | `--list-cores` | Print the cores whose extra files a platform installs. The options that narrow `--list-systems` narrow it too | | `--list-emulators` | Print every name `--emulator` accepts, each buildbot name beside the emulator it stands for. `--target` and `--installed-cores` narrow it, and `--system`, `--core`, `--region` and `--emulator` are refused | diff --git a/wiki/testing-guide.md b/wiki/testing-guide.md index dd89ceb11..67bd46fe1 100644 --- a/wiki/testing-guide.md +++ b/wiki/testing-guide.md @@ -59,7 +59,7 @@ Every module in `tests/`, by the area it guards. | Packs and manifests | synthetic + real packs | `test_artifact_lock`, `test_atomic_artifacts`, `test_batocera_cores`, `test_core_data_trees`, `test_deterministic_zip`, `test_emulator_pack_counts`, `test_finalize_pack_names`, `test_large_file_cache`, `test_libretro_layout`, `test_manifest_entry`, `test_minui_platform`, `test_no_game_data`, `test_pack_conformance_dirs`, `test_pack_core_extras`, `test_pack_counts`, `test_pack_destinations`, `test_pack_failures`, `test_pack_file_names`, `test_pack_grouping`, `test_pack_integrity`, `test_pack_member_identity`, `test_pack_readme`, `test_platform_inheritance`, `test_platform_keys`, `test_release_packs`, `test_required_only_archives`, `test_required_only_twins`, `test_save_root`, `test_split_extras`, `test_split_names`, `test_split_pack`, `test_system_pack_extras`, `test_system_pack_parity`, `test_torrentzip`, `test_which_pack` | | Slots and regions | synthetic + profiles | `test_region`, `test_region_agnostic_scan`, `test_region_groups`, `test_region_held`, `test_region_platform_index`, `test_region_required_only`, `test_slot`, `test_slots`, `test_slots_shipped_file` | | Hardware targets and systems | synthetic + target files | `test_amberelec_targets`, `test_emuelec_targets`, `test_extract_targets`, `test_lakka_targets`, `test_libretro_slugs`, `test_system_ids`, `test_system_selection`, `test_target_names`, `test_target_scrapers`, `test_target_systems`, `test_target_verify` | -| Installer and downloads | loopback server | `test_check_release`, `test_download`, `test_install`, `test_install_cores`, `test_install_experience`, `test_install_filesystems`, `test_install_app`, `test_install_from`, `test_install_games`, `test_install_journeys`, `test_install_offline`, `test_install_pack`, `test_install_removal`, `test_install_selection`, `test_install_tui`, `test_pypi_package` | +| Installer and downloads | loopback server | `test_check_release`, `test_download`, `test_install`, `test_install_cores`, `test_install_experience`, `test_install_expert`, `test_install_filesystems`, `test_install_app`, `test_install_from`, `test_install_games`, `test_install_journeys`, `test_install_offline`, `test_install_pack`, `test_install_removal`, `test_install_selection`, `test_install_tui`, `test_pypi_package` | | Handheld launchers | a pty as the console, fake installer and firmware tools, stubbed PortMaster dialogs | `test_handheld_launchers`, `test_port`, `test_site_handheld` | | Running cores | parsers on fixed inputs, a libretro core built from C in the test when a compiler exists | `test_core_probe` | | Measurement records | synthetic record files, the committed `measurements/` against HEAD, the **Proof** line naming the BIOS a core ran, and that no page shows a Tested block, a region outcome or a time per frame | `test_measurements` |