Add cockpit deployment package + single-instance guard

deploy/ builds a single zip for TeslaConsole: the self-contained tray app and
the signed ViGEmBus installer under a riojoy\ folder, with postinstall.bat at the
root. postinstall elevates and runs riojoy\install-rio.ps1, which installs
ViGEmBus silently (if absent) and registers RIOJoy to start at logon — no cert
trust, test signing, Secure Boot change, or reboot.

Also guard against two instances fighting over the COM port (machine-wide +
per-user autostart both firing): a per-session named mutex makes a second launch
exit immediately. Built zips (dist/) and the bundled installer (deploy/vendor/)
are git-ignored.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-06-29 09:29:01 -05:00
co-authored by Claude Opus 4.8
parent 2f434517b7
commit d17fd018eb
6 changed files with 275 additions and 0 deletions
+10
View File
@@ -2,6 +2,12 @@ namespace RioJoy.Tray;
internal static class Program
{
// Per-session single-instance guard. Two instances would both grab the RIO COM
// port, so a second launch (e.g. machine-wide + per-user autostart both firing)
// must exit immediately. A named mutex is released by the OS if the owner dies,
// so a crash never leaves a stale lock.
private const string SingleInstanceMutex = "RIOJoy.Tray.SingleInstance";
/// <summary>
/// Entry point. RIOJoy runs as a background tray application with no main
/// window: an ApplicationContext owns the NotifyIcon and the runtime, so the
@@ -10,6 +16,10 @@ internal static class Program
[STAThread]
private static void Main()
{
using var instance = new Mutex(initiallyOwned: true, SingleInstanceMutex, out bool createdNew);
if (!createdNew)
return; // another RIOJoy is already running in this session
ApplicationConfiguration.Initialize();
Application.Run(new TrayApplicationContext());
}