Compare commits
9
Commits
v0.3.2
...
10f32789e6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10f32789e6 | ||
|
|
bf818bdd29 | ||
|
|
4946dd2033 | ||
|
|
7e5793bb17 | ||
|
|
f52fa0cb79 | ||
|
|
9c8afb7541 | ||
|
|
02f17165f2 | ||
|
|
0f945ed68e | ||
|
|
43216a408e |
@@ -39,6 +39,13 @@
|
|||||||
background: rgba(255,255,255,0.15); color: #eee; cursor: pointer;
|
background: rgba(255,255,255,0.15); color: #eee; cursor: pointer;
|
||||||
}
|
}
|
||||||
#fullscreen-button.hidden { display: none; }
|
#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; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -54,6 +61,7 @@
|
|||||||
<button id="start-button" disabled>Loading...</button>
|
<button id="start-button" disabled>Loading...</button>
|
||||||
</div>
|
</div>
|
||||||
<button id="fullscreen-button" class="hidden">Fullscreen</button>
|
<button id="fullscreen-button" class="hidden">Fullscreen</button>
|
||||||
|
<button id="dispose-button" class="hidden">Stop & Dispose</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
@@ -66,6 +74,7 @@
|
|||||||
const fileInput = document.getElementById('table-file');
|
const fileInput = document.getElementById('table-file');
|
||||||
const romInput = document.getElementById('rom-file');
|
const romInput = document.getElementById('rom-file');
|
||||||
const fullscreenButton = document.getElementById('fullscreen-button');
|
const fullscreenButton = document.getElementById('fullscreen-button');
|
||||||
|
const disposeButton = document.getElementById('dispose-button');
|
||||||
|
|
||||||
let uploadedTableData;
|
let uploadedTableData;
|
||||||
fileInput.addEventListener('change', async () => {
|
fileInput.addEventListener('change', async () => {
|
||||||
@@ -104,6 +113,7 @@
|
|||||||
pinball.start();
|
pinball.start();
|
||||||
overlay.classList.add('hidden');
|
overlay.classList.add('hidden');
|
||||||
fullscreenButton.classList.remove('hidden');
|
fullscreenButton.classList.remove('hidden');
|
||||||
|
disposeButton.classList.remove('hidden');
|
||||||
|
|
||||||
// Touch controls are additive UI for touch-capable devices - not
|
// Touch controls are additive UI for touch-capable devices - not
|
||||||
// required for desktop mouse+keyboard play.
|
// required for desktop mouse+keyboard play.
|
||||||
@@ -118,6 +128,26 @@
|
|||||||
// browser denies it) - nothing to recover from here.
|
// browser denies it) - nothing to recover from here.
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mirrors the stop()-then-wait-a-couple-frames-then-dispose() pattern
|
||||||
|
// consumers need: stop() only takes effect on the engine's next
|
||||||
|
// internal step, so disposing synchronously right after can race it.
|
||||||
|
disposeButton.addEventListener('click', () => {
|
||||||
|
console.log('[dispose test] calling stop()...');
|
||||||
|
pinball.stop();
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
console.log('[dispose test] calling dispose()...');
|
||||||
|
pinball.dispose();
|
||||||
|
console.log('[dispose test] dispose() returned - no hang');
|
||||||
|
disposeButton.classList.add('hidden');
|
||||||
|
fullscreenButton.classList.add('hidden');
|
||||||
|
overlay.classList.remove('hidden');
|
||||||
|
startButton.textContent = 'Disposed (reload page to restart)';
|
||||||
|
startButton.disabled = true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@valknar/vpinball-wasm",
|
"name": "@valknar/vpinball-wasm",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@valknar/vpinball-wasm",
|
"name": "@valknar/vpinball-wasm",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.6.0"
|
"typescript": "^5.6.0"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@valknar/vpinball-wasm",
|
"name": "@valknar/vpinball-wasm",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"description": "Visual Pinball's engine compiled to WebAssembly - real .vpx tables, real VBScript, WebGL2 rendering, in the browser",
|
"description": "Visual Pinball's engine compiled to WebAssembly - real .vpx tables, real VBScript, WebGL2 rendering, in the browser",
|
||||||
"license": "SEE LICENSE IN LICENSE",
|
"license": "SEE LICENSE IN LICENSE",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user