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>
69 lines
2.7 KiB
PowerShell
69 lines
2.7 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Trust the test cert, enable test signing, stage and install the RioGamepad
|
|
driver. REQUIRES AN ELEVATED (admin) shell.
|
|
|
|
.DESCRIPTION
|
|
Two phases, because enabling test signing needs a reboot:
|
|
|
|
install.ps1 (phase 1, pre-reboot)
|
|
- import RIOJoyTest.cer into LocalMachine Root + TrustedPublisher
|
|
- stage the signed package into the driver store (pnputil /add-driver)
|
|
- bcdedit /set testsigning on
|
|
- THEN REBOOT
|
|
|
|
install.ps1 -CreateDevice (phase 2, after the reboot)
|
|
- create the root-enumerated device with devgen, which makes PnP install
|
|
the staged driver. Then check joy.cpl.
|
|
|
|
Run driver\sign.ps1 first to produce the signed package + RIOJoyTest.cer.
|
|
|
|
.PARAMETER Ewdk
|
|
Drive or root where the EWDK is mounted (default: E:).
|
|
.PARAMETER CreateDevice
|
|
Run phase 2 (create the device); use after the reboot.
|
|
#>
|
|
param(
|
|
[string]$Ewdk = "E:",
|
|
[switch]$CreateDevice
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$scriptDir = $PSScriptRoot
|
|
$pkg = Join-Path $scriptDir "package"
|
|
$inf = Join-Path $pkg "RioGamepad.inf"
|
|
$cer = Join-Path $scriptDir "RIOJoyTest.cer"
|
|
$devgen = Join-Path $Ewdk "Program Files\Windows Kits\10\Tools\10.0.28000.0\x64\devgen.exe"
|
|
$hardwareId = "root\RioGamepad"
|
|
|
|
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."
|
|
}
|
|
|
|
if ($CreateDevice) {
|
|
if (-not (Test-Path $devgen)) { throw "devgen not found: $devgen" }
|
|
Write-Host "Creating device node ($hardwareId)..."
|
|
& $devgen /add /instanceid "RIOJOY01" /hardwareid $hardwareId
|
|
Write-Host ""
|
|
Write-Host "Done. Open 'joy.cpl' and look for 'RIOJoy Virtual Gamepad'." -ForegroundColor Green
|
|
Write-Host "If it shows a problem, check Device Manager and 'pnputil /enum-drivers'."
|
|
return
|
|
}
|
|
|
|
if (-not (Test-Path $inf)) { throw "Signed package not found ($inf). Run driver\sign.ps1 first." }
|
|
if (-not (Test-Path $cer)) { throw "Certificate not found ($cer). Run driver\sign.ps1 first." }
|
|
|
|
Write-Host "Trusting test certificate (LocalMachine Root + TrustedPublisher)..."
|
|
Import-Certificate -FilePath $cer -CertStoreLocation Cert:\LocalMachine\Root | Out-Null
|
|
Import-Certificate -FilePath $cer -CertStoreLocation Cert:\LocalMachine\TrustedPublisher | Out-Null
|
|
|
|
Write-Host "Staging driver into the driver store..."
|
|
pnputil /add-driver $inf
|
|
|
|
Write-Host "Enabling test signing..."
|
|
bcdedit /set testsigning on | Out-Null
|
|
|
|
Write-Host ""
|
|
Write-Host "Phase 1 complete. REBOOT, then run: install.ps1 -CreateDevice" -ForegroundColor Yellow
|