RIOJoy — cockpit deployment package
====================================

This package deploys RIOJoy to a single directory (e.g. C:\games\RIOJOY) and runs
all local installation steps from postinstall.bat. It uses the signed ViGEmBus
virtual-controller driver, so there is NO test signing, NO Secure Boot change, and
NO reboot.

Contents
--------
  postinstall.bat   Entry point (at the root). Elevates, then runs
                    RIOJoy\install-rio.ps1.
  RIOJoy\           The payload folder:
    app\            The RIOJoy tray application (.NET Framework 4.8, framework-
                    dependent). .NET Framework 4.8 is in-box on Windows 10/11, so
                    no runtime install is required on the target machine.
    vendor\         The signed ViGEmBus installer (Nefarius, WHQL/attestation-signed).
    install-rio.ps1 The actual install steps (idempotent).
    pre-uninstall.bat  Cleanup entry point. Elevates, then runs uninstall-rio.ps1.
                    Run this before deleting the RIOJoy folder.
    uninstall-rio.ps1  The actual cleanup steps (idempotent).
    VERSION.txt     Build stamp (date + git short SHA).

What postinstall.bat does
-------------------------
  1. Elevates to administrator (UAC) if not already elevated.
  2. Installs ViGEmBus silently if its driver service is not already present.

  RIOJoy is NOT registered to auto-start and is NOT launched by the installer —
  the TeslaConsole launcher starts and stops the app.

Deploying with TeslaConsole
---------------------------
  1. Extract this zip so that postinstall.bat and the RIOJoy\ folder sit together
     (e.g. under C:\games\, giving C:\games\postinstall.bat and C:\games\RIOJoy\).
  2. Run postinstall.bat ELEVATED (TeslaConsole should run it as administrator).
     It is idempotent — re-running it is safe (e.g. for updates). The app and
     ViGEmBus install from the RIOJoy\ folder; install-rio.ps1 locates itself, so
     the RIOJoy\ folder can live wherever it is extracted.

Uninstalling with TeslaConsole
------------------------------
  Before deleting the RIOJoy folder, run RIOJoy\pre-uninstall.bat ELEVATED. It
  stops the tray app (releasing file locks), removes any leftover logon entry
  (from older builds that auto-started), uninstalls
  ViGEmBus, and clears per-user config (%APPDATA%\RIOJoy) for every profile. It is
  idempotent and non-fatal — safe even if RIOJoy was never fully installed. The
  console can then delete the folder cleanly. Use -KeepDriver to leave ViGEmBus in
  place, or -KeepConfig to leave per-user config.

After install
-------------
  * RIOJoy is started and stopped by the TeslaConsole launcher (it is not
    registered to auto-start at logon).
  * When running, RIOJoy lives in the system tray. Right-click it to pick/edit
    profiles, set the auto-switch executables, and toggle output to the PC.
  * The RIO's joystick output appears to games as a standard "Xbox 360 Controller"
    (verify in joy.cpl). Note the XInput layout limits joystick BUTTONS to 11
    (A, B, X, Y, LB, RB, Back, Start, L3, R3, Guide); bind everything else to the
    keyboard. The hat maps to the D-pad; axes map to the sticks and triggers.
  * Per-machine config lives in %APPDATA%\RIOJoy\config.json for the running user.

Building this package (on a dev machine)
-----------------------------------------
  Requires the .NET SDK (8.0+) with the .NET Framework 4.8 targeting/developer
  pack, and the signed ViGEmBus installer.

    powershell -ExecutionPolicy Bypass -File deploy\build-package.ps1 `
        -VigemInstaller <path-to-ViGEmBus_x.y.z_x64_x86_arm64.exe>

  (Or drop ViGEmBus_*.exe into deploy\vendor\ and omit -VigemInstaller.)
  Output: dist\RIOJoy-<version>.zip
