Files
TeslaSuite/Launcher
CydandClaude Fable 5 6973e7d60c Launcher: kill whole process tree on stop; fix Win10 install.bat icacls
Two field issues from the live rollout, both launcher-side.

1) Console "Stop" did nothing. Every Tesla game runs under a supervisor
   that stays alive and respawns the game (Firestorm -> launcher.exe,
   Red Planet -> a looping .bat under cmd.exe, tesla410revival ->
   pod-launch.exe -> dosbox). net40's Process.Kill() terminates only the
   tracked supervisor PID, so the game survived (and the supervisor/loop
   relaunched it). New KillProcessTree uses `taskkill /PID <pid> /T /F`
   (whole tree; XP Pro + Win10/11), Process.Kill() as fallback. All three
   kill paths (KillApp/KillAllOfType/KillAllApps) now untrack under the
   lock and tree-kill outside it, so the RPC lock isn't held across
   taskkill and our auto-restart watcher won't relaunch. Proven against a
   real supervisor->child: old Kill orphaned the child; tree-kill takes both.

2) install.bat threw "(CI)M was unexpected at this time" at [1/7] on
   Windows 10. The icacls `/grant *S-1-5-32-545:(OI)(CI)M` sat inside an
   `else ( ... )` block; cmd read the literal ) in (OI)(CI) as the block
   end. XP was fine (its branch uses cacls, no parens). Quote the grant
   token at all three icacls sites; move the explanatory notes above the
   blocks (a stray ) even in a rem inside ( ) is the same trap). Verified
   on Win11: as-shipped reproduces the error, fixed form parses (rc=0) and
   applies the identical ACE.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 20:38:36 -05:00
..

TeslaLauncher (XP11 — single binary)

.NET Framework 4.0 (framework-dependent) rewrite of the original Elsewhen Studios LLC software. One TeslaLauncher.exe runs on Windows XP SP3 through Windows 11: net40 is the newest framework XP can install, and net40 assemblies load in-place on the 4.8 runtime built into Windows 10/11. XP pods need the .NET 4.0 redistributable (installed automatically by install.bat when dotnet40\ is in the package); Win10/11 pods need nothing extra.

Architecture

One userland tray application — no Windows Service, no IPC.

The original Elsewhen software was a single service (on Win2k/XP a service could still touch the desktop). The modern rewrite split it into Service + Agent purely to work around Vista+ Session 0 isolation. XP11 closes the loop: everything runs in the auto-logged-in kiosk session, where the desktop, audio, and game processes live anyway.

TeslaLauncher (WinForms tray app, user session)

  • Listens on TCP 53290 for OFB-encrypted framed-JSON RPC from TeslaConsole
  • Handles first-boot network configuration (SecureConfig) and shows the Request ID / Passphrase on screen + COM2 plasma
  • Handles game file transfers from the Console (InstallProduct → C:\Games, postinstall.bat, pre-uninstall.bat on uninstall)
  • Launches/kills/watches simulation apps, controls volume, manages LaunchApps.xml
  • Registers with WER for restart-after-crash (Vista+; no-op on XP)

Requires the kiosk account (Firestorm) to be in Administrators — SecureConfig's netsh/hostname writes and product postinstall.bat driver installs need the admin token (UAC is disabled by the installer on modern Windows, so no prompts).

SecureConfig (first-boot protocol)

  • Assigns a temporary IP and broadcasts a UDP beacon so the Console can discover the pod
  • Operator reads the Passphrase off the pod screen and enters it into the Console
  • Console sends AES-encrypted network configuration (IP, mask, gateway, DNS, hostname)
  • TCP handshake establishes an OFB-encrypted session with RSA key exchange
  • Session key is saved for all subsequent Console connections

Uses the old-style netsh interface ip commands throughout — they update the live TCP/IP stack immediately and are the only form XP understands.

Communication Flow

TeslaConsole ──TCP 53290 (OFB + framed JSON)──> TeslaLauncher.exe (user session)

Files

File Description
TeslaLauncher.cs The whole launcher: tray, TCP listener, RPC dispatch, install, processes, volume
TeslaLauncher.csproj net40 WinForms exe project
MiniZip.cs Central-directory ZIP extractor (net40 has no ZipFile; stored + deflate + ZIP64)
SecureConfig.cs First-boot secure configuration protocol + OFB duplex stream
build.bat Builds + assembles the package
install.bat Dual-OS installer (XP SP3 and Win10/11 code paths; run as Administrator)

Building

Requirements:

  • .NET SDK (6.0+) to drive the build
  • Internet access for NuGet restore (first build only)
build.bat              :: build + assemble the package

Output goes to dist\TeslaLauncher\ (with App\ plus install.bat and redist folders) and dist\TeslaLauncher-podpkg.zip. The project is published in place (framework-dependent net40) — it references ../Contract, so it cannot be staged into a temp folder. App\ holds the exe plus Newtonsoft.Json.dll and TeslaConsoleLaunchLib.dll (the net40 leg of the shared contract).

Bench-testing switches

TeslaLauncher.exe /skipconfig      :: skip the DHCP SecureConfig gate
TeslaLauncher.exe /port:53291      :: listen on a non-standard port

Installation

  1. Copy the TeslaLauncher\ folder to each cockpit PC (XP SP3 or Win10/11)
  2. Run TeslaLauncher\install.bat as Administrator

The installer detects the OS and branches where the tooling differs:

Step XP SP3 Windows 10/11
.NET installs 4.0 redist from dotnet40\ if missing 4.8 built in — nothing
ACLs cacls icacls
Firewall off netsh firewall netsh advfirewall
SMB1 / DirectPlay native — skipped dism /Enable-Feature
DHCP reset netsh interface ip set address ... dhcp PowerShell Set-NetIPInterface
Notifications / UAC n/a policy keys + EnableLUA=0
UltraVNC UltraVNC_x86_Setup.exe (if bundled) UltraVNC_x64_Setup.exe

Common to both: auto-login (Firestorm), HKLM Run key for the launcher (no service registration), C:\Games + data dir creation, shares, workgroup, power settings, reboot.

First Boot

  1. Cockpit boots with DHCP (unconfigured state), auto-logs into the kiosk account
  2. Launcher runs SecureConfig: broadcasts beacon, displays codes on screen + plasma
  3. Console operator sees the pod's Request ID and enters the Passphrase
  4. Console sends encrypted network configuration
  5. Pod applies the configuration and is ready for normal operation

Normal Operation

The Console connects to each configured pod on TCP 53290 and can:

  • Install/uninstall simulation games
  • Launch/kill applications
  • Get/set volume level
  • Query pod status (FullUpdate)
  • Shutdown or reboot the pod

Key Paths

<CommonAppData> is C:\ProgramData on Vista+, and C:\Documents and Settings\All Users\Application Data on XP — the launcher and installer both resolve it per-OS; nothing hardcodes C:\ProgramData anymore.

Path Purpose
<CommonAppData>\TeslaLauncher\TeslaKeyStore.key Session key (32 bytes)
<CommonAppData>\TeslaLauncher\LaunchApps.xml Installed games registry (same XML shape as the two-process Agent wrote)
<CommonAppData>\TeslaLauncher\podconf.log Launcher log (was next to the exe pre-XP11)
<CommonAppData>\TeslaLauncher\configuring.json Transient: SecureConfig codes (kept for external diagnostics)
C:\Games\ Game installation directory

Wire Protocol

The Console talks to the launcher with length-prefixed JSON frames over the OFB-encrypted TCP stream (dispatch by method name) — see ../Contract/PodRpcProtocol.cs, shared by both ends. Since the whole suite went net40 (XP11), both ends serialize with Newtonsoft.Json and the Contract is net40-only (its former net48/System.Text.Json leg wrote shape-identical JSON and was dropped once the Console moved to net40). The request reader keeps date strings raw so a Ping echo returns byte-identical.

Volume on XP falls back from CoreAudio (Vista+) to nircmd.exe / winmm waveOutSetVolume.