Files
TeslaSuite/Console/install.bat
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

101 lines
4.4 KiB
Batchfile

@echo off
:: =============================================================================
:: TeslaConsole - Installation Script
:: =============================================================================
:: Installs the operator console on a control PC. Run as Administrator.
:: Must be run from the package folder produced by build-package.bat:
::
:: TeslaConsole\
:: install.bat <- this file
:: App\
:: TeslaConsole.exe + dependencies + RedPlanet\ (content)
::
:: The console is .NET Framework 4.8 (framework-dependent) — net48 is in-box on
:: Windows 10/11, so there is no runtime to install.
:: =============================================================================
setlocal
echo ============================================================
echo TeslaConsole - Installation
echo ============================================================
echo.
set ROOT=%~dp0
set APP_SRC=%ROOT%App
set INSTALL_DIR=C:\Program Files\TeslaConsole
set EXE=%INSTALL_DIR%\TeslaConsole.exe
set DATA_DIR=%ProgramData%\Tesla Console
:: -- Admin check --------------------------------------------------------------
net session >nul 2>&1
if %errorlevel% neq 0 (
echo ERROR: This script must be run as Administrator.
pause & exit /b 1
)
:: -- Verify source ------------------------------------------------------------
if not exist "%APP_SRC%\TeslaConsole.exe" (
echo ERROR: TeslaConsole.exe not found in %APP_SRC%
echo Run build-package.bat first, then run install.bat from the package folder.
pause & exit /b 1
)
:: -- .NET Framework 4.8 check (informational; 528040 = 4.8) --------------------
set NETREL=0
for /f "tokens=3" %%v in ('reg query "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" /v Release 2^>nul') do set NETREL=%%v
if %NETREL% LSS 528040 (
echo WARNING: .NET Framework 4.8 was not detected ^(Release=%NETREL%^).
echo It ships in-box with Windows 10/11; install it if the console fails to start.
echo.
)
:: -- STEP 1: Copy files -------------------------------------------------------
echo [1/4] Installing to %INSTALL_DIR% ...
taskkill /F /IM TeslaConsole.exe >nul 2>&1
if not exist "%INSTALL_DIR%" mkdir "%INSTALL_DIR%"
xcopy /E /I /Y /Q "%APP_SRC%\*" "%INSTALL_DIR%\" >nul
if errorlevel 1 (
echo ERROR: Failed to copy files to %INSTALL_DIR%.
pause & exit /b 1
)
echo Files copied.
:: -- STEP 2: Data directory (site config, mission recordings) -----------------
echo [2/4] Preparing data directory...
if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
:: Per-site plasma-display art. Created empty and never overwritten: what is in
:: here wins over the copy shipped in App\Plasma Images, so a release cannot
:: clobber a site's own name bitmaps.
if not exist "%DATA_DIR%\Plasma Images" mkdir "%DATA_DIR%\Plasma Images"
:: Grant the local Users group modify access so a normal operator account can
:: write local.siteconfig / console.settings / RP Missions when the console is
:: not run elevated.
icacls "%DATA_DIR%" /grant *S-1-5-32-545:(OI)(CI)M /T >nul 2>&1
echo %DATA_DIR% (Users: modify access)
:: -- STEP 3: Start Menu shortcut ----------------------------------------------
echo [3/4] Creating Start Menu shortcut...
powershell -NoProfile -Command "$s=(New-Object -ComObject WScript.Shell).CreateShortcut([Environment]::GetFolderPath('CommonPrograms')+'\TeslaConsole.lnk'); $s.TargetPath='%EXE%'; $s.WorkingDirectory='%INSTALL_DIR%'; $s.IconLocation='%EXE%,0'; $s.Save()" >nul 2>&1
echo Shortcut created (Start Menu -^> TeslaConsole).
:: -- STEP 4: Windows Firewall -------------------------------------------------
:: The console receives UDP RQST discovery beacons from unconfigured pods, so it
:: must be allowed to accept inbound traffic. A per-program rule is enough.
echo [4/4] Allowing TeslaConsole through Windows Firewall...
netsh advfirewall firewall delete rule name="TeslaConsole" >nul 2>&1
netsh advfirewall firewall add rule name="TeslaConsole" dir=in action=allow program="%EXE%" enable=yes profile=any >nul
echo Firewall rule added.
:: -- Done ---------------------------------------------------------------------
echo.
echo ============================================================
echo Installation Complete
echo ============================================================
echo.
echo Installed to : %INSTALL_DIR%
echo Data dir : %DATA_DIR%
echo Launch from : Start Menu -^> TeslaConsole
echo.
pause