diff --git a/game/btl4main.cpp b/game/btl4main.cpp index cd962d5..a811dfc 100644 --- a/game/btl4main.cpp +++ b/game/btl4main.cpp @@ -461,11 +461,17 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine // BT_FE_JOIN (join.bat): the callsign/mech request rides env // into the relaunched pod; L4NET's SEAT_REQUEST carries it to // the relay, which writes it into the session egg. Args = the - // universal join contract (join.bat's own OPERATOR.EGG/1501). + // universal join contract (OPERATOR.EGG + port 1501); the + // operator console overrides the port per LOCAL instance via + // BT_FE_JOINPORT (two instances on one box can't share -net). SetEnvironmentVariableA("BT_FE_EGG", NULL); SetEnvironmentVariableA("BT_CALLSIGN", fe_spec.joinCallsign); SetEnvironmentVariableA("BT_MECH", fe_spec.joinVehicle); - strcpy(fe_arguments, "-egg OPERATOR.EGG -net 1501 -platform glass"); + { + const char *join_port = getenv("BT_FE_JOINPORT"); + sprintf(fe_arguments, "-egg OPERATOR.EGG -net %d -platform glass", + join_port != NULL ? atoi(join_port) : 1501); + } break; #ifdef BT_STEAM case BTFeLaunchJoinSteam: diff --git a/tools/btoperator.py b/tools/btoperator.py index 13a9c63..b6fa725 100644 --- a/tools/btoperator.py +++ b/tools/btoperator.py @@ -725,21 +725,31 @@ class Operator(QMainWindow): env.insert("BT_DEV_GAUGES", "1") if self.f_inside.isChecked(): env.insert("BT_START_INSIDE", "1") + args = ["-egg", os.path.basename(self.egg_path) + if os.path.dirname(self.egg_path) == CONTENT + else self.egg_path] if relay: + # WALK-UP FLOW (2026-07-22): a relay-mode local instance goes + # through the JOIN-GAME menu exactly like a join.bat player -- + # callsign + mech picked in the menu, seat ASSIGNED by the + # relay (BT_SELF pinning is gone: it skipped the seat request + # that carries the choice). Zero-arg launch = the menu; it + # relaunches itself with -egg OPERATOR.EGG -net + # (distinct per instance -- two -net listeners can't share a + # port on one box). env.insert("BT_RELAY", "127.0.0.1:%d" % self.f_port.value()) - env.insert("BT_SELF", tag) - net_port = 1501 + env.insert("BT_FE_JOIN", "1") + env.insert("BT_FE_JOINPORT", str(1501 + 100 * r)) + args = [] else: host, _, port = tag.rpartition(":") net_port = int(port) - 1 + args += ["-net", str(net_port)] env.insert("BT_LOG", "operator_%d.log" % (r + 1)) proc = QProcess(self) proc.setWorkingDirectory(CONTENT) proc.setProcessEnvironment(env) - proc.start(exe, ["-egg", os.path.basename(self.egg_path) - if os.path.dirname(self.egg_path) == CONTENT - else self.egg_path, - "-net", str(net_port)]) + proc.start(exe, args) self.game_procs.append(proc) launched += 1 self.log.appendPlainText("launched %d local instance(s)" % launched)