param( [string]$Repo = "mithral/DevourUnlocker", [string]$Tag = "latest", [string]$GameDir = "", [switch]$Uninstall ) $ErrorActionPreference = "Stop" function Find-GameDir { $cands = @( "$env:ProgramFiles (x86)/Steam/steamapps/common/Devour", "C:/Steam/steamapps/common/Devour", "$env:USERPROFILE/.local/share/Steam/steamapps/common/Devour" ) foreach ($c in $cands) { if (Test-Path "$c/DEVOUR.exe") { return $c } } $vdf = "$env:ProgramFiles (x86)/Steam/steamapps/libraryfolders.vdf" if (Test-Path $vdf) { $txt = Get-Content $vdf -Raw foreach ($m in [regex]::Matches($txt, '"path"\s+"([^"]+)"')) { $p = $m.Groups[1].Value + "/steamapps/common/Devour" if (Test-Path "$p/DEVOUR.exe") { return $p } } } return $null } if (-not $GameDir) { $GameDir = Find-GameDir } if (-not $GameDir -or -not (Test-Path "$GameDir/DEVOUR.exe")) { Write-Error "Could not find Devour install. Use -GameDir C:/.../Devour" exit 1 } Write-Host "[*] Game dir: $GameDir" if ($Uninstall) { Remove-Item "$GameDir/winhttp.dll" -ErrorAction SilentlyContinue Remove-Item "$GameDir/DevourUnlocker.dll" -ErrorAction SilentlyContinue if (Test-Path "$GameDir/winhttp.dll.bak") { Move-Item "$GameDir/winhttp.dll.bak" "$GameDir/winhttp.dll" -Force; Write-Host "[*] Restored original" } Write-Host "[*] Uninstalled" exit 0 } if ($Tag -eq "latest") { $api = "https://api.github.com/repos/$Repo/releases/latest" $rel = Invoke-RestMethod -Uri $api $Tag = $rel.tag_name } Write-Host "[*] Installing $Repo $Tag" $zipUrl = "https://github.com/$Repo/releases/download/$Tag/DevourUnlocker_winhttp_$Tag.zip" $tmp = Join-Path $env:TEMP "devour_$Tag" New-Item -ItemType Directory -Force -Path $tmp | Out-Null $zip = Join-Path $tmp "pkg.zip" Invoke-WebRequest -Uri $zipUrl -OutFile $zip Expand-Archive -Path $zip -DestinationPath $tmp -Force if (Test-Path "$GameDir/winhttp.dll") { Copy-Item "$GameDir/winhttp.dll" "$GameDir/winhttp.dll.bak" -Force Write-Host "[*] Backed up winhttp.dll" } Copy-Item "$tmp/winhttp.dll" "$GameDir/winhttp.dll" -Force if (Test-Path "$tmp/DevourUnlocker.dll") { Copy-Item "$tmp/DevourUnlocker.dll" "$GameDir/DevourUnlocker.dll" -Force } if (-not (Test-Path "$GameDir/DevourUnlocker.json")) { if (Test-Path "$tmp/DevourUnlocker.json") { Copy-Item "$tmp/DevourUnlocker.json" "$GameDir/DevourUnlocker.json" } else { '{"unlockRobes":true,"unlockCharacters":true}' | Out-File "$GameDir/DevourUnlocker.json" } } Write-Host "[*] Installed to $GameDir — press F6 in-game for GUI, F5 to unload" Remove-Item $tmp -Recurse -Force