Skip to content

Launch Linux and Windows through a launcher, with SDK dependency#2019

Merged
DESTROYGIRL merged 21 commits into
NeotokyoRebuild:masterfrom
sunmachine:linux-build-fix
Jul 19, 2026
Merged

Launch Linux and Windows through a launcher, with SDK dependency#2019
DESTROYGIRL merged 21 commits into
NeotokyoRebuild:masterfrom
sunmachine:linux-build-fix

Conversation

@sunmachine

@sunmachine sunmachine commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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 in gameinfo.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 makes launcher_main a real standalone mod launcher: the game runs from its own install with its own bin/, and the SDK is nothing more than an asset dependency.

Much of its functionality can be found in Valve's hl2.sh script (the old ntre.sh script), except now ported over directly into the launcher.

Details:

  • Linux launches in-process like Windows: own bin/linux64 LD_LIBRARY_PATH, dlopen our launcher.so, no hl2.sh or Valve bootstraps.
  • Works around the engine opening |appid_243750| mounts with the SDK name partly lowercased (silent ENOENT on case-sensitive filesystems) via self-repairing symlink.
  • Missing or broken SDK install shows an error dialog instead of crashing in MXR_LoadAllSoundMixers.
  • No -game in launch options; derived from the binary name (neo_linux64 -> neo).
  • -wait_for_debugger now works on Linux.
  • CMake: NEO_MOD_APPID defaults to 3172910; opt-in NEO_INSTALL_LAUNCHER packages the launcher per the NEO_INSTALL_* conventions. No CI changes.
  • The earlier SDK_EXEC_DIR fix is removed, superseded by this layout.
  • Dev setups are unaffected; sourcemods/ and explicit -game launches don't use this launcher.

Verified on Linux via the Steam Play button (-steam only): full bot match with all SDK content mounted, error dialog when the SDK files are missing, stale symlink repaired automatically. In-game path dump 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 -steam only, drop the renamed Valve bootstraps, preserve bin/ filename casing (engine dlopens GameUI.so etc. by exact name).

Testing on Linux

Build (branch: linux-build-fix)

  • From src/, in a Steam Runtime 3.0 (sniper) environment:
    • cmake --preset linux-release
    • cmake --build build/linux-release --target launcher_main
  • Output: src/build/linux-release/launcher_main/neo_linux64

Overlay onto Steam (local testing only)

  • Set NT;RE to the sdk-dependency-testing branch, "-steam only (dev testing)" launch option.
    • You don't need to do a compatibility override for Sniper, it's already configured depot-side.
  • Copy neo_linux64 into ~/.local/share/Steam/steamapps/common/NEOTOKYOREBUILD/ (next to neo/).
  • NOTE: This step can be skipped if you're using the new Launch game without script (dev testing) option at Play-time.
    • Replace ntre.sh there with this shim, then chmod +x neo_linux64 ntre.sh:
    #!/bin/bash
    exec "$(cd "${0%/*}" && pwd)/neo_linux64" "$@"
  • Press Play. Optional: -condebug in launch options writes neo/console.log.
Screenshot 2026-07-18 at 12 55 51

Depot Changes

  • ntre.sh isn't required anymore.
  • The depot will need to execute from neo_linux64 as the shim's functionality was ported into the executable.

Toolchain

  • Windows MSVC VS2022
  • Linux GCC 10 Sniper 3.0

Linked Issues

  • fixes #
  • related #

TODO

  • Test Windows.
  • Update CI so that we can switch NEO_BUILD_LAUNCHER to ON by default.
    • To be done in a follow-up PR.

@sunzenshen
sunzenshen requested a review from a team July 14, 2026 03:38
Comment thread src/CMakeLists.txt Outdated
@sunmachine
sunmachine marked this pull request as draft July 15, 2026 03:34
@sunmachine

Copy link
Copy Markdown
Contributor Author

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.

@sunmachine

Copy link
Copy Markdown
Contributor Author

@DESTROYGIRL DESTROYGIRL self-assigned this Jul 15, 2026
@DESTROYGIRL

Copy link
Copy Markdown
Contributor

Windows build @ sunmachine#1

sunmachine and others added 5 commits July 18, 2026 12:14
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
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.
@sunmachine
sunmachine marked this pull request as ready for review July 18, 2026 17:54
@sunmachine sunmachine changed the title Fix silent SDK asset mounting failure in standalone Linux installs Launch Linux and Windows through a launcher, with SDK dependency Jul 18, 2026
@DESTROYGIRL
DESTROYGIRL requested review from a team and DESTROYGIRL and removed request for a team July 18, 2026 19:51

@DESTROYGIRL DESTROYGIRL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread src/launcher_main/main.cpp
Comment thread src/launcher_main/CMakeLists.txt
Comment thread src/launcher_main/main.cpp
@DESTROYGIRL

DESTROYGIRL commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

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
(maybe this can be handled in a different PR...?)

@DESTROYGIRL DESTROYGIRL added this to the Bug Cleanup milestone Jul 18, 2026
@DESTROYGIRL DESTROYGIRL added the Build System CMake and other build-related stuff label Jul 18, 2026
@DESTROYGIRL DESTROYGIRL added the Tournament Priority Issues to be prioritized for the upcoming NT;RE tournament label Jul 18, 2026
@sunmachine
sunmachine requested a review from DESTROYGIRL July 19, 2026 01:15
DESTROYGIRL
DESTROYGIRL previously approved these changes Jul 19, 2026

@DESTROYGIRL DESTROYGIRL left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working on linux / windows with SDK install prompt as well

@sunmachine

Copy link
Copy Markdown
Contributor Author

Marking TODOs as satisfied.

Comment thread src/launcher_main/CMakeLists.txt Outdated
Comment thread src/launcher_main/CMakeLists.txt Outdated
Comment thread src/CMakeLists.txt
DESTROYGIRL
DESTROYGIRL previously approved these changes Jul 19, 2026
Masterkatze
Masterkatze previously approved these changes Jul 19, 2026

@Masterkatze Masterkatze left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DESTROYGIRL
DESTROYGIRL merged commit 033fb35 into NeotokyoRebuild:master Jul 19, 2026
7 checks passed
@sunmachine
sunmachine deleted the linux-build-fix branch July 19, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build System CMake and other build-related stuff Tournament Priority Issues to be prioritized for the upcoming NT;RE tournament

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants