Skip to content

fix(steam): shut down Sven Steam client before GL teardown - #2

Merged
hzqst merged 1 commit into
mainfrom
dev
Oct 5, 2026
Merged

hzqst merged 1 commit into
mainfrom
dev

Conversation

@hzqst

@hzqst hzqst commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Fix a SvEngine shutdown-order defect on Sven Co-op. The engine's _restart path skips SteamAPI_Shutdown, and its normal-exit call runs too late (after GL_Shutdown), leaving Steam client threads alive until process teardown — reproduced as 0xC0000409 after osprey -> _restart -> quit.

For SvEngine (svencoop-8948 / svencoop-10257) only:

  • Install an engine SteamAPI_Shutdown IAT hook that suppresses the engine's late, restart-skipped call.
  • Resolve GL_Shutdown(HWND, HDC, HGLRC) through gamedata and inline-hook it to invoke the saved Steam API original once per engine lifetime, before forwarding all three arguments.
  • Clear both hooks, the saved originals and the per-engine flag during engine unload; other engine families keep their existing shutdown behavior.

The manifest gains a conditional group requiring the GL_Shutdown function for both Sven snapshots, so the pruned catalog now carries the eng global plus GL_Shutdown. LoadEngine resolves the new symbol before registering the DLL-notification callback.

Validation: Windows x86 Sven 10257. The old ThreadGuard reproduced 0xC0000409; the fixed DLL returned MetaHook's normal exit code 0 for the same control. Six further runs covered zero, one and three restarts with HalflifeCLI enabled and disabled; every restart restored osprey and native RCON and all six processes exited 0. Release build and all 11 gamedata snapshots passed validation. Sven 8948 has Windows code-path and catalog verification only; other engines and Renderer compatibility were not runtime-tested.

Merge component PRs before updating aggregate gitlinks; no automatic merge is requested.

🤖 Generated with Claude Code

Preserve shutdownserver before _restart, move SteamAPI_Shutdown before GL_Shutdown once per engine lifetime, and suppress the late engine import call. Add official gamedata requirements and record six passing runtime lifecycle checks.

Co-Authored-By: Codex <codex@openai.com>
@hzqst
hzqst merged commit c310393 into main Oct 5, 2026
1 check passed
@hzqst
hzqst deleted the dev branch October 5, 2026 07:32
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