From be73b40ae8bb16bd51d08fbfda2c823886b5f093 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 2 Jul 2025 19:10:02 -0700 Subject: [PATCH 1/2] Add monkey patch to Emscripten to disable `OffscreenCanvas` at runtime (#493) * Add runtime option to disable OffscreenCanvas in web port * Remove old patch --- .../{libwasmfs_fetch.js.patch => emscripten.patch} | 13 +++++++++++++ docker/emscripten/Dockerfile | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) rename ISLE/emscripten/{libwasmfs_fetch.js.patch => emscripten.patch} (88%) diff --git a/ISLE/emscripten/libwasmfs_fetch.js.patch b/ISLE/emscripten/emscripten.patch similarity index 88% rename from ISLE/emscripten/libwasmfs_fetch.js.patch rename to ISLE/emscripten/emscripten.patch index de8fab60..899d72eb 100644 --- a/ISLE/emscripten/libwasmfs_fetch.js.patch +++ b/ISLE/emscripten/emscripten.patch @@ -1,3 +1,16 @@ +diff --git a/src/lib/libpthread.js b/src/lib/libpthread.js +index 6d979627e..97e3f8684 100644 +--- a/src/lib/libpthread.js ++++ b/src/lib/libpthread.js +@@ -697,7 +697,7 @@ var LibraryPThread = { + { + transferredCanvasNames = UTF8ToString(transferredCanvasNames).trim(); + } +- transferredCanvasNames = transferredCanvasNames ? transferredCanvasNames.split(',') : []; ++ transferredCanvasNames = transferredCanvasNames && !Module['disableOffscreenCanvases'] ? transferredCanvasNames.split(',') : []; + #if GL_DEBUG + dbg(`pthread_create: transferredCanvasNames="${transferredCanvasNames}"`); + #endif diff --git a/src/lib/libwasmfs_fetch.js b/src/lib/libwasmfs_fetch.js index e8c9f7e21..caf1971d2 100644 --- a/src/lib/libwasmfs_fetch.js diff --git a/docker/emscripten/Dockerfile b/docker/emscripten/Dockerfile index f234e9ed..a213093c 100644 --- a/docker/emscripten/Dockerfile +++ b/docker/emscripten/Dockerfile @@ -16,10 +16,10 @@ RUN chown -R emscripten:emscripten /src USER emscripten -COPY ISLE/emscripten/libwasmfs_fetch.js.patch /tmp/ +COPY ISLE/emscripten/emscripten.patch /tmp/ RUN cd /emsdk/upstream/emscripten && \ - git apply --check /tmp/libwasmfs_fetch.js.patch && \ - git apply /tmp/libwasmfs_fetch.js.patch + git apply --check /tmp/emscripten.patch && \ + git apply /tmp/emscripten.patch COPY --chown=emscripten:emscripten 3rdparty/ ./3rdparty/ COPY --chown=emscripten:emscripten LEGO1/ ./LEGO1/ From 605163b755273fd46fad57194bddd186b221b259 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 3 Jul 2025 04:57:57 +0200 Subject: [PATCH 2/2] Fix WindowsTransition (#495) --- .../src/common/mxtransitionmanager.cpp | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index 9e052430..8c2c994d 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -469,17 +469,42 @@ void MxTransitionManager::WindowsTransition() MxS32 bytesPerPixel = ddsd.ddpfPixelFormat.dwRGBBitCount / 8; - memset(line, 0, ddsd.lPitch); + if (bytesPerPixel == 4) { + MxU32* pixels = (MxU32*) line; + for (int i = 0; i < 640; i++) { + pixels[i] = 0xFF000000; + } - for (MxS32 i = m_animationTimer + 1; i < 480 - m_animationTimer; i++) { - line += ddsd.lPitch; + for (MxS32 i = m_animationTimer + 1; i < 480 - m_animationTimer - 1; i++) { + line += ddsd.lPitch; + pixels = (MxU32*) line; + pixels[m_animationTimer] = 0xFF000000; + pixels[639 - m_animationTimer] = 0xFF000000; + } - memset(line + m_animationTimer * bytesPerPixel, 0, bytesPerPixel); - memset(line + 640 + (-1 - m_animationTimer) * bytesPerPixel, 0, bytesPerPixel); + if (m_animationTimer < 240 - 1) { + line += ddsd.lPitch; + pixels = (MxU32*) line; + for (int i = 0; i < 640; i++) { + pixels[i] = 0xFF000000; + } + } } + else { + memset(line, 0, 640 * bytesPerPixel); - line += ddsd.lPitch; - memset(line, 0, ddsd.lPitch); + for (MxS32 i = m_animationTimer + 1; i < 480 - m_animationTimer - 1; i++) { + line += ddsd.lPitch; + + memset(line + m_animationTimer * bytesPerPixel, 0, bytesPerPixel); + memset(line + (639 - m_animationTimer) * bytesPerPixel, 0, bytesPerPixel); + } + + if (m_animationTimer < 240 - 1) { + line += ddsd.lPitch; + memset(line, 0, 640 * bytesPerPixel); + } + } SetupCopyRect(&ddsd); m_ddSurface->Unlock(ddsd.lpSurface);