Repository navigation
Half-Life 25th Anniversary Update compablity - #1106
stamepicmorg wants to merge 8 commits into
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
fd897ce to
dfa5960
Compare
This comment was marked as resolved.
This comment was marked as resolved.
af7ee72 to
b189cf7
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
069282a to
b3c449a
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
|
@hun1er could you please review this PR? |
|
hello, i will do some tests on linux too and update table in header. |
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:
Should we add them, and if yes, here or in a separate PR? Things to weigh:
|
|
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. |
|
@anzz1 This PR does not mix engine versions. There is no HL25 engine code in it: What it changes is which
Engine-side HL25 changes are explicitly out of scope (see "What this is, and what it is not"), If there is a concrete case where this breaks something (a module, a mod, a platform), I'd like to By the same logic ReHLDS should not run on 7xxx/8684 either: it was reversed from 6152/6153, yet 8684 ( |
|
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.
|
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.
952f472 to
ce1a035
Compare
|
@wopox1337 thanks, done in 026d961: the HL25 branch of Also added (c05557f, ce1a035): HLDS and HLTV print the loaded |
@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 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 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. |
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.
|
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 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.
Why. A game DLL built with the HL25 SDK copies a 160-entry Where it would have crashed. Public code that calls the new entry:
Everything else the HL25 SDK changed is not ABI: Metamod-r passes its own @s1lentq thanks for pointing at the structural part. |
|
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 |
|
Linux results for 218cb85 (HL25 SDK engine API), added to the description:
|
@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:
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. |
|
The final entry in the engine functions struct predates Half-Life 25 -
check on GitHub as there is discussion and the implementation. I think
solokiller raised the initial bug.
…On Tuesday, November 17, 2026, STAM ***@***.***> wrote:
*stamepicmorg* left a comment (rehlds/ReHLDS#1106)
<#1106 (comment)>
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 <https://github.com/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.
—
Reply to this email directly, view it on GitHub
<#1106?email_source=notifications&email_token=AA34IYQAUKZIKGFQ7GHXHV35ZRHJJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMOJUHE2DOMRUGQ42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#issuecomment-6949472449>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA34IYVESOU7YHYZEO3RVED5ZRHJJAVCNFSNUABEKJSXA33TNF2G64TZHMZTKMBVGE2TIOB3JFZXG5LFHMZTEMRZGM4TEOJXGSQXMAQ>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AA34IYTNRLCOUTGFETY6L735ZRHJJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMOJUHE2DOMRUGQ42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSVGM33PORSXEX3JN5ZQ>
and Android
<https://github.com/notifications/mobile/android/AA34IYV7RWF6FHC2ZTIIKQL5ZRHJJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMOJUHE2DOMRUGQ42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSXGM33PORSXEX3BNZSHE33JMQ>.
Download it today!
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
… 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.
|
@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 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 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. |
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 thesteam_apithat comes with the HLDS build itself, old or new.What this is, and what it is not
steam_legacybranch (8684) or swap Valve'ssteam_apiby 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.steam_api. For hosters that means: install HLDS with steamcmd, put ReHLDS on top, done; nosteam_legacybranch, no copying old Valve dlls around.trigger_pushscaling with server fps ([BUG]: 25th anniversary update trigger_push entities are overpowered (scales with server FPS) #1149);FCVAR_PRIVILEGED,FCVAR_FILTERSTUFFTEXT,FCVAR_FILTERCHARS,FCVAR_NOBADPATHS); the bits are free in ReHLDS, flags are stored but not enforced.HL25 game content, HL25 game DLLs (Valve's
hl.dll, BugfixedHL-Rebased) and HL25 clients work on it, as tested below.delta.lstof the HL25 install. HL25 widenedeflagsinvalve/delta.lstto 2 bits for the newEFLAG_FLESH_SOUNDflag (the HL25 game DLL sets it, the HL25 client plays flesh hit sounds from it). The engine sends whatdelta.lstdescribes, so an olddelta.lstcopied over from a legacy mod setup silently drops the flag. Mods that ship their owndelta.lstshould merge that change.Background
HLDS has shipped exactly two
steam_apibuilds over its whole history (checked against all 64 builds since Feb 2013):steam_api.dlllibsteam_api.soThe HL25 builds dropped three flat exports ReHLDS imported directly:
SteamGameServer_Init(),SteamGameServer()andSteamApps(). Soswds.dll/engine_i486.so(andproxy.dll/proxy.so) could not load on an HL25 install unless the oldsteam_apiwas copied over it.What changes
New header-only
rehlds/common/SteamApiCompat.hresolves those three at run time: the legacy exports when present, otherwiseSteamInternal_GameServer_InitandSteamInternal_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 useISteamGameServerthrough 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.53aSteamGameServer_Initwrapper 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_apiandsteamclientit loaded, at Steam init and inversion(HLDS and HLTV):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
unrecognizedwith 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).-debugprints 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:
enginefuncs_t::pfnPEntityOfEntIndexAllEntities(last entry of the table; in Valve's engine since build 8279 / 2019, [GoldSource] PEntityOfEntIndex may not return the last player ValveSoftware/halflife#2272, public header only since the HL25 SDK);IFileSystem::GetFileModificationTimeinfilesystem_stdio(new last method, interface version stillVFileSystem009).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.dllimports 10 functions fromsteam_api.dllandproxy.dllimports 2, and all of them exist in both 1.22 and 1.53a; the same holds for the Linux.sofiles.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 newIFileSystemmethod for a few files), run on an HLDS 10211 install, Windows and Linux (theenginefuncs_tpart was also re-run on vanilla HLDS 8308 and 8684 on Windows: same results):swds.dll/engine_i486.so, ownfilesystem_stdio)On Linux the old
GetFileTimereturnsmax(ctime, mtime)whileGetFileModificationTimereturns the plain mtime; the ReHLDSfilesystem_stdioreturns 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):
src/game/server/util.h, entity search starts frompfnPEntityOfEntIndexAllEntities(0);INDEXENT()inserver/util.hgoes through it;GiveFnptrsToDll.Metamod-r passes its own
enginefuncs_tto 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):
Steam APIlinehl.so* with the legacy
libstdc++.so.6/libgcc_s.so.1of 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.Steam API/Steam clientlinesManual joins with a real HL25 Steam client (Windows)
steam_apiSTEAM USERID validated-insecureThe 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.steam_apihl.soOK = 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.1in 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:
steam_api1.53a needs a currentsteamclient.dll(the one steamcmd installs today); with a 2020 steamclient its init fails. steamcmd installs are fine.Unable to initialize Steamon Windows boxes that have the Steam client: launcher: prefer the server's own steamclient.dll on Windows #1213 (merged).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 importedSteamGameServer_Init(),SteamGameServer()andSteamApps()directly; those exports are gone in the HL25 builds, so the engine fails to load:undefined symbol: SteamGameServer_Init/SteamGameServer(25th Anniversarry compatibility #999, The latest version of HLDS 9907 is not compatible with the latest version of Rehlds #1020, [Prioblem]: undefined symbol: SteamGameServer_Init #1140)swds.dllbefore the console opens.The reverse does not work either: the vanilla HL25
swds.dllneedsSteamInternal_*, which SDK 1.22 does not have. So the two cannot share one folder with the samesteam_api.Approaches tried or considered
steam_legacy(8684) branch, the usual advice in #1020/#1140-insecure, Reunion, copying the oldsteam_apiover HL25 by handsteam_api.dll/libsteam_api.sofromrehlds/libinto the release and re-sign the dll in CIsteamworks_v160branch (Dec 2024): Steamworks headers upgraded to SDK 1.60, plus anISteamGameServer011adapter so the ReHLDS API stays the same for modulesSteamInternal_GameServer_Init_V2, which HL25's ownsteam_api1.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.VERSION_SAFE_STEAM_API_INTERFACES, i.e.SteamGameServer_InitSafe+CSteamAPIContext(interfaces throughSteamClient())steam_api(1.53a/1.57) still exportsSteamGameServer_InitSafeandSteamClient, 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.Why 6 works:
steam_apionly forwards an interface version string to steamclient, and steamclient still serves the old versions. HL25's own engine does the same: itsswds.dllasks forSteamGameServer015through a 1.53a dll whose native version is 014. ReHLDS keeps asking forSteamGameServer011/STEAMAPPS_INTERFACE_VERSION005, soISteamGameServerhanded to modules through the ReHLDS API (Reunion) is unchanged.Data behind it
steam_apifunctions the engine used, 10 exist in both versions, 3 do not; HLTVproxy.dllused 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).enginefuncs_tgot one entry at the end (pfnPEntityOfEntIndexAllEntities, which the engine has exported since build 8279 in 2019; the header only caught up with HL25),IFileSystemone method (GetFileModificationTime);INTERFACE_VERSION,DLL_FUNCTIONSandNEW_DLL_FUNCTIONSare unchanged. Both are implemented by this PR (see above).-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.trigger_pushscaling 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 oldsteam_api; the tests in the description above cover this PR's code with each build's ownsteam_api.Related
Unable to initialize Steamon Windows when the Steam client is (or was) installed:steam_apitakessteamclient.dllfrom the registry. Independent of this PR.steam_api1.53a needs a currentsteamclient.dll; steamcmd installs one, a 2020 copy fails.