feat(clone-app): Unity tool wrappers (Il2CppInspectorRedux, AssetRipper)
This commit is contained in:
parent
aad064d220
commit
3c9bb564ce
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/env bash
|
||||
# Recover the C# type model from a Unity IL2CPP build via Il2CppInspectorRedux.
|
||||
# Flags follow the Il2CppInspector CLI; adjust to your installed CLI version if
|
||||
# they differ. Only the tool-missing path is exercised by tests.
|
||||
set -uo pipefail
|
||||
|
||||
SO="${1:-}"; META="${2:-}"; OUT="${3:-}"
|
||||
if [[ -z "$SO" || -z "$META" || -z "$OUT" ]]; then
|
||||
echo "ERROR: usage: il2cpp-dump.sh <libil2cpp.so> <global-metadata.dat> <out-dir>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
BIN="${IL2CPP_INSPECTOR_CLI:-Il2CppInspector}"
|
||||
if ! command -v "$BIN" >/dev/null 2>&1; then
|
||||
cat >&2 <<'EOF'
|
||||
ERROR: Il2CppInspectorRedux CLI not found.
|
||||
Install it (needs the .NET SDK): https://github.com/LukeFZ/Il2CppInspectorRedux
|
||||
Build the CLI, put it on PATH, or set IL2CPP_INSPECTOR_CLI=/path/to/cli.
|
||||
EOF
|
||||
exit 3
|
||||
fi
|
||||
|
||||
mkdir -p "$OUT"
|
||||
# Produce C# stub headers + a metadata JSON describing types/methods/fields.
|
||||
"$BIN" --bin "$SO" --metadata "$META" \
|
||||
--select-outputs --cs-out "$OUT/types.cs" --json-out "$OUT/metadata.json"
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
# Extract Unity game assets (textures, sprites, audio, scenes, prefabs) from an
|
||||
# APK via AssetRipper's CLI. Only the tool-missing path is exercised by tests.
|
||||
set -uo pipefail
|
||||
|
||||
APK="${1:-}"; OUT="${2:-}"
|
||||
if [[ -z "$APK" || -z "$OUT" ]]; then
|
||||
echo "ERROR: usage: unity-assets.sh <apk> <out-dir>" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
BIN="${ASSETRIPPER_CLI:-AssetRipper}"
|
||||
if ! command -v "$BIN" >/dev/null 2>&1; then
|
||||
cat >&2 <<'EOF'
|
||||
ERROR: AssetRipper CLI not found.
|
||||
Install it (needs the .NET runtime): https://github.com/AssetRipper/AssetRipper
|
||||
Put the CLI on PATH, or set ASSETRIPPER_CLI=/path/to/AssetRipper.
|
||||
EOF
|
||||
exit 3
|
||||
fi
|
||||
|
||||
mkdir -p "$OUT"
|
||||
"$BIN" "$APK" -o "$OUT"
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
set -uo pipefail
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
S="$HERE/../skills/clone-app/scripts"
|
||||
fail=0
|
||||
check() {
|
||||
local desc="$1" expected="$2" actual="$3"
|
||||
if [[ "$expected" == "$actual" ]]; then echo "PASS: $desc"
|
||||
else echo "FAIL: $desc — expected '$expected' got '$actual'"; fail=1; fi
|
||||
}
|
||||
|
||||
# usage errors → exit 2
|
||||
bash "$S/il2cpp-dump.sh" >/dev/null 2>&1; check "il2cpp usage" "2" "$?"
|
||||
bash "$S/unity-assets.sh" >/dev/null 2>&1; check "assets usage" "2" "$?"
|
||||
|
||||
# tool missing → exit 3 + guidance text on stderr
|
||||
err="$(IL2CPP_INSPECTOR_CLI=/no/such/bin bash "$S/il2cpp-dump.sh" a b c 2>&1 >/dev/null)"; rc=$?
|
||||
check "il2cpp missing exit 3" "3" "$rc"
|
||||
grep -q "Il2CppInspectorRedux" <<<"$err" && echo "PASS: il2cpp guidance" || { echo "FAIL: il2cpp guidance"; fail=1; }
|
||||
|
||||
err="$(ASSETRIPPER_CLI=/no/such/bin bash "$S/unity-assets.sh" a b 2>&1 >/dev/null)"; rc=$?
|
||||
check "assets missing exit 3" "3" "$rc"
|
||||
grep -q "AssetRipper" <<<"$err" && echo "PASS: assets guidance" || { echo "FAIL: assets guidance"; fail=1; }
|
||||
|
||||
exit $fail
|
||||
Loading…
Reference in New Issue