Add Metamod-R timer fallback and static libstdc++ for legacy gamemod ABI#3
Open
APGRoboCop wants to merge 1 commit intomasterfrom
Open
Add Metamod-R timer fallback and static libstdc++ for legacy gamemod ABI#3APGRoboCop wants to merge 1 commit intomasterfrom
APGRoboCop wants to merge 1 commit intomasterfrom
Conversation
Two related fixes for SteamPipe/legacy compatibility:
1. adminmod_timer fallback for Metamod-R
Metamod-R drops LINK_ENTITY_TO_PLUGIN, so CREATE_NAMED_ENTITY("adminmod_timer")
in AM_ClientStart() returns null and the previous code aborted via am_exit(1).
Without the timer, all timer-driven say commands (timeleft, nextmap, votes)
silently die.
On null entity creation we now spin up a free-standing CTimer instance backed
by a static entvars_t, set s_bTimerFallbackActive = true, and poll its
nextthink from AM_StartFrame() instead of relying on the engine to fire it.
GetAdminTimer() centralises the lookup so callers don't care which path is
active. State is reset in AM_Initialize() so map changes can re-detect.
Also migrated the remaining direct GET_PRIVATE(pTimerEnt) call sites in
admin_commands.cpp (changelevel, kill_timer, get_timer, set_timer,
vote_multiple, vote_allowed) to use GetAdminTimer() so they work in both
modes.
2. Static libstdc++/libgcc in the Linux Makefile
The previous flags had -static-libstdc++ on the compile line (no-op with -c)
and -nodefaultlibs on the link line (which stripped libstdc++ before anything
could re-add it), so the resulting .so dynamically depended on the build
host's libstdc++.so.6. That broke loading on pre-SteamPipe gamemod hosts
(TS3 3.0, Action Half-Life, FireArms 3.0) whose runtime is older than
the build machine.
Moved -static-libstdc++ -static-libgcc to SHLIBLDFLAGS where they actually
take effect, dropped -nodefaultlibs, and added -Wl,--no-as-needed. Cleared
the malformed STDCPPLIB=-L<path-to-.so> (the -L flag takes a directory).
Result: ldd on the .so should show no libstdc++/libgcc dependency, matching
what AMXX 1.8.2+ does on Linux.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CREATE_NAMED_ENTITY("adminmod_timer")returns null on Metamod-R because it doesn't exposeLINK_ENTITY_TO_PLUGIN; previously this aborted the DLL viaam_exit(1)and silently broke every timer-driven say command (timeleft,nextmap, votes). On null we now spin up a free-standingCTimerbacked by a staticentvars_tand poll itsnextthinkfromAM_StartFrame()instead of relying on the engine to fire it.GetAdminTimer()centralises the lookup so callers don't care which path is active.-static-libstdc++on the compile line (no-op with-c) and-nodefaultlibson the link line (which stripped libstdc++ before anything could re-add it), so the resulting.sodynamically depended on the build host'slibstdc++.so.6. That broke loading on pre-SteamPipe gamemod hosts (TS3 3.0, Action Half-Life, FireArms 3.0). Moved the static flags toSHLIBLDFLAGSwhere they actually take effect, dropped-nodefaultlibs, added-Wl,--no-as-needed, and cleared the malformedSTDCPPLIB=-L<path-to-.so>(-Ltakes a directory).GET_PRIVATE(pTimerEnt)call sites inadmin_commands.cpp(changelevel, kill_timer, get_timer, set_timer, vote_multiple, vote_allowed) toGetAdminTimer()so they work in fallback mode.vote_allowedwould otherwise have silently returned 0 forever under Metamod-R.Why
Reported by a server admin running Metamod-R: AdminMod refuses to load. Independently, the SteamPipe-built Linux
.sodoesn't load against legacy gamemods (TS3/AHL/FA3), forcing them to stay on AdminMod 2.50.60. Both root causes are addressed here -- the fallback restores Metamod-R support without affecting Metamod-P/-AM (which keep the original entity path), and the static-runtime build matches what AMXX 1.8.2+ does on Linux for cross-host compatibility.Test plan
Ometamodtarget on Linux. Confirmldd admin_mm_i386.soshows nolibstdc++.so.6orlibgcc_s.so.1dependency.say timeleft/say nextmap/vote_multiplework as before.WARNING: CREATE_NAMED_ENTITY failed for adminmod_timer; using AM_StartFrame polling fallback, then timer-driven say commands fire correctly.changelevelintermission timer set: confirm the timer survives and fires on the next map.Reviewer notes
admin_mod_mm.dllusers won't see any behavior change.s_fallbackTimeris a single static instance with module lifetime;AM_Initialize()resetss_bTimerFallbackActiveso each map change re-detects whether the entity link is available.🤖 Generated with Claude Code