diff --git a/README.md b/README.md
index 1619a57a6..28c179745 100644
--- a/README.md
+++ b/README.md
@@ -43,11 +43,11 @@ The Files column counts what a pack holds once unzipped.
| Setup | Files | Size | Unzip into | Download |
|-------|------:|-----:|------------|----------|
-| Batocera | 19,125 | 10.1 GB | `/userdata/bios/` | [Download](https://abdess.github.io/retrobios/get/batocera/) |
-| EmuDeck | 14,651 | 8.0 GB | `~/Emulation/bios/` | [Download](https://abdess.github.io/retrobios/get/emudeck/) |
+| Batocera | 20,717 | 10.9 GB | `/userdata/bios/` | [Download](https://abdess.github.io/retrobios/get/batocera/) |
+| EmuDeck | 16,038 | 8.1 GB | `~/Emulation/bios/` | [Download](https://abdess.github.io/retrobios/get/emudeck/) |
| MiSTer FPGA | 90 | 29 MB | `/media/fat/games/` | [Download](https://abdess.github.io/retrobios/get/misterfpga/) |
-| RetroArch | 15,005 | 7.6 GB | `system/` | [Download](https://abdess.github.io/retrobios/get/retroarch/) |
-| RetroBat | 8,882 | 8.2 GB | `bios/` | [Download](https://abdess.github.io/retrobios/get/retrobat/) |
+| RetroArch | 14,989 | 7.5 GB | `system/` | [Download](https://abdess.github.io/retrobios/get/retroarch/) |
+| RetroBat | 11,209 | 8.9 GB | `bios/` | [Download](https://abdess.github.io/retrobios/get/retrobat/) |
| RomM | 468 | 831 MB | `library/bios/` | [Download](https://abdess.github.io/retrobios/get/romm/) |
ZIPs are made for the setups most people download. The others install with the line above, and each page gives the command: [AmberELEC](https://abdess.github.io/retrobios/get/amberelec/), [BizHawk](https://abdess.github.io/retrobios/get/bizhawk/), [EmuELEC](https://abdess.github.io/retrobios/get/emuelec/), [KNULLI](https://abdess.github.io/retrobios/get/knulli/), [Lakka](https://abdess.github.io/retrobios/get/lakka/), [MinUI](https://abdess.github.io/retrobios/get/minui/), [MyMinUI](https://abdess.github.io/retrobios/get/myminui/), [NextUI](https://abdess.github.io/retrobios/get/nextui/), [ROCKNIX](https://abdess.github.io/retrobios/get/rocknix/), [Recalbox](https://abdess.github.io/retrobios/get/recalbox/), [RetroDECK](https://abdess.github.io/retrobios/get/retrodeck/), [RetroPie](https://abdess.github.io/retrobios/get/retropie/).
@@ -110,4 +110,4 @@ The scripts and tooling are released under the [MIT License](LICENSE).
The BIOS and firmware files are not covered by that license: they are third-party system software, preserved and provided for personal backup, archival, and interoperability with emulation software. [NOTICE](NOTICE) sets out their status and how to ask for a file to be removed.
The reasoning, and where it is weakest, is in [the project's legal position](https://abdess.github.io/retrobios/wiki/legal/).
-*Auto-generated on 2026-11-11T21:59:37Z*
+*Auto-generated on 2026-11-12T02:12:16Z*
diff --git a/install.ps1 b/install.ps1
index 2158d2a78..4d3ef36ec 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 = "b2b012c9e63239c0d68aa2e87aab59e5a5f1fa0f17c33db63e6da221e5d7f42b"
+ $defaultInstallSha256 = "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650"
# 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 f812c9a9a..b6964da98 100644
--- a/install.py
+++ b/install.py
@@ -7455,6 +7455,137 @@ def plan_removal(
return Removal(plat, folder, remove, kept, gone, choice, lost)
+def _parent_of(dest: str) -> str:
+ """The folder of a dest, "" at the top: dc for dc/dc_boot.bin."""
+ parent = PurePosixPath(dest).parent.as_posix()
+ return "" if parent == "." else parent
+
+
+def plan_misplaced_removal(
+ plat: str, folder: Path, record: dict, manifests: list[dict],
+) -> Removal:
+ """The copies in the wrong place of the BIOS folder that removing takes.
+
+ A copy goes when its bytes are those of a file plat's record says the
+ installer placed, read again now at that place, under that file's own
+ name, and it sits beside that file (the name in another case), or at
+ the top of the folder where the list places files there itself:
+ GBA_BIOS.BIN beside gba_bios.bin, dc_boot.bin at the top of RetroArch's
+ system folder for dc/dc_boot.bin. A renamed copy stays: a core option,
+ a launcher or a frontend entry may name it. Only those folders
+ are read, so a games folder (ports/doom on a card whose install folder
+ is the roms folder), the save folder and any other tree are never
+ looked at. Even there these stay:
+
+ - a place any list of manifests reads or any setup recorded, in any
+ root, whole or as the end of the path from a folder down
+ - a link, anything but a regular file, a file with a second name, and
+ the installer's own file under a spelling the record does not use.
+ """
+ folder = Path(os.path.abspath(folder))
+ fold = not keeps_case(folder)
+
+ def norm(dest: str) -> str:
+ return dest.casefold() if fold else dest
+
+ known: set[str] = set()
+ top_placed = False
+ # Game data sits in folders a frontend lists as games: DOOM2.WAD beside
+ # doom2.wad is a game entry of its own there, never a copy.
+ games = {norm(str(entry.get("dest", ""))) for manifest in manifests
+ for entry in manifest.get("files") or [] if entry.get("category") == "game_data"}
+ for manifest in manifests:
+ for root, dest in _served(manifest, fold):
+ known.add(dest)
+ top_placed = top_placed or (root == "" and "/" not in dest)
+ known |= {norm(str(entry.get("dest", "")))
+ for entry in manifest.get("omitted_files") or []}
+ known |= {norm(str(item["dest"])) for setup in record["setups"].values()
+ for item in setup.get("files") or []}
+ placed: dict[int, list[dict]] = {}
+ # The folders read: each one the installer placed a file in, and the
+ # top where the list places files there itself.
+ folders: dict[str, str] = {"": ""} if top_placed else {}
+ for item in record["setups"][plat].get("files") or []:
+ if str(item.get("root") or "") == "" and isinstance(item.get("size"), int):
+ placed.setdefault(item["size"], []).append(item)
+ parent = _parent_of(str(item["dest"]))
+ folders.setdefault(norm(parent), parent)
+ proven: dict[str, tuple[str, os.stat_result, Path] | None] = {}
+
+ def in_place(item: dict) -> tuple[str, os.stat_result, Path] | None:
+ """The placed file's dest, lstat and path when it still holds its bytes."""
+ if item["dest"] not in proven:
+ path, why = _below(folder, item["dest"])
+ info = None
+ if path is not None and not why:
+ why, info = _check_ours(path, item)
+ proven[item["dest"]] = ((item["dest"], info, path)
+ if not why and info and path is not None else None)
+ return proven[item["dest"]]
+
+ def read_somewhere(rel: str) -> bool:
+ """Whether rel is a known place, or ends with one that names a
+ folder: saves/n3ds/Azahar/sysdata/keys.txt is the save folder's
+ n3ds/Azahar/sysdata/keys.txt. A bare name is no such end."""
+ parts = norm(rel).split("/")
+ return "/".join(parts) in known or any(
+ "/".join(parts[index:]) in known for index in range(1, len(parts) - 1))
+
+ remove: list[dict] = []
+ for rel_dir in sorted(folders.values()):
+ # The folder reached through no link, as _below reaches a file in it.
+ inside, why = _below(folder, f"{rel_dir}/-" if rel_dir else "-")
+ if inside is None or why:
+ continue
+ try:
+ entries = sorted(os.scandir(inside.parent), key=lambda entry: entry.name)
+ except OSError:
+ continue
+ for entry in entries:
+ rel = f"{rel_dir}/{entry.name}" if rel_dir else entry.name
+ if entry.name in (".nomedia", BACKUP_DIR) or read_somewhere(rel):
+ continue
+ path = Path(entry.path)
+ try:
+ info = os.lstat(path)
+ except OSError:
+ continue
+ if (not stat.S_ISREG(info.st_mode) or _is_link(info) or info.st_nlink != 1
+ or info.st_size not in placed):
+ continue
+ try:
+ sha1 = _digest_file(path, ("sha1",))["sha1"]
+ except OSError:
+ continue
+ found = [(other, hit) for other in placed[info.st_size] if other["sha1"] == sha1
+ for hit in [in_place(other)] if hit is not None]
+ if any(norm(str(other["dest"])) in games for other, _hit in found):
+ continue
+ if any((hit[1].st_dev, hit[1].st_ino) == (info.st_dev, info.st_ino)
+ for _other, hit in found):
+ # The installer's own file under a spelling the record does not use.
+ continue
+ # Under its twin's own name: a copy renamed (SCPH-39001 USA.bin, a
+ # game's own title) may be read by that name, a core option or a
+ # frontend entry naming it. Beside its twin that name differs in
+ # case only, and at the top it is a twin's anywhere below.
+ near = [hit for other, hit in found
+ if PurePosixPath(str(other["dest"])).name.casefold()
+ == entry.name.casefold()
+ and ((not rel_dir and top_placed)
+ or norm(_parent_of(str(other["dest"]))) == norm(rel_dir))]
+ if not near:
+ continue
+ remove.append({"dest": rel, "root": "", "sha1": sha1, "size": info.st_size,
+ "systems": [], "path": path, "inode": _stamp(info),
+ "placed": near[0][0], "placed_path": near[0][2],
+ "placed_inode": _stamp(near[0][1])})
+ remove.sort(key=lambda entry: str(entry["dest"]))
+ return Removal(plat, folder, remove, [], [], list(record["setups"][plat].get("choice")
+ or []), [])
+
+
def _left_by_hand(folder: Path, record: dict, fold: bool) -> list[str]:
"""The files in folder that no setup of its record names: placed by the
user or another program, never touched, counted in the summary."""
@@ -7494,6 +7625,38 @@ def _stamp(info: os.stat_result) -> tuple[int, int, int, int]:
return info.st_dev, info.st_ino, info.st_size, info.st_mtime_ns
+def _other_setup_list(name: str) -> tuple[dict | None, str]:
+ """The list of another setup of the folder, fetched from the address
+ whatever list this run was given, or None and why it is not at hand."""
+ if offline_requested():
+ return None, "this run is offline: run it again with the internet"
+ try:
+ return _validate_manifest(_fetch_json(MANIFEST_URL.format(platform=name),
+ MAX_MANIFEST_BYTES, "file list"), name), ""
+ except urllib.error.HTTPError as exc:
+ if exc.code == 404:
+ return None, "no such list exists, as for a setup this installer no longer serves"
+ return None, f"the server answered HTTP {exc.code}: run it again later"
+ except (ValueError, OSError):
+ return None, "it could not be fetched: run it again with the internet"
+
+
+def _still_in_place(entry: dict) -> bool:
+ """For a misplaced copy, whether the file it duplicates is still the one
+ the plan read at its place: a copy is deleted only while that one holds
+ its bytes. True for any other entry."""
+ placed = entry.get("placed_path")
+ if placed is None:
+ return True
+ try:
+ info = os.lstat(placed)
+ return (stat.S_ISREG(info.st_mode) and not _is_link(info)
+ and _stamp(info) == entry["placed_inode"]
+ and _digest_file(placed, ("sha1",))["sha1"] == entry["sha1"])
+ except OSError:
+ return False
+
+
class _ChangedSincePlan(OSError):
"""The file is not the one the plan read: it stays."""
@@ -7515,7 +7678,8 @@ def remove_files(removal: Removal, setup: dict, backup: bool
info = os.lstat(path)
if (not stat.S_ISREG(info.st_mode) or _is_link(info)
or _stamp(info) != entry["inode"]
- or _digest_file(path, ("sha1",))["sha1"] != entry["sha1"]):
+ or _digest_file(path, ("sha1",))["sha1"] != entry["sha1"]
+ or not _still_in_place(entry)):
raise _ChangedSincePlan(errno.ESTALE, CHANGED_SINCE_PLAN)
if backup:
if run is None or under is None:
@@ -7637,14 +7801,50 @@ def run_removal(args: argparse.Namespace) -> int:
files = _named_files(args.file or [], folder)
if files is None:
return 2
- removal = plan_removal(plat, folder, read.data, manifest, systems=systems, cores=cores,
- emulators=emulators, files=files)
+ misplaced = bool(getattr(args, "misplaced", False))
+ if misplaced:
+ # Every setup of the folder protects the places its list reads: one
+ # whose list or record entry cannot be read leaves nothing to tell
+ # its files from copies, so nothing is removed.
+ message = ""
+ if read.dropped:
+ message = (f"Nothing was removed from {shown_path(folder)}: the install "
+ f"record's entry for {display_name(read.dropped[0])}, which shares "
+ "the folder, cannot be used, so its files would not be told from "
+ f"copies. Install {display_name(read.dropped[0])} again, with the "
+ "choice it was installed with, to rewrite it.")
+ others = []
+ for name in read.data["setups"]:
+ if name == plat or message:
+ continue
+ other, why = _other_setup_list(name)
+ if other is None:
+ message = (f"Nothing was removed from {shown_path(folder)}: the file list "
+ f"of {display_name(name)}, which shares the folder, is needed "
+ f"to tell its files from copies, and {why}.")
+ else:
+ others.append(other)
+ if message:
+ print(message, file=sys.stderr)
+ EVENTS.emit("removal_plan", platform=plat, folder=str(folder), files=0, bytes=0,
+ systems=[], dests=[], kept=[], gone=0, backup=False,
+ message=message)
+ return 2
+ removal = plan_misplaced_removal(plat, folder, read.data, [manifest, *others])
+ else:
+ removal = plan_removal(plat, folder, read.data, manifest, systems=systems,
+ cores=cores, emulators=emulators, files=files)
size = sum(entry["size"] for entry in removal.remove)
- whole = not (systems or cores or emulators or files)
+ whole = not (systems or cores or emulators or files or misplaced)
by_hand = _left_by_hand(folder, read.data, not keeps_case(folder)) if whole else []
where = f"{shown_path(folder)} for {display_name(plat, manifest)}"
if not removal.remove:
- headline = f"Nothing to remove from {where}."
+ headline = (f"No copy in the wrong place of {where}." if misplaced
+ else f"Nothing to remove from {where}.")
+ elif misplaced:
+ headline = (f"Remove {_plural(len(removal.remove), 'copy')} in the wrong "
+ f"place of {where}, {format_size(size)} freed. Each is a file "
+ "RetroBIOS placed where the cores read it.")
elif args.backup:
headline = (f"Move {_plural(len(removal.remove), 'file')} "
f"({format_size(size)}) from {where} to a backup.")
@@ -7658,9 +7858,14 @@ def run_removal(args: argparse.Namespace) -> int:
for item in removal.kept],
gone=len(removal.gone), backup=bool(args.backup), message=headline)
print(headline)
- if args.dry_run or args.verbose:
- for entry in removal.remove:
- print(f" {entry['dest']}")
+ # The copies are the user's: they are named before any question.
+ listed = (removal.remove if args.dry_run or args.verbose
+ else removal.remove[:REMOVAL_KEPT_SHOWN] if misplaced else [])
+ for entry in listed:
+ print(f" {entry['dest']}" + (f" (in place: {entry['placed']})"
+ if entry.get("placed") else ""))
+ if len(listed) < len(removal.remove) and misplaced:
+ print(f" and {len(removal.remove) - len(listed)} more (--dry-run lists them)")
if removal.kept:
print(f"{agree(len(removal.kept), 'file stays', 'files stay')}: "
f"{_kept_words(removal.kept)}.")
@@ -7693,7 +7898,8 @@ def run_removal(args: argparse.Namespace) -> int:
return QUIT_CODE
KEPT.reset()
removed, failed, run = remove_files(removal, setup, bool(args.backup))
- problem = _record_after_removal(removal, removed)
+ # The copies were never the record's: it stays as it is.
+ problem = "" if misplaced else _record_after_removal(removal, removed)
freed = sum(entry["size"] for entry in removed)
if run is not None:
print(f"Moved {_plural(len(removed), 'file')} ({format_size(freed)}) to "
@@ -7704,7 +7910,8 @@ def run_removal(args: argparse.Namespace) -> int:
files=len(removed), bytes=freed, source="remove", status="made",
message=f"Moved {_plural(len(removed), 'file')} here.")
elif removed:
- print(f"Removed {_plural(len(removed), 'file')}, {format_size(freed)} freed.")
+ print(f"Removed {_plural(len(removed), 'copy' if misplaced else 'file')}, "
+ f"{format_size(freed)} freed.")
changed = [item for item in failed if item["changed"]]
if changed:
print(f"{agree(len(changed), 'file stays', 'files stay')}: "
@@ -16859,6 +17066,13 @@ def build_parser() -> argparse.ArgumentParser:
help="with --remove, one file of the BIOS folder (its path there, or the "
"full path). Repeat for several",
)
+ parser.add_argument(
+ "--misplaced",
+ action="store_true",
+ help="with --remove, delete instead the copies left in the wrong place of the "
+ "BIOS folder: each one whose bytes the installer placed where the cores "
+ "read them. A place a list reads, or a setup of the folder recorded, stays",
+ )
parser.add_argument(
"--backup",
action="store_true",
@@ -17255,7 +17469,7 @@ _ACTION_TAKES = {
"delete_backup": ("dry_run", "events", "yes", "no_input", "verbose"),
"backups": ("platform", "dest", "events", "no_input", "verbose"),
"remove": ("platform", "dest", "system", "core", "emulator", "file", "backup",
- "dry_run", "events", "yes", "no_input", "verbose", "manifest", "from_pack",
+ "misplaced", "dry_run", "events", "yes", "no_input", "verbose", "manifest", "from_pack",
"offline"),
}
# Options that are a choice of their own, never refused for being given.
@@ -17264,13 +17478,13 @@ _ACTION_FREE = ("jobs", "plain", "from_record")
def _check_actions(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None:
"""Refuse an action given with an option it does not read, two actions,
- or --file and --backup without --remove."""
+ or --file, --backup and --misplaced without --remove."""
actions = [name for name in _ACTION_TAKES if getattr(args, name)]
if len(actions) > 1:
parser.error(f"--{actions[0].replace('_', '-')} and --{actions[1].replace('_', '-')} "
"are two actions: run them one at a time")
if not actions:
- for name in ("file", "backup"):
+ for name in ("file", "backup", "misplaced"):
if getattr(args, name):
parser.error(f"--{name} applies to --remove")
return
@@ -17289,6 +17503,10 @@ def _check_actions(parser: argparse.ArgumentParser, args: argparse.Namespace) ->
if len(narrowed) > 1:
parser.error(f"--remove takes one of --system, --core, --emulator or --file, "
f"not {narrowed[0]} and {narrowed[1]}")
+ if args.misplaced and (narrowed or args.backup):
+ # The copies are the user's, so no backup note can give them
+ # back to a setup, and no system or core names them.
+ parser.error(f"--remove --misplaced takes no {(narrowed or ['--backup'])[0]}")
def _check_pack(parser: argparse.ArgumentParser, args: argparse.Namespace) -> None:
@@ -25330,7 +25548,7 @@ _ROW_VERBS = {
"device": "Open", "emulators": "Open", "emulator": "Tick", "board": "Choose",
"pack": "Choose", "offline": "Change", "more": "Open", "remove": "Open",
"backups": "Open", "putback": "Open", "dropbackup": "Open", "rmall": "Choose",
- "rmsystem": "Choose", "rmgo": "Remove", "rmbackup": "Change", "backup": "Choose",
+ "rmsystem": "Choose", "rmmisplaced": "Choose", "rmgo": "Remove", "rmbackup": "Change", "backup": "Choose",
"bkrestore": "Put back", "bkdelete": "Delete", "actgo": "Confirm",
"packmake": "Open", "packgo": "Make", "packwhere": "Change",
}
@@ -27407,8 +27625,9 @@ def tui_action_argv(state: TuiState, run: str, python: str, script: str) -> list
return argv + ["--backups", "--events"]
if state.manifest_path is not None:
argv.append(f"--manifest={state.manifest_path}")
- argv += ["--remove", *(f"{flag}={value}" for flag, value in state.removal_scope)]
- if state.removal_backup:
+ argv += ["--remove", *(f"{flag}={value}" if value else flag
+ for flag, value in state.removal_scope)]
+ if state.removal_backup and not _removing_misplaced(state):
argv.append("--backup")
return argv + (["--dry-run", "--events"] if run == "removal_plan" else ["--events", "--yes"])
@@ -27456,7 +27675,8 @@ def _remove_rows(state: TuiState) -> list[TuiRow]:
return [TuiRow("back", "Back")]
files = state.record.get("files") or []
size = format_size(sum(int(item.get("size") or 0) for item in files))
- rows = [TuiRow("rmall", "All RetroBIOS files", size, keep_right=True)]
+ rows = [TuiRow("rmall", "All RetroBIOS files", size, keep_right=True),
+ TuiRow("rmmisplaced", "Misplaced copies")]
for system, count, length in tui_removal_systems(state):
rows.append(TuiRow("rmsystem", system_title(system, state.manifest),
format_size(length), system, narrow=(_plural(count, "file"),),
@@ -27464,6 +27684,12 @@ def _remove_rows(state: TuiState) -> list[TuiRow]:
return rows
+def _removing_misplaced(state: TuiState) -> bool:
+ """Whether the removal is of the copies in the wrong place, which are
+ deleted: they were never a setup's, so no backup gives them back."""
+ return ("--misplaced", "") in state.removal_scope
+
+
def _removal_rows(state: TuiState) -> list[TuiRow]:
"""The removal plan's rows: Remove with the space it frees, the backup
choice, Details and Back."""
@@ -27473,9 +27699,11 @@ def _removal_rows(state: TuiState) -> list[TuiRow]:
rows = []
if plan["files"]:
rows.append(TuiRow("rmgo", f"Move {format_size(plan['bytes'])} to a backup"
- if state.removal_backup else f"Remove {format_size(plan['bytes'])}"))
- rows.append(TuiRow("rmbackup", f"Keep a backup: {_yes(state.removal_backup)}",
- "--backup"))
+ if state.removal_backup and not _removing_misplaced(state)
+ else f"Remove {format_size(plan['bytes'])}"))
+ if not _removing_misplaced(state):
+ rows.append(TuiRow("rmbackup", f"Keep a backup: {_yes(state.removal_backup)}",
+ "--backup"))
# B goes back: a Back row pushed what stays out of a 40x12 screen.
return rows + _details_row(state)
@@ -27505,7 +27733,8 @@ def _action_rows(state: TuiState) -> list[TuiRow]:
return [TuiRow("bkrestore", "Put back"), TuiRow("bkdelete", "Delete"),
TuiRow("back", "Back")]
if screen == "actconfirm":
- verb = {"remove": "Move to a backup" if state.removal_backup else "Remove",
+ verb = {"remove": "Move to a backup"
+ if state.removal_backup and not _removing_misplaced(state) else "Remove",
"restore": "Put back", "delete_backup": "Delete"}[state.action]
return [TuiRow("actgo", verb), TuiRow("back", "Back")]
if screen == "actdone" and not state.running:
@@ -27553,6 +27782,7 @@ def _activate_action(state: TuiState, row: TuiRow) -> list[tuple]:
"dropbackup": "delete_backup"}[action])
if screen == "remove":
state.removal_scope = ([("--system", str(row.value))] if action == "rmsystem"
+ else [("--misplaced", "")] if action == "rmmisplaced"
else [])
state.removal = None
_push(state, "removal")
@@ -27635,7 +27865,12 @@ def _removal_text(state: TuiState) -> list:
plan = state.removal or {}
folder = _short_path(state.dest, state.home)
if not plan.get("files"):
- lines: list = ["Nothing here can be removed."]
+ lines: list = ["No copy in the wrong place." if _removing_misplaced(state)
+ else "Nothing here can be removed."]
+ elif _removing_misplaced(state):
+ lines = [f"{_plural(plan['files'], 'copy')} in the wrong place go, "
+ f"{format_size(plan['bytes'])} freed. The files where the cores read "
+ "them stay."]
elif state.removal_backup:
lines = [f"{_plural(plan['files'], 'file')} to a backup, "
f"{format_size(plan['bytes'])}."]
@@ -27711,6 +27946,10 @@ def _view_backup(state: TuiState, width: int, height: int) -> tuple:
def _confirm_action_text(state: TuiState) -> list[str]:
if state.action == "remove":
plan = state.removal or {}
+ if _removing_misplaced(state):
+ return [f"Remove {_plural(plan.get('files', 0), 'copy')} in the wrong place for "
+ f"good? {format_size(plan.get('bytes', 0))} is freed. The files where "
+ "the cores read them stay."]
if state.removal_backup:
return [f"Move {_plural(plan.get('files', 0), 'file')} to a backup? The space "
"is freed once the backup is deleted."]
diff --git a/install.sh b/install.sh
index 9355b633f..46ab24bea 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="b2b012c9e63239c0d68aa2e87aab59e5a5f1fa0f17c33db63e6da221e5d7f42b"
+DEFAULT_INSTALL_SHA256="c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650"
# 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 0215b9685..d60a0ec3d 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": 1367313,
- "sha256": "b2b012c9e63239c0d68aa2e87aab59e5a5f1fa0f17c33db63e6da221e5d7f42b",
+ "size": 1379952,
+ "sha256": "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650",
"executable": false
},
{
@@ -71,8 +71,8 @@
"muos": {
"archive": {
"dest": "ARCHIVE/RetroBIOS.muxapp",
- "size": 1420938,
- "sha256": "7d23a5c6d1028b39ef54467d03860493d188d3dec79d70723f149e6f1411475d"
+ "size": 1433577,
+ "sha256": "153c13d4901e1899a935f04b164c7b96a1af08d0aafac93378a18aa62923c20d"
},
"members": [
{
@@ -92,8 +92,8 @@
{
"name": "RetroBIOS/install.py",
"repo_path": "install.py",
- "size": 1367313,
- "sha256": "b2b012c9e63239c0d68aa2e87aab59e5a5f1fa0f17c33db63e6da221e5d7f42b",
+ "size": 1379952,
+ "sha256": "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650",
"executable": false
},
{
@@ -166,8 +166,8 @@
{
"dest": ".config/modules/retrobios/install.py",
"repo_path": "install.py",
- "size": 1367313,
- "sha256": "b2b012c9e63239c0d68aa2e87aab59e5a5f1fa0f17c33db63e6da221e5d7f42b",
+ "size": 1379952,
+ "sha256": "c09a21f98f3080536ac599e954560730ad198e1a69742065179d8d5fa86ff650",
"executable": false
},
{
diff --git a/release.json b/release.json
index e2fa19dca..f293b8f38 100644
--- a/release.json
+++ b/release.json
@@ -1,25 +1,26 @@
{
"schema_version": 1,
- "tag": "v2026.11.10",
+ "tag": "v2026.11.11",
"packs": {
"Batocera_43.1_BIOS_Pack.zip": {
- "files": 19125,
- "extracted_size": 10792595135,
- "download_size": 7364979492,
+ "files": 20717,
+ "extracted_size": 11718549509,
+ "download_size": 8127352876,
"assets": [
- "Batocera_43.1_BIOS_Pack.part1of4.zip",
- "Batocera_43.1_BIOS_Pack.part2of4.zip",
- "Batocera_43.1_BIOS_Pack.part3of4.zip",
- "Batocera_43.1_BIOS_Pack.part4of4.zip"
+ "Batocera_43.1_BIOS_Pack.part1of5.zip",
+ "Batocera_43.1_BIOS_Pack.part2of5.zip",
+ "Batocera_43.1_BIOS_Pack.part3of5.zip",
+ "Batocera_43.1_BIOS_Pack.part4of5.zip",
+ "Batocera_43.1_BIOS_Pack.part5of5.zip"
],
"platforms": [
"batocera"
]
},
"EmuDeck_2.7EA_BIOS_Pack.zip": {
- "files": 14651,
- "extracted_size": 8555799930,
- "download_size": 5344993664,
+ "files": 16038,
+ "extracted_size": 8713666159,
+ "download_size": 5638755492,
"assets": [
"EmuDeck_2.7EA_BIOS_Pack.part1of3.zip",
"EmuDeck_2.7EA_BIOS_Pack.part2of3.zip",
@@ -41,9 +42,9 @@
]
},
"RetroArch_v1.22.2_BIOS_Pack.zip": {
- "files": 15005,
- "extracted_size": 8201385955,
- "download_size": 5073855389,
+ "files": 14989,
+ "extracted_size": 8031879733,
+ "download_size": 5040774606,
"assets": [
"RetroArch_v1.22.2_BIOS_Pack.part1of3.zip",
"RetroArch_v1.22.2_BIOS_Pack.part2of3.zip",
@@ -54,13 +55,14 @@
]
},
"RetroBat_8.3.1_BIOS_Pack.zip": {
- "files": 8882,
- "extracted_size": 8837711598,
- "download_size": 5814138531,
+ "files": 11209,
+ "extracted_size": 9603031964,
+ "download_size": 6361188449,
"assets": [
- "RetroBat_8.3.1_BIOS_Pack.part1of3.zip",
- "RetroBat_8.3.1_BIOS_Pack.part2of3.zip",
- "RetroBat_8.3.1_BIOS_Pack.part3of3.zip"
+ "RetroBat_8.3.1_BIOS_Pack.part1of4.zip",
+ "RetroBat_8.3.1_BIOS_Pack.part2of4.zip",
+ "RetroBat_8.3.1_BIOS_Pack.part3of4.zip",
+ "RetroBat_8.3.1_BIOS_Pack.part4of4.zip"
],
"platforms": [
"retrobat"
@@ -68,8 +70,8 @@
},
"RomM_5.4.1_BIOS_Pack.zip": {
"files": 468,
- "extracted_size": 871160574,
- "download_size": 468629106,
+ "extracted_size": 871160914,
+ "download_size": 468629159,
"assets": [
"RomM_5.4.1_BIOS_Pack.zip"
],
diff --git a/tests/fixtures/tui/colour-120x40.txt b/tests/fixtures/tui/colour-120x40.txt
index f56c2ea83..d152342c5 100644
--- a/tests/fixtures/tui/colour-120x40.txt
+++ b/tests/fixtures/tui/colour-120x40.txt
@@ -1316,6 +1316,7 @@
Choose what to remove. A file changed or added by hand stays.
^[[0;7;35m > All RetroBIOS files 528.0 KB^[[0m
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1347,7 +1348,6 @@
-
^[[0;1;35mA/Enter^[[0m Choose ^[[0;2mB/Esc^[[0m Back ^[[0;2m?^[[0m Help
diff --git a/tests/fixtures/tui/colour-40x12.txt b/tests/fixtures/tui/colour-40x12.txt
index b42524c2d..b8ecc131f 100644
--- a/tests/fixtures/tui/colour-40x12.txt
+++ b/tests/fixtures/tui/colour-40x12.txt
@@ -421,11 +421,11 @@
or added by hand stays.
^[[0;7;35m > All RetroBIOS files 528.0 KB^[[0m
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
^[[0;1;35mA^[[0m Choose ^[[0;2mB^[[0m Back ^[[0;2m?^[[0m Help
=== removal
^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Remove files^[[0m
diff --git a/tests/fixtures/tui/colour-40x15.txt b/tests/fixtures/tui/colour-40x15.txt
index 818f6a55d..b7a7be8f4 100644
--- a/tests/fixtures/tui/colour-40x15.txt
+++ b/tests/fixtures/tui/colour-40x15.txt
@@ -517,6 +517,7 @@
or added by hand stays.
^[[0;7;35m > All RetroBIOS files 528.0 KB^[[0m
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -524,7 +525,6 @@
-
^[[0;1;35mA^[[0m Choose ^[[0;2mB^[[0m Back ^[[0;2m?^[[0m Help
=== removal
^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Remove files^[[0m
diff --git a/tests/fixtures/tui/colour-80x24.txt b/tests/fixtures/tui/colour-80x24.txt
index 06ebc0dc5..de71990cc 100644
--- a/tests/fixtures/tui/colour-80x24.txt
+++ b/tests/fixtures/tui/colour-80x24.txt
@@ -804,6 +804,7 @@
Choose what to remove. A file changed or added by hand stays.
^[[0;7;35m > All RetroBIOS files 528.0 KB^[[0m
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -821,7 +822,6 @@
-
^[[0;1;35mA/Enter^[[0m Choose ^[[0;2mB/Esc^[[0m Back ^[[0;2m?^[[0m Help
=== removal
^[[0;1m ^[[0;1;35mRetroBIOS^[[0;1m: Remove files^[[0m
diff --git a/tests/fixtures/tui/remove-120x40.txt b/tests/fixtures/tui/remove-120x40.txt
index 810396d56..8d7f235b3 100644
--- a/tests/fixtures/tui/remove-120x40.txt
+++ b/tests/fixtures/tui/remove-120x40.txt
@@ -3,6 +3,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -34,7 +35,6 @@
-
A/Enter Choose B/Esc Back ? Help
diff --git a/tests/fixtures/tui/remove-40x12.txt b/tests/fixtures/tui/remove-40x12.txt
index 526499d8b..d5799f153 100644
--- a/tests/fixtures/tui/remove-40x12.txt
+++ b/tests/fixtures/tui/remove-40x12.txt
@@ -4,9 +4,9 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
A Choose B Back ? Help
diff --git a/tests/fixtures/tui/remove-40x15.txt b/tests/fixtures/tui/remove-40x15.txt
index 4a0bdb648..84e508e9c 100644
--- a/tests/fixtures/tui/remove-40x15.txt
+++ b/tests/fixtures/tui/remove-40x15.txt
@@ -4,6 +4,7 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -11,5 +12,4 @@
-
A Choose B Back ? Help
diff --git a/tests/fixtures/tui/remove-80x24.txt b/tests/fixtures/tui/remove-80x24.txt
index c7eb07835..173ad5f34 100644
--- a/tests/fixtures/tui/remove-80x24.txt
+++ b/tests/fixtures/tui/remove-80x24.txt
@@ -3,6 +3,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -20,5 +21,4 @@
-
A/Enter Choose B/Esc Back ? Help
diff --git a/tests/fixtures/tui/route-evmapy.txt b/tests/fixtures/tui/route-evmapy.txt
index 61cceeda4..aac1540b4 100644
--- a/tests/fixtures/tui/route-evmapy.txt
+++ b/tests/fixtures/tui/route-evmapy.txt
@@ -1514,11 +1514,11 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
A Choose B Back
=== remove 40x15
RetroBIOS: Remove files
@@ -1527,6 +1527,7 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1534,7 +1535,6 @@
-
A Choose B Back
=== remove 80x24
RetroBIOS: Remove files
@@ -1542,6 +1542,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1559,7 +1560,6 @@
-
A Choose B Back
=== removal 40x12
RetroBIOS: Remove files
diff --git a/tests/fixtures/tui/route-gptokeyb.txt b/tests/fixtures/tui/route-gptokeyb.txt
index a3dc08149..4c75da63a 100644
--- a/tests/fixtures/tui/route-gptokeyb.txt
+++ b/tests/fixtures/tui/route-gptokeyb.txt
@@ -1514,11 +1514,11 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
A Choose B Back
=== remove 40x15
RetroBIOS: Remove files
@@ -1527,6 +1527,7 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1534,7 +1535,6 @@
-
A Choose B Back
=== remove 80x24
RetroBIOS: Remove files
@@ -1542,6 +1542,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1559,7 +1560,6 @@
-
A Choose B Back
=== removal 40x12
RetroBIOS: Remove files
diff --git a/tests/fixtures/tui/route-gptokeyb_muxterm.txt b/tests/fixtures/tui/route-gptokeyb_muxterm.txt
index 14c681183..bdada502e 100644
--- a/tests/fixtures/tui/route-gptokeyb_muxterm.txt
+++ b/tests/fixtures/tui/route-gptokeyb_muxterm.txt
@@ -1514,11 +1514,11 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
A Choose B Back
=== remove 40x15
RetroBIOS: Remove files
@@ -1527,6 +1527,7 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1534,7 +1535,6 @@
-
A Choose B Back
=== remove 80x24
RetroBIOS: Remove files
@@ -1542,6 +1542,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1559,7 +1560,6 @@
-
A Choose B Back
=== removal 40x12
RetroBIOS: Remove files
diff --git a/tests/fixtures/tui/route-keys.txt b/tests/fixtures/tui/route-keys.txt
index 274cc5c31..08df105b7 100644
--- a/tests/fixtures/tui/route-keys.txt
+++ b/tests/fixtures/tui/route-keys.txt
@@ -1679,11 +1679,11 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
Enter Choose Esc Back ? Help
=== remove 40x15
RetroBIOS: Remove files
@@ -1692,6 +1692,7 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1699,7 +1700,6 @@
-
Enter Choose Esc Back ? Help
=== remove 80x24
RetroBIOS: Remove files
@@ -1707,6 +1707,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1724,7 +1725,6 @@
-
Enter Choose Esc Back ? Help
=== removal 40x12
RetroBIOS: Remove files
diff --git a/tests/fixtures/tui/route-miyoo.txt b/tests/fixtures/tui/route-miyoo.txt
index 24d1078cf..e7996b747 100644
--- a/tests/fixtures/tui/route-miyoo.txt
+++ b/tests/fixtures/tui/route-miyoo.txt
@@ -1617,11 +1617,11 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
A Choose R2 Back
=== remove 40x15
RetroBIOS: Remove files
@@ -1630,6 +1630,7 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1637,7 +1638,6 @@
-
A Choose R2 Back
=== remove 80x24
RetroBIOS: Remove files
@@ -1645,6 +1645,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1662,7 +1663,6 @@
-
A Choose R2 Back
=== removal 40x12
RetroBIOS: Remove files
diff --git a/tests/fixtures/tui/route-muxterm.txt b/tests/fixtures/tui/route-muxterm.txt
index 9e78a7dd0..fcb58c216 100644
--- a/tests/fixtures/tui/route-muxterm.txt
+++ b/tests/fixtures/tui/route-muxterm.txt
@@ -1733,11 +1733,11 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
-
Start Choose B Back
=== remove 40x15
RetroBIOS: Remove files
@@ -1746,6 +1746,7 @@
or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1753,7 +1754,6 @@
-
Start Choose B Back
=== remove 80x24
RetroBIOS: Remove files
@@ -1761,6 +1761,7 @@
Choose what to remove. A file changed or added by hand stays.
> All RetroBIOS files 528.0 KB
+ Misplaced copies
nintendo-gba 16.0 KB
sony-playstation 512.0 KB
@@ -1778,7 +1779,6 @@
-
Start Choose B Back
=== removal 40x12
RetroBIOS: Remove files
diff --git a/tests/test_install_removal.py b/tests/test_install_removal.py
index e14a1a9fd..b5052493c 100644
--- a/tests/test_install_removal.py
+++ b/tests/test_install_removal.py
@@ -22,6 +22,7 @@ import sys
import tempfile
import types
import unittest
+import zipfile
from pathlib import Path
from unittest import mock
@@ -644,5 +645,185 @@ class ReviewOfTheRemoval(unittest.TestCase):
moved.rename(repo.root)
+class MisplacedCopies(unittest.TestCase):
+ """--remove --misplaced deletes the copies a fix left in the wrong place:
+ only a regular file whose bytes the installer placed where the cores
+ read them, still there, at a place no list reads and no setup names."""
+
+ def test_the_copies_go_and_everything_else_stays(self):
+ with SharedRepository() as repo:
+ repo.install_both()
+ gba = (repo.dest / "gba_bios.bin").read_bytes()
+ mgba = (repo.dest / "mgba" / "extra.bin").read_bytes()
+ # Beside its file, and at the top for one below: both go.
+ (repo.dest / "GBA_BIOS.BIN").write_bytes(gba)
+ (repo.dest / "extra.bin").write_bytes(mgba)
+ # In another folder than its file's, or renamed: it stays.
+ (repo.dest / "mgba" / "gba_bios.bin").write_bytes(gba)
+ (repo.dest / "gba_bios (copy).bin").write_bytes(gba)
+ # Outside every folder the list places files in: a game folder.
+ (repo.dest / "old").mkdir()
+ (repo.dest / "old" / "gba_bios.bin").write_bytes(gba)
+ (repo.dest / "old" / "scph5501.bin").write_bytes(b"another revision")
+ (repo.dest / "mine.bin").write_bytes(b"added by hand")
+ (repo.dest / "link.bin").symlink_to(repo.dest / "gba_bios.bin")
+ # The save folder's own file: the end of its path is a place.
+ (repo.dest / "saves" / "mgba").mkdir(parents=True)
+ (repo.dest / "saves" / "mgba" / "extra.bin").write_bytes(mgba)
+ (repo.dest / "pcsx" / "twin.bin").write_bytes(gba)
+ os.link(repo.dest / "pcsx" / "twin.bin", repo.dest / "pcsx" / "twin2.bin")
+ with zipfile.ZipFile(repo.dest / "mgba" / "set.zip", "w") as archive:
+ archive.writestr("gba_bios.bin", gba)
+ record = repo.record.read_bytes()
+ dry = repo.run("--remove", "--misplaced", "--dry-run")
+ self.assertEqual(dry.returncode, 0, dry.stdout + dry.stderr)
+ self.assertIn("Remove 2 copies in the wrong place", dry.stdout)
+ self.assertIn(" extra.bin (in place: mgba/extra.bin)", dry.stdout)
+ self.assertIn(" GBA_BIOS.BIN (in place: gba_bios.bin)", dry.stdout)
+ self.assertTrue((repo.dest / "GBA_BIOS.BIN").is_file())
+ proc = repo.run("--remove", "--misplaced", "--yes", "--events")
+ self.assertEqual(proc.returncode, 0, proc.stdout + proc.stderr)
+ self.assertFalse((repo.dest / "GBA_BIOS.BIN").exists())
+ self.assertFalse((repo.dest / "extra.bin").exists())
+ for kept in ("gba_bios.bin", "mgba/gba_bios.bin", "gba_bios (copy).bin",
+ "old/gba_bios.bin", "old/scph5501.bin", "mine.bin",
+ "mgba/set.zip", "saves/mgba/extra.bin", "pcsx/twin.bin",
+ "pcsx/twin2.bin"):
+ self.assertTrue((repo.dest / kept).is_file(), kept)
+ self.assertTrue((repo.dest / "link.bin").is_symlink())
+ self.assertEqual(repo.record.read_bytes(), record)
+ events = repo.events(proc)
+ [plan] = [event for event in events if event["event"] == "removal_plan"]
+ self.assertEqual(sorted(plan["dests"]), ["GBA_BIOS.BIN", "extra.bin"])
+ self.assertEqual(sorted(event["dest"] for event in events
+ if event["event"] == "removed" and event["ok"]),
+ ["GBA_BIOS.BIN", "extra.bin"])
+ again = repo.run("--remove", "--misplaced", "--yes")
+ self.assertEqual(again.returncode, 2)
+ self.assertIn("No copy in the wrong place", again.stdout)
+
+ def test_a_question_comes_after_the_copies_are_named(self):
+ with SharedRepository() as repo:
+ repo.install_both()
+ (repo.dest / "GBA_BIOS.BIN").write_bytes((repo.dest / "gba_bios.bin").read_bytes())
+ code, said = repo.answer("n", "--remove", "--misplaced")
+ self.assertEqual(code, 2, said)
+ self.assertLess(said.index("GBA_BIOS.BIN (in place: gba_bios.bin)"),
+ said.index("Remove them for good? [y/N]"))
+ self.assertTrue((repo.dest / "GBA_BIOS.BIN").is_file())
+
+ def test_a_setup_whose_list_cannot_be_read_stops_the_removal(self):
+ with SharedRepository() as repo:
+ repo.install_both()
+ data = json.loads(repo.record.read_text())
+ data["setups"]["nowhere"] = {**data["setups"]["retroarch"], "files": []}
+ repo.record.write_text(json.dumps(data))
+ (repo.dest / "GBA_BIOS.BIN").write_bytes((repo.dest / "gba_bios.bin").read_bytes())
+ proc = repo.run("--remove", "--misplaced", "--yes")
+ self.assertEqual(proc.returncode, 2, proc.stdout + proc.stderr)
+ self.assertIn("the file list of nowhere, which shares the folder, is needed",
+ proc.stderr)
+ self.assertIn("no such list exists", proc.stderr)
+ self.assertTrue((repo.dest / "GBA_BIOS.BIN").is_file())
+
+ def test_a_copy_the_installer_no_longer_holds_in_place_stays(self):
+ with SharedRepository() as repo:
+ repo.install_both()
+ gba = (repo.dest / "gba_bios.bin").read_bytes()
+ (repo.dest / "GBA_BIOS.BIN").write_bytes(gba)
+ (repo.dest / "gba_bios.bin").write_bytes(b"edited by the user")
+ proc = repo.run("--remove", "--misplaced", "--yes")
+ self.assertEqual(proc.returncode, 2, proc.stdout + proc.stderr)
+ self.assertEqual((repo.dest / "GBA_BIOS.BIN").read_bytes(), gba)
+
+ def test_options_it_does_not_read_are_refused(self):
+ with SharedRepository() as repo:
+ for argv, words in (
+ (("--misplaced",), "--misplaced applies to --remove"),
+ (("--remove", "--misplaced", "--backup"), "takes no --backup"),
+ (("--remove", "--misplaced", "--system", "nintendo-gba"),
+ "takes no --system"),
+ ):
+ with self.subTest(argv=argv):
+ proc = repo.run(*argv)
+ self.assertEqual(proc.returncode, 2)
+ self.assertIn(words, proc.stderr)
+
+ def test_a_place_a_list_reads_or_a_setup_names_stays(self):
+ root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
+ self.addCleanup(shutil.rmtree, root, True)
+ folder = root / "bios"
+ folder.mkdir()
+ payload = b"the bios"
+ for rel in ("a.bin", "read/here.bin", "omitted.bin", "theirs.bin", "A.BIN",
+ "a (1).bin"):
+ (folder / rel).parent.mkdir(parents=True, exist_ok=True)
+ (folder / rel).write_bytes(payload)
+ record = _record(folder, [_item("a.bin", payload)],
+ others={"lakka": {"choice": [], "files": [_item("theirs.bin", payload)]}})
+ manifest = _served(("a.bin", payload), ("read/here.bin", b"other bytes"))
+ manifest["omitted_files"] = [{"dest": "omitted.bin"}]
+ removal = install.plan_misplaced_removal("retroarch", folder, record, [manifest])
+ self.assertEqual([entry["dest"] for entry in removal.remove], ["A.BIN"])
+ [entry] = removal.remove
+ self.assertEqual(entry["path"], folder / "A.BIN")
+ # The placed file edited after the plan: the copy is the one left.
+ (folder / "a.bin").write_bytes(b"edited")
+ removed, failed, _run = install.remove_files(removal, record["setups"]["retroarch"],
+ False)
+ self.assertEqual((removed, [item["dest"] for item in failed]), ([], ["A.BIN"]))
+ self.assertEqual((folder / "A.BIN").read_bytes(), payload)
+ (folder / "a.bin").write_bytes(payload)
+ os.unlink(folder / "A.BIN")
+ os.link(folder / "a.bin", folder / "A.BIN")
+ removal = install.plan_misplaced_removal("retroarch", folder, record, [manifest])
+ self.assertEqual(removal.remove, [])
+ # Folded on a drive that folds: READ/HERE.BIN is the list's place.
+ os.unlink(folder / "A.BIN")
+ os.rename(folder / "read" / "here.bin", folder / "read" / "HERE.BIN")
+ (folder / "OMITTED.BIN").write_bytes(payload)
+ os.unlink(folder / "omitted.bin")
+ with mock.patch.object(install, "keeps_case", return_value=False):
+ removal = install.plan_misplaced_removal("retroarch", folder, record, [manifest])
+ self.assertEqual(removal.remove, [])
+
+ def test_a_card_whose_folder_is_the_roms_root_keeps_its_games(self):
+ """EmuELEC installs into /storage/roms: ports/doom/doom2.wad is the
+ user's game, bios/old/doom2.wad a copy in the wrong place."""
+ root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
+ self.addCleanup(shutil.rmtree, root, True)
+ folder = root / "roms"
+ wad = b"doom ii"
+ for rel in ("bios/doom2.wad", "ports/doom/doom2.wad", "bios/old/doom2.wad",
+ "bios/doom2 (1).wad", "bios/DOOM2.WAD", "doom2.wad"):
+ (folder / rel).parent.mkdir(parents=True, exist_ok=True)
+ (folder / rel).write_bytes(wad)
+ elsewhere = root / "elsewhere"
+ elsewhere.mkdir()
+ (elsewhere / "doom2.wad").write_bytes(wad)
+ (folder / "bios" / "linked").symlink_to(elsewhere, target_is_directory=True)
+ # RetroArch installed below, with its own record.
+ nested = folder / "bios" / "retroarch"
+ nested.mkdir()
+ (nested / "doom2.wad").write_bytes(wad)
+ holder = folder / "bios" / install.BACKUP_DIR
+ holder.mkdir()
+ (holder / f"retroarch{install.RECORD_SUFFIX}").write_text("{}")
+ record = _record(folder, [_item("bios/doom2.wad", wad)])
+ removal = install.plan_misplaced_removal("emuelec", folder, {
+ **record, "setups": {"emuelec": record["setups"]["retroarch"]}},
+ [_served(("bios/doom2.wad", wad))])
+ # Beside its file, under its name: the top of the roms folder holds
+ # no list file, and the renamed copy may be a game's own entry.
+ self.assertEqual([entry["dest"] for entry in removal.remove], ["bios/DOOM2.WAD"])
+ # A game's data: DOOM2.WAD beside doom2.wad is a game entry of its own.
+ games = _served(("bios/doom2.wad", wad))
+ games["files"][0]["category"] = "game_data"
+ removal = install.plan_misplaced_removal("emuelec", folder, {
+ **record, "setups": {"emuelec": record["setups"]["retroarch"]}}, [games])
+ self.assertEqual(removal.remove, [])
+ self.assertEqual((elsewhere / "doom2.wad").read_bytes(), wad)
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/tests/test_install_tui.py b/tests/test_install_tui.py
index a638f2263..8dce4b4d7 100644
--- a/tests/test_install_tui.py
+++ b/tests/test_install_tui.py
@@ -15332,9 +15332,9 @@ SCREEN_WORDS = {
# Every plan names More (one word, counted in the plan budgets above):
# a pack can always be made. More's four rows where the folder has a
# record or a backup, then Make a pack (three words), Remove files with each system the record holds and its
- # size, the removal plan (what goes, the space freed, the folder, what
+ # size and the row for the misplaced copies (two words), the removal plan (what goes, the space freed, the folder, what
# stays and why), its confirm and result, and the backups newest first.
- "more": (20, 20, 18, 18), "remove": (31, 31, 29, 29), "removal": (34, 34, 32, 32),
+ "more": (20, 20, 18, 18), "remove": (33, 33, 31, 31), "removal": (34, 34, 32, 32),
"removal-confirm": (18, 18, 16, 16), "removal-done": (18, 18, 16, 16),
"backups": (24, 24, 22, 22),
# Make a pack: what goes in, its size and setup, where it goes, how it
@@ -15383,6 +15383,26 @@ class MoreScreens(unittest.TestCase):
argv = install.tui_argv(state, "removal_plan", "python", "install.py")
self.assertEqual(argv[-3:], ["--remove", "--dry-run", "--events"])
+ def test_the_misplaced_copies_are_deleted_never_moved_to_a_backup(self):
+ state = more_state("more", "remove")
+ actions = [row.action for row in install.tui_rows(state)]
+ state.focus["remove"] = actions.index("rmmisplaced")
+ self.assertEqual(install.tui_update(state, Key("enter")), [("run", "removal_plan")])
+ argv = install.tui_argv(state, "removal_plan", "python", "install.py")
+ self.assertEqual(argv[-4:], ["--remove", "--misplaced", "--dry-run", "--events"])
+ install.tui_receive(state, ("event", state.run_id, REMOVAL_PLAN))
+ install.tui_receive(state, ("ended", state.run_id, 0, []))
+ state.removal_backup = True
+ self.assertNotIn("rmbackup", [row.action for row in install.tui_rows(state)])
+ self.assertIn("in the wrong place go", screen_text(install.tui_view(state, 80, 24)))
+ state.focus["removal"] = 0
+ press(state, "enter")
+ self.assertIn("The files where the cores read them stay.",
+ screen_text(install.tui_view(state, 80, 24)))
+ press(state, "enter")
+ argv = install.tui_argv(state, "remove", "python", "install.py")
+ self.assertEqual(argv[-4:], ["--remove", "--misplaced", "--events", "--yes"])
+
def test_a_backup_is_one_row_away_and_the_removal_says_so(self):
state = removal_state()
state.focus["removal"] = 1
diff --git a/wiki/installer.md b/wiki/installer.md
index ada33fff3..e3ce413b8 100644
--- a/wiki/installer.md
+++ b/wiki/installer.md
@@ -847,6 +847,31 @@ question comes once, names what goes and the space freed, and only `y` or
answers it for a script. A run without a terminal and without `--yes` stops
with code 2 and names `--yes`.
+`--remove --misplaced` takes the other files instead: the copies an install
+found in the wrong place and copied where the cores read them. A copy goes
+only when the installer's file holds the same bytes at its place, read again
+just before, under the same name: beside it in another case (`GBA_BIOS.BIN`
+next to `gba_bios.bin`), or at the top of a folder where the list places files
+itself (`dc_boot.bin` at the top of RetroArch's `system` for `dc/dc_boot.bin`).
+No other folder is read: games, saves and other trees are never looked at. A
+renamed copy stays, since a core option, a launcher or a game list may name
+it (a PlayStation 2 BIOS picked by its name), and so does a copy of game data,
+which a frontend lists as a game of its own. A place any list of the folder
+reads or any setup recorded stays, and so do a link and a file with a second
+name. Every copy stays when the list of another setup of the folder cannot be
+fetched.
+
+The copies are named before the question. The record is not changed, and the
+copies are deleted, never moved to a backup: they were never a setup's.
+
+```
+python3 install.py --remove --misplaced --dry-run
+Remove 2 copies in the wrong place of /sdcard/RetroArch/system for RetroArch,
+2.0 MB freed. Each is a file RetroBIOS placed where the cores read it.
+ GBA_BIOS.BIN (in place: gba_bios.bin)
+ dc_boot.bin (in place: dc/dc_boot.bin)
+```
+
Removal deletes for good. `--backup` moves the files into a new dated folder of
`retrobios-backup` instead, and the end of the run prints the `--restore`
command that puts them back. On one drive a move frees no space until the
@@ -1331,6 +1356,7 @@ option takes the recorded choice whole.
| `--restore FOLDER` | Put back the files a run replaced or a removal moved and kept in FOLDER, a dated folder inside `retrobios-backup`, and update the install record. Takes no other option but `--dry-run`, `--events`, `--yes`, `--no-input` and `--verbose`. See [Files already in the folder](#files-you-already-had) |
| `--remove` | Remove what the installer placed in the BIOS folder, as its [install record](#the-install-record) proves it: every file, or those of one `--system`, `--core`, `--emulator` or `--file`. Deleted for good unless `--backup` is given. See [Removing files](#removing-files) |
| `--file PATH` | With `--remove`, one file of the BIOS folder, by its path there or in full. Repeat for several |
+| `--misplaced` | With `--remove`, delete the copies left in the wrong place of the BIOS folder, each one whose bytes the installer placed where the cores read them. See [Removing files](#removing-files) |
| `--backup` | With `--remove`, move the files into a dated folder of `retrobios-backup` instead of deleting them, for `--restore` to put back |
| `--backups` | List the backups of the BIOS folder, newest first, with the date, the files and the size of each |
| `--delete-backup FOLDER` | Delete one backup listed by `--backups`, after one question that names its date and size (`--yes` skips it) |