Skip to content

Half-Life 25th Anniversary Update compablity - #1106

Open
stamepicmorg wants to merge 8 commits into
masterfrom
bugfix/25th-edition-support
Open

stamepicmorg wants to merge 8 commits into
masterfrom
bugfix/25th-edition-support

Conversation

@stamepicmorg

@stamepicmorg stamepicmorg commented Jul 14, 2025 •

Copy link
Copy Markdown
Contributor

Half-Life 25th Anniversary Update support (reworked)

This PR no longer ships or re-signs Valve's steam_api. Instead the engine and HLTV now load with the steam_api that comes with the HLDS build itself, old or new.

What this is, and what it is not

  • Why it matters. Hosting providers and private server owners install HLDS with steamcmd, and steamcmd gives them the current (HL25) build. Today ReHLDS forces them to pin the steam_legacy branch (8684) or swap Valve's steam_api by hand, and juggling HLDS branches and versions is exactly how installs end up broken (undefined symbol: SteamGameServer_Init, see The latest version of HLDS 9907 is not compatible with the latest version of Rehlds #1020 and [Prioblem]: undefined symbol: SteamGameServer_Init #1140, including steamcmd not switching branches cleanly). With this PR there is one path for everyone: install the current HLDS, put the ReHLDS release on top, run, with no jumping between HLDS branches and versions and no third-party dlls.
  • A compatibility layer. ReHLDS stays the engine it is: a reverse-engineered legacy engine (6153/8684 line) with ReHLDS fixes. This PR only lets it load and run on a current HLDS install (what steamcmd gives you today, HL25 builds included) with that install's own steam_api. For hosters that means: install HLDS with steamcmd, put ReHLDS on top, done; no steam_legacy branch, no copying old Valve dlls around.
  • Not the HL25 engine. Features and behaviour changes that live inside the 9xxx/10xxx engine do not come with it, for example:
  • Use the delta.lst of the HL25 install. HL25 widened eflags in valve/delta.lst to 2 bits for the new EFLAG_FLESH_SOUND flag (the HL25 game DLL sets it, the HL25 client plays flesh hit sounds from it). The engine sends what delta.lst describes, so an old delta.lst copied over from a legacy mod setup silently drops the flag. Mods that ship their own delta.lst should merge that change.

Background

HLDS has shipped exactly two steam_api builds over its whole history (checked against all 64 builds since Feb 2013):

HLDS builds Windows steam_api.dll Linux libsteam_api.so
up to 8684 (steam_legacy) Steamworks SDK 1.22 SDK 1.23a
9890 and later (25th Anniversary) SDK 1.53a SDK 1.57

The HL25 builds dropped three flat exports ReHLDS imported directly: SteamGameServer_Init(), SteamGameServer() and SteamApps(). So swds.dll / engine_i486.so (and proxy.dll / proxy.so) could not load on an HL25 install unless the old steam_api was copied over it.

What changes

  • New header-only rehlds/common/SteamApiCompat.h resolves those three at run time: the legacy exports when present, otherwise SteamInternal_GameServer_Init and SteamInternal_FindOrCreate{GameServer,User}Interface.

  • The engine keeps asking for the interface versions it is compiled against (SteamGameServer011, STEAMAPPS_INTERFACE_VERSION005); steamclient still serves them by name, so modules that use ISteamGameServer through the ReHLDS API (Reunion) keep working. No new Steamworks headers, no adapters.

  • On the HL25 path the legacy Steam port is passed as 0 and the version as plain x.x.x.x, as the SDK 1.53a SteamGameServer_Init wrapper does.

  • The engine platform layer and the HLTV proxy both use it; the two direct ::SteamGameServer() calls in the engine go through the platform layer now.

  • The HL25 init path and the version trim are in named helpers (GameServer_InitHL25, PlainVersionString) with comments on why.

  • The server prints which steam_api and steamclient it loaded, at Steam init and in version (HLDS and HLTV):

    Steam API: Steamworks SDK 1.53a (HLDS 9890 and later)
    Steam client: server folder
    

    The SDK version is told by file size (steam_api has no version export; HLDS only ever shipped four files, all of different size); anything else prints as unrecognized with size and entry point kind. The steamclient line shows a full path when it is not the server's own (e.g. taken from an installed Steam client, see launcher: prefer the server's own steamclient.dll on Windows #1213). -debug prints both full paths.

  • HL25 SDK engine API parity. The public HL25 SDK (ValveSoftware/halflife, 2024) added two entries to the engine API that game DLLs see; ReHLDS now provides both, so a mod built with the HL25 SDK cannot call into a missing slot:

    These are the only structural (ABI) changes between the legacy and the HL25 engine API: INTERFACE_VERSION, DLL_FUNCTIONS, NEW_DLL_FUNCTIONS, all shared structs (entvars_t, edict_t, entity_state_t, clientdata_t, usercmd_t, cvar_t, ...), the engine delta tables and the network protocol (48) are unchanged. See "HL25 SDK engine API" below for how they were implemented and tested.

  • The Linux case-sensitivity fix that was part of this PR is already in master (ae2639d).

Result: after this change swds.dll imports 10 functions from steam_api.dll and proxy.dll imports 2, and all of them exist in both 1.22 and 1.53a; the same holds for the Linux .so files.

HL25 SDK engine API

Implemented from the declarations in the public HL25 SDK; the behaviour was matched to the HL25 engine with a black-box test, no engine code was copied. Test: a minimal game DLL built against the official HL25 SDK (copies the 160-entry enginefuncs_t, calls the new entry for a set of edict indexes and the new IFileSystem method for a few files), run on an HLDS 10211 install, Windows and Linux (the enginefuncs_t part was also re-run on vanilla HLDS 8308 and 8684 on Windows: same results):

Engine Windows Linux
Valve HLDS 10211 (swds.dll / engine_i486.so, own filesystem_stdio) reference reference
ReHLDS before this commit crash on the first call of the new entry SIGSEGV (exit 139) on the first call
ReHLDS with this PR same results as Valve for every case same results as Valve for every case

On Linux the old GetFileTime returns max(ctime, mtime) while GetFileModificationTime returns the plain mtime; the ReHLDS filesystem_stdio returns the same values as Valve's for both.

Cases: world, empty client slot, last client slot, entity with and without private data, freed entity, every index after filling the edict list, out of range, negative; existing file, file in the mod folder, missing file.

Mods and SDKs that call the new entry (so they would crash on ReHLDS without it):

  • Half-Life Unified SDK (base for new HL mods): src/game/server/util.h, entity search starts from pfnPEntityOfEntIndexAllEntities(0);
  • PrimeXT: INDEXENT() in server/util.h goes through it;
  • Toodles2You/tfc: takes the entry in GiveFnptrsToDll.

Metamod-r passes its own enginefuncs_t to the game DLL and will need the new entry as well (metamod-p already has it).

Linux stack run with this commit (Debian 12, Metamod-R 1.3.0.149 with 12 plugins incl. ReAPI, Reunion, ReVoice; AMX Mod X 1.10 with 7 modules and 68 plugins; Steam + VAC; 150 s, 5 maps / 6 map starts each):

HLDS base Steam API line own Valve hl.so BugfixedHL-Rebased 1.13.2
8684 Steamworks SDK 1.23a OK OK*
10211 (HL25) Steamworks SDK 1.57 OK OK

* with the legacy libstdc++.so.6 / libgcc_s.so.1 of the 8684 install moved aside (see the README note).

Tests

Windows 11 (VS2017 v141) and Linux (Debian 11, same toolchain as CI). Each HLDS install uses its own steam_api, nothing replaced, with steamclient from a fresh steamcmd install.

Windows Linux
HLDS 10210/10211 (HL25, steam_api 1.53a / 1.57) Steam logon + VAC secure; HL25 Steam client joins (VAC, real SteamID) Steam logon + VAC secure
HLDS 8684 (legacy, steam_api 1.22 / 1.23a) Steam logon + VAC secure Steam logon + VAC secure
HLTV proxy on HL25 connects, gets resources/baseline, Director up, clean disconnect same
HLTV proxy on legacy — same
Metamod-R + AMX Mod X + Reunion stack on HL25 (17 Metamod plugins, 68 AMXX plugins) all load; HL25 Steam client joins Linux build of the stack: all load; HL25 Steam client joins on 10211 (validated)
Steam API / Steam client lines 10210: SDK 1.53a, 8684: SDK 1.22 10211: SDK 1.57, 8684: SDK 1.23a

Manual joins with a real HL25 Steam client (Windows)

Server steam_api Mode Result
this PR, ReHLDS on HLDS 10210, plain own 1.53a VAC secure, Steam client running (+ #1213) joined, STEAM USERID validated
this PR, ReHLDS on HLDS 10210 + Metamod-R/AMXX/Reunion stack own 1.53a VAC secure + Reunion joined
ReHLDS master (4600) on HLDS 6153 / 8308 / 8684 / 9899 / 10210 old 1.22 VAC secure, no Reunion joined on all 5, played
ReHLDS 3.15.0.896 on HLDS 6153 / 8308 / 8684 / 9899 / 10210 old 1.22 VAC secure, no Reunion joined on all 5
vanilla Valve HLDS 5937 / 6153 / 8308 / 9899 own VAC secure joined
vanilla Valve HLDS 8684 / 10210 own VAC secure first instance rejected, joined after a server restart
ReHLDS 3.15 on HLDS 10210 old 1.22 -insecure joined, real SteamID
ReHLDS 3.14 + Reunion stack on HLDS 8684 old 1.22 VAC secure + Reunion joined

The rejects in the vanilla rows (and an early "STEAM validation rejected" on ReHLDS) stuck to one server instance after the client had hung on a killed server; a server restart cleared them. They are not caused by ReHLDS.

Linux matrix (this PR on current master with bzip2 #1066 and #1213)

Built with the CI toolchain (Debian 11), run in Debian 12 (glibc 2.36). Each install with its own libsteam_api.so. Stack: Metamod-R 1.3.0.149 (12 plugins incl. ReAPI, Reunion 0.2.0.25, ReVoice 0.1.0.34), AMX Mod X 1.10 (7 modules, 68 plugins). 150 s each, rcon changelevel every 25 s through 5 maps.

HLDS base steam_api own Valve hl.so BugfixedHL-Rebased 1.13.2
6153 1.23a OK OK*
8684 1.23a OK OK*
9899 (HL25) 1.57 OK OK
9907 (HL25) 1.57 OK OK
10211 (HL25) 1.57 OK OK

OK = all Metamod and AMXX plugins load, Steam logon + VAC secure, 5 maps / 6 map starts without errors.
* Legacy HLDS ships an old libstdc++.so.6 / libgcc_s.so.1 in the server root that shadows the system ones; modern game DLLs need them removed. BugfixedHL-Rebased also needs glibc 2.34+. Neither is about this PR.

Notes from testing:


Background and history (for reviewers)

What was tried before, what we measured, and why this approach.

The problem

The 25th Anniversary HLDS builds (9890+, Nov 2023) ship a newer steam_api (SDK 1.53a Windows / 1.57 Linux). ReHLDS is built against SDK 1.22/1.23a and imported SteamGameServer_Init(), SteamGameServer() and SteamApps() directly; those exports are gone in the HL25 builds, so the engine fails to load:

The reverse does not work either: the vanilla HL25 swds.dll needs SteamInternal_*, which SDK 1.22 does not have. So the two cannot share one folder with the same steam_api.

Approaches tried or considered

# Approach Status / why not
1 Use the steam_legacy (8684) branch, the usual advice in #1020/#1140 Works, but hosters cannot use the current HLDS; not a fix
2 Hoster workarounds: -insecure, Reunion, copying the old steam_api over HL25 by hand Common in practice; Reunion bypasses Steam auth, which is not something to require
3 First version of this PR (Jul 2025): put the old steam_api.dll / libsteam_api.so from rehlds/lib into the release and re-sign the dll in CI Worked, but ships and re-signs a Valve binary and replaces the one of the HLDS install; objections in the comments above were fair. Dropped.
4 s1lentq's steamworks_v160 branch (Dec 2024): Steamworks headers upgraded to SDK 1.60, plus an ISteamGameServer011 adapter so the ReHLDS API stays the same for modules Not merged; fell behind master. SDK 1.60 code calls SteamInternal_GameServer_Init_V2, which HL25's own steam_api 1.53a does not export, so it would still need its own 1.60 dll shipped. An early version also crashed Reunion on Linux before the adapter was added.
5 Two full Steamworks SDK header sets in one build, switched at run time Considered and rejected: the SDK headers cannot be isolated from each other cleanly; a lot of churn for what is three functions
6 #1121 (Aug 2025, stevenlafl): build with VERSION_SAFE_STEAM_API_INTERFACES, i.e. SteamGameServer_InitSafe + CSteamAPIContext (interfaces through SteamClient()) Closed by its author after the objections in that thread. Same goal, chosen at build time; the HL25 steam_api (1.53a/1.57) still exports SteamGameServer_InitSafe and SteamClient, so the idea is viable (not tested here). This PR keeps the legacy path exactly as it was and only resolves the missing entry points at run time.
7 This rework: resolve only the three missing entry points at run time, keep the interface versions the code is compiled against Chosen. No new SDK headers, no adapters, no Valve binaries shipped or re-signed.

Why 6 works: steam_api only forwards an interface version string to steamclient, and steamclient still serves the old versions. HL25's own engine does the same: its swds.dll asks for SteamGameServer015 through a 1.53a dll whose native version is 014. ReHLDS keeps asking for SteamGameServer011 / STEAMAPPS_INTERFACE_VERSION005, so ISteamGameServer handed to modules through the ReHLDS API (Reunion) is unchanged.

Data behind it

  • steam_api of every HLDS build since Feb 2013 (64 builds, Windows and Linux): exactly two versions per OS: 1.22 / 1.23a up to 8684, 1.53a / 1.57 from 9890 on. Only two paths need support.
  • Imports: of the 13 steam_api functions the engine used, 10 exist in both versions, 3 do not; HLTV proxy.dll used 4, the same 3 are missing. After this PR: engine 10 imports, proxy 2, all present in both versions (checked on the PE import table and the ELF dynamic symbols).
  • HL25 SDK vs the engine API (ValveSoftware/halflife, seed vs the 2024 HL25 update): enginefuncs_t got one entry at the end (pfnPEntityOfEntIndexAllEntities, which the engine has exported since build 8279 in 2019; the header only caught up with HL25), IFileSystem one method (GetFileModificationTime); INTERFACE_VERSION, DLL_FUNCTIONS and NEW_DLL_FUNCTIONS are unchanged. Both are implemented by this PR (see above).
  • VAC: VAC-secure joins of a current (HL25) Steam client work on the legacy path too (ReHLDS 3.15, master, vanilla 6153-10210), without Reunion or -insecure. A "STEAM validation rejected" that sticks to one server instance after a stuck client goes away when the server restarts; that was mistaken for a VAC problem before.
  • Out of scope here: gameplay changes of the HL25 engine itself (e.g. trigger_push scaling with fps, [BUG]: 25th anniversary update trigger_push entities are overpowered (scales with server FPS) #1149) and the packet entity limit (Increase engine limits in accordance to the new update #1002). ReHLDS stays the legacy engine; this PR is only about loading and running on HL25 installs.

Compatibility matrix behind the tests

On Windows a real server stack (Metamod-R 1.3.0.149 with 17 plugins incl. Reunion, ReVoice, WHBlocker; AMX Mod X 1.10 with 7 modules and 68 plugins) was run on HLDS 6153, 8684, 9899, 9909 and 10210 x ReHLDS 3.14 / 3.15 / master x three game DLLs (the build's own Valve hl.dll, an old BugfixedHL, BugfixedHL-Rebased 1.13.2), each for 150 s with map changes through five maps: 45 of 45 load and run clean. That run used the old steam_api; the tests in the description above cover this PR's code with each build's own steam_api.

Related

  • launcher: prefer the server's own steamclient.dll on Windows #1213 (merged): random Unable to initialize Steam on Windows when the Steam client is (or was) installed: steam_api takes steamclient.dll from the registry. Independent of this PR.
  • HL25's steam_api 1.53a needs a current steamclient.dll; steamcmd installs one, a 2020 copy fails.

@stamepicmorg
stamepicmorg requested review from a team, s1lentq and wopox1337 July 14, 2025 16:53
@stamepicmorg stamepicmorg added Engine: 📺 reHLTV Case refers to reHLDS version. Engine: 📀 reHLDS Case refers to reHLDS engine. Type: 🚀 enhancement Improvement or addition of a new feature. Priority: ⚠️ medium Medium priority tasks that should be addressed soon. Status: 🗣️ needs feedback Comments or feedback needed from the community or team. Difficulty: 🟢 easy Easy task that can be completed quickly. OS: 🪟 Windows Case refers to Windows. labels Jul 14, 2025
@stamepicmorg

This comment was marked as outdated.

@stamepicmorg

This comment was marked as outdated.

@stamepicmorg
stamepicmorg force-pushed the bugfix/25th-edition-support branch 4 times, most recently from fd897ce to dfa5960 Compare July 14, 2025 21:39
@stamepicmorg

This comment was marked as resolved.

@stamepicmorg
stamepicmorg force-pushed the bugfix/25th-edition-support branch 2 times, most recently from af7ee72 to b189cf7 Compare July 21, 2025 09:31
@anzz1

This comment was marked as off-topic.

@anzz1

This comment was marked as off-topic.

@stamepicmorg

This comment was marked as off-topic.

@anzz1

This comment was marked as off-topic.

@stamepicmorg

This comment was marked as resolved.

@stamepicmorg
stamepicmorg force-pushed the bugfix/25th-edition-support branch 3 times, most recently from 069282a to b3c449a Compare August 7, 2025 21:11
@anzz1

This comment was marked as off-topic.

@wopox1337

Copy link
Copy Markdown
Member

@hun1er could you please review this PR?
@Nord1cWarr1or could you help with QA (either approve the report or test it)?
@s1lentq could you do the final review / give an approval?

@stamepicmorg stamepicmorg changed the title Half-Life 25th Anniversary Update support Half-Life 25th Anniversary Update compablity Nov 16, 2026
@stamepicmorg

Copy link
Copy Markdown
Contributor Author

hello, i will do some tests on linux too and update table in header.

@stamepicmorg

Copy link
Copy Markdown
Contributor Author

Question for reviewers: port the HL25 SDK engine API additions?

Diffing the public Half-Life SDK (ValveSoftware/halflife, 2013 seed vs the 2024 HL25 update) against ReHLDS, the engine-facing API grew by:

HL25 SDK Where Used by public game code? In ReHLDS
edict_t* (*pfnPEntityOfEntIndexAllEntities)(int iEntIndex) appended at the end of enginefuncs_t no (declared only) missing
virtual long GetFileModificationTime(const char *pFileName) appended to IFileSystem ("ABOVE: Pre-25th anniversary interface") no (engine/client side) missing
FCVAR_PRIVILEGED, FCVAR_FILTERSTUFFTEXT, FCVAR_FILTERCHARS, FCVAR_NOBADPATHS (bits 10-13) cvardef.h engine semantics bits are free; flags are stored, not enforced

INTERFACE_VERSION, DLL_FUNCTIONS and NEW_DLL_FUNCTIONS did not change, and in our tests HL25 game DLLs (Valve's hl.dll, BugfixedHL-Rebased) load and run on ReHLDS without them, so this PR leaves them out on purpose.

Should we add them, and if yes, here or in a separate PR?

Things to weigh:

  1. enginefuncs_t size. Appending a function changes the table size that Metamod-R, ReAPI and other modules copy and hook (GiveFnptrsToDll, enginefuncs_t in their bundled SDK headers). Is a new entry at the end safe for all of them, or does it need a coordinated header update across the ecosystem?
  2. Semantics. pfnPEntityOfEntIndexAllEntities presumably returns the edict for any index, including free ones (unlike pfnPEntityOfEntIndex). Is there a reference for the exact behaviour we should match?
  3. cvar flags. Do we want to enforce the new flags (mostly client-side protections in HL25), or only keep the bits reserved?
  4. Scope. ReHLDS stays the legacy engine; is matching the HL25 engine API something we want at all, or only where a real mod/plugin needs it?

@anzz1

anzz1 commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

As explained earlier, engine versions should not be mixed and I strongly recommend against merging this. The only reason to merge this, is if you don't know what you're doing.

@stamepicmorg

stamepicmorg commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor Author

@anzz1 This PR does not mix engine versions. There is no HL25 engine code in it:
the engine is the same legacy reverse (6153/8684 line), the diff is 7 files and only
touches how three steam_api entry points are looked up.

What it changes is which steam_api the legacy engine can load:

Engine-side HL25 changes are explicitly out of scope (see "What this is, and what it is not"),
and the open question above about the HL25 SDK API is exactly about not pulling those in blindly.

If there is a concrete case where this breaks something (a module, a mod, a platform), I'd like to
see it and add it to the test matrix.

By the same logic ReHLDS should not run on 7xxx/8684 either: it was reversed from 6152/6153, yet 8684 (steam_legacy) is the recommended base, including in #1020. In both cases the engine is ReHLDS and the HLDS build only provides the install around it (content, game DLLs, steam_api). Our matrix runs the same stack on 6153, 8684, 9899, 9909 and 10210 with identical results; the only difference for HL25 installs was the steam_api version, which is what this PR handles.

@anzz1

anzz1 commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

6153 vs 8684 is an incremental update, bugfixes and such, no engine feature changes, they are compatible so that argument does not apply, while between legacy and HL25 there are radical, incompatible changes. Even the very fact you tried to make such argument stands to show you don't really realize the point here.

steam_legacy should be used with ReHLDS, as it is what ReHLDS is designed for. There is no reason not to use it, and every reason not to. Features that help the user to use it incorrectly, is not a good feature. The reason we don't have broken servers randomly out in the wild is precisely because ReHLDS doesn't work with the incompatible HL25 engine, so server operators have to do it the correct way, which is using the steam_legacy branch. It is not a bug, its a feature. I've already made my case earlier, which you marked as "off-topic" because I guess you didn't like it? I'm not gonna re-hash the conversation again. For the maintainer, read the arguments, its your decision ultimately, but this simply is not a sensible thing to do.

HLDS builds up to 8684 ship steam_api from Steamworks SDK 1.22 (Windows) /
1.23a (Linux); the HL25 builds (9890+) ship SDK 1.53a / 1.57, which dropped
the flat SteamGameServer_Init(), SteamGameServer() and SteamApps() exports.
The engine imported them directly, so it could not load with HL25's steam_api.

Resolve those three at run time in the platform layer: the legacy exports
when present, otherwise SteamInternal_GameServer_Init and
SteamInternal_FindOrCreate{GameServer,User}Interface. The engine keeps asking
for the interface versions it is compiled against (SteamGameServer011,
STEAMAPPS_INTERFACE_VERSION005); steamclient still serves them, so modules
that use ISteamGameServer through the ReHLDS API (Reunion) keep working.
The HL25 path passes 0 as the legacy Steam port and a plain x.x.x.x version,
like the SDK 1.53a SteamGameServer_Init wrapper.

The two direct ::SteamGameServer() calls (CSteam3Server::Shutdown,
CRehldsServerData::GetSteamGameServer) now go through the platform layer too.

Tested on Windows: HLDS 10210 with its own steam_api 1.53a and HLDS 8684 with
1.22 - Steam logon and VAC secure mode on both; the Armageddon stack (Metamod-R,
AMX Mod X, Reunion) loads on 10210. HL25's steam_api needs a current
steamclient.dll; with an old one SteamInternal_GameServer_Init fails.
Move the run-time selection of SteamGameServer_Init / SteamGameServer /
SteamApps into the header-only rehlds/common/SteamApiCompat.h and use it from
both the engine platform layer and the HLTV proxy (Master.cpp, Proxy.cpp), so
proxy.dll also loads with the legacy and the HL25 steam_api.
Review: move the HL25-specific argument handling of GameServer_Init into
GameServer_InitHL25() and PlainVersionString(), with comments on why: the
SDK 1.53a/1.57 SteamGameServer_Init is an inline wrapper that passes 0 for
the legacy Steam port, and Steamworks documents the version argument as
"x.x.x.x", while the engine builds "<PatchVersion>/<suffix>" (Host_Version).
hlds and HLTV print, after the Steam game server is initialized and in the
version command:
  Steam API: <legacy SDK 1.22/1.23a | HL25 SDK 1.53a/1.57>, <path>
  Steam client: <path>
The kind is told apart by the exports SteamApiCompat already resolves; the
paths come from GetModuleFileName on Windows and /proc/self/maps on Linux.
The steamclient path shows at once whether a server took its own
steamclient or the one of an installed Steam client (#1213).
…hs with -debug

steam_api has no version export or usable version resource, but HLDS has only
ever shipped four steam_api files, which differ in size: steam_api.dll SDK 1.22
(103920 B) and 1.53a (263080 B), libsteam_api.so SDK 1.23a Valve build
(76032 B) and 1.57 (375272 B); the SDK 1.23a steam_api.dll (104872 B) that
hosters copy over is known too. Anything else is printed as unrecognized with
its size and entry points.

Without -debug the steamclient line says "server folder" when the module comes
from the folder of hlds/hltv and the full path otherwise; -debug prints both
full paths.
@stamepicmorg
stamepicmorg force-pushed the bugfix/25th-edition-support branch from 952f472 to ce1a035 Compare November 16, 2026 22:58
@stamepicmorg

Copy link
Copy Markdown
Contributor Author

@wopox1337 thanks, done in 026d961: the HL25 branch of GameServer_Init is now GameServer_InitHL25(), and the version cut is PlainVersionString(), both with comments on why. In short: on the HL25 steam_api there is no exported SteamGameServer_Init, it is an inline wrapper in the SDK 1.53a/1.57 headers that calls SteamInternal_GameServer_Init(unIP, 0, ...); we do the same thing it does, so the legacy Steam port goes as 0 and the version as plain x.x.x.x (the engine passes "1.1.2.2/Stdio", Steamworks documents this argument as x.x.x.x, the master server compares it for out-of-date checks). The legacy path passes the arguments through unchanged, as before.

Also added (c05557f, ce1a035): HLDS and HLTV print the loaded steam_api and steamclient at Steam init and in version, e.g. Steam API: Steamworks SDK 1.57 (HLDS 9890 and later) / Steam client: server folder; full paths with -debug. The branch is rebased on current master (with #1066 and #1213); Linux results are in the description now.

@stamepicmorg

Copy link
Copy Markdown
Contributor Author

6153 vs 8684 is an incremental update, bugfixes and such, no engine feature changes, they are compatible so that argument does not apply, while between legacy and HL25 there are radical, incompatible changes. Even the very fact you tried to make such argument stands to show you don't really realize the point here.

steam_legacy should be used with ReHLDS, as it is what ReHLDS is designed for. There is no reason not to use it, and every reason not to. Features that help the user to use it incorrectly, is not a good feature. The reason we don't have broken servers randomly out in the wild is precisely because ReHLDS doesn't work with the incompatible HL25 engine, so server operators have to do it the correct way, which is using the steam_legacy branch. It is not a bug, its a feature. I've already made my case earlier, which you marked as "off-topic" because I guess you didn't like it? I'm not gonna re-hash the conversation again. For the maintainer, read the arguments, its your decision ultimately, but this simply is not a sensible thing to do.

@anzz1 The incompatible changes between the legacy and HL25 engines are real, but none of them reach this PR: the HL25 engine is never loaded. On an HL25 install the engine is ReHLDS, the same legacy reverse as on 8684; the install only provides content, game DLLs and steam_api. The engine ↔ game DLL interface (INTERFACE_VERSION, DLL_FUNCTIONS, NEW_DLL_FUNCTIONS) did not change in the HL25 SDK, and HL25 game DLLs run on ReHLDS in the matrices in the description (Windows and Linux).

As for broken servers: they already exist. #999, #1020 and #1140 are users who got exactly this failure from a default steamcmd install, and the usual workaround is copying an old Valve steam_api over the install by hand. With this PR the server also prints which steam_api and steamclient it loaded, so a mixed install is visible in the log instead of being guessed at.

If there is a concrete case where ReHLDS on an HL25 install behaves differently from ReHLDS on 8684 (a mod, a module, a map, a client), I'll add it to the matrix. Otherwise I'll leave the decision to the maintainers.

@Nord1cWarr1or

Copy link
Copy Markdown
Member

@Nord1cWarr1or could you help with QA (either approve the report or test it)?

Ofc, I can test these changes by creating a new server on Linux

The HL25 SDK (ValveSoftware/halflife, 2024) appends one entry to enginefuncs_t
and one virtual method to IFileSystem (same interface version VFileSystem009).
A module built with that SDK sees them and may call them; on ReHLDS the slots
did not exist, so such a call jumped to whatever followed the table.

- enginefuncs_t::pfnPEntityOfEntIndexAllEntities: NULL for an index out of
  range, a free edict, or an edict above the client slots without private
  data. Compared with the HL25 engine (HLDS 10211) in a black-box test with a
  game DLL built against the HL25 SDK: same result for every case tested.
- IFileSystem::GetFileModificationTime in filesystem_stdio: st_mtime of the
  file on disk, the pack time for a file inside a pack, 0 if not found; same
  results as the HL25 filesystem_stdio in the same test.

Metamod-r builds its own enginefuncs_t for the game DLL and needs the new
entry too.
@stamepicmorg

Copy link
Copy Markdown
Contributor Author

Added 218cb85: the two engine API entries of the HL25 SDK, so the PR now covers the whole engine API difference between the legacy and the HL25 engine, not only steam_api.

What it is. API parity with the public HL25 SDK (ValveSoftware/halflife, 2024): implemented from the declarations Valve published in that SDK, behaviour matched to the HL25 engine with a black-box test. No engine code was copied, the same way ReHLDS has always implemented the published engine API.

  • enginefuncs_t::pfnPEntityOfEntIndexAllEntities: NULL for an index out of range, a free edict, or an edict above the client slots without private data (unlike the original PEntityOfEntIndex, it also returns the last client slot while it is empty).
  • IFileSystem::GetFileModificationTime (filesystem_stdio): mtime of the file, pack time for a file inside a pack, 0 if missing.

Why. A game DLL built with the HL25 SDK copies a 160-entry enginefuncs_t; ReHLDS provided 159, so calling the new entry jumped past the end of the table. Reproduced with a minimal game DLL built against the official HL25 SDK on an HLDS 10211 install: Valve's engine returns results, ReHLDS before this commit crashes on the first call, ReHLDS with it returns the same results as Valve for every case. Details and the case list are in the description.

Where it would have crashed. Public code that calls the new entry:

  • Half-Life Unified SDK (twhl-community/halflife-unified-sdk), the usual base for new HL mods: entity search starts from pfnPEntityOfEntIndexAllEntities(0) (src/game/server/util.h);
  • PrimeXT (SNMetamorph/PrimeXT): INDEXENT() uses it (server/util.h);
  • Toodles2You/tfc: takes it in GiveFnptrsToDll.

Everything else the HL25 SDK changed is not ABI: INTERFACE_VERSION, DLL_FUNCTIONS, NEW_DLL_FUNCTIONS, the shared structs, delta tables and protocol 48 are identical. Behaviour-only differences of the HL25 engine (bigger net buffers, edict defaults, cvar hardening, sv_allow_shaders) stay out of this PR; they can go in separate PRs if wanted.

Metamod-r passes its own enginefuncs_t to the game DLL and needs the new entry as well (metamod-p already has it).

@s1lentq thanks for pointing at the structural part.

@GLoOoccK

Copy link
Copy Markdown

It might be worth taking a look at the GoldSrc-SDK repository:

https://github.com/BlackShadow/GoldSrc-SDK/

For example, here's a relevant implementation:

https://github.com/BlackShadow/GoldSrc-SDK/blob/main/GoldSrc-SDK/engine/pr_edict.cpp#L109-L121

@stamepicmorg

Copy link
Copy Markdown
Contributor Author

Linux results for 218cb85 (HL25 SDK engine API), added to the description:

  • Test game DLL built against the HL25 SDK on HLDS 10211: Valve's engine is the reference; ReHLDS without the commit segfaults (exit 139) on the first call of the new enginefuncs_t entry; with it every case returns the same as Valve, GetFileModificationTime included (plain mtime, same as Valve's filesystem_stdio).
  • Metamod-R + AMX Mod X + Reunion/ReVoice stack on 8684 and 10211, with the own Valve hl.so and with BugfixedHL-Rebased: 4/4 OK (all plugins and modules load, Steam + VAC, 5 maps / 6 map starts). The startup line shows Steamworks SDK 1.23a on 8684 and Steamworks SDK 1.57 on 10211.

@stamepicmorg

Copy link
Copy Markdown
Contributor Author

It might be worth taking a look at the GoldSrc-SDK repository:

https://github.com/BlackShadow/GoldSrc-SDK/

For example, here's a relevant implementation:

https://github.com/BlackShadow/GoldSrc-SDK/blob/main/GoldSrc-SDK/engine/pr_edict.cpp#L109-L121

@GLoOoccK Thanks, we know that repository. We deliberately do not use it as a source for ReHLDS code, and I'd ask that it not be used as a reference for code in this PR either:

  • Legal. GoldSrc-SDK is a decompilation of Valve's proprietary HL25 engine binaries, published without any license from Valve. Code derived from it would be a derivative of Valve's copyrighted code. It cannot be relicensed under ReHLDS's license, and it would expose the project to a DMCA takedown. That would hurt every server and project that depends on ReHLDS, not only this PR.
  • Trust. ReHLDS exists because Valve has tolerated community work on GoldSrc servers for years. We want to keep it that way: Valve should be able to look at any new code here and see that it is built on what they published, not on their leaked or decompiled internals. Hosters and server owners need the same assurance for what they run.
  • Not needed. Both entries are small. The declarations come from the public HL25 SDK Valve released (ValveSoftware/halflife). The behaviour was matched to the HL25 engine with a black-box test: a game DLL built against the HL25 SDK, run on Valve's HLDS 10211 and on ReHLDS, gives identical results on Windows and Linux (see the description). This is a clean-room approach: the spec is the public SDK, the reference is the observable behaviour of Valve's shipped engine, and no engine code is involved.

So for new engine API work the rule here is the same: public SDK headers plus black-box tests against Valve's binaries, no code from decompilations.

@tschumann

tschumann commented Nov 20, 2026 via email

Copy link
Copy Markdown

… not in HL25

The engine entry exists since build 8279 (ValveSoftware/halflife#2272); only the public SDK header
got it with the HL25 update. Black-box test confirms the same behaviour on HLDS 8308, 8684 and 10211.
@stamepicmorg

Copy link
Copy Markdown
Contributor Author

@tschumann thanks, you're right: the entry is older than HL25. Valve added it to the engine in build 8279 (June 2019) as a parallel, fixed variant of PEntityOfEntIndex. They first fixed PEntityOfEntIndex itself, then reverted it because CZ:DS relied on the old behaviour (ValveSoftware/halflife#2272, opened by kohtep; you asked about the table position in that thread). Only the public eiface.h got the declaration with the HL25 SDK update.

I re-ran the same black-box test DLL on vanilla HLDS 8308 and 8684. The entry is there, and the results match 10211 and this PR: only the last client slot differs from PEntityOfEntIndex. I fixed the comments in c1711f5 and updated the description.

So ReHLDS has been missing this export since 2019, not only since HL25. It still belongs to this PR, which brings the engine API up to the current Valve engine.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Difficulty: 🟢 easy Easy task that can be completed quickly. Engine: 📀 reHLDS Case refers to reHLDS engine. Engine: 📺 reHLTV Case refers to reHLDS version. OS: 🪟 Windows Case refers to Windows. Priority: ⚠️ medium Medium priority tasks that should be addressed soon. Status: 🗣️ needs feedback Comments or feedback needed from the community or team. Type: 🚀 enhancement Improvement or addition of a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants