This commit is contained in:
twinaphex 2018-02-24 14:34:03 +01:00
parent c5c2053913
commit 665aa372e0
2 changed files with 27 additions and 14 deletions

View File

@ -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)

View File

@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <dlfcn.h>
#include <math.h>
#include <stdarg.h>
#include <stdio.h>
@ -23,6 +22,10 @@
#include <string.h>
#include <unistd.h>
#ifdef HAVE_OPENGLES
#include <dlfcn.h>
#endif
#ifdef HAVE_LOCALE
#include <locale.h>
#endif
@ -30,7 +33,7 @@
#include <mpv/client.h>
#include <mpv/opengl_cb.h>
#include "libretro.h"
#include <libretro.h>
#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) {
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) {
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);