Skip to content

PS2 games in the browser: static recompilation to WebAssembly with a native runtime

C++

web: pass canvas resizes to the GS after the game starts

Samir Nuric00e26db16ab
diff --git a/web/shell.html b/web/shell.html
index d3aaa9f..6feab2d 100644
--- a/web/shell.html
+++ b/web/shell.html
@@ -228,7 +228,7 @@ function fitCanvas() {
if (canvas.width !== width || canvas.height !== height) {
canvas.width = width;
canvas.height = height;
- if (Module.calledRun && Module._ps2web_resize) Module._ps2web_resize(width, height);
+ if (Module.running && Module._ps2web_resize) Module._ps2web_resize(width, height);
}
}
window.addEventListener('resize', fitCanvas);
@@ -515,6 +515,7 @@ document.getElementById('start').addEventListener('click', async () => {
fitCanvas();
await startAudio();
statusEl.textContent = 'Running ' + Module.arguments[2] + ', ' + Module.gpuInfo;
+ Module.running = true;
Module.callMain(Module.arguments);
});
</script>