Files
riojoy/deploy/install-core.bat
T
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

69 lines
3.2 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 (bundled from Phase 8B onward).
if exist "%PKGROOT%vendor\xp\RioGamepadXP.inf" (
echo Installing the RioGamepadXP virtual joystick driver...
rundll32 setupapi.dll,InstallHinfSection DefaultInstall 132 %PKGROOT%vendor\xp\RioGamepadXP.inf
) else (
echo Note: RioGamepadXP driver not bundled yet - 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%