# HG changeset patch # User Michael Pavone # Date 1741254469 28800 # Node ID 36ae207af490ed3e2f21ed871f941e64cd90ca5f # Parent 568c1c22f3e3b59c3a7069981b5f0cff0e00dd70 Awful hack to work around what seems like a bug in the Emscripten version of SDL2 diff -r 568c1c22f3e3 -r 36ae207af490 render_sdl.c --- a/render_sdl.c Thu Mar 06 01:33:03 2025 -0800 +++ b/render_sdl.c Thu Mar 06 01:47:49 2025 -0800 @@ -1403,6 +1403,23 @@ } static int in_toggle; +#ifdef __EMSCRIPTEN__ +void resume_config_update(void *arg) +{ + uint8_t was_paused = arg != NULL; + quitting = 0; + init_audio(); + render_set_video_standard(video_standard); + + drain_events(); + in_toggle = 0; + if (!was_paused) { + SDL_PauseAudio(0); + } + emscripten_resume_main_loop(); +} +#endif __EMSCRIPTEN__ + void render_config_updated(void) { for (int i = 0; i <= FRAMEBUFFER_UI; i++) @@ -1479,8 +1496,13 @@ if (do_audio_reinit) { was_paused = SDL_GetAudioStatus() == SDL_AUDIO_PAUSED; render_close_audio(); +#ifdef __EMSCRIPTEN__ + emscripten_pause_main_loop(); + emscripten_async_call(resume_config_update, was_paused ? config : NULL, 1000); +#else quitting = 0; init_audio(); +#endif } render_set_video_standard(video_standard);