Skip to content

Commit 7fcce68

Browse files
authored
run.sh: keep the Steam overlay on macOS via STEAM_DYLD_INSERT_LIBRARIES (#121)
/bin/sh is a platform binary, so the DYLD_INSERT_LIBRARIES that Steam sets (its loader and overlay) is stripped before run.sh sees it, and the game was started with only libdoorstop.dylib inserted. Steam passes the same list as STEAM_DYLD_INSERT_LIBRARIES; use it when DYLD_INSERT_LIBRARIES is empty and keep it after Doorstop, as Valve's own launch scripts and MelonLoader do.
1 parent d8973b2 commit 7fcce68

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎assets/nix/run.sh‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,17 @@ case ${os_type} in
319319
;;
320320
Darwin*)
321321
dyld_library_path="${doorstop_directory}:${DYLD_LIBRARY_PATH}"
322-
if [ -z "$DYLD_INSERT_LIBRARIES" ]; then
322+
323+
# This script runs under /bin/sh, which is a platform binary, so a
324+
# DYLD_INSERT_LIBRARIES that Steam sets for the game (its loader and
325+
# overlay) is stripped before we get here. Steam passes the same list
326+
# as STEAM_DYLD_INSERT_LIBRARIES for launch scripts like this one; keep
327+
# it after Doorstop so the Steam overlay still works.
328+
inherited_libraries="${DYLD_INSERT_LIBRARIES:-${STEAM_DYLD_INSERT_LIBRARIES}}"
329+
if [ -z "$inherited_libraries" ]; then
323330
dyld_insert_libraries="${doorstop_name}"
324331
else
325-
dyld_insert_libraries="${doorstop_name}:${DYLD_INSERT_LIBRARIES}"
332+
dyld_insert_libraries="${doorstop_name}:${inherited_libraries}"
326333
fi
327334

328335
# Always go through arch. A universal executable runs as x86_64 whenever

0 commit comments

Comments
 (0)