|
|
@ -1,14 +1,7 @@
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <link.h>
|
|
|
|
|
|
|
|
#include "real_dlsym.h"
|
|
|
|
#include "real_dlsym.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void *egl_handle = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EXPORT_C_(void*) dlsym(void * handle, const char * name)
|
|
|
|
EXPORT_C_(void*) dlsym(void * handle, const char * name)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -21,25 +14,9 @@ EXPORT_C_(void*) dlsym(void * handle, const char * name)
|
|
|
|
if (!find_egl_ptr)
|
|
|
|
if (!find_egl_ptr)
|
|
|
|
find_egl_ptr = reinterpret_cast<decltype(find_egl_ptr)> (real_dlsym(RTLD_NEXT, "mangohud_find_egl_ptr"));
|
|
|
|
find_egl_ptr = reinterpret_cast<decltype(find_egl_ptr)> (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* func = nullptr;
|
|
|
|
void* real_func = real_dlsym(handle, name);
|
|
|
|
void* real_func = real_dlsym(handle, name);
|
|
|
|
|
|
|
|
bool is_angle = !!real_dlsym(handle, "eglStreamPostD3DTextureANGLE");
|
|
|
|
|
|
|
|
|
|
|
|
if (find_glx_ptr && real_func) {
|
|
|
|
if (find_glx_ptr && real_func) {
|
|
|
|
func = find_glx_ptr(name);
|
|
|
|
func = find_glx_ptr(name);
|
|
|
@ -49,8 +26,7 @@ EXPORT_C_(void*) dlsym(void * handle, const char * name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (find_egl_ptr && real_func && egl_handle == handle) {
|
|
|
|
if (find_egl_ptr && real_func && !is_angle) {
|
|
|
|
fprintf(stderr, "name %s\n", name);
|
|
|
|
|
|
|
|
func = find_egl_ptr(name);
|
|
|
|
func = find_egl_ptr(name);
|
|
|
|
if (func) {
|
|
|
|
if (func) {
|
|
|
|
//fprintf(stderr,"%s: local: %s\n", __func__ , name);
|
|
|
|
//fprintf(stderr,"%s: local: %s\n", __func__ , name);
|
|
|
|