Skip to content

fix(soundcache): prevent Sven server join crashes and retry loops - #1

Merged
hzqst merged 2 commits into
mainfrom
fix/server-join-crash-975
Nov 14, 2026
Merged

hzqst merged 2 commits into
mainfrom
fix/server-join-crash-975

Conversation

@hzqst

@hzqst hzqst commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Joining a Sven server with SvenSoundcacheControl enabled overwrote the stack: the legacy HLSDK status buffer is 72 bytes, but SvEngine writes 104 bytes and places the remote address at a different offset. Use the SDK's Sven-specific status/address types and correctly typed network callbacks.

Live testing also exposed a retry loop when StartSound loaded the sound list before MapStarted. Track each join from HUD_VidInit and refresh once at the first loader or map-start callback, so a later callback preserves the sounds just loaded for that join.

Add regression coverage for full native status writes, boundary guards, remote address contents, and both callback orders. Standalone builds and Windows CI now use the same CMake SDK pin, c7c2af7d9dbfee94ae3fb4514e97efb856835ec7, and validate the required header, so they can build before the SDK PR is merged.

SDK change: MetaHookSv/MetaHook#18

Validation:

  • Existing SDK override builds and a fresh standalone fetch: MSVC x86 Release/Debug DLL builds and both tests passed in each configuration.
  • The Windows CI build/install command, its CTest command, and installed gamedata validation also passed locally using the pinned SDK fetch.
  • clang-format 23.1.3 and git diff --check passed; packaged gamedata validated for both supported snapshots.
  • Before the ABI fix, the native-write regression exited with 0xc0000409; the early-load regression also failed before its lifecycle fix.
  • halflife-mcp live tests on Sven build 10257: 124.221.167.52:28347 and :28348, same-map retry, cl_soundcache_alwaysflush 0/1, server map changes, and local svencoop1 loopback. No reproduced crash or retry loop after both fixes.

Refs MetaHookSv/MetaHookSv#975.

Use the native SvEngine network ABI and refresh sound state once per HUD_VidInit join, before the first sound load or MapStarted callback. Cover full native status writes and early sound loading, and pin standalone builds to the SDK commit containing the required types.

Co-Authored-By: Codex <codex@openai.com>
Let CMake fetch its declared SDK commit instead of overriding it with main, and validate installed gamedata with the same fetched SDK.

Co-Authored-By: Codex <codex@openai.com>
@hzqst
hzqst merged commit 5009500 into main Nov 14, 2026
3 checks passed
hzqst added a commit to MetaHookSv/MetaHookSv that referenced this pull request Nov 14, 2026
Enabling SvenSoundcacheControl could crash when joining a server because it passed a 72-byte HLSDK status buffer to SvEngine's 104-byte writer. Live testing also revealed repeated reconnects when MapStarted cleared a sound list already loaded by StartSound.

Update both submodule pointers together:
- MetaHookSv/MetaHook#18: add the native SvEngine network types and ABI checks (e7ca5ca).
- MetaHookSv/SvenSoundcacheControl#1: use those types, refresh sound state only once per join, add regressions, and use the same pinned SDK in standalone builds and Windows CI (5009500).

Validation:
- MSVC x86 Release/Debug builds and both plugin tests passed with the local SDK and with a fresh standalone fetch of the published SDK commit.
- Plugin formatting, the new SDK header's clang-format 23.1.3 check, git diff --check, and both gamedata snapshot validations passed.
- halflife-mcp live tests on Sven build 10257 passed on 124.221.167.52:28347 and :28348, including same-map retry, the cvar enabled/disabled, server map changes, and local svencoop1 loopback.
- The aggregate changes only the two tested gitlinks; no aggregate build configuration changed.

Closes #975.

Generated with [Claude Code](https://claude.com/claude-code)
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