Compare commits

...

4 Commits

Author SHA1 Message Date
Etaash Mathamsetty 366c1a233f use simpler method to detect angle 4 weeks ago
Etaash Mathamsetty 86668eeb96 HACK: check EGL load directory and only hook the first loaded libEGL 4 weeks ago
Etaash Mathamsetty e99284aadd fix electron apps like minecraft-launcher 4 weeks ago
Etaash Mathamsetty 5912cce19f fix exception with std::stoi 4 weeks ago

@ -469,7 +469,8 @@ static bool find_input(const std::string& path, const char* input_prefix, std::s
if (uscore != std::string::npos) {
file.erase(uscore, std::string::npos);
input = path + "/" + file + "_input";
return std::stoi(read_line(input)) > 0;
//9 characters should not overflow the 32-bit int
return std::stoi(read_line(input).substr(0, 9)) > 0;
}
}
return false;

@ -20,7 +20,7 @@ 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.1", RTLD_LAZY|RTLD_LOCAL);
void *handle = real_dlopen("libEGL.so.1", RTLD_LAZY);
if (!handle) {
SPDLOG_ERROR("Failed to open " MANGOHUD_ARCH " libEGL.so.1: {}", dlerror());
} else {

@ -107,12 +107,7 @@ EXPORT_C_(void) glXDestroyContext(void *dpy, void *ctx)
EXPORT_C_(int) glXMakeCurrent(void* dpy, void* drawable, void* ctx) {
glx.Load();
SPDLOG_DEBUG("{}: {}, {}", __func__, drawable, ctx);
int ret = 0;
// This is hack, proper fix should be implemented.
// MakeCurrent fails on the minecraft-launcher so we
// just bypass it and minecraft hooking works as it should
if (get_program_name() != "minecraft-launcher")
ret = glx.MakeCurrent(dpy, drawable, ctx);
int ret = glx.MakeCurrent(dpy, drawable, ctx);
if (!is_blacklisted()) {
if (ret) {

@ -16,6 +16,7 @@ EXPORT_C_(void*) dlsym(void * handle, const char * name)
void* func = nullptr;
void* real_func = real_dlsym(handle, name);
bool is_angle = !!real_dlsym(handle, "eglStreamPostD3DTextureANGLE");
if (find_glx_ptr && real_func) {
func = find_glx_ptr(name);
@ -25,7 +26,7 @@ EXPORT_C_(void*) dlsym(void * handle, const char * name)
}
}
if (find_egl_ptr && real_func) {
if (find_egl_ptr && real_func && !is_angle) {
func = find_egl_ptr(name);
if (func) {
//fprintf(stderr,"%s: local: %s\n", __func__ , name);

Loading…
Cancel
Save