diff --git a/src/gl/inject_egl.cpp b/src/gl/inject_egl.cpp index 95debf40..f5586385 100644 --- a/src/gl/inject_egl.cpp +++ b/src/gl/inject_egl.cpp @@ -20,7 +20,9 @@ static void* get_egl_proc_address(const char* name) { void *func = nullptr; static void *(*pfn_eglGetProcAddress)(const char*) = nullptr; if (!pfn_eglGetProcAddress) { - void *handle = real_dlopen("libEGL.so", RTLD_LAZY | RTLD_NOLOAD); + void *handle = real_dlopen("libEGL.so", RTLD_LAZY); + if (!handle) + handle = real_dlopen("libEGL.so.1", RTLD_LAZY); if (!handle) { SPDLOG_ERROR("Failed to open " MANGOHUD_ARCH " libEGL.so.1: {}", dlerror()); } else { @@ -44,7 +46,6 @@ static void* get_egl_proc_address(const char* name) { EXPORT_C_(unsigned int) eglSwapBuffers( void* dpy, void* surf); EXPORT_C_(unsigned int) eglSwapBuffers( void* dpy, void* surf) { - SPDLOG_INFO("eglSwapBuffers"); static int (*pfn_eglSwapBuffers)(void*, void*) = nullptr; if (!pfn_eglSwapBuffers) pfn_eglSwapBuffers = reinterpret_cast(get_egl_proc_address("eglSwapBuffers")); diff --git a/src/hook_dlsym.cpp b/src/hook_dlsym.cpp index c41ab7c0..dcb13db2 100644 --- a/src/hook_dlsym.cpp +++ b/src/hook_dlsym.cpp @@ -1,14 +1,7 @@ #include #include #include -#include #include "real_dlsym.h" -#include -#include - -#include - -void *egl_handle = NULL; EXPORT_C_(void*) dlsym(void * handle, const char * name) { @@ -21,23 +14,6 @@ EXPORT_C_(void*) dlsym(void * handle, const char * name) if (!find_egl_ptr) find_egl_ptr = reinterpret_cast (real_dlsym(RTLD_NEXT, "mangohud_find_egl_ptr")); - char path_real[4096] = {0}; - //pick a libEGL to use since ANGLE uses the same file name - if(handle != RTLD_DEFAULT && handle != RTLD_NEXT) - { - struct link_map *path; - dlinfo(handle, RTLD_DI_LINKMAP, &path); - - int ret = readlink(path->l_name, path_real, 4096); - if (ret < 0) { - strcpy(path_real, path->l_name); - } - - if (strstr(path_real, "libEGL") && !egl_handle) { - egl_handle = handle; - } - } - void* func = nullptr; void* real_func = real_dlsym(handle, name); @@ -49,8 +25,7 @@ EXPORT_C_(void*) dlsym(void * handle, const char * name) } } - if (find_egl_ptr && real_func && egl_handle == handle) { - fprintf(stderr, "name %s\n", name); + if (find_egl_ptr && real_func) { func = find_egl_ptr(name); if (func) { //fprintf(stderr,"%s: local: %s\n", __func__ , name);