The DOSBox-X preservation pods run the original DOS builds of BattleTech 4.10 / Red Planet 4.10 inside an emulator whose bridged NIC is enumerated 100 above the host pod's last octet. A new checkbox on each game page (RP Death Race / Martian Football, BT Free For All / No Return) shifts every siteconfig address the page uses by +100 so the same pages control either version of the games: - Munga game connections (port 1501) target host+100; toggling the box drops and reconnects any requested pods at the new address. - Mission egg player and camera entries carry the shifted address. - The checkbox locks while a mission is loaded/running, like the other mission properties. Launcher / site-management traffic is untouched -- those services still run on the pod host itself. Pages share a pod's MungaGame, so the most recent page to toggle or enable wins if two pages fight over one pod. Verified end-to-end against vPOD: netstat shows the game connection move 127.0.0.1 -> 127.0.0.101 -> 127.0.0.1 as the box is toggled, and the egg received by vPOD carries pilot=127.0.0.101. All 103 diff tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
29 lines
1.0 KiB
C#
29 lines
1.0 KiB
C#
using System.Net;
|
|
|
|
namespace TeslaConsole;
|
|
|
|
/// <summary>
|
|
/// Support for the DOSBox-X preservation pods. The emulator that runs the
|
|
/// original DOS build of a game is bridged onto the pod network with its last
|
|
/// octet enumerated 100 above the host pod's address, so when a game page is
|
|
/// driving the emulated version it must target host+100 instead of the
|
|
/// address stored in the site config. Only the game traffic shifts — the
|
|
/// launcher and provisioning services still run on the host itself.
|
|
/// </summary>
|
|
internal static class DosBox
|
|
{
|
|
public const int AddressOffset = 100;
|
|
|
|
/// <summary>
|
|
/// Returns the address with its last octet raised by <see cref="AddressOffset"/>.
|
|
/// The octet wraps modulo 256; real site configs keep host octets at or
|
|
/// below 155 so the shifted address stays inside the subnet.
|
|
/// </summary>
|
|
public static IPAddress ShiftAddress(IPAddress address)
|
|
{
|
|
byte[] bytes = address.GetAddressBytes();
|
|
bytes[bytes.Length - 1] = (byte)(bytes[bytes.Length - 1] + AddressOffset);
|
|
return new IPAddress(bytes);
|
|
}
|
|
}
|