vPOD impersonates a Tesla game client (rpl4opt.exe / btl4.exe) so the Red Planet and BattleTech operator consoles can be exercised without real cockpit hardware. New net48 WinForms project under Console\vPOD: - MungaPodServer: the server half of the Munga control protocol (TCP 1501). The vendored MungaSocket is client-only, so this reimplements the identical framing ([16-byte header][12-byte base + body], dispatched by ClientID+MessageID) for the listening side, reusing the vendored message classes' WriteTo/BinaryReader serialization. - PodSimulator: the ApplicationState machine driven by the console's messages - answers StateQuery, reassembles the streamed egg and acknowledges it, and walks WaitingForEgg -> LoadingMission -> WaitingForLaunch -> RunningMission and back on Run/Stop/Abort/Suspend/Resume. - VPodForm: live display of listening/connection status, the colour-coded ApplicationState, an egg viewer (fields + summary), and a newest-first protocol log. A Red Planet / BattleTech toggle changes which ApplicationID the pod reports, live, so one vPOD stands in for either game. - PodArguments: parses the real client's launch flags (-net/-app/-lc/-mr/ -host/-res). Deployable from Manage Site -> Install Product: a catalog product in RedPlanet\Apps.xml (Game Client / Live Camera / Mission Review entries) plus pack.ps1, which builds dist\vPOD.zip laying out vPOD\vPOD.exe for the launcher to extract to C:\Games\vPOD. CatalogTests updated to 5 products / 11 entries with the four vPOD entry assertions (88/88 pass). TeslaConsole.csproj excludes vPOD\** from its **/*.cs glob; the project is added to the solution. Verified end-to-end over real TCP: a console-role client using the vendored MungaSocket drives connect -> WaitingForEgg -> stream egg -> (ack) -> WaitingForLaunch -> Run -> RunningMission -> Stop -> WaitingForEgg, with vPOD reporting the correct state at each step. MungaGame (what the console's game windows use) is a thin wrapper over MungaSocket, so this exercises the exact wire behaviour. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
98 lines
2.4 KiB
C#
98 lines
2.4 KiB
C#
using System;
|
|
using Munga.Net;
|
|
|
|
namespace VPod;
|
|
|
|
/// <summary>
|
|
/// The launch options a real game client understands, parsed from the command
|
|
/// line the console/launcher starts it with. vPOD accepts the same shape so it
|
|
/// is a drop-in stand-in:
|
|
/// <c>-net <port></c> Munga control port (default 1501)
|
|
/// <c>-lc</c> live-camera role (cosmetic here; state model is identical)
|
|
/// <c>-mr</c> mission-review role
|
|
/// <c>-res W H</c> resolution (ignored)
|
|
/// <c>-app rp|bt</c> which ApplicationID to report (RP by default; also
|
|
/// switchable live in the UI)
|
|
/// <c>-host <id></c> the responding host id reported in state responses
|
|
/// </summary>
|
|
internal sealed class PodArguments
|
|
{
|
|
public int Port { get; private set; } = MungaSocket.ConsolePort; // 1501
|
|
|
|
public ApplicationID Application { get; private set; } = ApplicationID.RPL4;
|
|
|
|
public HostType HostType { get; private set; } = HostType.GameMachineHostType;
|
|
|
|
public int HostId { get; private set; } = 1;
|
|
|
|
public static PodArguments Parse(string[] args)
|
|
{
|
|
PodArguments result = new PodArguments();
|
|
for (int i = 0; i < args.Length; i++)
|
|
{
|
|
string token = args[i].ToLowerInvariant();
|
|
switch (token)
|
|
{
|
|
case "-net":
|
|
if (i + 1 < args.Length && int.TryParse(args[i + 1], out int port))
|
|
{
|
|
result.Port = port;
|
|
i++;
|
|
}
|
|
break;
|
|
case "-lc":
|
|
result.HostType = HostType.MissionReviewHostType;
|
|
break;
|
|
case "-mr":
|
|
result.HostType = HostType.MissionReviewHostType;
|
|
break;
|
|
case "-res":
|
|
i += 2; // width height, ignored
|
|
break;
|
|
case "-app":
|
|
if (i + 1 < args.Length)
|
|
{
|
|
result.Application = ParseApp(args[i + 1]);
|
|
i++;
|
|
}
|
|
break;
|
|
case "-host":
|
|
if (i + 1 < args.Length && int.TryParse(args[i + 1], out int host))
|
|
{
|
|
result.HostId = host;
|
|
i++;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
private static ApplicationID ParseApp(string value)
|
|
{
|
|
switch (value.ToLowerInvariant())
|
|
{
|
|
case "bt":
|
|
case "btl4":
|
|
case "battletech":
|
|
return ApplicationID.BTL4;
|
|
case "nd":
|
|
case "ndl4":
|
|
return ApplicationID.NDL4;
|
|
default:
|
|
return ApplicationID.RPL4;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Mirror of the console's HostType (GameMachine=0, MissionReview=2, Console=3).
|
|
/// Duplicated here so vPOD does not depend on the console assembly.
|
|
/// </summary>
|
|
internal enum HostType
|
|
{
|
|
GameMachineHostType = 0,
|
|
MissionReviewHostType = 2,
|
|
ConsoleHostType = 3
|
|
}
|