From f9967eacf863cbecd0cdd5066f616d18cff58a74 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Thu, 28 May 2026 13:54:56 +0200 Subject: [PATCH] Auto-exclude disk image files (.img .iso .ccd .sub etc.) from .jsdos bundles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many DOS game ZIPs include CloneCD backups (.ccd/.img/.sub) or other disk images that are not needed for gameplay — the game data is already extracted in the working directory. These can be 300MB+ and cause WASM memory exhaustion in js-dos. Added a SKIP_EXT set that filters out known disk image extensions during game file pass. The .jsdos config pass is unaffected. --- src/main/java/com/dostalgia/UploadResource.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/dostalgia/UploadResource.java b/src/main/java/com/dostalgia/UploadResource.java index 72905f6..73523d4 100644 --- a/src/main/java/com/dostalgia/UploadResource.java +++ b/src/main/java/com/dostalgia/UploadResource.java @@ -279,6 +279,13 @@ public class UploadResource { // ─── Bundle Creation ───────────────────────────────────────── + /** File extensions that are never game data and should be excluded from .jsdos bundles. */ + private static final java.util.Set SKIP_EXT = java.util.Set.of( + ".img", ".iso", ".nrg", ".mdf", ".mds", // disk images + ".ccd", ".sub", ".cue", // CloneCD / CUE sheets + ".dmg" // Mac disk images + ); + private void createBundle(Path extractDir, String exePath, Path bundlePath) throws IOException { // Write .jsdos config directly into the extract directory Path jsdos = extractDir.resolve(".jsdos"); @@ -333,6 +340,11 @@ public class UploadResource { try (var walk = Files.walk(extractDir)) { walk.filter(Files::isRegularFile) .filter(f -> !f.startsWith(jsdos)) + .filter(f -> { + String n = f.getFileName().toString().toLowerCase(); + int dot = n.lastIndexOf('.'); + return dot < 0 || !SKIP_EXT.contains(n.substring(dot)); + }) .sorted() // deterministic order .forEach(writeFile); }