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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019HBRGKTE1GnN2ah8gcZKr3
This commit is contained in:
Claude committed 2026-10-05 07:05:26 +00:00
1 parent 06861dbb9a
commit e223ad511d
2 files changed
+47 -6

No files matched your search

+42 -5
View File
@@ -14,8 +14,9 @@
# hours there, mostly compiling Dawn, and later ones reuse it. # hours there, mostly compiling Dawn, and later ones reuse it.
# #
# Options: # Options:
# --disc PATH your clean PAL RMCP01 disc: an image nodtool reads (ISO, WBFS, RVZ, ...) or an # --disc PATH your clean PAL RMCP01 disc: an ISO, WBFS or RVZ image (or WIA, CISO, GCZ, NFS,
# extracted disc folder holding sys/ and files/. Needed for the first build only. # 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@<frame-ip>, or an ~/.ssh/config # --frame HOST where to install: an SSH destination (steamos@<frame-ip>, or an ~/.ssh/config
# host such as Frame Control's "frame"), or "local" when running on the Frame. # host such as Frame Control's "frame"), or "local" when running on the Frame.
# Without it the game is only built. # 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. # 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" disc_dir="$work_dir/disc"
if [[ -n "$disc" ]]; then if [[ -n "$disc" ]]; then
[[ -e "$disc" ]] || fail "no disc at $disc" [[ -e "$disc" ]] || fail "no disc at $disc"
if [[ -d "$disc" ]]; then if [[ -d "$disc" ]]; then
disc_dir=$(cd "$disc" && pwd) 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 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" nodtool="$work_dir/nodtool-$nodtool_version"
if [[ ! -x "$nodtool" ]]; then 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" "https://github.com/encounter/nod/releases/download/$nodtool_version/nodtool-linux-$host_arch"
chmod +x "$nodtool.partial" chmod +x "$nodtool.partial"
mv "$nodtool.partial" "$nodtool" mv "$nodtool.partial" "$nodtool"
fi fi
rm -rf "$disc_dir.partial" 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" mv "$disc_dir.partial" "$disc_dir"
fi fi
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" fail "no disc yet: pass --disc with your disc image or an extracted disc folder"
fi fi
fi fi
if [[ -n "$disc_dir" ]]; then
check_disc_id "$disc_dir"
note "disc: $disc_dir"
fi
mkdir -p "$source_dir/Assets" mkdir -p "$source_dir/Assets"
if [[ -n "$disc_dir" ]]; then if [[ -n "$disc_dir" ]]; then
cp "$disc_dir/sys/main.dol" "$disc_dir/files/rel/StaticR.rel" "$source_dir/Assets/" cp "$disc_dir/sys/main.dol" "$disc_dir/files/rel/StaticR.rel" "$source_dir/Assets/"
+5 -1
View File
@@ -41,7 +41,8 @@ of it compiling Dawn under emulation; later builds reuse it.
**You need:** **You need:**
- a Steam Frame with Developer Mode on (Steam Settings → System → Enable Developer Mode, then set a - 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; 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. - 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. 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@<frame-ip> | bash -s -- --disc "/path/to/Mario Kart Wii.wbfs" --frame steamos@<frame-ip>
``` ```
- `--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 - 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 [Frame Control](https://github.com/saphid/frame-control), pass `--frame frame` instead: its SSH
key answers to that name. key answers to that name.