#!/usr/bin/env bash set -euo pipefail # DevourUnlocker installer — pulls winhttp.dll from GitHub Releases and drops beside DEVOUR.exe # Works for CachyOS/Proton and native Linux; Windows users should use install.ps1 # Usage: REPO=mithral/DevourUnlocker bash install.sh [--uninstall] [--tag v2.0.0] [--game-dir /path] REPO="${REPO:-mithral/DevourUnlocker}" TAG="${TAG:-latest}" GAME_DIR="" UNINSTALL=0 while [[ $# -gt 0 ]]; do case "$1" in --uninstall) UNINSTALL=1; shift;; --tag) TAG="$2"; shift 2;; --game-dir) GAME_DIR="$2"; shift 2;; --repo) REPO="$2"; shift 2;; *) echo "Unknown arg $1"; exit 1;; esac done detect_game_dir() { local cands=( "$HOME/.local/share/Steam/steamapps/common/Devour" "$HOME/.steam/steam/steamapps/common/Devour" "/mnt/*/SteamLibrary/steamapps/common/Devour" ) for c in "${cands[@]}"; do for e in $c; do [[ -f "$e/DEVOUR.exe" ]] && { echo "$e"; return 0; }; done done # parse libraryfolders.vdf local vdf="$HOME/.local/share/Steam/steamapps/libraryfolders.vdf" if [[ -f "$vdf" ]]; then grep -o '"path"[[:space:]]*"[^"]*"' "$vdf" | cut -d'"' -f4 | while read -r p; do if [[ -f "$p/steamapps/common/Devour/DEVOUR.exe" ]]; then echo "$p/steamapps/common/Devour"; return 0; fi done fi return 1 } if [[ -z "$GAME_DIR" ]]; then GAME_DIR="$(detect_game_dir || true)" fi if [[ -z "$GAME_DIR" || ! -f "$GAME_DIR/DEVOUR.exe" ]]; then echo "[!] Could not find Devour install. Use --game-dir /path/to/Devour" exit 1 fi echo "[*] Game dir: $GAME_DIR" if [[ $UNINSTALL -eq 1 ]]; then echo "[*] Uninstalling..." rm -f "$GAME_DIR/winhttp.dll" "$GAME_DIR/DevourUnlocker.dll" "$GAME_DIR/DevourUnlocker.json" if [[ -f "$GAME_DIR/winhttp.dll.bak" ]]; then mv "$GAME_DIR/winhttp.dll.bak" "$GAME_DIR/winhttp.dll"; echo "[*] Restored original winhttp.dll"; fi echo "[*] Clearing Proton launch override hint:" echo " Remove from Steam -> Devour -> Properties -> Launch Options: WINEDLLOVERRIDES=\"winhttp=n,b %command%\"" exit 0 fi # Resolve tag -> download URL if [[ "$TAG" == "latest" ]]; then API="https://api.github.com/repos/$REPO/releases/latest" TAG=$(curl -s "$API" | grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' | cut -d'"' -f4) [[ -z "$TAG" ]] && { echo "[!] Could not resolve latest tag"; exit 1; } fi echo "[*] Installing $REPO $TAG" ZIP_URL="https://github.com/$REPO/releases/download/$TAG/DevourUnlocker_winhttp_$TAG.zip" TMP="$(mktemp -d)" echo "[*] Downloading $ZIP_URL" if ! curl -L -o "$TMP/pkg.zip" "$ZIP_URL"; then echo "[!] Download failed — check REPO/TAG or build a release with that name" echo " Fallback: build locally with cmake --build build" exit 1 fi unzip -o "$TMP/pkg.zip" -d "$TMP" >/dev/null # Backup existing winhttp if not ours if [[ -f "$GAME_DIR/winhttp.dll" ]]; then if ! grep -q "DevourUnlocker" "$GAME_DIR/winhttp.dll" 2>/dev/null; then cp "$GAME_DIR/winhttp.dll" "$GAME_DIR/winhttp.dll.bak" && echo "[*] Backed up existing winhttp.dll -> winhttp.dll.bak" fi fi cp -v "$TMP/winhttp.dll" "$GAME_DIR/winhttp.dll" cp -v "$TMP/DevourUnlocker.dll" "$GAME_DIR/DevourUnlocker.dll" 2>/dev/null || true # Keep user's json if exists [[ -f "$GAME_DIR/DevourUnlocker.json" ]] || cp -v "$TMP/DevourUnlocker.json" "$GAME_DIR/DevourUnlocker.json" 2>/dev/null || echo '{"unlockRobes":true,"unlockCharacters":true}' > "$GAME_DIR/DevourUnlocker.json" echo "[*] Installed to $GAME_DIR" echo "[*] For Proton (CachyOS): set Steam -> Devour -> Properties -> Launch Options to:" echo " WINEDLLOVERRIDES=\"winhttp=n,b\" %command%" echo "[*] Then launch Devour, press F6 for GUI (selective unlock), F5 to unload." echo "[*] Multiplayer: safe for friend lobbies (client visual, no VAC/EAC)." rm -rf "$TMP"