Launch Linux and Windows through a launcher, with SDK dependency#2019
Conversation
|
Marking as a draft for now; this proved the problem and POC for the fix (with the patch POC in discord), but it needs to be tidied up before proper review. |
|
Fix-proof-of-concept is here: https://discord.com/channels/1235346473827434517/1526783378718855268/1526787211507535954 |
|
Windows build @ sunmachine#1 |
Rename the launcher binary to neo_linux64: Linux cannot have both the executable and the game/neo mod directory under the same name at the install root, and GetExecutableModName strips the _linux64 suffix so the default -game dir is still neo. Add src/common to the include path and include tier1/strtools.h before steam_api.h, since our patched matchmakingtypes.h uses V_strcpy_safe. When NEO_COPY_LIBRARIES is on, also stage libsteam_api.so into game/bin/linux64/ where the launcher dlopens it.
added neo ifdefs also
ef21e47 to
3977f72
Compare
steam_appid.txt written by the launcher now identifies the mod without requiring -DNEO_MOD_APPID at configure time.
Follows the existing NEO_INSTALL_* install/CPack convention; produces a -launcher artifact holding the launcher binary for the install root. steam_api already ships with the engine binaries in bin/.
The launcher now loads binaries from its own directory on both platforms. The Source SDK Base 2013 MP install remains a required asset dependency checked at startup, because gameinfo.txt mounts hl2/platform content from it, but it is no longer used as an execution root and SDK_EXEC_DIR is no longer set. Windows also gains the default -game injection the POSIX path already had (neo_win64.exe -> -game <root>\neo). The Windows flow is untested and needs scrutiny before use.
The launcher now mirrors the Windows flow: it prepends its own bin/linux64 to LD_LIBRARY_PATH (re-exec'ing itself once, since the dynamic linker reads the variable only at startup), loads launcher.so from the mod's own install, and calls LauncherMain directly. Environment obligations of the stock launch script are replicated: working directory at the install root, fd soft limit raised to 2048, __GL_THREADED_OPTIMIZATIONS, ENABLE_PATHMATCH when pathmatch.inf exists, and re-launch on exit status 42. No SDK Base binaries or scripts are involved in the launch chain anymore.
The engine opens |appid_243750| search paths with the final word of the SDK Base 2013 Multiplayer folder name lowercased, which silently mounts nothing on case-sensitive filesystems (observed via strace: every SDK-content open used ".../Source SDK Base 2013 multiplayer/..."). The launcher now creates a symlink under that mangled name pointing at the real install when the path does not already resolve. Failure to create it degrades to a warning.
readlink does not NUL-terminate its buffer. The result feeds GetBaseDir, execv, and argv[0], so an unterminated path could carry stack garbage into every downstream path computation.
The debugger-wait helpers existed but nothing called them, so the flag did nothing. Wait right after the bootstrap re-exec, before any Steam or engine work, so a debugger can attach to the process that loads the engine.
There was a problem hiding this comment.
Works and compiles without warning on windows. Tested playing on a v30 dedicated server, no issues noticed.
Tested:
- Running on Windows works
- Running on Windows without SDK 2013 already installed works
- Running on Linux works, though I noticed some console errors regarding shaders, unsure if its expected. A more seasoned linux player can verify
- Running on Linux without SDK 2013 already installed works (check comments)
|
A TODO on this is to create a workflow for github actions that produces a new archive containing the launcher as part of the builds |
DESTROYGIRL
left a comment
There was a problem hiding this comment.
Working on linux / windows with SDK install prompt as well
|
Marking TODOs as satisfied. |
d454beb to
fa05a5a
Compare
d454beb to
fa05a5a
Compare
4fa0e47 to
e2eb409
Compare
Co-authored-by: @DESTROYGIRL
Description
NT;RE ships its own engine binaries on its own appid; only the HL2/platform assets come from Source SDK Base 2013 MP, mounted through the
|appid_243750|search paths ingameinfo.txt. Valve's stock launcher assumes the opposite layout and runs the game from the SDK install, which is why the SDK asset mounts silently fail on Linux. This PR makeslauncher_maina real standalone mod launcher: the game runs from its own install with its ownbin/, and the SDK is nothing more than an asset dependency.Much of its functionality can be found in Valve's
hl2.shscript (the oldntre.shscript), except now ported over directly into the launcher.Details:
bin/linux64LD_LIBRARY_PATH, dlopen ourlauncher.so, nohl2.shor Valve bootstraps.|appid_243750|mounts with the SDK name partly lowercased (silent ENOENT on case-sensitive filesystems) via self-repairing symlink.MXR_LoadAllSoundMixers.-gamein launch options; derived from the binary name (neo_linux64->neo).-wait_for_debuggernow works on Linux.NEO_MOD_APPIDdefaults to 3172910; opt-inNEO_INSTALL_LAUNCHERpackages the launcher per theNEO_INSTALL_*conventions. No CI changes.SDK_EXEC_DIRfix is removed, superseded by this layout.sourcemods/and explicit-gamelaunches don't use this launcher.Verified on Linux via the Steam Play button (
-steamonly): full bot match with all SDK content mounted, error dialog when the SDK files are missing, stale symlink repaired automatically. In-gamepathdump in the comments.Warning
The Windows flow is code-complete but untested; needs a run on a real Windows install, including with the SDK absent.
Depot follow-ups (not this PR): launcher binaries at the install root, launch options pointing at them with
-steamonly, drop the renamed Valve bootstraps, preservebin/filename casing (engine dlopensGameUI.soetc. by exact name).Testing on Linux
Build (branch: linux-build-fix)
src/, in a Steam Runtime 3.0 (sniper) environment:cmake --preset linux-releasecmake --build build/linux-release --target launcher_mainsrc/build/linux-release/launcher_main/neo_linux64Overlay onto Steam (local testing only)
sdk-dependency-testingbranch, "-steam only (dev testing)" launch option.neo_linux64into~/.local/share/Steam/steamapps/common/NEOTOKYOREBUILD/(next toneo/).Launch game without script (dev testing)option at Play-time.ntre.shthere with this shim, thenchmod +x neo_linux64 ntre.sh:Depot Changes
ntre.shisn't required anymore.neo_linux64as the shim's functionality was ported into the executable.Toolchain
Linked Issues
TODO
Update CI so that we can switch NEO_BUILD_LAUNCHER to ON by default.