Steamworks SDK 1.64 vendored at extern/steamworks_sdk_164 (headers + win32 redistributables only; .gitignore trims the rest). Both projects build with RP412_STEAM; activation stays behind the RP412STEAM=1 environment switch, so plain desktop runs never touch Steam. L4STEAMTRANSPORT.cpp implements NetTransport on ISteamNetworkingSockets with FakeIP: SteamNetTransport_Install brings up SteamAPI, relay network access, and a two-port FakeIP identity (fake port 0 = console channel, 1 = game mesh), then swaps the process wire; any failure logs the reason and the game carries on over TCP. Addressing keeps the engine untouched: all pods share the -net port convention, eggs carry fakeip:engineport, and the transport alone translates engine ports to Steam fake ports via the lobby-fed peer table (RegisterPeer). Connect mirrors the TCP retry-while-refused loop; Receive normalizes message lanes back into the stream semantics CheckBuffers expects. Runtime verified on this box: RP412STEAM=1 under AppID 480 came up as 169.254.59.52 (fake ports 32256/32257); without Steam credentials it falls back to TCP cleanly; default boot logs no Steam lines at all. steam_api.dll ships in the dist. Next: the lobby layer (ISteamMatchmaking member data -> RegisterPeer + egg build + RPL4CONSOLE marshal), which needs a second account to test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
84 lines
4.0 KiB
C
84 lines
4.0 KiB
C
//===========================================================================//
|
|
// File: l4steamtransport.h //
|
|
// Project: MUNGA Brick: Steam Network Transport //
|
|
// Contents: NetTransport over ISteamNetworkingSockets (FakeIP) //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994-1995, Virtual World Entertainment, Inc. //
|
|
// PROPRIETARY AND CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#pragma once
|
|
|
|
#include "..\munga\style.h"
|
|
|
|
//########################################################################
|
|
// SteamNetTransport - the retail wire (l4steamtransport.cpp). Built
|
|
// only under RP412_STEAM (Steamworks SDK vendored at
|
|
// extern\steamworks_sdk_164; steam_api.dll ships beside the exe).
|
|
//
|
|
// Method mapping onto ISteamNetworkingSockets:
|
|
//
|
|
// Install SteamAPI_Init + InitRelayNetworkAccess, then
|
|
// BeginAsyncRequestFakeIP(2): fake port 0 is the
|
|
// console channel, fake port 1 the game mesh.
|
|
// On success installs itself via NetTransport_Set;
|
|
// on any failure the process stays on Winsock TCP.
|
|
// GetLocalAddresses our FakeIP (the mesh identifies "which [pilots]
|
|
// entry is me" against it).
|
|
// Resolve SteamNetworkingIPAddr::ParseString - FakeIPs ARE
|
|
// IPv4 strings, so egg text stays unchanged.
|
|
// Connect ConnectByIPAddress to the peer's FakeIP + fake
|
|
// game port (SDR routes it; NAT traversal and IP
|
|
// privacy come free); blocks pumping callbacks
|
|
// until Connected, retrying like the TCP
|
|
// connect-while-refused loop.
|
|
// Listen CreateListenSocketP2PFakeIP - first engine port
|
|
// seen maps to fake port 0, second to fake port 1.
|
|
// Accept connection-request callback AcceptConnections
|
|
// queue up; Accept() pops fully-connected ones.
|
|
// Send SendMessageToConnection, reliable lane (the
|
|
// engine's stream framing assumes ordered
|
|
// reliable delivery).
|
|
// Receive ReceiveMessagesOnConnection into the caller's
|
|
// buffer; normalized to ReceiveNoData /
|
|
// ReceiveDisconnected like the Winsock transport.
|
|
// GetRemoteAddress GetRemoteFakeIPForConnection, with the fake
|
|
// port translated back to the ENGINE port so the
|
|
// mesh's SOCKADDR_IN identity checks keep working.
|
|
//
|
|
// Addressing convention under Steam: every pod launches with the same
|
|
// -net port (the lobby fixes it), so the egg's [pilots] entries are
|
|
// "<fakeip>:<engine game port>" - the engine's self-match and peer
|
|
// checks all work on engine ports, and only this transport knows the
|
|
// Steam-assigned fake port values. The lobby layer exchanges each
|
|
// member's FakeIP + fake game port and feeds RegisterPeer before the
|
|
// egg is distributed.
|
|
//########################################################################
|
|
|
|
#ifdef RP412_STEAM
|
|
|
|
// Bring Steam up and make this the process transport. False (with the
|
|
// reason logged) leaves the Winsock transport in place - callers just
|
|
// carry on over TCP.
|
|
Logical
|
|
SteamNetTransport_Install();
|
|
|
|
// Our FakeIP as a dotted string ("169.254.x.y"), for lobby member data
|
|
// and the [pilots] list. Empty until Install succeeds.
|
|
const char *
|
|
SteamNetTransport_GetFakeAddressString();
|
|
|
|
// Our Steam-assigned fake game port (lobby member data).
|
|
int
|
|
SteamNetTransport_GetFakeGamePort();
|
|
|
|
// The lobby feeds every member's FakeIP + fake game port here before
|
|
// StartConnecting runs.
|
|
void
|
|
SteamNetTransport_RegisterPeer(
|
|
const char *fake_ip,
|
|
int fake_game_port
|
|
);
|
|
|
|
#endif // RP412_STEAM
|