Compare commits
11
Commits
v0.3.2
..
1c21d2d79b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c21d2d79b | ||
|
|
f607992885 | ||
|
|
10f32789e6 | ||
|
|
bf818bdd29 | ||
|
|
4946dd2033 | ||
|
|
7e5793bb17 | ||
|
|
f52fa0cb79 | ||
|
|
9c8afb7541 | ||
|
|
02f17165f2 | ||
|
|
0f945ed68e | ||
|
|
43216a408e |
@@ -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; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -54,6 +61,7 @@
|
||||
<button id="start-button" disabled>Loading...</button>
|
||||
</div>
|
||||
<button id="fullscreen-button" class="hidden">Fullscreen</button>
|
||||
<button id="dispose-button" class="hidden">Stop & Dispose</button>
|
||||
</div>
|
||||
|
||||
<script type="module">
|
||||
@@ -66,6 +74,7 @@
|
||||
const fileInput = document.getElementById('table-file');
|
||||
const romInput = document.getElementById('rom-file');
|
||||
const fullscreenButton = document.getElementById('fullscreen-button');
|
||||
const disposeButton = document.getElementById('dispose-button');
|
||||
|
||||
let uploadedTableData;
|
||||
fileInput.addEventListener('change', async () => {
|
||||
@@ -104,6 +113,7 @@
|
||||
pinball.start();
|
||||
overlay.classList.add('hidden');
|
||||
fullscreenButton.classList.remove('hidden');
|
||||
disposeButton.classList.remove('hidden');
|
||||
|
||||
// Touch controls are additive UI for touch-capable devices - not
|
||||
// required for desktop mouse+keyboard play.
|
||||
@@ -118,6 +128,26 @@
|
||||
// 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>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@valknar/vpinball-wasm",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@valknar/vpinball-wasm",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"devDependencies": {
|
||||
"typescript": "^5.6.0"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@valknar/vpinball-wasm",
|
||||
"version": "0.3.2",
|
||||
"version": "0.3.4",
|
||||
"description": "Visual Pinball's engine compiled to WebAssembly - real .vpx tables, real VBScript, WebGL2 rendering, in the browser",
|
||||
"license": "SEE LICENSE IN LICENSE",
|
||||
"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);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
diff --git a/src/renderer/Window.cpp b/src/renderer/Window.cpp
|
||||
index 3dff060..92a96df 100644
|
||||
--- a/src/renderer/Window.cpp
|
||||
+++ b/src/renderer/Window.cpp
|
||||
@@ -264,6 +264,12 @@ Window::Window(const string& title, const Settings& settings, VPXWindowId window
|
||||
m_pixelDensity = 1.f;
|
||||
}
|
||||
|
||||
+#ifndef __EMSCRIPTEN__
|
||||
+ // SDL3's Emscripten video backend emulates SDL_SetWindowIcon by pointing
|
||||
+ // the page's <link rel="icon"> at a blob: URL of the encoded surface -
|
||||
+ // a reasonable desktop-icon mapping in general, but unwanted here where
|
||||
+ // the embedding page already has its own favicon. Skip it on this target
|
||||
+ // rather than fight it from the host page's JS.
|
||||
if (auto icon = BaseTexture::CreateFromFile(g_app->m_fileLocator.GetAppPath(FileLocator::AppSubFolder::Assets, "vpinball.png")); icon)
|
||||
{
|
||||
SDL_Surface* pSurface = icon->ToSDLSurface();
|
||||
@@ -276,6 +282,7 @@ Window::Window(const string& title, const Settings& settings, VPXWindowId window
|
||||
else {
|
||||
PLOGE << "Failed to load window icon: " << SDL_GetError();
|
||||
}
|
||||
+#endif
|
||||
|
||||
// Check if the platform allows positioning windows (as Wayland forbids it...)
|
||||
{
|
||||
Reference in New Issue
Block a user