Files
TeslaSuite/Console/README.md
T
CydandClaude Opus 5 2a5a387381 Console: remember Enable Custom Bitmaps, ship the art; bump suite to 4.11.4.5
Settings -> Enable Custom Bitmaps was a static bool with no backing store:
it defaulted to off on every launch, so an operator had to re-tick it each
session and any custom plasma art was silently ignored until they did. New
ConsoleSettings persists machine-level menu toggles as XML in
%ProgramData%\Tesla Console\console.settings, alongside RPDefaults.rpd /
BTDefaults.btd / local.siteconfig. It is loaded once from Main and never
from a static initializer: the differential suite drives PlasmaBitmaps
directly and must keep seeing the original defaults rather than whatever
this machine has saved. A missing file is the first-run case; a corrupt one
is ignored and rewritten by the next toggle, because losing a menu setting
must never stop the console starting.

Custom art is now version-controlled and rolls with the release. New
Console\Plasma Images\ is copied into the package, and the lookup searches
%ProgramData%\Tesla Console\Plasma Images first and the exe-relative folder
second, so a release can never clobber a site's own name bitmaps.
install.bat creates the data-dir folder before the icacls grant so an
unelevated operator can write it. Ships with three 128x32 name bitmaps
(Deadmeat, Muerte, Phrogg); Muerte arrived as "Muerte_128x32-2.bmp", a name
the lookup can never build, so it is renamed to match its pilot.

Two fixes fell out of making the flag sticky. Path.Combine ran on the raw
participant name outside the try block, so with the option on a pilot named
"A:B" threw ArgumentException straight out of egg generation; names that
cannot be a Windows file name now just render procedurally. And the art was
loaded with Image.FromFile, which keeps the bitmap backed by the file and
locked for its whole lifetime — it is copied out through a stream now, so
art can be swapped between missions without restarting the console.

Verified against the built net40 exe: all three shipped bitmaps resolve by
pilot name, ProgramData wins over the shipped copy, a wrong-size file is
ignored, an illegal-character name does not throw, the file is not left
locked, and the settings round-trip and corrupt-file tolerance both hold.
Diff suite 106/106.

Version bumped 4.11.4.4 -> 4.11.4.5 across Console, Launcher, vPOD, the
install/build banners, the diff-suite version assertion and the README's
latest-release pointer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-28 13:16:11 -05:00

125 lines
6.2 KiB
Markdown

# TeslaConsole
Reconstructed C# source for the original **TeslaConsole.exe** — the operator
console that drives the cockpit pods (the counterpart to `TeslaLauncherService`
/ `TeslaLauncherAgent`).
## Provenance
This source was recovered by decompiling the original managed assembly with
[ILSpy](https://github.com/icsharpcode/ILSpy) (`ilspycmd` 7.2). The original
`TeslaConsole.exe` is a **.NET Framework 2.0** WinForms application
(`assets/Tesla Console/TeslaConsole.exe`, dated 2012). The reconstructed project
here is retargeted to **.NET Framework 4.8** so it builds with current tooling;
it is otherwise a faithful decompilation, not a rewrite.
> Decompiled code is functionally equivalent to the original but not
> character-for-character identical to the lost sources. Local variable names,
> some control flow, and compiler-generated members differ. Treat this as a
> recovered baseline, not pristine source.
## Dependencies
The console references these assemblies. Most are vendored as binaries under
`lib/` (copied from `assets/Tesla Console/`):
| Assembly | Origin |
|----------|--------|
| `WeifenLuo.WinFormsUI.Docking.dll` | Third-party docking UI (open source, see `assets/Tesla Console/WeifenLuo.txt`) |
| `TeslaConsoleLaunchLib.dll` | Wire types / launch protocol — **now built from source** (see below) |
| `TeslaSecureConfiguration.dll` | First-boot secure config protocol — **now built from source** (see below) |
| `Munga Net.dll` | Managed C# client for the Red Planet game's Munga protocol (TCP 1501); manual binary serialization, no BinaryFormatter (proprietary, vendored) |
| `BitmapLibrary.dll` | Plasma-display bitmap rendering (proprietary, vendored) |
> The Red Planet game itself is C++ and lives in its own repo (`c:\vwe\rp411` /
> `gitea.mysticmachines.com/VWE/RP411.git`). That source defines the Munga protocol
> but is **not** a drop-in for the managed `Munga Net.dll` above, so it is not
> vendored here.
Two of these are no longer vendored binaries — they are built from source and
shared across the suite:
- `TeslaConsoleLaunchLib``../Contract/Tesla.Contract.csproj` (net40, like the
whole suite since XP11): the single source of truth for the
Console↔Launcher RPC contract (wire types, the
`PodManagerConnection` client, and the framed-JSON `PodRpc` protocol), shared with the
Launcher. The assembly keeps the
`TeslaConsoleLaunchLib` name so the original-exe baseline still resolves in the
differential tests; the wire no longer embeds assembly names (see RPC note below).
- `TeslaSecureConfiguration``../SecureConfig/Tesla.SecureConfig.csproj` (net40),
the first-boot provisioning protocol (UDP beacons, OFB crypto, RSA key exchange).
The original `TeslaSecureConfiguration.dll` is retained under `lib/` as the baseline
for the byte-identical crypto guard (`SecureConfigCompatTests`). The remaining
vendored assemblies (`Munga Net`, `BitmapLibrary`) are .NET 2.0 managed and could be
decompiled to source the same way if full-source builds are needed.
### Console ↔ Launcher RPC (no BinaryFormatter)
The pod-management channel (TCP 53290) runs **length-prefixed JSON**
frames over the existing OFB-encrypted stream — see `Contract/PodRpcProtocol.cs`,
shared verbatim by both ends (Newtonsoft.Json — net40 has no System.Text.Json).
This replaced the original `BinaryFormatter` +
serialized-`MethodBase` scheme (a remote-code-execution sink, and what had pinned the
Launcher to an old runtime); dispatch is now by method-name string. The Launcher and
the Console both target **net40** (XP11: XP SP3 through Windows 11). Note the Console
still uses `BinaryFormatter` for *local* disk persistence (`Site` config, mission
results) — that is local file I/O, not the network surface, and is intentionally
left alone.
## Layout
This folder is **self-contained** — it can be lifted out into its own repository
and still build and run.
```
TeslaConsole/
*.cs, TeslaConsole.*/ decompiled source (by namespace)
*.resx, app.ico string resources + icon
assets/icons/ UI images (raw originals, embedded as manifest resources —
the resx BinaryFormatter blobs cannot build for net40)
TeslaConsole.csproj net40 project (XP11: runs on XP SP3 through Windows 11)
RedPlanet/ runtime content (RPConfig.xml, RPStrings.xml) — copied to output
images/ source art (pod art / maps / vehicles) — reference only
installer_banner.bmp installer artwork — reference only
lib/ referenced binaries + WeifenLuo license
original/ original TeslaConsole.exe + .InstallState — reference baseline
```
## Building
Requirements: .NET SDK (6.0+) — the `Microsoft.NETFramework.ReferenceAssemblies`
NuGet package supplies the net40 reference assemblies, so a standalone Framework
targeting pack is **not** required.
```
dotnet build TeslaConsole.csproj -c Release
```
Output: `bin/Release/net40/TeslaConsole.exe` (with `RedPlanet/` and all
dependency DLLs copied alongside it).
## Runtime content
- `RedPlanet\RPConfig.xml`, `RedPlanet\RPStrings.xml` are loaded relative to the
exe and are copied to the build output automatically.
- `Plasma Images\*.bmp` is an **optional** override set for the pod plasma name
displays, enabled by *Settings → Enable Custom Bitmaps*. The console looks in
`%ProgramData%\Tesla Console\Plasma Images` (the machine's own art, wins) and
then in `Plasma Images\` next to the exe (the set that ships with the release —
see [`Plasma Images/README.md`](Plasma%20Images/README.md) for naming and sizes).
When neither has a match the console renders the text procedurally, so no art is
required to build or run.
- Machine-level Settings-menu toggles persist in
`%ProgramData%\Tesla Console\console.settings` (XML, written on change by
`ConsoleSettings`). Deleting it just restores the defaults.
## Notes
- The `.resx` resources embed BinaryFormatter-serialized bitmaps. The project
sets `GenerateResourceUsePreserializedResources` and references
`System.Resources.Extensions` so these build under the modern SDK.
- Namespaces: `TeslaConsole` (UI + pod management), `TeslaConsole.RedPlanet`
(the Red Planet game scenario/mission model), `TeslaConsole.Properties`
(settings + resources).