mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 06:40:48 +00:00
fix images not loading in menu in emscripten
add changes to work with latest emscripten SDK
This commit is contained in:
parent
0096b9e6f0
commit
776568a429
@ -17,6 +17,7 @@ HAVE_CC_RESAMPLER = 1
|
|||||||
HAVE_EGL = 1
|
HAVE_EGL = 1
|
||||||
HAVE_OPENGLES = 1
|
HAVE_OPENGLES = 1
|
||||||
HAVE_RJPEG = 0
|
HAVE_RJPEG = 0
|
||||||
|
HAVE_RPNG = 1
|
||||||
HAVE_EMSCRIPTEN = 1
|
HAVE_EMSCRIPTEN = 1
|
||||||
HAVE_MENU = 1
|
HAVE_MENU = 1
|
||||||
HAVE_MENU_WIDGETS = 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:
|
#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']" \
|
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']" \
|
-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 \
|
--js-library emscripten/library_rwebaudio.js \
|
||||||
|
@ -49,22 +49,8 @@
|
|||||||
void RWebAudioRecalibrateTime(void);
|
void RWebAudioRecalibrateTime(void);
|
||||||
void dummyErrnoCodes(void);
|
void dummyErrnoCodes(void);
|
||||||
|
|
||||||
static unsigned emscripten_fullscreen_reinit;
|
|
||||||
static unsigned emscripten_frame_count = 0;
|
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)
|
static void emscripten_mainloop(void)
|
||||||
{
|
{
|
||||||
int ret;
|
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();
|
ret = runloop_iterate();
|
||||||
|
|
||||||
task_queue_check();
|
task_queue_check();
|
||||||
@ -221,8 +201,6 @@ static void frontend_emscripten_get_env(int *argc, char *argv[],
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
EMSCRIPTEN_RESULT r;
|
|
||||||
|
|
||||||
dummyErrnoCodes();
|
dummyErrnoCodes();
|
||||||
|
|
||||||
emscripten_set_canvas_element_size("#canvas", 800, 600);
|
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);
|
emscripten_set_main_loop(emscripten_mainloop, 0, 0);
|
||||||
rarch_main(argc, argv, NULL);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,8 +264,8 @@ static EM_BOOL rwebinput_mouse_cb(int event_type,
|
|||||||
|
|
||||||
uint8_t mask = 1 << mouse_event->button;
|
uint8_t mask = 1 << mouse_event->button;
|
||||||
|
|
||||||
g_rwebinput_mouse->x = mouse_event->canvasX;
|
g_rwebinput_mouse->x = mouse_event->targetX;
|
||||||
g_rwebinput_mouse->y = mouse_event->canvasY;
|
g_rwebinput_mouse->y = mouse_event->targetY;
|
||||||
g_rwebinput_mouse->delta_x += mouse_event->movementX;
|
g_rwebinput_mouse->delta_x += mouse_event->movementX;
|
||||||
g_rwebinput_mouse->delta_y += mouse_event->movementY;
|
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
|
/* emscripten currently doesn't have an API to remove handlers, so make
|
||||||
* once and reuse it */
|
* 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);
|
rwebinput_keyboard_cb);
|
||||||
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
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);
|
"[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);
|
rwebinput_keyboard_cb);
|
||||||
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
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);
|
"[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);
|
rwebinput_keyboard_cb);
|
||||||
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
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);
|
"[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);
|
rwebinput_wheel_cb);
|
||||||
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
if (r != EMSCRIPTEN_RESULT_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
<button class="btn btn-primary disabled tooltip-enable" id="btnMenu" onclick="keyPress('F1');" title="Menu toggle" disabled>
|
<button class="btn btn-primary disabled tooltip-enable" id="btnMenu" onclick="keyPress('F1');" title="Menu toggle" disabled>
|
||||||
<span class="fa fa-bars" id="btnMenu"></span> <span class="sr-only">Menu</span>
|
<span class="fa fa-bars" id="btnMenu"></span> <span class="sr-only">Menu</span>
|
||||||
</button>
|
</button>
|
||||||
<button class="btn btn-primary disabled tooltip-enable" id="btnFullscreen" onclick="Module.requestFullScreen()" title="Fullscreen" disabled>
|
<button class="btn btn-primary disabled tooltip-enable" id="btnFullscreen" onclick="Module.requestFullscreen()" title="Fullscreen" disabled>
|
||||||
<span class="fa fa-desktop" id="icnAdd"></span> <span class="sr-only">Fullscreen</span>
|
<span class="fa fa-desktop" id="icnAdd"></span> <span class="sr-only">Fullscreen</span>
|
||||||
</button>
|
</button>
|
||||||
</button>
|
</button>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user