Skip to content

Commit 0667aa1

Browse files
authored
Merge pull request #27 from mo10/bug_fix
Fix macos support. Fix run script.
2 parents 2441a60 + ad71cae commit 0667aa1

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

assets/nix/run.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,18 @@ doorstop_directory="${BASEDIR}/"
246246
doorstop_name="libdoorstop.${lib_extension}"
247247

248248
export LD_LIBRARY_PATH="${doorstop_directory}:${corlib_dir}:${LD_LIBRARY_PATH}"
249-
export LD_PRELOAD="${doorstop_name}:${LD_PRELOAD}"
250-
export DYLD_LIBRARY_PATH="${doorstop_directory}:${corlib_dir}:${DYLD_LIBRARY_PATH}"
251-
export DYLD_INSERT_LIBRARIES="${doorstop_name}:${DYLD_INSERT_LIBRARIES}"
249+
if [ -z "$LD_PRELOAD" ]; then
250+
export LD_PRELOAD="${doorstop_name}"
251+
else
252+
export LD_PRELOAD="${doorstop_name}:${LD_PRELOAD}"
253+
fi
254+
255+
export DYLD_LIBRARY_PATH="${doorstop_directory}:${DYLD_LIBRARY_PATH}"
256+
if [ -z "$DYLD_INSERT_LIBRARIES" ]; then
257+
export DYLD_INSERT_LIBRARIES="${doorstop_name}"
258+
else
259+
export DYLD_INSERT_LIBRARIES="${doorstop_name}:${DYLD_INSERT_LIBRARIES}"
260+
fi
252261

253262
# shellcheck disable=SC2086
254263
exec "$executable_path" $rest_args

src/nix/entrypoint.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ __attribute__((constructor)) void doorstop_ctor() {
7474

7575
void *unity_player = plthook_handle_by_name("UnityPlayer");
7676

77-
// TODO: Chekc if this still works on macOS
78-
if (unity_player && plthook_open_by_address(&hook, unity_player) == 0) {
77+
if (unity_player && plthook_open_by_handle(&hook, unity_player) == 0) {
7978
LOG("Found UnityPlayer, hooking into it instead");
8079
} else if (plthook_open(&hook, NULL) != 0) {
8180
LOG("Failed to open current process PLT! Cannot run Doorstop! "

0 commit comments

Comments
 (0)