diff --git a/Makefile.emscripten b/Makefile.emscripten
index 94e1a14a8b..4aec3ec356 100644
--- a/Makefile.emscripten
+++ b/Makefile.emscripten
@@ -17,6 +17,7 @@ HAVE_CC_RESAMPLER = 1
HAVE_EGL = 1
HAVE_OPENGLES = 1
HAVE_RJPEG = 0
+HAVE_RPNG = 1
HAVE_EMSCRIPTEN = 1
HAVE_MENU = 1
HAVE_MENU_WIDGETS = 1
@@ -37,7 +38,7 @@ OBJDIR := obj-emscripten
#if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS:
-LIBS := -s USE_ZLIB=1 -s USE_LIBPNG=1
+LIBS := -s USE_ZLIB=1
LDFLAGS := -L. --no-heap-copy -s $(LIBS) -s TOTAL_MEMORY=$(MEMORY) -s NO_EXIT_RUNTIME=0 -s FULL_ES2=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain']" \
-s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \
--js-library emscripten/library_rwebaudio.js \
diff --git a/frontend/drivers/platform_emscripten.c b/frontend/drivers/platform_emscripten.c
index e87b3d181c..47886043a5 100644
--- a/frontend/drivers/platform_emscripten.c
+++ b/frontend/drivers/platform_emscripten.c
@@ -49,22 +49,8 @@
void RWebAudioRecalibrateTime(void);
void dummyErrnoCodes(void);
-static unsigned emscripten_fullscreen_reinit;
static unsigned emscripten_frame_count = 0;
-static EM_BOOL emscripten_fullscreenchange_cb(int event_type,
- const EmscriptenFullscreenChangeEvent *fullscreen_change_event,
- void *user_data)
-{
- (void)event_type;
- (void)fullscreen_change_event;
- (void)user_data;
-
- emscripten_fullscreen_reinit = 5;
-
- return EM_TRUE;
-}
-
static void emscripten_mainloop(void)
{
int ret;
@@ -92,12 +78,6 @@ static void emscripten_mainloop(void)
}
}
- if (emscripten_fullscreen_reinit != 0)
- {
- if (--emscripten_fullscreen_reinit == 0)
- command_event(CMD_EVENT_REINIT, NULL);
- }
-
ret = runloop_iterate();
task_queue_check();
@@ -221,8 +201,6 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
int main(int argc, char *argv[])
{
- EMSCRIPTEN_RESULT r;
-
dummyErrnoCodes();
emscripten_set_canvas_element_size("#canvas", 800, 600);
@@ -230,14 +208,6 @@ int main(int argc, char *argv[])
emscripten_set_main_loop(emscripten_mainloop, 0, 0);
rarch_main(argc, argv, NULL);
- r = emscripten_set_fullscreenchange_callback("#document", NULL, false,
- emscripten_fullscreenchange_cb);
- if (r != EMSCRIPTEN_RESULT_SUCCESS)
- {
- RARCH_ERR(
- "[EMSCRIPTEN/CTX] failed to create fullscreen callback: %d\n", r);
- }
-
return 0;
}
diff --git a/input/drivers/rwebinput_input.c b/input/drivers/rwebinput_input.c
index 482725f24d..80e00c0a1e 100644
--- a/input/drivers/rwebinput_input.c
+++ b/input/drivers/rwebinput_input.c
@@ -264,8 +264,8 @@ static EM_BOOL rwebinput_mouse_cb(int event_type,
uint8_t mask = 1 << mouse_event->button;
- g_rwebinput_mouse->x = mouse_event->canvasX;
- g_rwebinput_mouse->y = mouse_event->canvasY;
+ g_rwebinput_mouse->x = mouse_event->targetX;
+ g_rwebinput_mouse->y = mouse_event->targetY;
g_rwebinput_mouse->delta_x += mouse_event->movementX;
g_rwebinput_mouse->delta_y += mouse_event->movementY;
@@ -314,7 +314,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
/* emscripten currently doesn't have an API to remove handlers, so make
* once and reuse it */
- r = emscripten_set_keydown_callback("#document", NULL, false,
+ r = emscripten_set_keydown_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
@@ -322,7 +322,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
"[EMSCRIPTEN/INPUT] failed to create keydown callback: %d\n", r);
}
- r = emscripten_set_keyup_callback("#document", NULL, false,
+ r = emscripten_set_keyup_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
@@ -330,7 +330,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
"[EMSCRIPTEN/INPUT] failed to create keydown callback: %d\n", r);
}
- r = emscripten_set_keypress_callback("#document", NULL, false,
+ r = emscripten_set_keypress_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, false,
rwebinput_keyboard_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
@@ -362,7 +362,7 @@ static void *rwebinput_input_init(const char *joypad_driver)
"[EMSCRIPTEN/INPUT] failed to create mousemove callback: %d\n", r);
}
- r = emscripten_set_wheel_callback("#document", NULL, false,
+ r = emscripten_set_wheel_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, false,
rwebinput_wheel_cb);
if (r != EMSCRIPTEN_RESULT_SUCCESS)
{
diff --git a/pkg/emscripten/libretro/index.html b/pkg/emscripten/libretro/index.html
index 2c50fdd617..5f4ed08b91 100644
--- a/pkg/emscripten/libretro/index.html
+++ b/pkg/emscripten/libretro/index.html
@@ -93,7 +93,7 @@
-