# PhantomFrame installer for Windows: # irm https://raw.githubusercontent.com/rpatty-dev/phantomframe/main/install.ps1 | iex # Downloads PhantomFrame-Setup.exe from the latest GitHub release and installs it per-user (no admin rights). # Older Python-based PhantomFrame installs run this script to update themselves, which moves them to the # native app: the Start menu shortcut and the old folder's Launch.bat then open the new PhantomFrame.exe. & { $ErrorActionPreference = 'Continue' $ProgressPreference = 'SilentlyContinue' # Invoke-WebRequest is very slow with the progress bar on [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 $Repo = 'rpatty-dev/phantomframe' function Say($m) { Write-Host "==> $m" -ForegroundColor Red } Say 'Finding the latest PhantomFrame release' $rel = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest" -Headers @{ 'User-Agent' = 'PhantomFrame-installer' } -ErrorAction Stop $asset = $rel.assets | Where-Object { $_.name -eq 'PhantomFrame-Setup.exe' } | Select-Object -First 1 if (-not $asset) { throw "Release $($rel.tag_name) has no PhantomFrame-Setup.exe" } $setup = Join-Path $env:TEMP "PhantomFrame-Setup-$($rel.tag_name).exe" Say "Downloading PhantomFrame $($rel.tag_name)" Invoke-WebRequest $asset.browser_download_url -OutFile $setup -UseBasicParsing -ErrorAction Stop Say 'Installing' $setupArgs = @('/S') if ($env:PHANTOMFRAME_NO_LAUNCH -ne '1') { $setupArgs += '/launch' } $p = Start-Process $setup -ArgumentList $setupArgs -Wait -PassThru Remove-Item $setup -Force -ErrorAction SilentlyContinue if ($p.ExitCode -ne 0) { throw "PhantomFrame setup failed (exit code $($p.ExitCode))" } # Updating an old Python install: point its Launch.bat at the native app $old = $env:PHANTOMFRAME_DIR if ($old -and (Test-Path (Join-Path $old 'gta6_framegen.py'))) { $exe = Join-Path $env:LOCALAPPDATA 'Programs\PhantomFrame\PhantomFrame.exe' Set-Content (Join-Path $old 'Launch.bat') "@echo off`r`nrem PhantomFrame is now a native app.`r`nstart `"`" `"$exe`"" -Encoding ASCII } Say "PhantomFrame $($rel.tag_name) installed. Open it from the Start menu." }