Files
riojoy/driver/uninstall.ps1
T
CydandClaude Opus 4.8 5dddbd2694 Phase 1 (3b): driver signing/install scripts + C# HID feeder sink
Make the virtual gamepad deployable on owned cabinets and wire the real
user-mode feeder:

- driver/sign.ps1 (non-admin): create a self-signed code-signing cert, build the
  catalog with inf2cat, and SHA-256-sign RioGamepad.sys + .cat (embed-sign the sys
  before cataloguing so the .cat matches). Exports RIOJoyTest.cer. Verified
  end-to-end against the EWDK (signability + catalog clean; both files signed).
- driver/install.ps1 (admin, two-phase): trust the cert (LocalMachine Root +
  TrustedPublisher), stage the package (pnputil /add-driver), enable test signing;
  after reboot, -CreateDevice runs devgen to create root\RioGamepad so PnP installs
  it. uninstall.ps1 reverses it.
- RioJoy.Core.Output.HidFeederJoystickSink: opens the driver by
  GUID_DEVINTERFACE_RIOGAMEPAD (SetupAPI), maintains a RioHidReport, and submits it
  via DeviceIoControl(IOCTL_RIO_SUBMIT_REPORT) on each axis/button/hat change.
  RioCoordinator now uses it when the driver is present and falls back to the no-op
  sink otherwise (status shows "[no joystick driver]").
- gitignore the signing outputs (driver/package/, *.cat); driver/README.md gets the
  full build → sign → install → joy.cpl workflow.

Remaining = the actual elevated install + reboot + joy.cpl verification on the
cabinet (admin steps), and on-hardware confirmation of the feeder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 21:17:04 -05:00

62 lines
2.1 KiB
PowerShell

<#
.SYNOPSIS
Remove the RioGamepad device and driver. REQUIRES AN ELEVATED shell.
.DESCRIPTION
Removes the device node, deletes the driver package from the store, and
(optionally) turns test signing back off and removes the trusted test cert.
.PARAMETER DisableTestSigning
Also run 'bcdedit /set testsigning off' (needs a reboot to take effect).
.PARAMETER RemoveCert
Also remove the RIOJoy test certificate from the machine trust stores.
#>
param(
[switch]$DisableTestSigning,
[switch]$RemoveCert
)
$ErrorActionPreference = "Continue"
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator)) {
throw "This script must be run from an elevated (Administrator) shell."
}
# 1. Remove the device instance(s) matching our hardware id.
Write-Host "Removing RioGamepad device node(s)..."
$instances = (pnputil /enum-devices /connected /class System) 2>$null
& pnputil /remove-device /deviceid "root\RioGamepad" 2>$null
# 2. Delete the driver package(s) from the store (oem*.inf published from RioGamepad.inf).
Write-Host "Locating staged driver package..."
$drivers = pnputil /enum-drivers
$published = $null
for ($i = 0; $i -lt $drivers.Count; $i++) {
if ($drivers[$i] -match 'Original Name:\s*RioGamepad\.inf') {
for ($j = $i; $j -ge 0; $j--) {
if ($drivers[$j] -match 'Published Name:\s*(oem\d+\.inf)') { $published = $Matches[1]; break }
}
}
}
if ($published) {
Write-Host "Deleting $published ..."
pnputil /delete-driver $published /uninstall /force
} else {
Write-Host "No staged RioGamepad driver package found."
}
if ($RemoveCert) {
Write-Host "Removing test certificate from trust stores..."
Get-ChildItem Cert:\LocalMachine\Root, Cert:\LocalMachine\TrustedPublisher |
Where-Object { $_.Subject -eq "CN=RIOJoy Test Cert" } |
ForEach-Object { Remove-Item $_.PSPath -Force }
}
if ($DisableTestSigning) {
Write-Host "Disabling test signing (reboot required)..."
bcdedit /set testsigning off | Out-Null
}
Write-Host "Done."