diff --git a/examples/basic/index.html b/examples/basic/index.html index b243f66..3aa6df4 100644 --- a/examples/basic/index.html +++ b/examples/basic/index.html @@ -39,6 +39,13 @@ background: rgba(255,255,255,0.15); color: #eee; cursor: pointer; } #fullscreen-button.hidden { display: none; } + + #dispose-button { + position: absolute; top: 12px; left: 12px; z-index: 10; + padding: 8px 14px; border-radius: 6px; border: none; + background: rgba(220,38,38,0.85); color: #fff; cursor: pointer; + } + #dispose-button.hidden { display: none; } @@ -54,6 +61,7 @@ + diff --git a/patches/vpinball/0008-emscripten-controller-stop-no-busywait.patch b/patches/vpinball/0008-emscripten-controller-stop-no-busywait.patch new file mode 100644 index 0000000..000ceb9 --- /dev/null +++ b/patches/vpinball/0008-emscripten-controller-stop-no-busywait.patch @@ -0,0 +1,25 @@ +diff --git a/plugins/pinmame/Controller.cpp b/plugins/pinmame/Controller.cpp +index 29c2405..a498fee 100644 +--- a/plugins/pinmame/Controller.cpp ++++ b/plugins/pinmame/Controller.cpp +@@ -265,8 +265,20 @@ void Controller::Stop() + if (PinmameIsRunning()) + { + PinmameStop(); ++#ifdef __EMSCRIPTEN__ ++ // PinmameStop() only sets a "please quit" flag here (see its own ++ // Emscripten branch) - there's no separate OS thread that will ever ++ // notice it and finish stopping on its own, so busy-waiting for ++ // PinmameIsRunning() to clear on this single thread would spin ++ // forever. Drive one more step directly instead: with the quit flag ++ // already set, it's a bounded, instant call that completes the ++ // pending teardown (calls cpu_post_run() and OnStateChange(0)) ++ // synchronously right here. ++ PinmameEmscriptenStep(); ++#else + while (PinmameIsRunning() != 0) // Wait until the machine is stopped + std::this_thread::sleep_for(std::chrono::milliseconds(75)); ++#endif + if (m_onGameEndHandler) + m_onGameEndHandler(this); + }