Files
riojoy/deploy/install-rio.ps1
CydandClaude Fable 5 2ecb617c09 Phase 8D: universal deployment package (XP + Win10/11, two entry points)
One RIOJoy-<ver>.zip now deploys on both OS generations (~75 MB with the
offline XP prerequisites):
- Layout: RIOJoy\app (net48 x64) + RIOJoy\app-xp (net40 x86) +
  RIOJoy\vendor (ViGEmBus; vendor\xp: .NET 4.0 offline installer +
  KB2468871, both signature-verified; RioGamepadXP driver slots in when
  8B lands - build warns/skips until then).
- RIOJoy\install-core.bat: shared OS-detecting install logic (ver ->
  5.1 = XP); pure cmd.exe on the XP path, delegates to install-rio.ps1
  on 10/11. Exports RIOJOY_APPDIR for shortcut creation.
- postinstall.bat (TeslaConsole, unattended): elevates, runs the core,
  then deletes install.bat + README.txt so C:\games stays clean.
- install.bat (standalone computers): same core + Start Menu/desktop
  shortcuts via make-shortcut.vbs (XP-safe); keeps the README.
- README.txt at the zip root explains which entry point to run.
- deploy *.ps1 re-encoded UTF-8-with-BOM: Windows PowerShell read the
  BOM-less files as ANSI, where an em-dash byte parses as a curly quote
  and breaks string parsing (bit install-rio.ps1 in dry-run testing).

Verified: zip layout correct; extracted package dispatch-tested on
Win10 non-elevated (OS detect -> modern route -> admin guard, system
untouched).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 20:53:43 -05:00

66 lines
2.8 KiB
PowerShell

<#
.SYNOPSIS
RIOJoy cockpit post-install. Installs the signed ViGEmBus virtual-controller
driver (if absent). Must run elevated (postinstall.bat elevates for you).
Idempotent — safe to re-run. RIOJoy is NOT registered to auto-start: the
TeslaConsole launcher owns the app's start/stop lifecycle.
.DESCRIPTION
Run from inside the deployed package directory (e.g. C:\games\RIOJOY). Paths
are resolved relative to this script, so the layout is:
<root>\app\RioJoy.Tray.exe the published tray app (net48)
<root>\vendor\ViGEmBus_*.exe the signed ViGEmBus installer
<root>\install-rio.ps1 (this file)
ViGEmBus is WHQL/attestation-signed: it installs with NO test signing, NO
Secure Boot change, and NO reboot. The RIO appears to games as a standard
Xbox 360 controller.
#>
$ErrorActionPreference = 'Stop'
$root = $PSScriptRoot
$appExe = Join-Path $root 'app\RioJoy.Tray.exe'
$vendorDir = Join-Path $root 'vendor'
# --- guards ---------------------------------------------------------------
$principal = [Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
throw 'install-rio.ps1 must run elevated. Run postinstall.bat (it elevates).'
}
if (-not (Test-Path $appExe)) { throw "App not found: $appExe (is the package complete?)." }
Write-Host '== RIOJoy post-install ==' -ForegroundColor Cyan
# 1. Install ViGEmBus if its driver service is not already present.
$svc = Get-Service -Name ViGEmBus -ErrorAction SilentlyContinue
if ($svc) {
Write-Host "ViGEmBus already installed (service is $($svc.Status))."
} else {
$installer = Get-ChildItem -Path $vendorDir -Filter 'ViGEmBus*.exe' -ErrorAction SilentlyContinue |
Select-Object -First 1
if ($installer) {
Write-Host "Installing ViGEmBus ($($installer.Name))..."
$p = Start-Process -FilePath $installer.FullName `
-ArgumentList '/install', '/quiet', '/norestart' -Wait -PassThru
if ($p.ExitCode -notin 0, 3010) {
throw "ViGEmBus install failed (exit code $($p.ExitCode))."
}
Write-Host 'ViGEmBus installed.'
} else {
Write-Warning "ViGEmBus installer not found in $vendorDir — joystick output will be"
Write-Warning "unavailable until ViGEmBus is installed (keyboard/mouse still work)."
}
}
# RIOJoy itself is deliberately NOT registered to auto-start and NOT launched
# here: the TeslaConsole launcher starts and stops the app.
# --- summary --------------------------------------------------------------
Write-Host ''
Write-Host "RIOJoy installed to $root" -ForegroundColor Green
Write-Host 'RIOJoy is not auto-started; the TeslaConsole launcher starts and stops it.'
exit 0