using System; using Munga.Net; namespace VPod; /// /// 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: /// -net <port> Munga control port (default 1501) /// -lc live-camera role (cosmetic here; state model is identical) /// -mr mission-review role /// -res W H resolution (ignored) /// -app rp|bt which ApplicationID to report (RP by default; also /// switchable live in the UI) /// -host <id> the responding host id reported in state responses /// 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; } } } /// /// Mirror of the console's HostType (GameMachine=0, MissionReview=2, Console=3). /// Duplicated here so vPOD does not depend on the console assembly. /// internal enum HostType { GameMachineHostType = 0, MissionReviewHostType = 2, ConsoleHostType = 3 }