diff --git a/install.ps1 b/install.ps1 index 37ec12874..db72b7c21 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 = "86f11e91316119889fda8a2baa228a9b7be1c1d3fd29780473a59e412e362c7d" + $defaultInstallSha256 = "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a" $maximumInstallerBytes = 2MB $installerExit = 0 $installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null } diff --git a/install.py b/install.py index e81a361ed..c9894999b 100644 --- a/install.py +++ b/install.py @@ -8481,7 +8481,10 @@ def _print_menu_head( named = ", " + ", ".join(filter(None, [ f"for {held} of {total} systems" + (" (--system)" if flag else "") if systems else "", - ("--core" if flag else f"{_plural(len(cores), 'core')} chosen") if cores else "", + # Out of the cores the systems chosen offered, as Cores counts + # them: "1 core chosen" read as one of one. + ("--core" if flag else cores_words(len(cores), len(available_choices( + *narrow(files, omitted, systems, [], []))["cores"]))) if cores else "", ("--region" if flag else "regions ranked") if regions else ""])) named = "" if named == ", " else named if current is not given: @@ -8665,7 +8668,10 @@ def _choose_narrowing(files: list[dict], omitted: list[dict], manifest: dict | N core_names = available_choices(kept, kept_omitted)["cores"] if len(core_names) > 1: print("\nThe platform's own files for these systems are always kept.") - print("The extra files each core loads can be narrowed.") + # Every core is kept, as Cores draws them all ticked: a list of + # numbers read as nothing chosen yet. + print("Every core's extra files are kept: Enter keeps them all, numbers keep " + "only those cores.") cores = _pick("Cores:", [ (core, _filter_by_target( [f for f in kept if f.get("cores") is not None], [core])) @@ -14620,6 +14626,11 @@ class TuiState: self.region_order: list[str] = [] # The cores of every system listed, after "Cores of the other systems". self.cores_all: bool = False + # None pressed on Cores: no core ticked, which no option says + # (state.cores empty is every core). Done is refused until one is. + self.no_cores: bool = False + # The cores --core named, as line mode names them on its head. + self.cli_cores: list = [] # The names of the systems ticked before a check counted again, and # those of them that hold nothing under its options. self.ticked_names: dict[str, str] = {} @@ -15364,6 +15375,26 @@ def tui_choices(state: TuiState) -> dict[str, list[str]]: return available_choices(manifest.get("files", []), manifest.get("omitted_files", [])) +def core_ticked(state: TuiState, name: str) -> bool: + """Whether Cores draws name ticked: every core while none narrows the + run (state.cores empty), else those chosen.""" + return name in state.cores or (not state.cores and not state.no_cores) + + +def _core_base(state: TuiState) -> list[str]: + """The cores a choice on Cores is made among: those of the systems + chosen, every core of the list else.""" + every = tui_choices(state)["cores"] + theirs = _chosen_cores(state) + return every if theirs is None else [name for name in every if name in theirs] + + +def cores_words(chosen: int, total: int) -> str: + """The cores a run keeps, as the plan, Options and line mode say it: + all cores, or 3 of 12 cores.""" + return "all cores" if not chosen or chosen >= total else f"{chosen} of {total} cores" + + def _chosen_cores(state: TuiState) -> set[str] | None: """The cores the files of the systems chosen name, None when every system is chosen.""" @@ -15492,8 +15523,11 @@ def tui_rows(state: TuiState) -> list[TuiRow]: # stays in view. shown = every if theirs is None or state.cores_all else [ name for name in every if name in theirs or name in state.cores] - rows = [_filter_row(state)] + [ - TuiRow("core", f"[{'x' if name in state.cores else ' '}] {name}", value=name) + # Every core ticked when no core narrows the run, as Choose systems + # ticks every system: all boxes empty read as nothing chosen, and + # the owner ticked each one by hand. + rows = [TuiRow("all", "All"), TuiRow("none", "None"), _filter_row(state)] + [ + TuiRow("core", f"[{'x' if core_ticked(state, name) else ' '}] {name}", value=name) for name in shown if _matches(name, needle)] hidden = len(every) - len(shown) if hidden: @@ -15818,8 +15852,9 @@ def _option_rows(state: TuiState) -> list[TuiRow]: f"{_yes(state.installed_only)} ({found} found)", "--installed-cores")) if choices["cores"]: - chosen = f"{len(state.cores)} chosen" if state.cores else "all" - rows.append(TuiRow("cores", f"Cores: {chosen}", "--core")) + # The plan's words, the noun left to the row's own label. + rows.append(TuiRow("cores", "Cores: " + cores_words( + len(state.cores), len(_core_base(state))).replace(" cores", ""), "--core")) copied = ", ".join(str(folder) for folder in state.from_folders) or "none" if manifest.get("save_directory"): # The interface said "Name it with --save-dir" and had no row for it. @@ -15908,6 +15943,9 @@ def _back(state: TuiState) -> list[tuple]: chose = False if state.screen == "regions": state.region_order = [] + if state.screen == "cores" and state.no_cores: + # None, then Esc: no core ticked is no choice, and every core is kept. + state.no_cores = False state.stack.pop() if chose and state.screen == "plan": # The systems chosen, the next press is Install: Back left the focus @@ -16665,6 +16703,18 @@ def _activate(state: TuiState, row: TuiRow) -> list[tuple]: if action == "morecores": state.cores_all = True return [] + if action == "all": + state.cores, state.no_cores = [], False + return [] + if action == "none": + state.cores, state.no_cores = [], True + state.focus["cores"] = next( + (i for i, item in enumerate(tui_rows(state)) if item.action == "core"), + state.focus.get("cores", 0)) + return [] + if state.no_cores: + state.status = "No core is ticked: tick one, or choose All." + return [] return _back(state) if screen == "confirm": if action == "install": @@ -17148,7 +17198,7 @@ def _option(state: TuiState, action: str, step: int) -> list[tuple]: elif action == "cores": # On the first core: the filter row under A opened a field a # controller cannot type into. - return _push(state, action, 1 if tui_choices(state)["cores"] else 0) + return _push(state, action, 3 if tui_choices(state)["cores"] else 2) elif action == "regions": state.region_order = [] _push(state, action) @@ -17252,7 +17302,7 @@ def _tick(state: TuiState, row: TuiRow, on: bool | None) -> None: if state.screen == "systems" and row.action == "system": chosen = state.ticked elif state.screen == "cores" and row.action == "core": - chosen = set(state.cores) + chosen = {name for name in tui_choices(state)["cores"] if core_ticked(state, name)} else: return value = row.value @@ -17262,10 +17312,20 @@ def _tick(state: TuiState, row: TuiRow, on: bool | None) -> None: state.ticked.add(value) else: state.ticked.discard(value) - elif want and value not in state.cores: - state.cores.append(value) - elif not want and value in state.cores: + elif want: + if value not in state.cores: + state.cores.append(value) + state.no_cores = False + if set(_core_base(state)) <= set(state.cores): + # Every core ticked again: no narrowing, as before. + state.cores = [] + elif not state.cores and not state.no_cores: + # Every core was ticked: one untick keeps the others. + state.cores = [name for name in _core_base(state) if name != value] + state.no_cores = not state.cores + elif value in state.cores: state.cores.remove(value) + state.no_cores = not state.cores def _edit_text(text: str, key: TuiKey, selected: bool = False) -> str | None: @@ -18965,7 +19025,12 @@ def _view_plan(state: TuiState, width: int, height: int) -> tuple: at += 1 named = [*([f"for {len(state.systems)} of {len(tui_systems(state))} systems (--system)"] if state.cli_systems and state.systems else []), - *(["--core"] if state.cores else []), *(["--region"] if state.regions else [])] + # Named on the command line as line mode names it, chosen on + # Cores out of how many: "--core" said nothing of the count. + *([("--core" if state.cores == state.cli_cores else + cores_words(len(state.cores), len(_core_base(state))))] + if state.cores else []), + *(["--region"] if state.regions else [])] said = ", ".join(named) # A system --system named that --no-game-data left empty, in line mode's # words (tui_audit_16 P3-7). @@ -19241,16 +19306,21 @@ def _middle_label(row: TuiRow, room: int) -> TuiRow: def _view_regions(state: TuiState, width: int, height: int) -> tuple: + # An order, not a set: ticked all, it would rank regions nobody ranked. + # None ticked keeps every region, said so. before = ["Tick the regions to keep, best first. Where a system has one BIOS " - "per region, the best one found is installed."] + "per region, the best one found is installed. With none ticked, every " + "region's BIOS is kept."] return ("Preferred regions", _compose(state, width, height, before, tui_rows(state)), ("A/Enter Tick", "B/Esc Done", "Left/Right Order", "? Help")) def _view_cores(state: TuiState, width: int, height: int) -> tuple: - before = ["Tick the cores you use. With none ticked, every core's files are kept."] - return ("Cores", _compose(state, width, height, before, tui_rows(state)), + before = ["Every core ticked keeps every core's files. Untick the cores you do not " + "use: the platform's own files are always kept."] + status = [state.status] if state.status else [] + return ("Cores", _compose(state, width, height, before, tui_rows(state), status), ("A/Enter Done", "B/Esc Back", "X/Space Tick", "? Help")) @@ -20233,6 +20303,7 @@ def tui_start( state.cores = list(dict.fromkeys( token.strip() for value in args.core or [] for token in value.split(",") if token.strip())) + state.cli_cores = list(state.cores) state.no_game_data = state.cli_no_game_data = bool(args.no_game_data) state.installed_only = bool(args.installed_cores) state.jobs = args.jobs diff --git a/install.sh b/install.sh index 26f947c7e..cacf12717 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="86f11e91316119889fda8a2baa228a9b7be1c1d3fd29780473a59e412e362c7d" +DEFAULT_INSTALL_SHA256="403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a" MAX_INSTALLER_BYTES=2097152 cleanup() { diff --git a/install/launchers/index.json b/install/launchers/index.json index bd040ac20..19f5a91c4 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": 981280, - "sha256": "86f11e91316119889fda8a2baa228a9b7be1c1d3fd29780473a59e412e362c7d", + "size": 984900, + "sha256": "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a", "executable": false }, { @@ -71,8 +71,8 @@ "muos": { "archive": { "dest": "ARCHIVE/RetroBIOS.muxapp", - "size": 1034457, - "sha256": "92d78b81459583ea9ac00546e28f3118e815ac302c0f180e882b44a16e5bcb53" + "size": 1038077, + "sha256": "49b9de6afa23afda4f6c786fa0968c36af1bd2ec9b52cb0927df4c527dcc701c" }, "members": [ { @@ -92,8 +92,8 @@ { "name": "RetroBIOS/install.py", "repo_path": "install.py", - "size": 981280, - "sha256": "86f11e91316119889fda8a2baa228a9b7be1c1d3fd29780473a59e412e362c7d", + "size": 984900, + "sha256": "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a", "executable": false }, { @@ -166,8 +166,8 @@ { "dest": ".config/modules/retrobios/install.py", "repo_path": "install.py", - "size": 981280, - "sha256": "86f11e91316119889fda8a2baa228a9b7be1c1d3fd29780473a59e412e362c7d", + "size": 984900, + "sha256": "403b6e8a7efcd24858b0f46ffa19c2b9012cdeef149768729d8e48d0b68a296a", "executable": false }, { diff --git a/tests/fixtures/tui/colour-120x40.txt b/tests/fixtures/tui/colour-120x40.txt index 376973b2e..7b7a0d47d 100644 --- a/tests/fixtures/tui/colour-120x40.txt +++ b/tests/fixtures/tui/colour-120x40.txt @@ -494,7 +494,7 @@ ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Preferred regions^[[0m Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found - is installed. + is installed. With none ticked, every region's BIOS is kept. ^[[0;7;35m > [1] North America^[[0m [ ] Japan @@ -534,9 +534,12 @@ === cores ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Cores^[[0m - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: the platform's own + files are always kept. -^[[0;7;35m > Filter (/ to type)^[[0m +^[[0;7;35m > All^[[0m + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed @@ -568,10 +571,7 @@ - - - - ^[[0;1;35mA/Enter^[[0m Filter ^[[0;2mB/Esc^[[0m Back ^[[0;2mX/Space^[[0m Tick ^[[0;2m?^[[0m Help + ^[[0;1;35mA/Enter^[[0m Tick all ^[[0;2mB/Esc^[[0m Back ^[[0;2mX/Space^[[0m Tick ^[[0;2m?^[[0m Help === preview ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Preview^[[0m diff --git a/tests/fixtures/tui/colour-40x12.txt b/tests/fixtures/tui/colour-40x12.txt index b1eac105c..bbbf7d339 100644 --- a/tests/fixtures/tui/colour-40x12.txt +++ b/tests/fixtures/tui/colour-40x12.txt @@ -160,26 +160,26 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. ^[[0;7;35m > [1] North America^[[0m [ ] Japan - ^[[0;1;35mA^[[0m Tick ^[[0;2mB^[[0m Done ^[[0;2m<>^[[0m Order ^[[0;2m?^[[0m Help === cores ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Cores^[[0m - Tick the cores you use. With none - ticked, every core's files are kept. - -^[[0;7;35m > Filter (/ to type)^[[0m + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. +^[[0;7;35m > All^[[0m + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed - - - - ^[[0;1;35mA^[[0m Filter ^[[0;2mB^[[0m Back ^[[0;2mX^[[0m Tick ^[[0;2m?^[[0m Help + ^[[0;1;35mA^[[0m Tick all ^[[0;2mB^[[0m Back ^[[0;2mX^[[0m Tick ^[[0;2m?^[[0m Help === preview ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Preview^[[0m diff --git a/tests/fixtures/tui/colour-40x15.txt b/tests/fixtures/tui/colour-40x15.txt index a1914ccc5..9430e9fbd 100644 --- a/tests/fixtures/tui/colour-40x15.txt +++ b/tests/fixtures/tui/colour-40x15.txt @@ -196,7 +196,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. ^[[0;7;35m > [1] North America^[[0m [ ] Japan @@ -204,24 +205,23 @@ - ^[[0;1;35mA^[[0m Tick ^[[0;2mB^[[0m Done ^[[0;2m<>^[[0m Order ^[[0;2m?^[[0m Help === cores ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Cores^[[0m - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. -^[[0;7;35m > Filter (/ to type)^[[0m +^[[0;7;35m > All^[[0m + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed - - - - - ^[[0;1;35mA^[[0m Filter ^[[0;2mB^[[0m Back ^[[0;2mX^[[0m Tick ^[[0;2m?^[[0m Help + ^[[0;1;35mA^[[0m Tick all ^[[0;2mB^[[0m Back ^[[0;2mX^[[0m Tick ^[[0;2m?^[[0m Help === preview ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Preview^[[0m diff --git a/tests/fixtures/tui/colour-80x24.txt b/tests/fixtures/tui/colour-80x24.txt index 2501614e0..8c3fb5a3a 100644 --- a/tests/fixtures/tui/colour-80x24.txt +++ b/tests/fixtures/tui/colour-80x24.txt @@ -302,7 +302,8 @@ ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Preferred regions^[[0m Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. ^[[0;7;35m > [1] North America^[[0m [ ] Japan @@ -321,14 +322,16 @@ - ^[[0;1;35mA/Enter^[[0m Tick ^[[0;2mB/Esc^[[0m Done ^[[0;2mLeft/Right^[[0m Order ^[[0;2m?^[[0m Help === cores ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Cores^[[0m - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. -^[[0;7;35m > Filter (/ to type)^[[0m +^[[0;7;35m > All^[[0m + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed @@ -344,10 +347,7 @@ - - - - ^[[0;1;35mA/Enter^[[0m Filter ^[[0;2mB/Esc^[[0m Back ^[[0;2mX/Space^[[0m Tick ^[[0;2m?^[[0m Help + ^[[0;1;35mA/Enter^[[0m Tick all ^[[0;2mB/Esc^[[0m Back ^[[0;2mX/Space^[[0m Tick ^[[0;2m?^[[0m Help === preview ^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Preview^[[0m diff --git a/tests/fixtures/tui/cores-120x40.txt b/tests/fixtures/tui/cores-120x40.txt index d7a27d39c..571c06bea 100644 --- a/tests/fixtures/tui/cores-120x40.txt +++ b/tests/fixtures/tui/cores-120x40.txt @@ -1,8 +1,11 @@ RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: the platform's own + files are always kept. - > Filter (/ to type) + > All + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed @@ -34,7 +37,4 @@ - - - - A/Enter Filter B/Esc Back X/Space Tick ? Help + A/Enter Tick all B/Esc Back X/Space Tick ? Help diff --git a/tests/fixtures/tui/cores-40x12.txt b/tests/fixtures/tui/cores-40x12.txt index 0a09139e1..7557af130 100644 --- a/tests/fixtures/tui/cores-40x12.txt +++ b/tests/fixtures/tui/cores-40x12.txt @@ -1,12 +1,12 @@ RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. - - > Filter (/ to type) + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. + > All + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed - - - - A Filter B Back X Tick ? Help + A Tick all B Back X Tick ? Help diff --git a/tests/fixtures/tui/cores-40x15.txt b/tests/fixtures/tui/cores-40x15.txt index 0015d8e99..5cbef31a7 100644 --- a/tests/fixtures/tui/cores-40x15.txt +++ b/tests/fixtures/tui/cores-40x15.txt @@ -1,15 +1,15 @@ RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. - > Filter (/ to type) + > All + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed - - - - - A Filter B Back X Tick ? Help + A Tick all B Back X Tick ? Help diff --git a/tests/fixtures/tui/cores-80x24.txt b/tests/fixtures/tui/cores-80x24.txt index 1c98e53b5..c2fce774c 100644 --- a/tests/fixtures/tui/cores-80x24.txt +++ b/tests/fixtures/tui/cores-80x24.txt @@ -1,8 +1,11 @@ RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. - > Filter (/ to type) + > All + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed @@ -18,7 +21,4 @@ - - - - A/Enter Filter B/Esc Back X/Space Tick ? Help + A/Enter Tick all B/Esc Back X/Space Tick ? Help diff --git a/tests/fixtures/tui/regions-120x40.txt b/tests/fixtures/tui/regions-120x40.txt index 17076bca5..271fd15d7 100644 --- a/tests/fixtures/tui/regions-120x40.txt +++ b/tests/fixtures/tui/regions-120x40.txt @@ -1,7 +1,7 @@ RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found - is installed. + is installed. With none ticked, every region's BIOS is kept. > [1] North America [ ] Japan diff --git a/tests/fixtures/tui/regions-40x12.txt b/tests/fixtures/tui/regions-40x12.txt index 077ec3344..70928bc8b 100644 --- a/tests/fixtures/tui/regions-40x12.txt +++ b/tests/fixtures/tui/regions-40x12.txt @@ -3,10 +3,10 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan - A Tick B Done <> Order ? Help diff --git a/tests/fixtures/tui/regions-40x15.txt b/tests/fixtures/tui/regions-40x15.txt index ed7a42e45..fb7897ea1 100644 --- a/tests/fixtures/tui/regions-40x15.txt +++ b/tests/fixtures/tui/regions-40x15.txt @@ -3,7 +3,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan @@ -11,5 +12,4 @@ - A Tick B Done <> Order ? Help diff --git a/tests/fixtures/tui/regions-80x24.txt b/tests/fixtures/tui/regions-80x24.txt index f34ca81a9..fe09f21c6 100644 --- a/tests/fixtures/tui/regions-80x24.txt +++ b/tests/fixtures/tui/regions-80x24.txt @@ -1,7 +1,8 @@ RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. > [1] North America [ ] Japan @@ -20,5 +21,4 @@ - A/Enter Tick B/Esc Done Left/Right Order ? Help diff --git a/tests/fixtures/tui/route-evmapy.txt b/tests/fixtures/tui/route-evmapy.txt index dea4a502d..757cd93ec 100644 --- a/tests/fixtures/tui/route-evmapy.txt +++ b/tests/fixtures/tui/route-evmapy.txt @@ -623,12 +623,12 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan - A Tick B Done <> Order === regions 40x15 RetroBIOS: Preferred regions @@ -636,7 +636,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan @@ -644,13 +645,13 @@ - A Tick B Done <> Order === regions 80x24 RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. > [1] North America [ ] Japan @@ -669,43 +670,45 @@ - A Tick B Done Left/Right Order === cores 40x12 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. - - > Filter (with a keyboard) + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - A Filter B Back X Tick + A Tick all B Back X Tick === cores 40x15 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - - A Filter B Back X Tick + A Tick all B Back X Tick === cores 80x24 RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed @@ -721,10 +724,7 @@ - - - - A Filter B Back X Tick + A Tick all B Back X Tick === preview 80x24 RetroBIOS: Preview diff --git a/tests/fixtures/tui/route-gptokeyb.txt b/tests/fixtures/tui/route-gptokeyb.txt index be42befe4..57e529f2c 100644 --- a/tests/fixtures/tui/route-gptokeyb.txt +++ b/tests/fixtures/tui/route-gptokeyb.txt @@ -623,12 +623,12 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan - A Tick B Done <> Order === regions 40x15 RetroBIOS: Preferred regions @@ -636,7 +636,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan @@ -644,13 +645,13 @@ - A Tick B Done <> Order === regions 80x24 RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. > [1] North America [ ] Japan @@ -669,43 +670,45 @@ - A Tick B Done Left/Right Order === cores 40x12 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. - - > Filter (with a keyboard) + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - A Filter B Back X Tick + A Tick all B Back X Tick === cores 40x15 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - - A Filter B Back X Tick + A Tick all B Back X Tick === cores 80x24 RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed @@ -721,10 +724,7 @@ - - - - A Filter B Back X Tick + A Tick all B Back X Tick === preview 80x24 RetroBIOS: Preview diff --git a/tests/fixtures/tui/route-gptokeyb_muxterm.txt b/tests/fixtures/tui/route-gptokeyb_muxterm.txt index cd39e4a38..7b58f1a18 100644 --- a/tests/fixtures/tui/route-gptokeyb_muxterm.txt +++ b/tests/fixtures/tui/route-gptokeyb_muxterm.txt @@ -623,12 +623,12 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan - A Tick B Done <> Order === regions 40x15 RetroBIOS: Preferred regions @@ -636,7 +636,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan @@ -644,13 +645,13 @@ - A Tick B Done <> Order === regions 80x24 RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. > [1] North America [ ] Japan @@ -669,43 +670,45 @@ - A Tick B Done Left/Right Order === cores 40x12 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. - - > Filter (with a keyboard) + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - A Filter B Back X Tick + A Tick all B Back X Tick === cores 40x15 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - - A Filter B Back X Tick + A Tick all B Back X Tick === cores 80x24 RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed @@ -721,10 +724,7 @@ - - - - A Filter B Back X Tick + A Tick all B Back X Tick === preview 80x24 RetroBIOS: Preview diff --git a/tests/fixtures/tui/route-keys.txt b/tests/fixtures/tui/route-keys.txt index 189f0f71e..27618219c 100644 --- a/tests/fixtures/tui/route-keys.txt +++ b/tests/fixtures/tui/route-keys.txt @@ -598,12 +598,12 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan - Enter Tick Esc Done <> Order ? Help === regions 40x15 RetroBIOS: Preferred regions @@ -611,7 +611,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan @@ -619,13 +620,13 @@ - Enter Tick Esc Done <> Order ? Help === regions 80x24 RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. > [1] North America [ ] Japan @@ -644,43 +645,45 @@ - Enter Tick Esc Done Left/Right Order ? Help === cores 40x12 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. - - > Filter (/ to type) + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. + > All + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed - - - - Enter Filter Esc Back Space Tick + Enter Tick all Esc Back Space Tick === cores 40x15 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. - > Filter (/ to type) + > All + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed - - - - - Enter Filter Esc Back Space Tick + Enter Tick all Esc Back Space Tick === cores 80x24 RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. - > Filter (/ to type) + > All + None + Filter (/ to type) [ ] mesen [x] pcsx_rearmed @@ -696,10 +699,7 @@ - - - - Enter Filter Esc Back Space Tick ? Help + Enter Tick all Esc Back Space Tick ? Help === preview 40x12 RetroBIOS: Preview diff --git a/tests/fixtures/tui/route-miyoo.txt b/tests/fixtures/tui/route-miyoo.txt index 5b9098ff5..80d5b8cbd 100644 --- a/tests/fixtures/tui/route-miyoo.txt +++ b/tests/fixtures/tui/route-miyoo.txt @@ -652,12 +652,12 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan - A Tick R2 Done <> Order === regions 40x15 RetroBIOS: Preferred regions @@ -665,7 +665,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan @@ -673,13 +674,13 @@ - A Tick R2 Done <> Order === regions 80x24 RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. > [1] North America [ ] Japan @@ -698,43 +699,45 @@ - A Tick R2 Done Left/Right Order === cores 40x12 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. - - > Filter (with a keyboard) + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - A Filter R2 Back + A Tick all R2 Back === cores 40x15 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed - - - - - A Filter R2 Back + A Tick all R2 Back === cores 80x24 RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. - > Filter (with a keyboard) + > All + None + Filter (with a keyboard) [ ] mesen [x] pcsx_rearmed @@ -750,10 +753,7 @@ - - - - A Filter R2 Back + A Tick all R2 Back === preview 80x24 RetroBIOS: Preview diff --git a/tests/fixtures/tui/route-muxterm.txt b/tests/fixtures/tui/route-muxterm.txt index 05260a80f..1ad851b69 100644 --- a/tests/fixtures/tui/route-muxterm.txt +++ b/tests/fixtures/tui/route-muxterm.txt @@ -652,12 +652,12 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan - Start Tick B Done <> Order === regions 40x15 RetroBIOS: Preferred regions @@ -665,7 +665,8 @@ Tick the regions to keep, best first. Where a system has one BIOS per region, the best one found is - installed. + installed. With none ticked, every + region's BIOS is kept. > [1] North America [ ] Japan @@ -673,13 +674,13 @@ - Start Tick B Done <> Order === regions 80x24 RetroBIOS: Preferred regions Tick the regions to keep, best first. Where a system has one BIOS per region, - the best one found is installed. + the best one found is installed. With none ticked, every region's BIOS is + kept. > [1] North America [ ] Japan @@ -698,43 +699,45 @@ - Start Tick B Done Left/Right Order === cores 40x12 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. - - > Filter (Select shows a keyboard) + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. + > All + None + Filter (Select shows a keyboard) [ ] mesen [x] pcsx_rearmed - - - - Start Filter B Back Y Tick + Start Tick all B Back Y Tick === cores 40x15 RetroBIOS: Cores - Tick the cores you use. With none - ticked, every core's files are kept. + Every core ticked keeps every core's + files. Untick the cores you do not + use: the platform's own files are + always kept. - > Filter (Select shows a keyboard) + > All + None + Filter (Select shows a keyboard) [ ] mesen [x] pcsx_rearmed - - - - - Start Filter B Back Y Tick + Start Tick all B Back Y Tick === cores 80x24 RetroBIOS: Cores - Tick the cores you use. With none ticked, every core's files are kept. + Every core ticked keeps every core's files. Untick the cores you do not use: + the platform's own files are always kept. - > Filter (Select shows a keyboard) + > All + None + Filter (Select shows a keyboard) [ ] mesen [x] pcsx_rearmed @@ -750,10 +753,7 @@ - - - - Start Filter B Back Y Tick + Start Tick all B Back Y Tick === preview 40x12 RetroBIOS: Preview diff --git a/tests/test_install_from.py b/tests/test_install_from.py index 2ddb97e7e..ff28c52c7 100644 --- a/tests/test_install_from.py +++ b/tests/test_install_from.py @@ -148,7 +148,7 @@ class CopyFromAnOldCard(FromFolder): proc = self.install() self.assertEqual(proc.returncode, 1, proc.stdout + proc.stderr) self.assertEqual(self.installed(), {"scph5500.bin": JP, "pcsx/extra.bin": EXTRA}) - self.assertIn(f"2 files copied from {self.old}, 2 still missing.", proc.stdout) + self.assertIn(f"2 files copied from {self.old}, 2 failed.", proc.stdout) def test_a_link_out_of_the_folder_is_not_followed(self): outside = self.root / "elsewhere" @@ -196,7 +196,7 @@ class CopyFromAnOldCard(FromFolder): (repo.root / "bios" / "mgba_extra.bin").unlink() proc = repo.run("--from", str(old), "--no-input") self.assertEqual(proc.returncode, 1, proc.stdout + proc.stderr) - self.assertIn(f"2 files copied from {old}, 2 downloaded, 1 still missing.", + self.assertIn(f"2 files copied from {old}, 2 downloaded, 1 failed.", proc.stdout) self.assertEqual(sorted(repo.installed()), sorted( name for name in payloads if name != "mgba/extra.bin")) diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py index 96602a56e..f4cf5099a 100644 --- a/tests/test_install_tui.py +++ b/tests/test_install_tui.py @@ -527,18 +527,20 @@ class Flow(unittest.TestCase): state.focus["options"] = 3 press(state, "enter") self.assertEqual(state.screen, "cores") - self.assertEqual([row.value for row in install.tui_rows(state)][1:], + self.assertEqual([row.value for row in install.tui_rows(state)][3:], ["mesen", "pcsx_rearmed"]) self.assertEqual(install.tui_rows(state)[state.focus["cores"]].value, "mesen") + # Every core ticked while none narrows the run: one untick keeps + # the others, ticked back it is every core again. press(state, " ") - self.assertEqual(state.cores, ["mesen"]) - press(state, "left") + self.assertEqual(state.cores, ["pcsx_rearmed"]) + press(state, "right") self.assertEqual(state.cores, []) press(state, "/", "p", "c") - self.assertEqual([row.value for row in install.tui_rows(state)][1:], ["pcsx_rearmed"]) - press(state, "enter", "right", "enter") + self.assertEqual([row.value for row in install.tui_rows(state)][3:], ["pcsx_rearmed"]) + press(state, "enter", "left", "enter") self.assertEqual(state.screen, "options") - self.assertEqual(install.tui_flags(state), [("--core", "pcsx_rearmed")]) + self.assertEqual(install.tui_flags(state), [("--core", "mesen")]) def test_preview_is_a_dry_run(self): state = checked_state() @@ -13855,6 +13857,81 @@ class AuditTwentyThreeAndSixteen(unittest.TestCase): self.assertIn("reads its BIOS files", small) self.assertIn(folder[-12:], small) + # The owner's note: Cores drew every box empty when no core narrows the + # run, read as "nothing is ticked, tick them all". + + def cores_screen(self, **given) -> install.TuiState: + state = checked_state() + state.cores = list(given.get("cores", [])) + state.cli_cores = list(state.cores) + press(state, "o") + state.focus["options"] = next(index for index, row in enumerate( + install.tui_rows(state)) if row.action == "cores") + press(state, "enter") + self.assertEqual(state.screen, "cores") + return state + + @staticmethod + def boxes(state: install.TuiState) -> dict: + return {row.value: row.label[:3] for row in install.tui_rows(state) + if row.action == "core"} + + def test_cores_open_every_one_ticked(self): + state = self.cores_screen() + self.assertEqual(self.boxes(state), {"mesen": "[x]", "pcsx_rearmed": "[x]"}) + self.assertEqual(install.tui_rows(state)[state.focus["cores"]].value, "mesen") + self.assertEqual(install.tui_flags(state), []) + + def test_one_untick_narrows_to_the_others(self): + state = self.cores_screen() + press(state, " ") + self.assertEqual(self.boxes(state), {"mesen": "[ ]", "pcsx_rearmed": "[x]"}) + self.assertEqual(install.tui_flags(state), [("--core", "pcsx_rearmed")]) + press(state, " ") + self.assertEqual(self.boxes(state), {"mesen": "[x]", "pcsx_rearmed": "[x]"}) + self.assertEqual(state.cores, []) + press(state, " ", "enter") + self.assertEqual(state.screen, "options") + row = next(row for row in install.tui_rows(state) if row.action == "cores") + self.assertEqual(row.label, "Cores: 1 of 2") + state.stack = ["setup", "plan"] + self.assertIn("1 of 2 cores", " ".join(install.tui_view(state, 100, 30))) + + def test_none_then_all_as_the_systems_list(self): + state = self.cores_screen() + rows = install.tui_rows(state) + state.focus["cores"] = next(i for i, row in enumerate(rows) if row.action == "none") + press(state, "enter") + self.assertEqual(self.boxes(state), {"mesen": "[ ]", "pcsx_rearmed": "[ ]"}) + press(state, "enter") + self.assertEqual(state.screen, "cores") + self.assertIn("No core is ticked", str(state.status)) + state.focus["cores"] = next(i for i, row in enumerate(rows) if row.action == "all") + press(state, "enter") + self.assertEqual(self.boxes(state), {"mesen": "[x]", "pcsx_rearmed": "[x]"}) + self.assertEqual(install.tui_flags(state), []) + + def test_core_ticks_only_the_cores_it_names(self): + state = self.cores_screen(cores=["pcsx_rearmed"]) + self.assertEqual(self.boxes(state), {"mesen": "[ ]", "pcsx_rearmed": "[x]"}) + state.stack = ["setup", "plan"] + self.assertIn("--core", " ".join(install.tui_view(state, 100, 30))) + + def test_both_modes_count_the_cores_kept_alike(self): + listing = self.listing("retroarch", [ + self.entry("a.bin", b"A" * 8, ["nintendo-gba"]), + self.entry("m.bin", b"M" * 8, ["nintendo-gba"], cores=["mgba"]), + self.entry("v.bin", b"V" * 8, ["nintendo-gba"], cores=["vba_next"]), + self.entry("p.bin", b"P" * 8, ["sony-playstation"])]) + text, _asked = self.line_run(_args(manifest=listing, dest=self.here, + declared_only=False, dry_run=True), + ["c", "", "2"]) + self.assertIn("Every core's extra files are kept: Enter keeps them all", text) + head = text.rsplit("Counted again for your choices", 1)[1] + self.assertIn("1 of 2 cores", head) + self.assertEqual(install.cores_words(0, 2), "all cores") + self.assertEqual(install.cores_words(2, 2), "all cores") + # Root cause 6: the pages say what the installer shows. def test_which_pack_names_the_first_screen(self): diff --git a/wiki/installer.md b/wiki/installer.md index cd21730d0..19531cdeb 100644 --- a/wiki/installer.md +++ b/wiki/installer.md @@ -770,7 +770,11 @@ answer is not asked. chosen too, as `generate_pack.py --system` does. - **Cores.** The platform's own BIOS list for the chosen systems is always kept. This narrows only the extra files each emulator core loads beyond it. - Asked only when the chosen systems have such files. + Asked only when the chosen systems have such files. Every core is kept + until numbers name some, and the head then says how many of how many + (`1 of 2 cores`). The full screen's **Cores** opens with every core + ticked, as Choose systems does: untick the ones you do not use, **All** + and **None** tick or untick them all. - **Regions.** Asked only when a chosen system has one BIOS per region. The numbers give an order of preference: `2,1` keeps the second region where a file for it exists, and the first one elsewhere.