Files
bigmak94andClaude Opus 5.5 bd9bded792 GalaxyQuest: Super Mario Galaxy in VR on Meta Quest 3
A native port built on the Petari decompilation (previous commit): an
HLE platform layer (OS, DVD, GX, audio, input, NAND) under the game's
own code, an OpenXR presentation (a diorama around the player, a giant
screen, the HUD and settings as compositor layers, SpaceWarp, dynamic
resolution), Touch Plus controls, the tools that convert your own game
files (tools/cook, which also takes the few pieces of data the game's
executable holds from your sys/main.dol), and the port's changes to the
decompilation (`git diff petari-base -- decomp`).  README.md explains
installing and building, docs/TECHNICAL.md how it works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 01:59:38 +02:00

89 lines
3.0 KiB
Bash

#!/bin/bash
# Finds the tools the build scripts use; sourced by build_android.sh,
# tools/package_apk.sh and the device scripts. Everything can be given
# through the environment:
# ANDROID_NDK_HOME Android NDK (r29)
# ANDROID_HOME Android SDK (build-tools, platforms/android-3x, platform-tools)
# JAVA_HOME a JDK (17 or newer) for keytool and apksigner
# CMAKE, NINJA, PYTHON, ADB the programs themselves
# Otherwise they are looked up on PATH, in the usual install places, and in
# ../tools next to the repository (where the portable toolchains of the
# original development setup live).
REPO=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
LOCAL_TOOLS=$(cd "$REPO/.." && pwd)/tools
# Git Bash / MSYS on Windows: programs end in .exe and some take Windows paths.
case "$(uname -s)" in
MINGW* | MSYS* | CYGWIN*) IS_WINDOWS=1; EXE=.exe ;;
*) IS_WINDOWS=; EXE= ;;
esac
# A path as native programs want it (C:/... on Windows).
native_path() {
if [ -n "$IS_WINDOWS" ] && command -v cygpath > /dev/null; then cygpath -m "$1"; else echo "$1"; fi
}
first_dir() {
for d in "$@"; do
if [ -n "$d" ] && [ -d "$d" ]; then echo "$d"; return 0; fi
done
return 1
}
find_ndk() {
first_dir "$ANDROID_NDK_HOME" "$ANDROID_NDK_ROOT" "$ANDROID_NDK" "$LOCAL_TOOLS/android-ndk-r29" \
$(ls -d "$(find_sdk 2> /dev/null)"/ndk/29.* 2> /dev/null | sort -V | tail -1)
}
find_sdk() {
first_dir "$ANDROID_HOME" "$ANDROID_SDK_ROOT" "$LOCALAPPDATA/Android/Sdk" "$HOME/AppData/Local/Android/Sdk" "$HOME/Android/Sdk" \
"$HOME/Library/Android/sdk"
}
# The NDK's own LLVM tools (llvm-strip, llvm-addr2line).
ndk_llvm_bin() {
ls -d "$(find_ndk)"/toolchains/llvm/prebuilt/*/bin 2> /dev/null | head -1
}
find_program() { # name, then fallbacks
local name=$1
shift
if command -v "$name" > /dev/null; then command -v "$name"; return 0; fi
for p in "$@"; do
if [ -x "$p" ]; then echo "$p"; return 0; fi
done
return 1
}
find_cmake() { [ -n "$CMAKE" ] && echo "$CMAKE" || find_program cmake $(ls "$LOCAL_TOOLS"/cmake-*/bin/cmake$EXE 2> /dev/null | tail -1); }
find_ninja() { [ -n "$NINJA" ] && echo "$NINJA" || find_program ninja "$LOCAL_TOOLS/ninja/ninja$EXE"; }
find_adb() {
if [ -n "$ADB" ]; then echo "$ADB"; return 0; fi
find_program adb "$(find_sdk 2> /dev/null)/platform-tools/adb$EXE"
}
# A Python 3 that runs (on Windows "python" may be the Microsoft Store stub).
find_python() {
if [ -n "$PYTHON" ]; then echo "$PYTHON"; return 0; fi
for p in python3 python "$LOCAL_TOOLS/python/python$EXE"; do
if command -v "$p" > /dev/null && "$p" -c "import sys; sys.exit(sys.version_info < (3, 8))" 2> /dev/null; then
command -v "$p"
return 0
fi
done
if command -v py > /dev/null && py -3 -c "" 2> /dev/null; then
echo "py -3"
return 0
fi
return 1
}
# Runs Python 3 (see find_python) with the given arguments.
py3() {
local p
p=$(find_python) || { echo "Python 3 not found: put it on PATH or set PYTHON" >&2; return 1; }
if [ "$p" = "py -3" ]; then py -3 "$@"; else "$p" "$@"; fi
}