diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ea2cdf..e586818 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -73,8 +73,10 @@ target_sources(xsystem35 PRIVATE jpeg.c menu.c message.c + microui/microui.c midi.c mmap.c + modal.c msgskip.c mt19937-1.c music.c @@ -93,6 +95,7 @@ target_sources(xsystem35 PRIVATE system.c texthook.c variable.c + volume.c vsp.c xsystem35.c ) @@ -120,11 +123,6 @@ else() endif() endif() -if (NOT EMSCRIPTEN) - target_sources(xsystem35 PRIVATE - modal.c microui/microui.c volume.c) -endif() - if (HAVE_WEBP) target_sources(xsystem35 PRIVATE webp.c) target_link_libraries(xsystem35 PRIVATE WebP) @@ -167,7 +165,7 @@ if (EMSCRIPTEN) # Functions that call an asynchronous function via a function pointer must # be added to ASYNCIFY_ADD, even if it had a direct call to another # asynchronous function, so that the indirect call itself is instrumented. - -sASYNCIFY_ADD=commands2F60,nact_main,send_agsevent,cb_waitkey_sprite + -sASYNCIFY_ADD=commands2F60,nact_main,send_agsevent,cb_waitkey_sprite,modal_run -sALLOW_MEMORY_GROWTH=1 -sNO_EXIT_RUNTIME=1 -sEXPORTED_FUNCTIONS=_main,_malloc diff --git a/src/menu.c b/src/menu.c index f442b86..86ff3ac 100644 --- a/src/menu.c +++ b/src/menu.c @@ -41,10 +41,6 @@ void menu_init(void) { return; } -void menu_render_overlay(void) { - return; -} - EM_JS(void, menu_setSkipState, (bool enabled, bool activated), { xsystem35.shell.setSkipButtonState(enabled, activated); }); diff --git a/src/modal.c b/src/modal.c index 30037e6..190492f 100644 --- a/src/modal.c +++ b/src/modal.c @@ -24,6 +24,9 @@ #include #include #include +#ifdef __EMSCRIPTEN__ +#include +#endif #include "event.h" #include "font.h" @@ -290,6 +293,7 @@ static bool modal_event_trampoline(const SDL_Event *e) { return current_modal->handler(e, current_modal); } +EMSCRIPTEN_KEEPALIVE // Prevent inlining, because this function is listed in ASYNCIFY_ADD void modal_run(modal *m) { assert(!ctx); // modals are not nestable ctx = calloc(1, sizeof(*ctx)); diff --git a/src/volume.c b/src/volume.c index aa146c5..7383d19 100644 --- a/src/volume.c +++ b/src/volume.c @@ -24,6 +24,9 @@ #include #include +#ifdef __EMSCRIPTEN__ +#include +#endif #include "portab.h" #include "system.h" #include "nact.h" @@ -215,6 +218,7 @@ static bool volume_build(mu_Context *ctx, modal *modal) { return keep_open; } +EMSCRIPTEN_KEEPALIVE void volume_dialog_open(void) { struct volume_state st = { .base = { .build = volume_build, .handler = modal_default_handler }, diff --git a/src/xsystem35.c b/src/xsystem35.c index 00fbe1f..2b3c24b 100644 --- a/src/xsystem35.c +++ b/src/xsystem35.c @@ -40,10 +40,6 @@ #include #endif -#ifndef __EMSCRIPTEN__ -#define HAVE_VOLUME_VALANCER 1 -#endif - #include "nact.h" #include "debugger.h" #include "portab.h" @@ -503,9 +499,7 @@ int main(int argc, char **argv) { if (integer_scaling) gfx_setIntegerScaling(true); -#ifdef HAVE_VOLUME_VALANCER volume_init(); -#endif menu_init(); if (debugger_mode != DEBUGGER_DISABLED) {