mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-06-28 14:05:15 +02:00
dont make the browser hang
This commit is contained in:
parent
65db5c8a05
commit
eaa645ab17
2 changed files with 19 additions and 2 deletions
|
|
@ -5,6 +5,9 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "common/logging.h"
|
||||
#include "common/scm_rev.h"
|
||||
|
|
@ -29,6 +32,9 @@ EmuWindow_SDL3::EmuWindow_SDL3(InputCommon::InputSubsystem* input_subsystem_, Co
|
|||
}
|
||||
|
||||
EmuWindow_SDL3::~EmuWindow_SDL3() {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_cancel_main_loop();
|
||||
#endif
|
||||
system.HIDCore().UnloadInputDevices();
|
||||
input_subsystem->Shutdown();
|
||||
SDL_Quit();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@
|
|||
#include <memory>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <fmt/ostream.h>
|
||||
|
||||
|
|
@ -446,9 +449,17 @@ int main(int argc, char** argv) {
|
|||
if (system.DebuggerEnabled()) {
|
||||
system.InitializeDebugger();
|
||||
}
|
||||
while (emu_window->IsOpen()) {
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// Required so lambda fits snuggly into our "main loop"
|
||||
static EmuWindow_SDL3* static_ems_emu_window = emu_window.get();
|
||||
emscripten_set_main_loop([]() {
|
||||
static_ems_emu_window->WaitEvent();
|
||||
}, 0, 1);
|
||||
#else
|
||||
while (emu_window->IsOpen())
|
||||
emu_window->WaitEvent();
|
||||
}
|
||||
#endif
|
||||
system.DetachDebugger();
|
||||
void(system.Pause());
|
||||
system.ShutdownMainProcess();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue