Files
riojoy/deploy/install-core.bat
T
CydandClaude Fable 5 52712f8409 Phase 8B: RioGamepadXP.sys — WDM HID minidriver for Windows XP
The XP flavor of our own virtual joystick (no third-party driver), built
with WDK 7.1.0 to x86/subsystem-5.01. Exposes the identical Public.h
contract as the modern KMDF+VHF driver — same GUID, IOCTL_RIO_SUBMIT_REPORT,
25-byte report, VID/PID — so HidFeederJoystickSink drives both.

Design (driver/RioGamepadXP/rioxp.c):
- WDM HID minidriver via HidRegisterMinidriver presenting the 6-axis/hat/
  96-button joystick. POLLED mode (DevicesArePolled=TRUE): hidclass paces
  IOCTL_HID_READ_REPORT and we complete each synchronously from a cached
  report — no pending-IRP or cancel-routine machinery (the usual crash
  surface in a virtual HID driver).
- Named sideband control device (\Device\RioGamepadXP + \DosDevices symlink)
  takes IOCTL_RIO_SUBMIT_REPORT and updates the cache under a spinlock.
- hidclass overwrites our CREATE/CLOSE/DEVICE_CONTROL during registration;
  we save its pointers and reinstall wrappers that route the control device's
  IRPs to us and forward the HID FDO's to hidclass.

Packaging/install:
- Root-enumerated, so install uses devcon (built from the same WDK) —
  InstallHinfSection can't create the devnode. install-core.bat runs
  "devcon install RioGamepadXP.inf root\RioGamepadXP"; unsigned is fine
  (XP x86 enforces no kernel signing). Bundled into vendor\xp\.
- net40 feeder opens the driver by name (\.\RioGamepadXP); XP can't put a
  device interface on a bare control device (no PDO) — the one nuance.

Static build only: compiles clean but runtime bring-up (joy.cpl enumeration,
report flow) needs a real XP target — that's 8E. 275 tests still green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 14:01:16 -05:00

76 lines
3.5 KiB
Batchfile

@echo off
rem ===========================================================================
rem RIOJoy shared install core - called by postinstall.bat (cabinet /
rem TeslaConsole) and install.bat (freestanding). NOT run directly.
rem Detects the OS and installs the matching flavor's prerequisites:
rem Windows XP (5.1) -> .NET 4.0 + KB2468871 from RIOJoy\vendor\xp,
rem RioGamepadXP driver INF when bundled;
rem app = RIOJoy\app-xp (net40 x86)
rem Windows 10/11 -> RIOJoy\install-rio.ps1 (ViGEmBus etc.);
rem app = RIOJoy\app (net48 x64)
rem Pure cmd.exe on the XP path (XP has no in-box PowerShell). Idempotent.
rem Sets RIOJOY_APPDIR for the caller (shortcut creation).
rem ===========================================================================
setlocal EnableExtensions
set CORE_RC=0
set PKGROOT=%~dp0
rem PKGROOT = ...\RIOJoy\ (this file lives inside the payload folder)
ver | findstr /C:"Version 5.1" >nul
if %errorlevel% equ 0 goto xp
rem --- Windows 10/11 ---------------------------------------------------------
echo Detected modern Windows - installing the net48 x64 flavor prerequisites.
powershell -NoProfile -ExecutionPolicy Bypass -File "%PKGROOT%install-rio.ps1"
set CORE_RC=%errorlevel%
endlocal & set "RIOJOY_APPDIR=%~dp0app" & exit /b %CORE_RC%
:xp
rem --- Windows XP SP3 ---------------------------------------------------------
echo Detected Windows XP - installing the net40 x86 flavor prerequisites.
rem .NET Framework 4.0 (XP's ceiling; required by the app).
reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v Install 2>nul | findstr /C:"0x1" >nul
if %errorlevel% equ 0 (
echo .NET Framework 4.0 already installed.
) else (
if exist "%PKGROOT%vendor\xp\dotNetFx40_Full_x86_x64.exe" (
echo Installing .NET Framework 4.0 - this takes several minutes...
"%PKGROOT%vendor\xp\dotNetFx40_Full_x86_x64.exe" /q /norestart
if errorlevel 3011 echo .NET install requests a reboot - reboot before first use.
) else (
echo ERROR: vendor\xp\dotNetFx40_Full_x86_x64.exe is missing from the package.
set CORE_RC=1
goto xpdone
)
)
rem KB2468871 - required by the async runtime (Microsoft.Bcl.Async).
rem The update no-ops quickly when already applied, so run unconditionally.
if exist "%PKGROOT%vendor\xp\NDP40-KB2468871-v2-x86.exe" (
echo Applying .NET 4.0 update KB2468871...
"%PKGROOT%vendor\xp\NDP40-KB2468871-v2-x86.exe" /q /norestart
) else (
echo WARNING: vendor\xp\NDP40-KB2468871-v2-x86.exe not bundled - the app
echo will not run without KB2468871. Install it before first use.
)
rem RioGamepadXP virtual-joystick driver. Root-enumerated, so it must be
rem created with devcon (rundll32/InstallHinfSection would not make the
rem devnode). devcon is idempotent: re-running "install" updates in place.
if exist "%PKGROOT%vendor\xp\RioGamepadXP.inf" (
if exist "%PKGROOT%vendor\xp\devcon.exe" (
echo Installing the RioGamepadXP virtual joystick driver...
"%PKGROOT%vendor\xp\devcon.exe" install "%PKGROOT%vendor\xp\RioGamepadXP.inf" root\RioGamepadXP
if errorlevel 1 echo WARNING: driver install returned an error - check Device Manager.
) else (
echo WARNING: vendor\xp\devcon.exe missing - cannot create the driver devnode.
)
) else (
echo Note: RioGamepadXP driver not bundled - joystick output is
echo unavailable on XP; keyboard/mouse, lamps and plasma still work.
)
:xpdone
endlocal & set "RIOJOY_APPDIR=%~dp0app-xp" & exit /b %CORE_RC%