diff --git a/Makefile.emscripten b/Makefile.emscripten index 79f77f2c56..c7e5612320 100644 --- a/Makefile.emscripten +++ b/Makefile.emscripten @@ -1,4 +1,4 @@ -TARGET = retroarch.html +TARGET = retroarch.js OBJ = frontend/frontend_emscripten.o \ retroarch.o \ @@ -18,6 +18,7 @@ OBJ = frontend/frontend_emscripten.o \ core_options.o \ patch.o \ compat/compat.o \ + compat/rxml/rxml.o \ screenshot.o \ cheats.o \ audio/utils.o \ @@ -44,6 +45,7 @@ HAVE_SDL_IMAGE = 1 HAVE_FREETYPE = 1 HAVE_ZLIB = 1 HAVE_FBO = 1 +WANT_MINIZ = 1 libretro ?= -lretro diff --git a/frontend/frontend_emscripten.c b/frontend/frontend_emscripten.c index 1e90dbd1f1..d03c294fb7 100644 --- a/frontend/frontend_emscripten.c +++ b/frontend/frontend_emscripten.c @@ -106,10 +106,8 @@ int main(int argc, char *argv[]) rarch_main_clear_state(); rarch_init_msg_queue(); - char *_argv[] = { "retroarch", "--menu", "-v" }; - int init_ret; - if ((init_ret = rarch_main_init(3, _argv))) return init_ret; + if ((init_ret = rarch_main_init(argc, argv))) return init_ret; #ifdef HAVE_MENU menu_init(); diff --git a/gfx/context/emscriptenegl_ctx.c b/gfx/context/emscriptenegl_ctx.c index 2674e8bcc6..e0778fe973 100644 --- a/gfx/context/emscriptenegl_ctx.c +++ b/gfx/context/emscriptenegl_ctx.c @@ -75,7 +75,8 @@ static void gfx_ctx_set_resize(unsigned width, unsigned height) static void gfx_ctx_update_window_title(void) { char buf[128]; - gfx_get_fps(buf, sizeof(buf), false); + if (gfx_get_fps(buf, sizeof(buf), false)) + RARCH_LOG("%s\n", buf); } static void gfx_ctx_get_video_size(unsigned *width, unsigned *height) @@ -91,10 +92,10 @@ static bool gfx_ctx_init(void) EGLint width; EGLint height; - RARCH_LOG("[VC/EMSCRIPTEN]: Initializing...\n"); + RARCH_LOG("[EMSCRIPTEN/EGL]: Initializing...\n"); if (g_inited) { - RARCH_ERR("[VC/EMSCRIPTEN]: Attempted to re-initialize driver.\n"); + RARCH_LOG("[EMSCRIPTEN/EGL]: Attempted to re-initialize driver.\n"); return true; } @@ -147,7 +148,7 @@ static bool gfx_ctx_init(void) eglQuerySurface(g_egl_dpy, g_egl_surf, EGL_HEIGHT, &height); g_fb_width = width; g_fb_height = height; - RARCH_LOG("[VC/EMSCRIPTEN]: Dimensions: %ux%u\n", width, height); + RARCH_LOG("[EMSCRIPTEN/EGL]: Dimensions: %ux%u\n", width, height); return true; @@ -182,9 +183,10 @@ static void gfx_ctx_destroy(void) { if (g_egl_dpy) { + eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (g_egl_ctx) { - eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglDestroyContext(g_egl_dpy, g_egl_ctx); } @@ -193,8 +195,6 @@ static void gfx_ctx_destroy(void) eglDestroySurface(g_egl_dpy, g_egl_surf); } - eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); eglTerminate(g_egl_dpy); } diff --git a/gfx/gl.c b/gfx/gl.c index bec4389a92..c6a4b571b4 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -1844,6 +1844,7 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo } RARCH_LOG("Found GL context: %s\n", gl->ctx_driver->ident); + while (glGetError() != GL_NO_ERROR); context_get_video_size_func(&gl->full_x, &gl->full_y); RARCH_LOG("Detecting screen resolution %ux%u.\n", gl->full_x, gl->full_y);