Skip to content

feat: add host mode and Windows x64/Linux support - #2

Merged
hzqst merged 1 commit into
mainfrom
feat/host-mode
Nov 20, 2026
Merged

hzqst merged 1 commit into
mainfrom
feat/host-mode

Conversation

@hzqst

@hzqst hzqst commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a host mode so a game engine without its own Steam session (HLND2T-DiligentGraphics, for GoldSrc-SDK-compatible Steam authentication) can use Steam through the bridge: engine → SteamAPIBridge → steam_api(64).dll / libsteam_api.so.

  • Host session: SteamBridge_HostInit(runtimePath, initializeClient) loads the runtime (default: platform runtime beside the bridge) and calls SteamAPI_InitFlat; HostShutdown, HostRunCallbacks, HostIsActive, HostIsClientActive. Dedicated servers pass initializeClient = 0.
  • Client: UserInitiateGameConnection/UserTerminateGameConnection (_DEPRECATED ticket API used by GoldSrc), UserAdvertiseGame, UserGetSteamID, UserGetPersonaName, UserIsSubscribedApp; voice VoiceStart/StopRecording, VoiceGetAvailable, VoiceGet (optional PCM), VoiceDecompress, VoiceGetOptimalSampleRate.
  • Game server: ServerInit (via SteamInternal_GameServer_Init_V2 with the SteamGameServer_InitEx interface list), logon, product/mod/description/rules/key values, advertise, player/bot counts, SendUserConnectAndAuthenticate, unauthenticated users, disconnect, user data, shared-socket packets.
  • Events: client (GameServerDeny, GameServerChangeRequested, GameOverlayActivated) and server (logon success/failure, policy, client approve/deny/kick) callbacks are translated to plain structs. A shutdown requested from a callback runs after the native dispatcher returns.
  • Platforms: Windows MSVC x86/x64 and Linux x86/x64 (src/Platform.h). Plugin mode finds steam_api.dll / steam_api64.dll / libsteam_api.so; the GoldSrc 8684 SteamClient012 fallback stays Windows x86 only. Linux exports only SteamBridge_* (version script).
  • CMake: as a subproject the bridge keeps the parent's configurations; STEAMAPIBRIDGE_INSTALL_DIR (default svencoop/metahook/dlls), STEAMAPIBRIDGE_INSTALL_RUNTIME and STEAMAPIBRIDGE_RUNTIME. New x64 and Linux build scripts.
  • SteamSDK pinned to Steamworks SDK v1.65 (chore(sdk): update Steamworks SDK to v1.65 and add x64/Linux runtimes SteamSDK#1, commit ba2bfcc). Merge SteamSDK#1 first; the pin points to its branch commit and should be moved to the merge commit if that differs.
  • Fixes a pre-existing parallel-build race: several test executables copied the bridge into the same directory.

AGENTS.md/README.md are updated: only host mode may initialize or shut down Steam, and only on the host's request; plugin mode is unchanged.

Not included (separate work): rich presence, FakeIP / SteamNetworkingSockets, SteamInput, launch command line.

Verification

  • CTest, Windows x86 Debug/Release (4 tests), x64 Debug/Release (3 tests; legacy fixture is x86-only), Linux x64/x86 Release under WSL Ubuntu 24.04 (2 tests): all pass. New SteamBridge.Host covers unavailable runtime, client init failure, tickets, voice (incl. non-OK results), event translation and client/server dispatcher separation, deferred shutdown from callbacks, game server setters/authentication/packets and dedicated (server-only) sessions, against a fixture runtime exporting the real entry points.
  • Fresh x64 configure without STEAMSDK_SOURCE_PATH fetches the pinned SteamSDK and passes CTest.
  • clang-format 23.1.3 format-check: 14 files, 0 differences.
  • Real Steam (manual): SteamBridgeHostSmoke with SDK v1.65 steam_api64.dll (x64) and steam_api.dll (x86), logged-in Steam client, steam_appid.txt = 70: client init, SteamID/persona, anonymous game server logon (LOGON_SUCCESS, POLICY), 218-byte ticket accepted by SendUserConnectAndAuthenticate, then GSClientApprove for the same SteamID. Linux was not tested against a real Steam client.
  • Not tested: plugin mode on Linux (its fixtures are Windows .def based), MetaHookSv consumers on top of this change.

🤖 Generated with Claude Code

Add a host mode for engines without their own Steam session: the bridge loads
the steam_api runtime and owns SteamAPI/SteamGameServer initialization,
callback pumping and shutdown. The C ABI covers game connection tickets,
SteamID, persona name, app subscription, voice, game server logon, rules,
heartbeats, ticket authentication and shared-socket packets, and translates
client and game server callbacks into plain event structures. Shutdown
requested from a callback is deferred until the dispatcher returns.

Build for Windows x86/x64 and Linux x86/x64. Plugin mode finds the platform
runtime name; the GoldSrc 8684 legacy fallback stays Windows x86 only. As a
subproject the bridge keeps the parent's configurations, and the install
directory and runtime staging are configurable. Pin SteamSDK to Steamworks
SDK v1.65. Test executables share one directory so parallel builds no longer
race copying the bridge.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@hzqst
hzqst merged commit a073511 into main Nov 20, 2026
2 checks passed
@hzqst
hzqst deleted the feat/host-mode branch November 20, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant