From aeb4ef700aad1775745286af90fc8aebf7f8a206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=9010?= <0w0@0w0.pw> Date: Sat, 22 Oct 2022 23:29:38 +0800 Subject: [PATCH] Fix notworking on linux --- src/nix/entrypoint.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nix/entrypoint.c b/src/nix/entrypoint.c index 1bf4556..61ebde6 100644 --- a/src/nix/entrypoint.c +++ b/src/nix/entrypoint.c @@ -6,6 +6,12 @@ #include "../util/util.h" #include "./plthook/plthook.h" +#if defined(__APPLE__) +#define PLTHOOK_OPEN_BY_HANDLE_OR_ADDRESS plthook_open_by_handle +#else +#define PLTHOOK_OPEN_BY_HANDLE_OR_ADDRESS plthook_open_by_address +#endif + void capture_mono_path(void *handle) { char_t *result; get_module_path(handle, &result, NULL, 0); @@ -74,7 +80,7 @@ __attribute__((constructor)) void doorstop_ctor() { void *unity_player = plthook_handle_by_name("UnityPlayer"); - if (unity_player && plthook_open_by_handle(&hook, unity_player) == 0) { + if (unity_player && PLTHOOK_OPEN_BY_HANDLE_OR_ADDRESS(&hook, unity_player) == 0) { LOG("Found UnityPlayer, hooking into it instead"); } else if (plthook_open(&hook, NULL) != 0) { LOG("Failed to open current process PLT! Cannot run Doorstop! "