From 665aa372e0f4e25eff6c1ee4f83eda7f74935d32 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 24 Feb 2018 14:34:03 +0100 Subject: [PATCH] Updates --- Makefile | 10 ++++++++-- mpv-libretro.c | 31 +++++++++++++++++++------------ 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index c8a4316..4b1695d 100644 --- a/Makefile +++ b/Makefile @@ -112,8 +112,14 @@ else endif OBJECTS := mpv-libretro.o -LDFLAGS += -lmpv -ldl -lm -CFLAGS += -Wall -pedantic -std=gnu99 +LDFLAGS += -lmpv +CFLAGS += -Wall -pedantic -std=c99 + +ifneq (,$(findstring gles,$(platform))) +LDFLAGS += -ldl +endif + +LDFLAGS += -lm all: $(TARGET) diff --git a/mpv-libretro.c b/mpv-libretro.c index ec7d177..3f95acc 100644 --- a/mpv-libretro.c +++ b/mpv-libretro.c @@ -14,8 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - -#include + #include #include #include @@ -23,6 +22,10 @@ #include #include +#ifdef HAVE_OPENGLES +#include +#endif + #ifdef HAVE_LOCALE #include #endif @@ -30,7 +33,7 @@ #include #include -#include "libretro.h" +#include #include "version.h" static struct retro_hw_render_callback hw_render; @@ -131,20 +134,24 @@ static void *get_proc_address_mpv(void *fn_ctx, const char *name) void *proc_addr = (void *) hw_render.get_proc_address(name); #pragma GCC diagnostic pop +#ifdef HAVE_OPENGLES /* EGL 1.4 (supported by the RPI firmware) does not necessarily return * function pointers for core functions. */ - if (!proc_addr) { - void *h = dlopen("/opt/vc/lib/libGLESv2.so", RTLD_LAZY); + if (!proc_addr) + { + void *h = dlopen("/opt/vc/lib/libGLESv2.so", RTLD_LAZY); - if (!h) - h = dlopen("/usr/lib/libGLESv2.so", RTLD_LAZY); + if (!h) + h = dlopen("/usr/lib/libGLESv2.so", RTLD_LAZY); - if (h) { - proc_addr = dlsym(h, name); - dlclose(h); - } - } + if (h) + { + proc_addr = dlsym(h, name); + dlclose(h); + } + } +#endif if(proc_addr == NULL) log_cb(RETRO_LOG_ERROR, "Failure obtaining %s proc address\n", name);