From e33a732651a6e6708fa93577ec4fd4ddd6e1a6a5 Mon Sep 17 00:00:00 2001 From: ruckus7382sfgsgdf <355121112+ruckus7382sfgsgdf@users.noreply.github.com> Date: Thu, 12 Nov 2026 13:58:36 -0600 Subject: [PATCH] Triforce v0.3.4 The slowdown in fights and the controller whose buttons stopped arriving are fixed; the checks' file names; groundwork for Linux. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/linux-appimage.yml | 10 ++-- .github/workflows/vulkan-dlss.yml | 8 +-- .github/workflows/windows-builder.yml | 8 +-- builder/linux/hookshot-builder.desktop | 2 +- builder/linux/hookshot-folder | 28 ++++++---- builder/linux/hookshot-launch | 27 +++++---- builder/linux/hookshot_builder.py | 52 +++++++++--------- builder/linux/linux_update.py | 76 +++++++++++++++++--------- gpu/vk/vk_memory.cpp | 68 +++++++++++++++++++++-- host/hos_update.c | 8 +-- host/nn_hid.c | 31 +++++++++++ host/pad_sdl.c | 11 ++++ scripts/linux/appimage.sh | 12 ++-- scripts/linux/check_player_build.sh | 4 +- scripts/linux/make_parts.py | 6 +- scripts/linux/publish_parts.sh | 2 +- tests/test_linux_builder_jobs.py | 2 +- tests/test_linux_update.py | 36 ++++++------ tests/test_make_game_ngx.py | 2 +- 19 files changed, 266 insertions(+), 127 deletions(-) diff --git a/.github/workflows/linux-appimage.yml b/.github/workflows/linux-appimage.yml index 335e09a..6376895 100644 --- a/.github/workflows/linux-appimage.yml +++ b/.github/workflows/linux-appimage.yml @@ -100,18 +100,18 @@ jobs: # (AMD FSR 4's Linux side, a build option the AppImage leaves off (gpu/vk/vk_fsr4.cpp: dlopen, the older backend # description, the unit exposure; the descriptor buffers in vk_main.cpp): built once more in a copy of the back end's # work folder, where only vk_fsr4.cpp compiles again. The AppImage above is not changed) - - name: hookshot_vk.so with AMD FSR 4 (build check) + - name: triforce_vk.so with AMD FSR 4 (build check) shell: bash # (this container's default is sh, which has no PIPESTATUS) run: | cp -r build-linux/vk-work "$RUNNER_TEMP/vk-fsr" - rm -f "$RUNNER_TEMP/vk-fsr/sa/build/hookshot_vk.so" # (the AppImage's own, without FSR: the test below is this build's) + rm -f "$RUNNER_TEMP/vk-fsr/sa/build/triforce_vk.so" # (the AppImage's own, without FSR: the test below is this build's) D="$PWD/build-linux/deps" OOT_WORK="$RUNNER_TEMP/vk-fsr" EMSDK="$D/emsdk" RX_CPM="$D/cpm" RX_MARCH=x86-64-v3 RX_VK_ONLY=1 RX_RELEASE=1 HOOKSHOT_FSR=1 \ "$D/python/bin/python3" -I nx2/build.py --standalone --jobs "$(nproc)" | tee "$RUNNER_TEMP/vk-fsr.log" test "${PIPESTATUS[0]}" -eq 0 grep -q "with AMD FSR 4" "$RUNNER_TEMP/vk-fsr.log" - test -f "$RUNNER_TEMP/vk-fsr/sa/build/hookshot_vk.so" + test -f "$RUNNER_TEMP/vk-fsr/sa/build/triforce_vk.so" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: @@ -135,7 +135,7 @@ jobs: release: name: Release asset - if: startsWith(github.ref, 'refs/tags/') && github.ref_name != 'builder-parts' && github.ref_name != 'linux-parts' + if: startsWith(github.ref, 'refs/tags/') && github.ref_name != 'builder-parts' && github.ref_name != 'linux-parts' && vars.CI_RELEASE_LINUX == 'true' needs: appimage runs-on: ubuntu-24.04 timeout-minutes: 15 @@ -163,4 +163,4 @@ jobs: # (the release made here or by the Windows builder workflow, whichever is first; a -rc tag is a prerelease and # never "latest") - name: AppImage to the release - run: scripts/release_upload.sh "$GITHUB_REF_NAME" dist/*.AppImage dist/parts/hookshot-linux.txt + run: scripts/release_upload.sh "$GITHUB_REF_NAME" dist/*.AppImage dist/parts/triforce-linux.txt diff --git a/.github/workflows/vulkan-dlss.yml b/.github/workflows/vulkan-dlss.yml index b3753bb..f21bef0 100644 --- a/.github/workflows/vulkan-dlss.yml +++ b/.github/workflows/vulkan-dlss.yml @@ -1,5 +1,5 @@ # NVIDIA DLSS is a local build's option: NVIDIA's SDK is never part of Hookshot or its downloads. This only checks that -# hookshot_vk.dll still compiles and links with it, through llvm-mingw as players build it. It runs by hand, and on a push or +# triforce_vk.dll still compiles and links with it, through llvm-mingw as players build it. It runs by hand, and on a push or # pull request only when a file DLSS's build depends on changed (the paths below), not on every push. scripts/ngx_sdk.py # fetches the SDK at its pinned release, SHA-256 checked, without DLSS's runtime: NVIDIA's license is accepted for that run # alone (--accept-nvidia-license), and nothing of it is uploaded or cached. @@ -104,7 +104,7 @@ jobs: run: echo "HOOKSHOT_MINGW=$(python -I scripts/release_parts.py llvm-mingw "$RUNNER_TEMP/llvm")" >> "$GITHUB_ENV" - name: NVIDIA's DLSS SDK (headers and nvsdk_ngx_s.lib) run: python -I scripts/ngx_sdk.py --platform windows --build-only --accept-nvidia-license "$RUNNER_TEMP/ngx-sdk" - - name: hookshot_vk.dll with NVIDIA DLSS and AMD FSR 4 + - name: triforce_vk.dll with NVIDIA DLSS and AMD FSR 4 env: RX_VK_ONLY: '1' RX_RELEASE: '1' @@ -119,9 +119,9 @@ jobs: # is loaded by NGX at run time from the game folder's ngx folder, and its core, _nvngx.dll, from the driver's) - name: Imports run: | - dll="$RUNNER_TEMP/vk-work/sa/build/hookshot_vk.dll" + dll="$RUNNER_TEMP/vk-work/sa/build/triforce_vk.dll" "$HOOKSHOT_MINGW/bin/llvm-objdump" -p "$dll" | sed -n 's/^ *DLL Name: //p' | tr -d '\r' | sort -u | tee "$RUNNER_TEMP/imports.txt" if grep -viE '^(kernel32|user32|gdi32|advapi32)\.dll$|^api-ms-win-crt-[a-z0-9-]+\.dll$' "$RUNNER_TEMP/imports.txt"; then - echo "::error::hookshot_vk.dll with NVIDIA DLSS imports a DLL that is not Windows' own (above)" + echo "::error::triforce_vk.dll with NVIDIA DLSS imports a DLL that is not Windows' own (above)" exit 1 fi diff --git a/.github/workflows/windows-builder.yml b/.github/workflows/windows-builder.yml index 334e487..50fe605 100644 --- a/.github/workflows/windows-builder.yml +++ b/.github/workflows/windows-builder.yml @@ -185,18 +185,18 @@ jobs: - name: llvm-mingw run: echo "HOOKSHOT_MINGW=$(python -I scripts/release_parts.py llvm-mingw "$RUNNER_TEMP/llvm")" >> "$GITHUB_ENV" # (as scripts/linux/appimage.sh builds Linux's: the back end alone, no lift, no game) - - name: hookshot_vk.dll + - name: triforce_vk.dll env: RX_VK_ONLY: '1' RX_RELEASE: '1' run: | OOT_WORK="$RUNNER_TEMP/vk-work" RX_CPM="$GITHUB_WORKSPACE/_deps/cpm" \ python -I nx2/build.py --standalone --jobs "$NUMBER_OF_PROCESSORS" - ls -l "$RUNNER_TEMP/vk-work/sa/build/hookshot_vk.dll" + ls -l "$RUNNER_TEMP/vk-work/sa/build/triforce_vk.dll" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: - name: hookshot_vk-windows - path: ${{ runner.temp }}/vk-work/sa/build/hookshot_vk.dll + name: triforce_vk-windows + path: ${{ runner.temp }}/vk-work/sa/build/triforce_vk.dll if-no-files-found: error release: diff --git a/builder/linux/hookshot-builder.desktop b/builder/linux/hookshot-builder.desktop index 8b5c72b..156b18b 100644 --- a/builder/linux/hookshot-builder.desktop +++ b/builder/linux/hookshot-builder.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Type=Application -Name=Hookshot Builder +Name=Triforce Builder Comment=Builds Ocarina of Time for PC from your own copy of the game Exec=AppRun Icon=hookshot diff --git a/builder/linux/hookshot-folder b/builder/linux/hookshot-folder index ffe1343..e8095bd 100755 --- a/builder/linux/hookshot-folder +++ b/builder/linux/hookshot-folder @@ -1,14 +1,14 @@ #!/bin/sh -# The game folder's launcher, what hookshot.exe is on Windows: Play, and Update when a newer release is out. -# The game itself is bin/hookshot. This file is copied to hookshot in the folder (nx2/make_game.py). +# The game folder's launcher, what Triforce.exe is on Windows: Play, and Update when a newer release is out. +# The game itself is bin/triforce. This file is copied to triforce in the folder (nx2/make_game.py). # -# It starts the builder installed by an update ($XDG_DATA_HOME/hookshot/builder), or the builder= line in -# hookshot_version.txt (the AppImage that built the folder). With neither, it starts the game. +# It starts the builder installed by an update ($XDG_DATA_HOME/triforce/builder), or the builder= line in +# triforce_version.txt (the AppImage that built the folder; hookshot_version.txt in a folder that still has that). With neither, it starts the game. set -eu HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) installed() { - root=${HOOKSHOT_BUILDER_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}}/hookshot/builder + root=${HOOKSHOT_BUILDER_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}}/triforce/builder [ -f "$root/current" ] || return 1 tag=$(tr -d ' \r\n' < "$root/current") [ -n "$tag" ] && [ -x "$root/versions/$tag/AppRun" ] || return 1 @@ -16,13 +16,15 @@ installed() { } builder_line() { - [ -f "$HERE/hookshot_version.txt" ] || return 1 + file=$HERE/triforce_version.txt + [ -f "$file" ] || file=$HERE/hookshot_version.txt + [ -f "$file" ] || return 1 path= while IFS= read -r line || [ -n "$line" ]; do case $line in builder=*) path=${line#builder=} ;; esac - done < "$HERE/hookshot_version.txt" + done < "$file" [ -n "$path" ] && [ -x "$path" ] || return 1 printf '%s\n' "$path" } @@ -34,9 +36,11 @@ fi if [ -n "$run" ]; then exec "$run" --launch "$HERE" fi -if [ -x "$HERE/bin/hookshot" ]; then - cd "$HERE" - exec ./bin/hookshot -fi -echo "Hookshot: the game (bin/hookshot) is missing from this folder. Build it again with Hookshot Builder." >&2 +for game in bin/triforce bin/hookshot; do + if [ -x "$HERE/$game" ]; then + cd "$HERE" + exec "./$game" + fi +done +echo "Triforce: the game (bin/triforce) is missing from this folder. Build it again with Triforce Builder." >&2 exit 1 diff --git a/builder/linux/hookshot-launch b/builder/linux/hookshot-launch index 1c6c18f..dd7366c 100755 --- a/builder/linux/hookshot-launch +++ b/builder/linux/hookshot-launch @@ -1,8 +1,8 @@ #!/bin/sh -# Start the game Hookshot Builder wrote, from that folder, without the AppImage's libraries. +# Start the game Triforce Builder wrote, from that folder, without the AppImage's libraries. # The builder AppImage calls this for --play. The window's Play button does the same thing. # -# hookshot-launch the out= folder in ~/.config/hookshot/builder.ini +# hookshot-launch the out= folder in ~/.config/triforce/builder.ini # hookshot-launch /path/to/the/game that folder # HOOKSHOT_LAUNCH_CONFIG= read that ini instead (a test) set -eu @@ -11,7 +11,7 @@ ini_path() { if [ -n "${HOOKSHOT_LAUNCH_CONFIG:-}" ]; then printf '%s\n' "$HOOKSHOT_LAUNCH_CONFIG" else - printf '%s\n' "${XDG_CONFIG_HOME:-$HOME/.config}/hookshot/builder.ini" + printf '%s\n' "${XDG_CONFIG_HOME:-$HOME/.config}/triforce/builder.ini" fi } @@ -28,7 +28,9 @@ out_of() { } ready() { - [ -n "${1:-}" ] && [ -f "$1/image.bin" ] && { [ -x "$1/bin/hookshot" ] || [ -f "$1/hookshot" ]; } + # (bin/triforce under the launcher, or triforce in a folder built without one; Hookshot's names after them) + [ -n "${1:-}" ] && [ -f "$1/image.bin" ] && + { [ -x "$1/bin/triforce" ] || [ -x "$1/bin/hookshot" ] || [ -f "$1/triforce" ] || [ -f "$1/hookshot" ]; } } folder=${1:-} @@ -40,13 +42,13 @@ if [ -z "$folder" ]; then fi if ! ready "$folder"; then - echo "Hookshot: no built game to start. Build one with Hookshot Builder, or pass its folder." >&2 + echo "Triforce: no built game to start. Build one with Triforce Builder, or pass its folder." >&2 # (HOOKSHOT_LAUNCH_CONFIG is a test: it must not open a dialog) if [ -z "${HOOKSHOT_LAUNCH_CONFIG:-}" ]; then if command -v zenity >/dev/null 2>&1; then - zenity --error --title=Hookshot --text="No built game to start. Build one with Hookshot Builder first." || true + zenity --error --title=Triforce --text="No built game to start. Build one with Triforce Builder first." || true elif command -v kdialog >/dev/null 2>&1; then - kdialog --error "No built game to start. Build one with Hookshot Builder first." || true + kdialog --error "No built game to start. Build one with Triforce Builder first." || true fi fi exit 1 @@ -60,9 +62,14 @@ for name in $names; do done cd "$folder" -# (--play already chose Play. The game's own update question stays for a bin/hookshot the player started themselves) +# (--play already chose Play. The game's own update question stays for a bin/triforce the player started themselves) export HOOKSHOT_NO_UPDATE_CHECK=1 -if [ -x ./bin/hookshot ]; then - exec ./bin/hookshot +for game in ./bin/triforce ./bin/hookshot; do + if [ -x "$game" ]; then + exec "$game" + fi +done +if [ -f ./triforce ]; then + exec ./triforce fi exec ./hookshot diff --git a/builder/linux/hookshot_builder.py b/builder/linux/hookshot_builder.py index a01bafc..6b2b73c 100644 --- a/builder/linux/hookshot_builder.py +++ b/builder/linux/hookshot_builder.py @@ -1,4 +1,4 @@ -"""Hookshot Builder for Linux: what builder/HookshotBuilder (WPF) is on Windows, in Tk. It runs nx2/make_game.py and +"""Triforce Builder for Linux: what builder/HookshotBuilder (WPF) is on Windows, in Tk. It runs nx2/make_game.py and follows its @@ lines (make_game.py's docstring), then offers to start the game. The AppImage starts it (builder/linux/AppRun), with the compiler, sysroot and libraries it brings in the environment. @@ -29,15 +29,15 @@ import linux_update # noqa: E402 (the release check and the part download) import make_game # noqa: E402 (LANGUAGES, BUILD_ID) import toolchain # noqa: E402 (default_jobs: RX_JOBS) -CONFIG = os.path.join(os.environ.get("XDG_CONFIG_HOME") or os.path.expanduser("~/.config"), "hookshot", "builder.ini") +CONFIG = os.path.join(os.environ.get("XDG_CONFIG_HOME") or os.path.expanduser("~/.config"), "triforce", "builder.ini") STAGES = {"read": "Reading your game files", "lift": "Translating the game to PC code", "compile": "Compiling", "finish": "Putting the game folder together", "shaders": "Preparing shaders"} DLSS_LICENSE = ( - "NVIDIA DLSS is NVIDIA's, not Hookshot's. With it ticked, the build downloads NVIDIA's DLSS SDK (release v310.9.16) from " + "NVIDIA DLSS is NVIDIA's, not Triforce's. With it ticked, the build downloads NVIDIA's DLSS SDK (release v310.9.16) from " "github.com/NVIDIA/DLSS, under NVIDIA's own license, the NVIDIA RTX SDKs license:\n\n" "https://github.com/NVIDIA/DLSS/blob/9981c6350dc58c0ce21f024fd65e31e851c31689/LICENSE.txt\n\n" "Its files stay on this PC (in the builder's ngx-sdk folder, and libnvidia-ngx-dlss.so in the game folder's ngx folder). " - "Hookshot never includes or shares them: never share a game folder built with them.\n\n" + "Triforce never includes or shares them: never share a game folder built with them.\n\n" "Do you accept NVIDIA's license?" ) @@ -142,14 +142,14 @@ def add_to_menu(folder): shutil.copyfile(src, icon) apps = os.path.join(os.environ.get("XDG_DATA_HOME") or os.path.expanduser("~/.local/share"), "applications") os.makedirs(apps, exist_ok=True) - with open(os.path.join(apps, "hookshot.desktop"), "w", encoding="utf-8") as f: - f.write("[Desktop Entry]\nType=Application\nName=Hookshot\nComment=The Legend of Zelda: Ocarina of Time, built from your copy\n" + with open(os.path.join(apps, "triforce.desktop"), "w", encoding="utf-8") as f: + f.write("[Desktop Entry]\nType=Application\nName=Triforce\nComment=The Legend of Zelda: Ocarina of Time, built from your copy\n" "Exec=%s\nPath=%s\nIcon=%s\nCategories=Game;\nTerminal=false\nStartupWMClass=%s\n" - % (desktop_exec(os.path.join(folder, "hookshot")), folder, icon, APP_ID)) + % (desktop_exec(os.path.join(folder, "triforce")), folder, icon, APP_ID)) def free_gb(path): - path = os.path.expanduser(path or "") # (the field takes ~/Games/Hookshot, as build() and apply_mode() read it) + path = os.path.expanduser(path or "") # (the field takes ~/Games/Triforce, as build() and apply_mode() read it) while path and not os.path.exists(path): path = os.path.dirname(path) try: @@ -308,7 +308,7 @@ def _arg(name): class Builder(tk.Tk): def __init__(self, launch=None, update=None, fetched=False, tag=None): super().__init__() - self.title("Hookshot Builder") + self.title("Triforce Builder") self.apply_scale() self.apply_theme() self.minsize(self.px(760), self.px(520)) @@ -330,7 +330,7 @@ class Builder(tk.Tk): self.nup = tk.StringVar(value=self.cfg.get("nup", "")) self.romfs = tk.StringVar(value=self.cfg.get("romfs", "")) self.exefs = tk.StringVar(value=self.cfg.get("exefs", "")) - self.out = tk.StringVar(value=self.cfg.get("out", os.path.expanduser("~/Games/Hookshot"))) + self.out = tk.StringVar(value=self.cfg.get("out", os.path.expanduser("~/Games/Triforce"))) names = [n for _, n in make_game.LANGUAGES] code = self.cfg.get("language", "en-US") self.language = tk.StringVar(value=dict(make_game.LANGUAGES).get(code, names[0])) @@ -578,8 +578,8 @@ class Builder(tk.Tk): if self.images.get("logo") is not None: canvas.create_image(x, px(32), image=self.images["logo"], anchor="w") x += self.images["logo"].width() + px(10) - canvas.create_text(x, px(32), text="Hookshot", font="HsBrand", fill=INK, anchor="w") - x += int(self.tk.call("font", "measure", "HsBrand", "Hookshot")) + canvas.create_text(x, px(32), text="Triforce", font="HsBrand", fill=INK, anchor="w") + x += int(self.tk.call("font", "measure", "HsBrand", "Triforce")) if chip: canvas.create_text(x + px(12), px(32), text=chip, font="HsSmall", fill=INK_SOFT, anchor="w") self.header_canvas = canvas @@ -644,7 +644,7 @@ class Builder(tk.Tk): # ---- the form ---- def show_form(self): - self.title("Hookshot Builder") + self.title("Triforce Builder") if self.page: self.page.destroy() px = self.px @@ -657,7 +657,7 @@ class Builder(tk.Tk): f.columnconfigure(1, minsize=px(20)) f.columnconfigure(2, minsize=px(200)) ttk.Label(f, text="Build your game", style="Title.TLabel").grid(row=0, column=0, columnspan=3, sticky="w") - ttk.Label(f, text="Pick your game files and where the game goes. Hookshot does the rest, once.", style="Sub.TLabel", + ttk.Label(f, text="Pick your game files and where the game goes. Triforce does the rest, once.", style="Sub.TLabel", wraplength=px(800)).grid(row=1, column=0, columnspan=3, sticky="w", pady=(px(6), 0)) if game_ready(self.cfg.get("out")): ttk.Button(f, text="Play the game built in %s" % self.cfg["out"], command=lambda: self.play_and_close(self.cfg["out"])).grid( @@ -819,14 +819,14 @@ class Builder(tk.Tk): self.status.set("Update builds your game again %s NVIDIA DLSS." % ("with" if self.dlss.get() else "without")) elif self.mode == "update-game": - self.status.set("Hookshot %s is available. Your game is %s. Update downloads only what changed, then compiles what changed." + self.status.set("Triforce %s is available. Your game is %s. Update downloads only what changed, then compiles what changed." % (target, game)) elif self.mode == "up-to-date" and self.latest is None: self.status.set("Your game is %s, as this builder. GitHub did not answer, so newer versions could not be checked." % game) elif self.mode == "up-to-date": self.status.set("%s is the latest version." % game) elif self.mode == "update-builder": - self.status.set("Hookshot Builder %s is available (this one is %s). Update it first, then build." % (self.latest, self.tools or "this one")) + self.status.set("Triforce Builder %s is available (this one is %s). Update it first, then build." % (self.latest, self.tools or "this one")) else: self.status.set("") @@ -840,20 +840,20 @@ class Builder(tk.Tk): self.launch_status.set("Update available: %s" % target) show = True elif target and game and game != target: - self.launch_status.set("%s is out. Build this folder again with Hookshot Builder to get it." % target) + self.launch_status.set("%s is out. Build this folder again with Triforce Builder to get it." % target) elif game and self.latest is None: self.launch_status.set("Up to date with this builder (GitHub did not answer)") elif game: self.launch_status.set("Up to date") else: - self.launch_status.set("Could not check for updates (GitHub did not answer)" if self.latest is None else "Hookshot") + self.launch_status.set("Could not check for updates (GitHub did not answer)" if self.latest is None else "Triforce") if hasattr(self, "launch_update"): self.launch_update.pack(side="right", padx=self.px(4)) if show else self.launch_update.pack_forget() def show_launch(self, folder): if self.page: self.page.destroy() - self.title("Hookshot") + self.title("Triforce") px = self.px page = self.page = ttk.Frame(self) page.pack(fill="both", expand=True) @@ -881,7 +881,7 @@ class Builder(tk.Tk): def begin_update(self, folder=None): if folder is not None: self.update_folder = folder - self.show_progress("Updating your game" if self.update_folder else "Updating Hookshot Builder") + self.show_progress("Updating your game" if self.update_folder else "Updating Triforce Builder") folder = self.update_folder # (a game older than this builder is built again with it: nothing to download, and GitHub need not answer. So is one # from a builder that is not an older release, e.g. from the Actions tab: issue 902) @@ -952,20 +952,20 @@ class Builder(tk.Tk): out = os.path.expanduser(self.out.get().strip()) if self.kind.get() == "nup": if not os.path.isfile(self.nup.get()): - return messagebox.showerror("Hookshot", "Choose your game's .nup file.") + return messagebox.showerror("Triforce", "Choose your game's .nup file.") src = ["--nup", self.nup.get()] else: if not (os.path.isdir(self.romfs.get()) and os.path.isdir(self.exefs.get())): - return messagebox.showerror("Hookshot", "Choose your game's romfs and exefs folders.") + return messagebox.showerror("Triforce", "Choose your game's romfs and exefs folders.") src = ["--romfs", self.romfs.get(), "--exefs", self.exefs.get()] if not out: - return messagebox.showerror("Hookshot", "Choose where to save the game.") + return messagebox.showerror("Triforce", "Choose where to save the game.") try: jobs = make_game.requested_jobs(os.environ.get("HOOKSHOT_JOBS")) if jobs is None and os.environ.get("RX_JOBS"): # (the older setting, still honoured) jobs = toolchain.default_jobs() except ValueError as error: - return messagebox.showerror("Hookshot", str(error)) + return messagebox.showerror("Triforce", str(error)) code = next((c for c, n in make_game.LANGUAGES if n == self.language.get()), "en-US") dlss = bool(self.dlss.get()) if hasattr(self, "dlss") else False self.cfg.update(kind=self.kind.get(), nup=self.nup.get(), romfs=self.romfs.get(), exefs=self.exefs.get(), out=out, language=code, @@ -977,7 +977,7 @@ class Builder(tk.Tk): ([] if jobs is None else ["--jobs", str(jobs)]) + ([] if self.prepare.get() else ["--no-prepare-shaders"]) + \ (dlss_args(True) if dlss else []) slow = slow_disk_warning(out) # (a warning, not a stop: a hard drive still builds, only much slower) - if slow is not None and not messagebox.askokcancel("Hookshot", slow): + if slow is not None and not messagebox.askokcancel("Triforce", slow): return self.show_progress() self.started = time.time() @@ -1182,7 +1182,7 @@ class Builder(tk.Tk): def close(self): if self.proc and self.proc.poll() is None: - if not messagebox.askyesno("Hookshot", "Stop the build and close?"): + if not messagebox.askyesno("Triforce", "Stop the build and close?"): return os.killpg(self.proc.pid, signal.SIGTERM) self.destroy() diff --git a/builder/linux/linux_update.py b/builder/linux/linux_update.py index 8fbeffe..55a081a 100644 --- a/builder/linux/linux_update.py +++ b/builder/linux/linux_update.py @@ -1,8 +1,8 @@ """Linux builder updates, the same way Windows installs (builder/setup/setup.c, scripts/make_setup_parts.py). -A release publishes hookshot-linux.txt. Each part is a zip named by its SHA-256 and kept on the linux-parts release, so a +A release publishes triforce-linux.txt. Each part is a zip named by its SHA-256 and kept on the linux-parts release, so a part whose files did not change is not downloaded again. The player's copy lives at -$XDG_DATA_HOME/hookshot/builder/versions/ (AppRun at its root, the same layout as the AppImage). An unchanged part +$XDG_DATA_HOME/triforce/builder/versions/ (AppRun at its root, the same layout as the AppImage). An unchanged part is copied from the builder that is running now (the mounted AppImage, or the version installed last time). tag @@ -22,9 +22,16 @@ import zipfile from part_links import SYSROOT_PART, is_absolute_link, relative_sysroot_link -LIST_NAME = "hookshot-linux.txt" -LATEST_LIST = "https://github.com/NotRexed/Hookshot/releases/latest/download/" + LIST_NAME -LATEST_API = "https://api.github.com/repos/NotRexed/Hookshot/releases/latest" +LIST_NAME = "triforce-linux.txt" +REPO = "ruckus7382sfgsgdf/CBeta0.2" # (Triforce's releases) +LATEST_LIST = "https://github.com/%s/releases/latest/download/%s" % (REPO, LIST_NAME) +# (Triforce: the newest release, pre-releases too, as the Windows side asks: /releases/latest skips pre-releases, and +# every Triforce release so far is one. The answer is a list of one release) +LATEST_API = "https://api.github.com/repos/%s/releases?per_page=1" % REPO +# (the game folder's names, nx2/make_game.py's; Hookshot's after them, for a folder that still has those) +GAME_NAMES = ("triforce", "hookshot") +VERSION_FILES = ("triforce_version.txt", "hookshot_version.txt") +KEPT_EXEFS = (".triforce_exefs", ".hookshot_exefs") class Part(object): @@ -48,7 +55,7 @@ class Manifest(object): def data_root(): base = os.environ.get("HOOKSHOT_BUILDER_HOME") or os.environ.get("XDG_DATA_HOME") or os.path.expanduser("~/.local/share") - return os.path.join(base, "hookshot", "builder") + return os.path.join(base, "triforce", "builder") def parse_list(text, local=True): @@ -173,29 +180,34 @@ def game_version(folder): """The release a folder was built with, when it still has the game files an update builds from.""" if not folder: return None, False - kept = os.path.isdir(os.path.join(folder, ".hookshot_exefs")) and os.path.isdir(os.path.join(folder, "romfs")) + kept = (any(os.path.isdir(os.path.join(folder, name)) for name in KEPT_EXEFS) + and os.path.isdir(os.path.join(folder, "romfs"))) version = None - try: - with open(os.path.join(folder, "hookshot_version.txt"), encoding="utf-8") as f: - for line in f: - if line.startswith("version="): - version = line[8:].strip() or None - break - except OSError: - pass + for name in VERSION_FILES: + try: + with open(os.path.join(folder, name), encoding="utf-8") as f: + for line in f: + if line.startswith("version="): + version = line[8:].strip() or None + break + except OSError: + continue + break return version, kept def game_exe(folder): - """bin/hookshot under the launcher, or hookshot in a folder built before the launcher.""" - if not folder: + """bin/triforce under the launcher, or triforce in a folder built without one (Hookshot's names after them).""" + if not folder or not os.path.isfile(os.path.join(folder, "image.bin")): return None - nested = os.path.join(folder, "bin", "hookshot") - if os.path.isfile(nested) and os.path.isfile(os.path.join(folder, "image.bin")): - return nested - flat = os.path.join(folder, "hookshot") - if os.path.isfile(flat) and os.path.isfile(os.path.join(folder, "image.bin")): - return flat + for name in GAME_NAMES: # (under the launcher first: beside image.bin that name is the launcher itself) + nested = os.path.join(folder, "bin", name) + if os.path.isfile(nested): + return nested + for name in GAME_NAMES: + flat = os.path.join(folder, name) + if os.path.isfile(flat): + return flat return None @@ -218,7 +230,7 @@ def _https(url): def _request(url, timeout, limit=MAX_DOWNLOAD): # (no second argument: Request's second is the POST body, and a str body failed every download before connecting) - req = urllib.request.Request(_https(url), headers={"User-Agent": "Hookshot", "Accept": "application/vnd.github+json"}) + req = urllib.request.Request(_https(url), headers={"User-Agent": "Triforce", "Accept": "application/vnd.github+json"}) with urllib.request.urlopen(req, timeout=timeout) as response: return _read_at_most(response, limit) @@ -238,7 +250,7 @@ def _api_download(url): for asset in json.loads(info.decode("utf-8")).get("assets", []): if asset.get("name") == name: req = urllib.request.Request(_https(asset.get("url")), headers={ - "User-Agent": "Hookshot", "Accept": "application/octet-stream"}) + "User-Agent": "Triforce", "Accept": "application/octet-stream"}) with urllib.request.urlopen(req, timeout=120) as response: return _read_at_most(response, MAX_DOWNLOAD) return None @@ -276,6 +288,8 @@ def latest_tag(get=None): try: import json body = json.loads(get(LATEST_API).decode("utf-8")) + if isinstance(body, list): # (releases?per_page=1: the newest first) + body = body[0] if body else {} tag = body.get("tag_name") if tag: return tag @@ -529,6 +543,18 @@ def fetch_manifest(get=None): if override: with open(override, encoding="utf-8") as handle: return parse_list(handle.read()) + # (Triforce: the newest release's own list, by its tag, so a pre-release is found; /releases/latest is the fallback) + try: + import json + body = json.loads(get(LATEST_API).decode("utf-8")) + if isinstance(body, list): + body = body[0] if body else {} + tag = body.get("tag_name") or "" + if tag and all(ch.isalnum() or ch in "._-" for ch in tag): + url = "https://github.com/%s/releases/download/%s/%s" % (REPO, tag, LIST_NAME) + return parse_list(get(url).decode("utf-8"), local=False) + except Exception: + pass return parse_list(get(LATEST_LIST).decode("utf-8"), local=False) diff --git a/gpu/vk/vk_memory.cpp b/gpu/vk/vk_memory.cpp index 4e6bdc2..8315d66 100644 --- a/gpu/vk/vk_memory.cpp +++ b/gpu/vk/vk_memory.cpp @@ -3567,7 +3567,12 @@ void mirror_sync(Pool& p) { logf("vk: pool %#llx (%llu MB): CPU over GPU pages in %u syncs, %.1f bindings a sync", (unsigned long long)p.lo, (unsigned long long)((p.hi - p.lo) >> 20), p.conflict_syncs, p.bind_rate); // (Triforce: RX_VK_DEMOTE_PIECES=1: a mirror in pieces of any size: only the pieces with such pages leave it) - if (p.conflict_syncs >= 8 && !p.demote_queued && !off && ((p.mpieces && demote_pieces_mode() == 1) || p.hi - p.lo <= (cap_mb << 20)) && + // (Triforce, 11-12: the size cap holds for a mirror in pieces again. Only the piece leaves, but every binding that + // reaches it is bound whole in guest memory: the 224 MB pool's one 256 KB piece put 17 to 46 GB of bindings over PCIe + // per 600 submits in a player's fights (18 to 45 fps), and the trials alone, lost or won, made a lab tour's frames over + // 40 ms 409 against ~75. RX_VK_DEMOTE_ANY_SIZE=1: as before) + static const bool any_size = getenv("RX_VK_DEMOTE_ANY_SIZE") != nullptr; + if (p.conflict_syncs >= 8 && !p.demote_queued && !off && ((p.mpieces && demote_pieces_mode() == 1 && any_size) || p.hi - p.lo <= (cap_mb << 20)) && !p.demote_blocked && p.compute_writes) { p.demote_queued = true; demote_wanted.push_back(p.lo); @@ -4389,7 +4394,8 @@ void demote_trials() { { // (Triforce) the size cap once more, on the pool as it is now: the list holds starts, and a 48 MB pool queued // before it was remade as a 224 MB one took that one out of the mirrors whole (see below) static const uint64_t cap_mb = getenv("RX_VK_DEMOTE_MB") ? strtoull(getenv("RX_VK_DEMOTE_MB"), nullptr, 10) : 64; - if (!(p->mpieces && demote_pieces_mode() == 1) && p->hi - p->lo > (cap_mb << 20)) { + static const bool any_size = getenv("RX_VK_DEMOTE_ANY_SIZE") != nullptr; // (11-12: the cap holds in pieces too, above) + if (!(p->mpieces && demote_pieces_mode() == 1 && any_size) && p->hi - p->lo > (cap_mb << 20)) { p->demote_queued = false, p->conflict_syncs = 0; std::fill(p->conf_bits.begin(), p->conf_bits.end(), 0ull); continue; @@ -4583,10 +4589,29 @@ void imports_give_back() { // (pools_mu held) static bool ram_short = false; static uint64_t ram_avail = 0, ram_total = 0; if (ram_rule && calls % 256 == 0) { + // (Triforce, 11-12: Linux too. MEMORYSTATUSEX alone stopped the Linux build from v0.3.0 on. There: /proc/meminfo's + // MemTotal and MemAvailable, in kB; where neither is to be had the rule never fires) + uint64_t total = 0, avail = 0; + bool known = false; +#ifdef _WIN32 MEMORYSTATUSEX ms{}; ms.dwLength = sizeof ms; - if (GlobalMemoryStatusEx(&ms)) { - ram_total = ms.ullTotalPhys, ram_avail = test_avail >= 0 ? (uint64_t)test_avail << 20 : ms.ullAvailPhys; + if (GlobalMemoryStatusEx(&ms)) total = ms.ullTotalPhys, avail = ms.ullAvailPhys, known = true; +#else + if (FILE* f = fopen("/proc/meminfo", "r")) { + char line[128]; + unsigned long long kb = 0; + int got = 0; + while (got != 3 && fgets(line, sizeof line, f)) { + if (sscanf(line, "MemTotal: %llu kB", &kb) == 1) total = (uint64_t)kb << 10, got |= 1; + else if (sscanf(line, "MemAvailable: %llu kB", &kb) == 1) avail = (uint64_t)kb << 10, got |= 2; + } + fclose(f); + known = got == 3; + } +#endif + if (known) { + ram_total = total, ram_avail = test_avail >= 0 ? (uint64_t)test_avail << 20 : avail; // (Triforce, later on 11-11: 1.5 GB whatever the PC has, not 8% of it as well. On a 32 GB PC 8% is 2.6 GB, and a // player's session there sat at 2.2-2.6 GB available with nothing wrong: the rule fired 15 times in 3.5 minutes, // and 9 of the session's imports were of chunks it had given back, ~30 ms each on the replay thread) @@ -5360,6 +5385,41 @@ void memory_end_submission(VkCommandBuffer cmd) { logf("vk: bound in guest memory, by pool (the GPU reads these over PCIe; binds and the bytes of their ranges over these 600 submits, " "%.1f MB in all, a range counted once a submit): %s", all / 1048576.0, ds.c_str()); } + // (Triforce, 11-12) A piece left in guest memory that turns out to cost much goes back into its mirror, for good. + // A trial decides in 90 frames, by the GPU's time then, that the pieces of a pool both sides write stay in guest + // memory; and a binding that reaches such a piece is bound whole in guest memory, whatever its size. A player's + // sessions (RTX 4070 SUPER): the 224 MB pool 0x108c000000 lost one 256 KB piece this way in a quiet moment (11.76 ms + // against 12.01), and from then on 383 bindings of ~74 MB each were read over PCIe every 600 submits, 17 to 46 GB + // against the usual 0.2 GB: 18 to 45 fps in fights for minutes, 60 to 100 frames over 40 ms every five seconds, + // and 3 to 5 GB for the rest of the session. Four of his session logs show it (medians of 4 to 25 GB), none of the + // lab's: its triforce_mirror_keep.txt held that pool from an earlier trial. Past RX_VK_DIRECT_MAX_MB (1024) of such + // bindings in 600 submits the pool's pieces are the mirror's again (made at their next binding), it is tried no + // more, and its start goes into triforce_mirror_keep.txt for later runs. Not while its trial runs. 0: off, as before + static const double direct_max_mb = getenv("RX_VK_DIRECT_MAX_MB") ? atof(getenv("RX_VK_DIRECT_MAX_MB")) : 1024.0; + if (direct_max_mb > 0) + for (const auto& [lo, bytes] : direct_bytes_by_pool) { + if ((double)bytes < direct_max_mb * 1048576.0) continue; + const auto it = imported.find(lo); + if (it == imported.end()) continue; + Pool& dp = it->second; + if (!dp.mpieces || dp.mstate != Pool::MIRROR_ON || !dp.trial_bits.empty()) continue; + std::vector bits(dp.direct_bits.size()); + uint64_t pieces = 0; + for (size_t w = 0; w < bits.size(); w++) { + bits[w] = __atomic_load_n(&dp.direct_bits[w], __ATOMIC_RELAXED); + pieces += (uint64_t)std::popcount(bits[w]); + } + if (!pieces) continue; + pieces_set_direct(dp, bits, false); + dp.demote_blocked = true, dp.demote_queued = false, dp.conflict_syncs = 0; + std::fill(dp.conf_bits.begin(), dp.conf_bits.end(), 0ull); + pools_gen++; + mirror_keep_add(lo); + logf("vk: pool %#llx (%llu MB): %llu KB of it were left in guest memory, and the bindings that reach them were %.0f MB " + "read over PCIe in 600 submits: those pieces are mirrored again and the pool is tried no more " + "(RX_VK_DIRECT_MAX_MB=%.0f; 0: off)", (unsigned long long)lo, (unsigned long long)((dp.hi - dp.lo) >> 20), + (unsigned long long)((pieces << dp.piece_shift) >> 10), (double)bytes / 1048576.0, direct_max_mb); + } direct_by_pool.clear(), direct_bytes_by_pool.clear(); } } diff --git a/host/hos_update.c b/host/hos_update.c index 0d38d26..f51ee91 100644 --- a/host/hos_update.c +++ b/host/hos_update.c @@ -236,14 +236,14 @@ static int latest_tag(char *tag, size_t cap) { "https://github.com/ruckus7382sfgsgdf/CBeta0.2/releases/latest/download/triforce-linux.txt 2>/dev/null", tag, cap); } -/* the builder an update installed (builder/linux/linux_update.py): /hookshot/builder/versions//AppRun. The +/* the builder an update installed (builder/linux/linux_update.py): /triforce/builder/versions//AppRun. The builder= line names the AppImage that built the folder, which the player may have deleted since */ static int installed_builder(char *out, size_t cap) { const char *home = getenv("HOOKSHOT_BUILDER_HOME"), *data = getenv("XDG_DATA_HOME"), *user = getenv("HOME"); char root[MAX_PATH * 2], path[MAX_PATH * 2 + 64], tag[128]; - if (home && *home) snprintf(root, sizeof root, "%s/hookshot/builder", home); - else if (data && *data) snprintf(root, sizeof root, "%s/hookshot/builder", data); - else if (user && *user) snprintf(root, sizeof root, "%s/.local/share/hookshot/builder", user); + if (home && *home) snprintf(root, sizeof root, "%s/triforce/builder", home); + else if (data && *data) snprintf(root, sizeof root, "%s/triforce/builder", data); + else if (user && *user) snprintf(root, sizeof root, "%s/.local/share/triforce/builder", user); else return 0; snprintf(path, sizeof path, "%s/current", root); FILE *f = fopen(path, "rb"); diff --git a/host/nn_hid.c b/host/nn_hid.c index e86fbe0..dc3f3b8 100644 --- a/host/nn_hid.c +++ b/host/nn_hid.c @@ -692,6 +692,37 @@ static void pads_read(uint64_t *buttons, int32_t stick[4]) { if (rx_option(17, 0)) v[3] = -v[3]; stick_max(s, v); } + } else if (xinput_get) { + /* (Triforce, 11-12) SDL has the pads: XInput is only looked at, ten times a second, for the pads it had before + SDL opened its own. A pad whose buttons XInput shows down while SDL shows none, 20 looks with no look between + where SDL showed one: SDL's button input is not arriving (pad_sdl.c's SDL_JOYSTICK_THREAD), said once */ + static int64_t next_look; + static int silent, said; + if (!said && now >= next_look) { + next_look = now + 100000000LL; + const uint64_t triggers = 1ULL << HOS_PAD_LTRIGGER | 1ULL << HOS_PAD_RTRIGGER; + for (int p = 0; p < XUSER_MAX_COUNT; p++) { + if (!was_connected[p]) continue; + XINPUT_STATE xs; + if (xinput_get((DWORD)p, &xs) != ERROR_SUCCESS) { + hos_log("hid: controller %d disconnected", p); + was_connected[p] = 0; + continue; + } + if (!xs.Gamepad.wButtons) continue; + if (raw & ~triggers) { + silent = 0; + continue; + } + if (++silent >= 20) { + said = 1; + hos_log("hid: XInput shows controller %d's buttons down and SDL shows none, 20 times running: SDL's " + "button and stick input is not arriving (HOS_NO_SDL=1 in triforce_env.txt reads the " + "controllers through XInput alone)", p); + break; + } + } + } } InterlockedExchange(&pad_raw_now, (LONG)raw); /* Back and Start together open the Insert menu (gpu/vk/vk_menu.cpp, for pads whose Home button the system diff --git a/host/pad_sdl.c b/host/pad_sdl.c index 08bd09a..83421cf 100644 --- a/host/pad_sdl.c +++ b/host/pad_sdl.c @@ -85,6 +85,17 @@ static int32_t stick_value(int16_t v, int flip, int zone) { static int pads_start(void) { /* poll in the background, whatever window is in front (nn_hid.c decides when input counts) */ hos_sdl_hint("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1"); +#ifdef _WIN32 + /* (Triforce, 11-12) SDL's own thread for its controller window's messages. On Windows SDL reads an Xbox pad through + raw input: the buttons and sticks arrive as WM_INPUT messages to a window SDL makes on the thread that starts its + controllers, and only the triggers and Guide come from XInput. SDL handles those messages in its video event loop, + or on a thread of its own with this hint; this thread has neither a window loop nor SDL's video, so the messages + were never handled: once SDL had opened the pad only the triggers worked, until the game was started again with + the pad turned on later (SDL never saw that pad, its arrival being such a message too, and XInput read it). A + player's Xbox Series X pad on the Xbox Wireless Adapter, SDL 2.32.10, the same calls in a probe: XInput 694 state + changes in 8 s of pressing, SDL 0 button or stick changes with the triggers moving; with the hint 579 for 700. */ + hos_sdl_hint("SDL_JOYSTICK_THREAD", "1"); +#endif /* (SDL2: PlayStation pads' rumble asked for; SDL3 turns it on when a rumble is first sent) */ hos_sdl_hint("SDL_JOYSTICK_HIDAPI_PS5_RUMBLE", "1"); hos_sdl_hint("SDL_JOYSTICK_HIDAPI_PS4_RUMBLE", "1"); diff --git a/scripts/linux/appimage.sh b/scripts/linux/appimage.sh index 8a8899c..db3c021 100755 --- a/scripts/linux/appimage.sh +++ b/scripts/linux/appimage.sh @@ -3,7 +3,7 @@ # nothing made from it is in it: the game is built from the player's own copy, as on Windows. # # scripts/linux/deps.sh (first: the compiler, Python, FFmpeg, SDL2, headers into build-linux/deps) -# scripts/linux/appimage.sh -> build-linux/Hookshot--x86_64.AppImage +# scripts/linux/appimage.sh -> build-linux/Triforce--x86_64.AppImage # The same image builds the game and, with --play, starts the one it saved. # # Built on the oldest system it is for (CI: Ubuntu 22.04): the sysroot it carries is that system's C library, so the @@ -21,10 +21,10 @@ PY=$DEPS/python/bin/python3 # ---- the Vulkan back end, built here once (it needs no game) ---- VKW=$B/vk-work -rm -rf "$VKW/sa/build/hookshot_vk.so" +rm -rf "$VKW/sa/build/triforce_vk.so" OOT_WORK=$VKW RX_MARCH=x86-64-v3 RX_VK_ONLY=1 RX_RELEASE=1 "$PY" -I nx2/build.py --standalone --jobs "${JOBS:-$(nproc)}" -VK=$VKW/sa/build/hookshot_vk.so -[ -f "$VK" ] || { echo "hookshot_vk.so was not built"; exit 1; } +VK=$VKW/sa/build/triforce_vk.so +[ -f "$VK" ] || { echo "triforce_vk.so was not built"; exit 1; } # ---- the tools' native helpers, built now: the AppImage is read-only. a64emit with its C++ runtime inside (the one this system # builds with is newer than older systems have), and the stamp build_emit.py checks, so it is not built again ---- @@ -142,14 +142,14 @@ cp assets/hookshot.png "$APPDIR/hookshot.png" mkdir -p "$APPDIR/usr/share/icons/hicolor/256x256/apps" cp assets/hookshot.png "$APPDIR/usr/share/icons/hicolor/256x256/apps/hookshot.png" -# (the update list, beside AppRun and not inside a hashed part: hookshot-linux.txt names each part's checksum) +# (the update list, beside AppRun and not inside a hashed part: triforce-linux.txt names each part's checksum) # (the parts are served from the linux-parts release of the repository this is built in, where # scripts/linux/publish_parts.sh uploads them: without --base the list named NotRexed/Hookshot's release, which a fork's # CI does not upload to, so a fork's update list named parts that were not there) python3 scripts/linux/make_parts.py "$APPDIR" "$VERSION" "$B/parts" \ --base "https://github.com/${GITHUB_REPOSITORY:-NotRexed/Hookshot}/releases/download/linux-parts" -OUT=$B/Hookshot-$VERSION-x86_64.AppImage +OUT=$B/Triforce-$VERSION-x86_64.AppImage rm -f "$OUT" ARCH=x86_64 APPIMAGE_EXTRACT_AND_RUN=1 "$DEPS/appimagetool" --runtime-file "$DEPS/runtime-x86_64" --comp zstd "$APPDIR" "$OUT" echo "$OUT: $(du -h "$OUT" | cut -f1)" diff --git a/scripts/linux/check_player_build.sh b/scripts/linux/check_player_build.sh index b003a44..c889c6c 100755 --- a/scripts/linux/check_player_build.sh +++ b/scripts/linux/check_player_build.sh @@ -4,7 +4,7 @@ # made nx2/build.py write the menu's fonts from third_party/fonts at every build start, the AppImage does not carry that # folder, and every Linux build stopped at LibertinusSans-Regular.ttf while CI stayed green (2026-11-10, #1567). # -# scripts/linux/check_player_build.sh [] (default: the newest in build-linux/) +# scripts/linux/check_player_build.sh [] (default: the newest in build-linux/) # # The image is extracted, as its runtime does, and run with AppRun's own environment (the AppImage's Python, compiler, # sysroot, FFmpeg and the prebuilt Vulkan back end, HOOKSHOT_VK_PREBUILT) in an otherwise empty one, so nothing of the @@ -15,7 +15,7 @@ # Neither may write into the image's tree: on a player's PC it is read-only. set -euo pipefail cd "$(dirname "$0")/../.." -IMAGE=${1:-$(ls -t build-linux/Hookshot-*-x86_64.AppImage 2>/dev/null | head -1 || true)} +IMAGE=${1:-$(ls -t build-linux/Triforce-*-x86_64.AppImage 2>/dev/null | head -1 || true)} [ -n "$IMAGE" ] && [ -f "$IMAGE" ] || { echo "no AppImage to check (scripts/linux/appimage.sh makes one)"; exit 1; } IMAGE=$(readlink -f "$IMAGE") TMP=$(mktemp -d) diff --git a/scripts/linux/make_parts.py b/scripts/linux/make_parts.py index f5337da..7b5ee6e 100644 --- a/scripts/linux/make_parts.py +++ b/scripts/linux/make_parts.py @@ -5,7 +5,7 @@ Each directory that changes on its own is one zip: the tools (every release), Python, clang, FFmpeg, the sysroot, and the two libraries beside them. A zip is deterministic, so a directory whose files did not change has the same SHA-256 next time and the builder copies the one it already has. The zips are uploaded to the linux-parts release; the version's -own release carries hookshot-linux.txt, which names them. +own release carries triforce-linux.txt, which names them. The list is not inside a zip (it names the zips' checksums). """ @@ -106,10 +106,10 @@ def main(): lines.append("tree" if files is None else "\n".join("file %s" % name for name in files)) print("%-32s %5d MB %s" % (dest, size >> 20, digest[:16]), flush=True) text = "\n".join(lines) + "\n" - with open(os.path.join(args.out, "hookshot-linux.txt"), "w", encoding="utf-8", newline="\n") as handle: + with open(os.path.join(args.out, "triforce-linux.txt"), "w", encoding="utf-8", newline="\n") as handle: handle.write(text) # (beside AppRun, not inside a hashed part: the list names those checksums) - with open(os.path.join(root, "hookshot-linux.txt"), "w", encoding="utf-8", newline="\n") as handle: + with open(os.path.join(root, "triforce-linux.txt"), "w", encoding="utf-8", newline="\n") as handle: handle.write(text) diff --git a/scripts/linux/publish_parts.sh b/scripts/linux/publish_parts.sh index b374678..8f6aaf9 100755 --- a/scripts/linux/publish_parts.sh +++ b/scripts/linux/publish_parts.sh @@ -1,6 +1,6 @@ #!/bin/bash # Upload the Linux builder's parts (scripts/linux/make_parts.py) to the linux-parts release, which is not "latest". -# A zip whose name is already there is left (its checksum is in the name). hookshot-linux.txt itself goes on the +# A zip whose name is already there is left (its checksum is in the name). triforce-linux.txt itself goes on the # version release, with the AppImage. Run from CI on a tag, with GH_TOKEN and GITHUB_REPOSITORY. set -euo pipefail ROOT=$(cd "$(dirname "$0")/../.." && pwd) diff --git a/tests/test_linux_builder_jobs.py b/tests/test_linux_builder_jobs.py index 71cea3b..a6bdf28 100644 --- a/tests/test_linux_builder_jobs.py +++ b/tests/test_linux_builder_jobs.py @@ -153,7 +153,7 @@ class BuilderBuildJobsTests(unittest.TestCase): self.assertFalse(hasattr(harness.gui, "proc")) self.assertEqual(len(harness.events), 1) kind, title, message = harness.events[0] - self.assertEqual((kind, title), ("error", "Hookshot")) + self.assertEqual((kind, title), ("error", "Triforce")) self.assertIn("HOOKSHOT_JOBS", message) self.assertIn("0 for automatic", message) self.assertEqual(harness.environ, {"HOOKSHOT_JOBS": raw, "RX_JOBS": "2"}) diff --git a/tests/test_linux_update.py b/tests/test_linux_update.py index 359ebab..58917e7 100644 --- a/tests/test_linux_update.py +++ b/tests/test_linux_update.py @@ -83,7 +83,7 @@ class UpdateTests(unittest.TestCase): with self.subTest(case=label): case = root / label home = case / "home" - versions = home / "hookshot" / "builder" / "versions" + versions = home / "triforce" / "builder" / "versions" previous = versions / "v1" previous.mkdir(parents=True) (previous / "kept").write_bytes(b"previous version") @@ -197,7 +197,7 @@ class UpdateTests(unittest.TestCase): self.assertNotIn(linux_update.LIST_NAME, zipped.namelist()) payloads[part.url] = archive.read_bytes() home = root / "publisher-home" - versions = home / "hookshot" / "builder" / "versions" + versions = home / "triforce" / "builder" / "versions" versions.mkdir(parents=True) canary = versions / "canary" canary.write_bytes(b"publisher sibling canary") @@ -217,7 +217,7 @@ class UpdateTests(unittest.TestCase): with self.subTest(target_exists=exists), tempfile.TemporaryDirectory(prefix="hookshot-stage-") as tmp: root = Path(tmp).resolve() home = root / "home" - versions = home / "hookshot" / "builder" / "versions" + versions = home / "triforce" / "builder" / "versions" versions.mkdir(parents=True) target = root / "outside-stage" sentinel = root / "sentinel" @@ -266,7 +266,7 @@ class UpdateTests(unittest.TestCase): if linked_home: home.symlink_to(real_home, target_is_directory=True) self.assertIn(root, home.resolve().parents) - versions = home / "hookshot" / "builder" / "versions" + versions = home / "triforce" / "builder" / "versions" old = versions / "v1" old.mkdir(parents=True) (old / "kept").write_text("old", encoding="utf-8") @@ -362,7 +362,7 @@ class UpdateTests(unittest.TestCase): for label, links in chains: with self.subTest(case=label), tempfile.TemporaryDirectory(prefix="hookshot-chain-") as tmp: home = Path(tmp).resolve() / "home" - versions = home / "hookshot" / "builder" / "versions" + versions = home / "triforce" / "builder" / "versions" versions.mkdir(parents=True) canary = versions / "canary" canary.write_bytes(b"canary") @@ -447,7 +447,7 @@ class UpdateTests(unittest.TestCase): root = Path(tmp) / "rc" appdir(root) (root / "usr" / "share" / "hookshot" / "VERSION").write_text("v1.1-rc.1\n", encoding="utf-8") - (root / "hookshot-linux.txt").write_text( + (root / "triforce-linux.txt").write_text( "tag v1.1-rc.1\npart %s 10 usr/share/hookshot file://%s/rc.zip\nfile nx2/marker.py\n" % ("a" * 64, tmp), encoding="utf-8") stable = "tag v1.0\npart %s 10 usr/share/hookshot https://example.invalid/old.zip\nfile nx2/marker.py\n" % ("b" * 64) @@ -466,7 +466,7 @@ class UpdateTests(unittest.TestCase): # an AppImage at the latest release keeps using its bundled list (nothing was ever reinstalled there) release = Path(tmp) / "release" appdir(release) # (VERSION v1) - (release / "hookshot-linux.txt").write_text( + (release / "triforce-linux.txt").write_text( "tag v1\npart %s 10 usr/share/hookshot file://%s/release.zip\nfile nx2/marker.py\n" % ("e" * 64, tmp), encoding="utf-8") same = "tag v1\npart %s 10 usr/share/hookshot https://example.invalid/old.zip\nfile nx2/marker.py\n" % ("b" * 64) @@ -489,7 +489,7 @@ class UpdateTests(unittest.TestCase): make_parts.main() finally: sys.argv = argv - manifest = linux_update.parse_list((first / "hookshot-linux.txt").read_text(encoding="utf-8")) + manifest = linux_update.parse_list((first / "triforce-linux.txt").read_text(encoding="utf-8")) home = root / "home" os.environ["HOOKSHOT_BUILDER_HOME"] = str(home) self.addCleanup(lambda: os.environ.pop("HOOKSHOT_BUILDER_HOME", None)) @@ -502,7 +502,7 @@ class UpdateTests(unittest.TestCase): linux_update.install(manifest, str(old), manifest, get=get) self.assertEqual(downloaded, []) - installed = home / "hookshot" / "builder" / "versions" / "v1" + installed = home / "triforce" / "builder" / "versions" / "v1" self.assertTrue((installed / "AppRun").stat().st_mode & stat.S_IXUSR) self.assertEqual((installed / "usr" / "share" / "hookshot" / "nx2" / "marker.py").read_text(encoding="utf-8"), "print('one')\n") @@ -515,7 +515,7 @@ class UpdateTests(unittest.TestCase): make_parts.main() finally: sys.argv = argv - nxt = linux_update.parse_list((second / "hookshot-linux.txt").read_text(encoding="utf-8")) + nxt = linux_update.parse_list((second / "triforce-linux.txt").read_text(encoding="utf-8")) downloaded.clear() def get2(url): @@ -526,10 +526,10 @@ class UpdateTests(unittest.TestCase): linux_update.install(nxt, str(installed), manifest, get=get2) self.assertEqual(len(downloaded), 1) self.assertIn("usr-share-hookshot", downloaded[0]) - built = home / "hookshot" / "builder" / "versions" / "v2" + built = home / "triforce" / "builder" / "versions" / "v2" self.assertEqual((built / "usr" / "share" / "hookshot" / "nx2" / "marker.py").read_text(encoding="utf-8"), "print('two')\n") self.assertEqual((built / "usr" / "lib" / "hookshot" / "hookshot_vk.so").read_bytes(), b"vk") - self.assertFalse((home / "hookshot" / "builder" / "versions" / "v1").exists()) + self.assertFalse((home / "triforce" / "builder" / "versions" / "v1").exists()) def test_an_installed_builder_finds_its_own_root(self): with tempfile.TemporaryDirectory(prefix="hookshot-root-") as tmp: @@ -575,11 +575,11 @@ class UpdateTests(unittest.TestCase): (out / name).write_bytes(b"old " + name.encode()) with mock.patch.dict(os.environ, {"HOOKSHOT_TOOLS": str(ROOT)}): exec(finish, make_game.__dict__, {"built": str(built), "out": str(out), "work": str(work)}) - self.assertEqual((out / "hookshot").read_bytes(), (ROOT / "builder" / "linux" / "hookshot-folder").read_bytes()) - self.assertTrue((out / "hookshot").stat().st_mode & stat.S_IXUSR) - self.assertEqual(sorted(p.name for p in out.iterdir()), ["bin", "hookshot", "image.bin"]) + self.assertEqual((out / make_game.BESIDE[0]).read_bytes(), (ROOT / "builder" / "linux" / "hookshot-folder").read_bytes()) + self.assertTrue((out / make_game.BESIDE[0]).stat().st_mode & stat.S_IXUSR) + self.assertEqual(sorted(p.name for p in out.iterdir()), sorted(["bin", make_game.BESIDE[0], "image.bin"])) self.assertEqual(sorted(p.name for p in (out / "bin").iterdir()), sorted(make_game.BESIDE)) - self.assertEqual((out / "bin" / "hookshot").read_bytes(), b"new hookshot") + self.assertEqual((out / "bin" / make_game.BESIDE[0]).read_bytes(), b"new " + make_game.BESIDE[0].encode()) def test_the_sysroot_path_is_not_part_of_an_object_key(self): import build @@ -617,14 +617,14 @@ class UpdateTests(unittest.TestCase): def test_the_folder_launcher_finds_the_builder_under_the_builder_home(self): # HOOKSHOT_BUILDER_HOME is the data directory, as XDG_DATA_HOME is: linux_update installs to - # /hookshot/builder and host/hos_update.c looks there, so the launcher must too + # /triforce/builder and host/hos_update.c looks there, so the launcher must too with tempfile.TemporaryDirectory(prefix="hookshot-folder-") as tmp: root = Path(tmp) game = root / "game" (game / "bin").mkdir(parents=True) home = root / "home" started = root / "started" - installed = home / "hookshot" / "builder" + installed = home / "triforce" / "builder" (installed / "versions" / "v9").mkdir(parents=True) (installed / "current").write_text("v9\n", encoding="utf-8") apprun = installed / "versions" / "v9" / "AppRun" diff --git a/tests/test_make_game_ngx.py b/tests/test_make_game_ngx.py index 2526211..e84dfa8 100644 --- a/tests/test_make_game_ngx.py +++ b/tests/test_make_game_ngx.py @@ -190,7 +190,7 @@ class LinuxBuilderDlssTests(unittest.TestCase): self.assertIn("https://github.com/NVIDIA/DLSS/blob/", self.builder.DLSS_LICENSE) self.assertIn("never share a game folder built with them", self.builder.DLSS_LICENSE) with mock.patch.dict(os.environ, {"HOOKSHOT_BUILDER_HOME": str(self.root)}): - sdk = str(self.root / "hookshot" / "builder" / "ngx-sdk") + sdk = str(self.root / "triforce" / "builder" / "ngx-sdk") self.assertEqual(self.builder.ngx_sdk_dir(), sdk) env_off = self.builder.make_game_env(False, {"HOOKSHOT_NGX_SDK": "/stale", "HOOKSHOT_VK_PREBUILT": "/app/hookshot_vk.so"}) self.assertNotIn("HOOKSHOT_NGX_SDK", env_off)