Files
TeslaSuite/Launcher/README.md
T
CydandClaude Fable 5 91640dcbf2 XP11: whole suite on net40 — Console + vPOD run on XP SP3 through Win11
The Launcher's XP11 port (8730b9b) now extends to everything: one net40
flavor across Console, vPOD, Contract, and SecureConfig (Newtonsoft.Json
everywhere; the net48/System.Text.Json legs and their #if splits are gone
since nothing consumed them).

Console (net40, single TFM like the Launcher):
- The ~31 BinaryFormatter bitmap blobs in the .resx files became raw
  embedded files under assets/icons/ (extracted byte-faithfully via a
  serialization surrogate — the animated square_throbber.gif survives),
  loaded by Properties.Resources.EmbeddedBitmap/EmbeddedIcon. Reason:
  System.Resources.Extensions' DeserializingResourceReader is net461+
  and cannot load on net40. Strings stay in the .resx.
- IReadOnlyList -> IList in AppRegistry (net45+ interface).

vPOD (net40, single TFM):
- Zip extraction now shares the Launcher's MiniZip.cs (linked source), so
  the diff-test install round-trip exercises it against ZipArchive zips.
- RPC args as JTokens; LaunchApps.json persistence via Newtonsoft;
  Thread.VolatileRead instead of Volatile.Read.

Contract/SecureConfig: net40-only; Client/** (PodManagerConnection) now
ships in the one build. The Launcher package gains
TeslaSecureConfiguration.dll as a dependency of the client half.

Tests: the net48 xunit host loads the net40 assemblies (both CLR4), so
the suite exercises exactly what ships — 106/106 green. Also verified
live: net40 console provisioned, managed, and ran a full RP mission
against net40 vPOD (beacon/passphrase/RSA, 53290 RPC, egg load,
Run/Stop Mission).

Version: 4.11.4.3 across Launcher, Console, and vPOD (vPOD joins the
suite version line; was 1.0.0). Ship the dotNetFx40 redistributable in
Launcher/assets for XP-era pods.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 21:01:34 -05:00

146 lines
6.4 KiB
Markdown

# 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`.