RACEVISOR SESSION LAUNCHERS
===========================

One double-click starts everything a sim-racing session needs, in the order that works:

    wheel software -> OpenKneeboard -> RaceVisor -> the sim -> OBS (last)

None of those is required. You do not need RaceVisor, a kneeboard or OBS to use the
launchers: whatever is not installed is skipped.

These are plain text scripts. Open any of them in Notepad to see exactly what it does
before you run it. They are starting points: every rig is different, so expect to edit
a path or two. Nothing here installs anything or changes a setting you cannot change back.

Windows 10 / 11 only.


WHAT IS IN THE FOLDER
---------------------

  Start_iRacing.bat    double-click launchers, one per sim
  Start_AC.bat           (Assetto Corsa)
  Start_ACC.bat          (Assetto Corsa Competizione)
  Start_AMS2.bat         (Automobilista 2)
  Start_RF2.bat          (rFactor 2)

  Start_Sim.ps1        the script that does the work; the .bat files just call it
  Set_XR_Runtime.ps1   show or change the active OpenXR runtime (Meta / Virtual Desktop / SteamVR)
  Stop_SteamVR.bat     double-click: stop SteamVR and go back to the Meta runtime
  Stop_SteamVR.ps1     the script behind Stop_SteamVR.bat

Keep all the files together in ONE folder. The .bat files look for the .ps1 files next
to themselves.


QUICK START
-----------

  1. Unzip the folder anywhere, for example Documents\RaceVisor-Launchers.
  2. (Optional) If you use RaceVisor, put RaceVisor.exe in the same folder or set its path
     in step 3. The launchers work without it - it is simply skipped.
  3. Open Start_Sim.ps1 in Notepad and look at the block marked CONFIGURE HERE:
       $StartRaceVisor $true / $false. RaceVisor is optional.
       $RaceVisorExe   where RaceVisor.exe is ('' = look in the usual places)
       $ObsExe         where obs64.exe is     ('' = find it automatically)
       $PreSimApps     the apps started before the sim. Delete the lines you do not
                       use, add your own wheel software, keep the order.
  4. Double-click the .bat for your sim.
  5. Read what it prints. Each line starts with one of:
       [run ]  started it
       [skip]  already running, or not installed
       [ ok ]  already the way it needs to be
       [warn]  did not do something on purpose - the line says why
       [MISS]  something it needs was not found - the line says what

If Windows shows "Windows protected your PC" the first time, that is SmartScreen
reacting to a downloaded script. Right-click the .zip BEFORE unzipping -> Properties ->
tick Unblock -> OK, then unzip again.


FLAGS AND SWITCHES
------------------

Add these after the .bat name in a shortcut or a command prompt, for example:

    Start_iRacing.bat -NoFilm

Start_<sim>.bat / Start_Sim.ps1

  -Sim <name>      which sim: iRacing, AC, ACC, AMS2 or RF2. The .bat files fill this
                   in for you. Required when you run Start_Sim.ps1 directly.
  -NoFilm          plain race. Does NOT switch the OpenXR runtime to SteamVR and does
                   NOT start OBS. Most people want this for everyday driving.
  -NoObs           do the VR/runtime side but leave OBS alone.
  -Force           start everything even if it looks like it is already running.
  -SimWaitSec <n>  how many seconds to wait for the sim to start rendering before
                   giving up on OBS. Default 600 (ten minutes).

  With no flags the launcher is in "film mode": it switches the OpenXR runtime to
  SteamVR (one administrator prompt), starts SteamVR, and starts OBS once you are in
  the car. To make plain racing the default, edit the .bat and add -NoFilm after
  "-Sim <name>" on both lines.

Set_XR_Runtime.ps1

  (no flag)        show which OpenXR runtime is active, change nothing
  -Meta            Meta Quest over the Link cable or Air Link
  -VD              Virtual Desktop (wireless)
  -Steam           SteamVR

  Pick one flag only. Asks for administrator permission. Refuses while a sim is running.

Stop_SteamVR.bat / Stop_SteamVR.ps1

  (no flag)        stop SteamVR and set the OpenXR runtime back to Meta
  -CloseSteam      also close the Steam client
  -KeepRuntime     stop SteamVR but leave the OpenXR runtime alone. Use this if SteamVR
                   is your normal runtime (Index, Vive, Pimax and so on).


RUNNING A .ps1 DIRECTLY
-----------------------

The .bat files handle this for you. To run a .ps1 yourself, open PowerShell in the
folder and use:

    powershell -NoProfile -ExecutionPolicy Bypass -File .\Set_XR_Runtime.ps1

"-ExecutionPolicy Bypass" applies to that one run only. It does not change your system.


CHANGING THINGS
---------------

Different wheel:    edit $PreSimApps in Start_Sim.ps1. Replace the Logitech G HUB line
                    with your wheel software, or delete it if your wheel needs none.
No kneeboard:       delete the OpenKneeboard line from $PreSimApps.
Another sim:        copy one block inside "$sims = @{ ... }" in Start_Sim.ps1, give it a
                    new name, set its Steam app id (or Launch path) and the name of the
                    process that runs while you are driving. Add the name to the
                    ValidateSet list near the top, then copy a .bat and change -Sim.
Not sure of a process name: start the program, open Task Manager -> Details, and use
                    the name in the first column without ".exe".

The web page that goes with these scripts has a generator that writes a script for
your hardware: pick your sim, headset, wheel and extras, and download the result.


IF SOMETHING GOES WRONG
-----------------------

The window flashes and closes
    Open a Command Prompt in the folder and run the .bat from there so the text stays
    on screen.

Red text about "parse errors" or unexpected tokens
    The .ps1 was edited with curly quotes or other special characters. Use straight
    quotes only, and save as plain text.

The sim opens flat on the monitor instead of in the headset
    The active OpenXR runtime does not match how the headset is connected.
    Run Set_XR_Runtime.ps1 with no flags to see it, then -Meta, -VD or -Steam.

The sim sits at "loading" forever in VR
    The OpenXR runtime is SteamVR but SteamVR is not running. Start SteamVR first, or
    switch the runtime back with Set_XR_Runtime.ps1 -Meta.

The overlay does not show over the sim
    The sim is in exclusive fullscreen. Use Windowed or Borderless.

[skip] RaceVisor not found
    Not an error - RaceVisor is optional. To use it, set $RaceVisorExe at the top of
    Start_Sim.ps1 to the full path of RaceVisor.exe.


These scripts are provided as-is, free to copy and adapt. Use at your own risk.
