From e223ad511de45aec7c17261087a95ae73bb0c12d Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 5 Oct 2026 07:05:26 +0000 Subject: [PATCH] Install script: check the disc's ID and accept more disc layouts Tested with a synthetic RMCP01 Wii disc built with nod and converted to encrypted ISO, WBFS and RVZ: all three extract, and main.dol and StaticR.rel come out byte-identical. nodtool reads the format from the file, so a misnamed image works too. - Stop before building unless boot.bin says RMCP01, naming the release (RMCE01 and the like) when it is another region; a wrong extraction in the work dir is removed so the next run starts clean. - Accept extracted folders whose partition sits in a subfolder (DATA/). - Explain unreadable files (a .zip, say) instead of nodtool's bare error. - Extract quietly: the real disc has thousands of files. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_019HBRGKTE1GnN2ah8gcZKr3 --- Launcher/steam-frame-install.sh | 47 +++++++++++++++++++++++++++++---- README.md | 6 ++++- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/Launcher/steam-frame-install.sh b/Launcher/steam-frame-install.sh index 098eb36..685bf22 100755 --- a/Launcher/steam-frame-install.sh +++ b/Launcher/steam-frame-install.sh @@ -14,8 +14,9 @@ # hours there, mostly compiling Dawn, and later ones reuse it. # # Options: -# --disc PATH your clean PAL RMCP01 disc: an image nodtool reads (ISO, WBFS, RVZ, ...) or an -# extracted disc folder holding sys/ and files/. Needed for the first build only. +# --disc PATH your clean PAL RMCP01 disc: an ISO, WBFS or RVZ image (or WIA, CISO, GCZ, NFS, +# TGC), or an extracted disc folder holding sys/ and files/. Needed for the first +# build only. # --frame HOST where to install: an SSH destination (steamos@, or an ~/.ssh/config # host such as Frame Control's "frame"), or "local" when running on the Frame. # Without it the game is only built. @@ -184,22 +185,54 @@ fi # --------------------------------------------------------------------------------------------- # The disc: the two files the translation reads, and the extracted disc the game reads at run time. +check_disc_id() { + # Fails unless the extracted disc in $1 is the release the translation is made for. + local id + if [[ ! -f "$1/sys/boot.bin" ]]; then + note "could not check the disc's game ID: $1/sys/boot.bin is missing" + return 0 + fi + id=$(head -c 6 "$1/sys/boot.bin" | tr -dc 'A-Z0-9') + [[ "$id" == RMCP01 ]] && return 0 + # An extraction of the wrong disc is not kept, so the next run extracts the one it is given. + [[ "$1" == "$work_dir/disc" ]] && rm -rf "$1" + case "$id" in + RMC?01) fail "this is the $id release of Mario Kart Wii. The translation is made for the PAL + release, RMCP01; other regions' code differs and is not supported." ;; + *) fail "this disc's game ID is ${id:-unreadable}, not Mario Kart Wii PAL (RMCP01)" ;; + esac +} + disc_dir="$work_dir/disc" if [[ -n "$disc" ]]; then [[ -e "$disc" ]] || fail "no disc at $disc" if [[ -d "$disc" ]]; then disc_dir=$(cd "$disc" && pwd) + # Some tools put the game's partition in a subfolder (DATA/, for example). + if [[ ! -f "$disc_dir/sys/main.dol" ]]; then + for candidate in "$disc_dir"/*/; do + if [[ -f "$candidate/sys/main.dol" && -f "$candidate/files/rel/StaticR.rel" ]]; then + disc_dir=${candidate%/} + break + fi + done + fi + [[ -f "$disc_dir/sys/main.dol" && -f "$disc_dir/files/rel/StaticR.rel" ]] || + fail "$disc is not an extracted disc: it needs sys/main.dol and files/rel/StaticR.rel" elif [[ ! -f "$disc_dir/sys/main.dol" ]]; then - say "Extracting your disc" + say "Extracting your disc (a minute or two)" nodtool="$work_dir/nodtool-$nodtool_version" if [[ ! -x "$nodtool" ]]; then - curl -fL -o "$nodtool.partial" \ + curl -fL --progress-bar -o "$nodtool.partial" \ "https://github.com/encounter/nod/releases/download/$nodtool_version/nodtool-linux-$host_arch" chmod +x "$nodtool.partial" mv "$nodtool.partial" "$nodtool" fi rm -rf "$disc_dir.partial" - "$nodtool" extract "$disc" "$disc_dir.partial" + # nodtool tells the format from the file's contents, whatever it is named. + "$nodtool" extract -q "$disc" "$disc_dir.partial" || + fail "nodtool could not read $disc. It reads ISO, WBFS, RVZ, WIA, CISO, GCZ, NFS and TGC + images; unpack a .zip or .7z first." mv "$disc_dir.partial" "$disc_dir" fi fi @@ -210,6 +243,10 @@ if [[ ! -f "$disc_dir/sys/main.dol" || ! -f "$disc_dir/files/rel/StaticR.rel" ]] fail "no disc yet: pass --disc with your disc image or an extracted disc folder" fi fi +if [[ -n "$disc_dir" ]]; then + check_disc_id "$disc_dir" + note "disc: $disc_dir" +fi mkdir -p "$source_dir/Assets" if [[ -n "$disc_dir" ]]; then cp "$disc_dir/sys/main.dol" "$disc_dir/files/rel/StaticR.rel" "$source_dir/Assets/" diff --git a/README.md b/README.md index d88ec74..6c88dde 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ of it compiling Dawn under emulation; later builds reuse it. **You need:** - a Steam Frame with Developer Mode on (Steam Settings → System → Enable Developer Mode, then set a user password), on the same network as your PC; -- your own clean PAL `RMCP01` disc image of Mario Kart Wii (ISO, WBFS, RVZ, ...); +- your own clean PAL `RMCP01` disc of Mario Kart Wii: an ISO, WBFS or RVZ image (WIA, CISO, GCZ + and NFS work too), or a folder you extracted it to; - an x86_64 Linux PC with about 20 GB free and 16 GB of memory or more. The PC commands below work in bash, zsh and fish. @@ -73,6 +74,9 @@ curl -fsSL https://raw.githubusercontent.com/mitch030504/Wiicompiled_VR_Frame/op | bash -s -- --disc "/path/to/Mario Kart Wii.wbfs" --frame steamos@ ``` +- `--disc` takes the image whatever its name or extension; the format is read from the file + itself. It checks the game ID before building and stops on any disc other than PAL `RMCP01`. + A `.zip` or `.7z` has to be unpacked first. - It asks for the Frame's password when it gets there. If you use [Frame Control](https://github.com/saphid/frame-control), pass `--frame frame` instead: its SSH key answers to that name.